mirror of
https://github.com/lensapp/lens.git
synced 2024-11-10 10:36:25 +03:00
Use @typescript-eslint/semi.
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
parent
0b182ccf6f
commit
460dfe4d2b
@ -49,7 +49,8 @@ module.exports = {
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/no-empty-interface": "off",
|
||||
"indent": ["error", 2],
|
||||
"semi": ["error", "always"],
|
||||
"semi": "off",
|
||||
"@typescript-eslint/semi": ["error"],
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -78,7 +79,8 @@ module.exports = {
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"indent": ["error", 2],
|
||||
"semi": ["error", "always"],
|
||||
"semi": "off",
|
||||
"@typescript-eslint/semi": ["error"],
|
||||
},
|
||||
}
|
||||
]
|
||||
|
@ -7,10 +7,10 @@ import { ensureDir, pathExists } from "fs-extra";
|
||||
import path from "path";
|
||||
|
||||
class KubectlDownloader {
|
||||
public kubectlVersion: string
|
||||
protected url: string
|
||||
public kubectlVersion: string;
|
||||
protected url: string;
|
||||
protected path: string;
|
||||
protected dirname: string
|
||||
protected dirname: string;
|
||||
|
||||
constructor(clusterVersion: string, platform: string, arch: string, target: string) {
|
||||
this.kubectlVersion = clusterVersion;
|
||||
|
@ -4,6 +4,6 @@ export type AppEvent = {
|
||||
name: string;
|
||||
action: string;
|
||||
params?: object;
|
||||
}
|
||||
};
|
||||
|
||||
export const appEventBus = new EventEmitter<[AppEvent]>();
|
||||
|
@ -4,7 +4,7 @@ export type KubeResource =
|
||||
"namespaces" | "nodes" | "events" | "resourcequotas" |
|
||||
"services" | "secrets" | "configmaps" | "ingresses" | "networkpolicies" | "persistentvolumes" | "storageclasses" |
|
||||
"pods" | "daemonsets" | "deployments" | "statefulsets" | "replicasets" | "jobs" | "cronjobs" |
|
||||
"endpoints" | "customresourcedefinitions" | "horizontalpodautoscalers" | "podsecuritypolicies" | "poddisruptionbudgets"
|
||||
"endpoints" | "customresourcedefinitions" | "horizontalpodautoscalers" | "podsecuritypolicies" | "poddisruptionbudgets";
|
||||
|
||||
export interface KubeApiResource {
|
||||
resource: KubeResource; // valid resource name
|
||||
|
@ -31,7 +31,7 @@ export interface UserPreferences {
|
||||
}
|
||||
|
||||
export class UserStore extends BaseStore<UserStoreModel> {
|
||||
static readonly defaultTheme: ThemeId = "lens-dark"
|
||||
static readonly defaultTheme: ThemeId = "lens-dark";
|
||||
|
||||
private constructor() {
|
||||
super({
|
||||
@ -42,7 +42,7 @@ export class UserStore extends BaseStore<UserStoreModel> {
|
||||
this.handleOnLoad();
|
||||
}
|
||||
|
||||
@observable lastSeenAppVersion = "0.0.0"
|
||||
@observable lastSeenAppVersion = "0.0.0";
|
||||
@observable kubeConfigPath = kubeConfigDefaultPath; // used in add-cluster page for providing context
|
||||
@observable seenContexts = observable.set<string>();
|
||||
@observable newContexts = observable.set<string>();
|
||||
@ -113,7 +113,7 @@ export class UserStore extends BaseStore<UserStoreModel> {
|
||||
logger.error(err);
|
||||
this.resetKubeConfigPath();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@action
|
||||
markNewContextsAsSeen() {
|
||||
|
@ -25,11 +25,11 @@ export interface WorkspaceState {
|
||||
}
|
||||
|
||||
export class Workspace implements WorkspaceModel, WorkspaceState {
|
||||
@observable id: WorkspaceId
|
||||
@observable name: string
|
||||
@observable description?: string
|
||||
@observable ownerRef?: string
|
||||
@observable enabled: boolean
|
||||
@observable id: WorkspaceId;
|
||||
@observable name: string;
|
||||
@observable description?: string;
|
||||
@observable ownerRef?: string;
|
||||
@observable enabled: boolean;
|
||||
|
||||
constructor(data: WorkspaceModel) {
|
||||
Object.assign(this, data);
|
||||
@ -72,7 +72,7 @@ export class Workspace implements WorkspaceModel, WorkspaceState {
|
||||
}
|
||||
|
||||
export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
||||
static readonly defaultId: WorkspaceId = "default"
|
||||
static readonly defaultId: WorkspaceId = "default";
|
||||
|
||||
private constructor() {
|
||||
super({
|
||||
|
@ -26,7 +26,7 @@ export abstract class ClusterFeature {
|
||||
installed: false,
|
||||
latestVersion: null,
|
||||
canUpgrade: false
|
||||
}
|
||||
};
|
||||
|
||||
abstract async install(cluster: Cluster): Promise<void>;
|
||||
|
||||
|
@ -18,7 +18,7 @@ export function extensionPackagesRoot() {
|
||||
export class ExtensionLoader {
|
||||
protected extensions = observable.map<LensExtensionId, InstalledExtension>();
|
||||
protected instances = observable.map<LensExtensionId, LensExtension>();
|
||||
protected readonly requestExtensionsChannel = "extensions:loaded"
|
||||
protected readonly requestExtensionsChannel = "extensions:loaded";
|
||||
|
||||
@observable isLoaded = false;
|
||||
whenLoaded = when(() => this.isLoaded);
|
||||
|
@ -16,19 +16,19 @@ export interface InstalledExtension {
|
||||
|
||||
type Dependencies = {
|
||||
[name: string]: string;
|
||||
}
|
||||
};
|
||||
|
||||
type PackageJson = {
|
||||
dependencies: Dependencies;
|
||||
}
|
||||
};
|
||||
|
||||
export class ExtensionManager {
|
||||
|
||||
protected bundledFolderPath: string
|
||||
protected bundledFolderPath: string;
|
||||
|
||||
protected packagesJson: PackageJson = {
|
||||
dependencies: {}
|
||||
}
|
||||
};
|
||||
|
||||
get extensionPackagesRoot() {
|
||||
return extensionPackagesRoot();
|
||||
|
@ -3,7 +3,7 @@ import * as path from "path";
|
||||
import { LensExtension } from "./lens-extension";
|
||||
|
||||
export abstract class ExtensionStore<T> extends BaseStore<T> {
|
||||
protected extension: LensExtension
|
||||
protected extension: LensExtension;
|
||||
|
||||
async loadExtension(extension: LensExtension) {
|
||||
this.extension = extension;
|
||||
|
@ -5,7 +5,7 @@ import { WindowManager } from "../main/window-manager";
|
||||
import { getExtensionPageUrl } from "./registries/page-registry";
|
||||
|
||||
export class LensMainExtension extends LensExtension {
|
||||
@observable.shallow appMenus: MenuRegistration[] = []
|
||||
@observable.shallow appMenus: MenuRegistration[] = [];
|
||||
|
||||
async navigate<P extends object>(pageId?: string, params?: P, frameId?: number) {
|
||||
const windowManager = WindowManager.getInstance<WindowManager>();
|
||||
|
@ -4,16 +4,16 @@ import { LensExtension } from "./lens-extension";
|
||||
import { getExtensionPageUrl } from "./registries/page-registry";
|
||||
|
||||
export class LensRendererExtension extends LensExtension {
|
||||
@observable.shallow globalPages: PageRegistration[] = []
|
||||
@observable.shallow clusterPages: PageRegistration[] = []
|
||||
@observable.shallow globalPageMenus: PageMenuRegistration[] = []
|
||||
@observable.shallow clusterPageMenus: PageMenuRegistration[] = []
|
||||
@observable.shallow kubeObjectStatusTexts: KubeObjectStatusRegistration[] = []
|
||||
@observable.shallow appPreferences: AppPreferenceRegistration[] = []
|
||||
@observable.shallow clusterFeatures: ClusterFeatureRegistration[] = []
|
||||
@observable.shallow statusBarItems: StatusBarRegistration[] = []
|
||||
@observable.shallow kubeObjectDetailItems: KubeObjectDetailRegistration[] = []
|
||||
@observable.shallow kubeObjectMenuItems: KubeObjectMenuRegistration[] = []
|
||||
@observable.shallow globalPages: PageRegistration[] = [];
|
||||
@observable.shallow clusterPages: PageRegistration[] = [];
|
||||
@observable.shallow globalPageMenus: PageMenuRegistration[] = [];
|
||||
@observable.shallow clusterPageMenus: PageMenuRegistration[] = [];
|
||||
@observable.shallow kubeObjectStatusTexts: KubeObjectStatusRegistration[] = [];
|
||||
@observable.shallow appPreferences: AppPreferenceRegistration[] = [];
|
||||
@observable.shallow clusterFeatures: ClusterFeatureRegistration[] = [];
|
||||
@observable.shallow statusBarItems: StatusBarRegistration[] = [];
|
||||
@observable.shallow kubeObjectDetailItems: KubeObjectDetailRegistration[] = [];
|
||||
@observable.shallow kubeObjectMenuItems: KubeObjectMenuRegistration[] = [];
|
||||
|
||||
async navigate<P extends object>(pageId?: string, params?: P) {
|
||||
const { navigate } = await import("../renderer/navigation");
|
||||
|
@ -2,7 +2,7 @@ export type KubeObjectStatus = {
|
||||
level: KubeObjectStatusLevel;
|
||||
text: string;
|
||||
timestamp?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export enum KubeObjectStatusLevel {
|
||||
INFO = 1,
|
||||
|
@ -2,7 +2,7 @@ import { autoUpdater } from "electron-updater";
|
||||
import logger from "./logger";
|
||||
|
||||
export class AppUpdater {
|
||||
static readonly defaultUpdateIntervalMs = 1000 * 60 * 60 * 24 // once a day
|
||||
static readonly defaultUpdateIntervalMs = 1000 * 60 * 60 * 24; // once a day
|
||||
|
||||
static checkForUpdates() {
|
||||
return autoUpdater.checkForUpdatesAndNotify();
|
||||
|
@ -4,11 +4,11 @@ import { Cluster } from "../cluster";
|
||||
export type ClusterDetectionResult = {
|
||||
value: string | number | boolean
|
||||
accuracy: number
|
||||
}
|
||||
};
|
||||
|
||||
export class BaseClusterDetector {
|
||||
cluster: Cluster
|
||||
key: string
|
||||
cluster: Cluster;
|
||||
key: string;
|
||||
|
||||
constructor(cluster: Cluster) {
|
||||
this.cluster = cluster;
|
||||
|
@ -3,7 +3,7 @@ import { createHash } from "crypto";
|
||||
import { ClusterMetadataKey } from "../cluster";
|
||||
|
||||
export class ClusterIdDetector extends BaseClusterDetector {
|
||||
key = ClusterMetadataKey.CLUSTER_ID
|
||||
key = ClusterMetadataKey.CLUSTER_ID;
|
||||
|
||||
public async detect() {
|
||||
let id: string;
|
||||
|
@ -2,8 +2,8 @@ import { BaseClusterDetector } from "./base-cluster-detector";
|
||||
import { ClusterMetadataKey } from "../cluster";
|
||||
|
||||
export class DistributionDetector extends BaseClusterDetector {
|
||||
key = ClusterMetadataKey.DISTRIBUTION
|
||||
version: string
|
||||
key = ClusterMetadataKey.DISTRIBUTION;
|
||||
version: string;
|
||||
|
||||
public async detect() {
|
||||
this.version = await this.getKubernetesVersion();
|
||||
|
@ -2,7 +2,7 @@ import { BaseClusterDetector } from "./base-cluster-detector";
|
||||
import { ClusterMetadataKey } from "../cluster";
|
||||
|
||||
export class LastSeenDetector extends BaseClusterDetector {
|
||||
key = ClusterMetadataKey.LAST_SEEN
|
||||
key = ClusterMetadataKey.LAST_SEEN;
|
||||
|
||||
public async detect() {
|
||||
if (!this.cluster.accessible) return null;
|
||||
|
@ -2,7 +2,7 @@ import { BaseClusterDetector } from "./base-cluster-detector";
|
||||
import { ClusterMetadataKey } from "../cluster";
|
||||
|
||||
export class NodesCountDetector extends BaseClusterDetector {
|
||||
key = ClusterMetadataKey.NODES_COUNT
|
||||
key = ClusterMetadataKey.NODES_COUNT;
|
||||
|
||||
public async detect() {
|
||||
if (!this.cluster.accessible) return null;
|
||||
|
@ -2,8 +2,8 @@ import { BaseClusterDetector } from "./base-cluster-detector";
|
||||
import { ClusterMetadataKey } from "../cluster";
|
||||
|
||||
export class VersionDetector extends BaseClusterDetector {
|
||||
key = ClusterMetadataKey.VERSION
|
||||
value: string
|
||||
key = ClusterMetadataKey.VERSION;
|
||||
value: string;
|
||||
|
||||
public async detect() {
|
||||
const version = await this.getKubernetesVersion();
|
||||
|
@ -32,7 +32,7 @@ export enum ClusterMetadataKey {
|
||||
|
||||
export type ClusterRefreshOptions = {
|
||||
refreshMetadata?: boolean
|
||||
}
|
||||
};
|
||||
|
||||
export interface ClusterState {
|
||||
initialized: boolean;
|
||||
@ -50,7 +50,7 @@ export interface ClusterState {
|
||||
|
||||
export class Cluster implements ClusterModel, ClusterState {
|
||||
public id: ClusterId;
|
||||
public kubeCtl: Kubectl
|
||||
public kubeCtl: Kubectl;
|
||||
public contextHandler: ContextHandler;
|
||||
public ownerRef: string;
|
||||
protected kubeconfigManager: KubeconfigManager;
|
||||
|
@ -12,10 +12,10 @@ import { KubeAuthProxy } from "./kube-auth-proxy";
|
||||
export class ContextHandler {
|
||||
public proxyPort: number;
|
||||
public clusterUrl: UrlWithStringQuery;
|
||||
protected kubeAuthProxy: KubeAuthProxy
|
||||
protected apiTarget: httpProxy.ServerOptions
|
||||
protected prometheusProvider: string
|
||||
protected prometheusPath: string
|
||||
protected kubeAuthProxy: KubeAuthProxy;
|
||||
protected apiTarget: httpProxy.ServerOptions;
|
||||
protected prometheusProvider: string;
|
||||
protected prometheusPath: string;
|
||||
|
||||
constructor(protected cluster: Cluster) {
|
||||
this.clusterUrl = url.parse(cluster.apiUrl);
|
||||
|
@ -7,11 +7,11 @@ import { helmCli } from "./helm-cli";
|
||||
|
||||
type CachedYaml = {
|
||||
entries: any; // todo: types
|
||||
}
|
||||
};
|
||||
|
||||
export class HelmChartManager {
|
||||
protected cache: any = {}
|
||||
protected repo: HelmRepo
|
||||
protected cache: any = {};
|
||||
protected repo: HelmRepo;
|
||||
|
||||
constructor(repo: HelmRepo){
|
||||
this.cache = HelmRepoManager.cache;
|
||||
|
@ -10,7 +10,7 @@ import logger from "../logger";
|
||||
export type HelmEnv = Record<string, string> & {
|
||||
HELM_REPOSITORY_CACHE?: string;
|
||||
HELM_REPOSITORY_CONFIG?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export interface HelmRepoConfig {
|
||||
repositories: HelmRepo[]
|
||||
@ -29,11 +29,11 @@ export interface HelmRepo {
|
||||
}
|
||||
|
||||
export class HelmRepoManager extends Singleton {
|
||||
static cache = {} // todo: remove implicit updates in helm-chart-manager.ts
|
||||
static cache = {}; // todo: remove implicit updates in helm-chart-manager.ts
|
||||
|
||||
protected repos: HelmRepo[];
|
||||
protected helmEnv: HelmEnv
|
||||
protected initialized: boolean
|
||||
protected helmEnv: HelmEnv;
|
||||
protected initialized: boolean;
|
||||
|
||||
async loadAvailableRepos(): Promise<HelmRepo[]> {
|
||||
const res = await customRequestPromise({
|
||||
|
@ -12,13 +12,13 @@ export interface KubeAuthProxyLog {
|
||||
}
|
||||
|
||||
export class KubeAuthProxy {
|
||||
public lastError: string
|
||||
public lastError: string;
|
||||
|
||||
protected cluster: Cluster
|
||||
protected env: NodeJS.ProcessEnv = null
|
||||
protected proxyProcess: ChildProcess
|
||||
protected port: number
|
||||
protected kubectl: Kubectl
|
||||
protected cluster: Cluster;
|
||||
protected env: NodeJS.ProcessEnv = null;
|
||||
protected proxyProcess: ChildProcess;
|
||||
protected port: number;
|
||||
protected kubectl: Kubectl;
|
||||
|
||||
constructor(cluster: Cluster, port: number, env: NodeJS.ProcessEnv) {
|
||||
this.env = env;
|
||||
|
@ -8,7 +8,7 @@ import { dumpConfigYaml, loadConfig } from "../common/kube-helpers";
|
||||
import logger from "./logger";
|
||||
|
||||
export class KubeconfigManager {
|
||||
protected configDir = app.getPath("temp")
|
||||
protected configDir = app.getPath("temp");
|
||||
protected tempFile: string;
|
||||
|
||||
private constructor(protected cluster: Cluster, protected contextHandler: ContextHandler, protected port: number) { }
|
||||
|
@ -54,18 +54,18 @@ export function bundledKubectlPath(): string {
|
||||
}
|
||||
|
||||
export class Kubectl {
|
||||
public kubectlVersion: string
|
||||
protected directory: string
|
||||
protected url: string
|
||||
protected path: string
|
||||
protected dirname: string
|
||||
public kubectlVersion: string;
|
||||
protected directory: string;
|
||||
protected url: string;
|
||||
protected path: string;
|
||||
protected dirname: string;
|
||||
|
||||
static get kubectlDir() {
|
||||
return path.join((app || remote.app).getPath("userData"), "binaries", "kubectl");
|
||||
}
|
||||
|
||||
public static readonly bundledKubectlVersion: string = bundledVersion
|
||||
public static invalidBundle = false
|
||||
public static readonly bundledKubectlVersion: string = bundledVersion;
|
||||
public static invalidBundle = false;
|
||||
private static bundledInstance: Kubectl;
|
||||
|
||||
// Returns the single bundled Kubectl instance
|
||||
|
@ -12,22 +12,22 @@ export type LensBinaryOpts = {
|
||||
originalBinaryName: string;
|
||||
newBinaryName?: string;
|
||||
requestOpts?: request.Options;
|
||||
}
|
||||
};
|
||||
|
||||
export class LensBinary {
|
||||
|
||||
public binaryVersion: string
|
||||
protected directory: string
|
||||
protected url: string
|
||||
public binaryVersion: string;
|
||||
protected directory: string;
|
||||
protected url: string;
|
||||
protected path: string;
|
||||
protected tarPath: string;
|
||||
protected dirname: string
|
||||
protected binaryName: string
|
||||
protected platformName: string
|
||||
protected arch: string
|
||||
protected originalBinaryName: string
|
||||
protected requestOpts: request.Options
|
||||
protected logger: Console | winston.Logger
|
||||
protected dirname: string;
|
||||
protected binaryName: string;
|
||||
protected platformName: string;
|
||||
protected arch: string;
|
||||
protected originalBinaryName: string;
|
||||
protected requestOpts: request.Options;
|
||||
protected logger: Console | winston.Logger;
|
||||
|
||||
constructor(opts: LensBinaryOpts) {
|
||||
const baseDir = opts.baseDir;
|
||||
|
@ -12,11 +12,11 @@ import { ContextHandler } from "./context-handler";
|
||||
import logger from "./logger";
|
||||
|
||||
export class LensProxy {
|
||||
protected origin: string
|
||||
protected proxyServer: http.Server
|
||||
protected router: Router
|
||||
protected closed = false
|
||||
protected retryCounters = new Map<string, number>()
|
||||
protected origin: string;
|
||||
protected proxyServer: http.Server;
|
||||
protected router: Router;
|
||||
protected closed = false;
|
||||
protected retryCounters = new Map<string, number>();
|
||||
|
||||
static create(port: number, clusterManager: ClusterManager) {
|
||||
return new LensProxy(port, clusterManager).listen();
|
||||
|
@ -11,7 +11,7 @@ import { menuRegistry } from "../extensions/registries/menu-registry";
|
||||
import logger from "./logger";
|
||||
import { exitApp } from "./exit-app";
|
||||
|
||||
export type MenuTopId = "mac" | "file" | "edit" | "view" | "help"
|
||||
export type MenuTopId = "mac" | "file" | "edit" | "view" | "help";
|
||||
|
||||
export function initMenu(windowManager: WindowManager) {
|
||||
return autorun(() => buildMenu(windowManager), {
|
||||
|
@ -10,8 +10,8 @@ import { appEventBus } from "../common/event-bus";
|
||||
|
||||
export class NodeShellSession extends ShellSession {
|
||||
protected nodeName: string;
|
||||
protected podId: string
|
||||
protected kc: KubeConfig
|
||||
protected podId: string;
|
||||
protected kc: KubeConfig;
|
||||
|
||||
constructor(socket: WebSocket, cluster: Cluster, nodeName: string) {
|
||||
super(socket, cluster);
|
||||
|
@ -10,15 +10,15 @@ jest.mock("net", () => {
|
||||
listen = jest.fn(() => {
|
||||
this.emit('listening');
|
||||
return this;
|
||||
})
|
||||
});
|
||||
address = () => {
|
||||
newPort = Math.round(Math.random() * 10000);
|
||||
return {
|
||||
port: newPort
|
||||
};
|
||||
}
|
||||
unref = jest.fn()
|
||||
close = jest.fn(cb => cb())
|
||||
};
|
||||
unref = jest.fn();
|
||||
close = jest.fn(cb => cb());
|
||||
};
|
||||
},
|
||||
};
|
||||
|
@ -4,9 +4,9 @@ import { PrometheusService } from "./provider-registry";
|
||||
import logger from "../logger";
|
||||
|
||||
export class PrometheusHelm extends PrometheusLens {
|
||||
id = "helm"
|
||||
name = "Helm"
|
||||
rateAccuracy = "5m"
|
||||
id = "helm";
|
||||
name = "Helm";
|
||||
rateAccuracy = "5m";
|
||||
|
||||
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
|
||||
const labelSelector = "app=prometheus,component=server,heritage=Helm";
|
||||
|
@ -3,9 +3,9 @@ import { CoreV1Api } from "@kubernetes/client-node";
|
||||
import logger from "../logger";
|
||||
|
||||
export class PrometheusLens implements PrometheusProvider {
|
||||
id = "lens"
|
||||
name = "Lens"
|
||||
rateAccuracy = "1m"
|
||||
id = "lens";
|
||||
name = "Lens";
|
||||
rateAccuracy = "1m";
|
||||
|
||||
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
|
||||
try {
|
||||
|
@ -3,9 +3,9 @@ import { CoreV1Api, V1Service } from "@kubernetes/client-node";
|
||||
import logger from "../logger";
|
||||
|
||||
export class PrometheusOperator implements PrometheusProvider {
|
||||
rateAccuracy = "1m"
|
||||
id = "operator"
|
||||
name = "Prometheus Operator"
|
||||
rateAccuracy = "1m";
|
||||
id = "operator";
|
||||
name = "Prometheus Operator";
|
||||
|
||||
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
|
||||
try {
|
||||
|
@ -11,7 +11,7 @@ export type PrometheusClusterQuery = {
|
||||
cpuCapacity: string;
|
||||
podUsage: string;
|
||||
podCapacity: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type PrometheusNodeQuery = {
|
||||
memoryUsage: string;
|
||||
@ -20,7 +20,7 @@ export type PrometheusNodeQuery = {
|
||||
cpuCapacity: string;
|
||||
fsSize: string;
|
||||
fsUsage: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type PrometheusPodQuery = {
|
||||
memoryUsage: string;
|
||||
@ -32,32 +32,32 @@ export type PrometheusPodQuery = {
|
||||
fsUsage: string;
|
||||
networkReceive: string;
|
||||
networkTransmit: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type PrometheusPvcQuery = {
|
||||
diskUsage: string;
|
||||
diskCapacity: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type PrometheusIngressQuery = {
|
||||
bytesSentSuccess: string;
|
||||
bytesSentFailure: string;
|
||||
requestDurationSeconds: string;
|
||||
responseDurationSeconds: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type PrometheusQueryOpts = {
|
||||
[key: string]: string | any;
|
||||
};
|
||||
|
||||
export type PrometheusQuery = PrometheusNodeQuery | PrometheusClusterQuery | PrometheusPodQuery | PrometheusPvcQuery | PrometheusIngressQuery
|
||||
export type PrometheusQuery = PrometheusNodeQuery | PrometheusClusterQuery | PrometheusPodQuery | PrometheusPvcQuery | PrometheusIngressQuery;
|
||||
|
||||
export type PrometheusService = {
|
||||
id: string;
|
||||
namespace: string;
|
||||
service: string;
|
||||
port: number;
|
||||
}
|
||||
};
|
||||
|
||||
export interface PrometheusProvider {
|
||||
id: string;
|
||||
@ -68,10 +68,10 @@ export interface PrometheusProvider {
|
||||
|
||||
export type PrometheusProviderList = {
|
||||
[key: string]: PrometheusProvider;
|
||||
}
|
||||
};
|
||||
|
||||
export class PrometheusProviderRegistry {
|
||||
private static prometheusProviders: PrometheusProviderList = {}
|
||||
private static prometheusProviders: PrometheusProviderList = {};
|
||||
|
||||
static getProvider(type: string): PrometheusProvider {
|
||||
if (!this.prometheusProviders[type]) {
|
||||
|
@ -3,9 +3,9 @@ import { CoreV1Api } from "@kubernetes/client-node";
|
||||
import logger from "../logger";
|
||||
|
||||
export class PrometheusStacklight implements PrometheusProvider {
|
||||
id = "stacklight"
|
||||
name = "Stacklight"
|
||||
rateAccuracy = "1m"
|
||||
id = "stacklight";
|
||||
name = "Stacklight";
|
||||
rateAccuracy = "1m";
|
||||
|
||||
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
|
||||
try {
|
||||
|
@ -5,7 +5,7 @@ import _ from "lodash";
|
||||
|
||||
export type IMetricsQuery = string | string[] | {
|
||||
[metricName: string]: string;
|
||||
}
|
||||
};
|
||||
|
||||
// This is used for backoff retry tracking.
|
||||
const MAX_ATTEMPTS = 5;
|
||||
|
@ -8,7 +8,7 @@ import * as tcpPortUsed from "tcp-port-used";
|
||||
import logger from "../logger";
|
||||
|
||||
class PortForward {
|
||||
public static portForwards: PortForward[] = []
|
||||
public static portForwards: PortForward[] = [];
|
||||
|
||||
static getPortforward(forward: {clusterId: string; kind: string; name: string; namespace: string; port: string}) {
|
||||
return PortForward.portForwards.find((pf) => {
|
||||
@ -22,14 +22,14 @@ class PortForward {
|
||||
});
|
||||
}
|
||||
|
||||
public clusterId: string
|
||||
public process: ChildProcessWithoutNullStreams
|
||||
public kubeConfig: string
|
||||
public kind: string
|
||||
public namespace: string
|
||||
public name: string
|
||||
public port: string
|
||||
public localPort: number
|
||||
public clusterId: string;
|
||||
public process: ChildProcessWithoutNullStreams;
|
||||
public kubeConfig: string;
|
||||
public kind: string;
|
||||
public namespace: string;
|
||||
public name: string;
|
||||
public port: string;
|
||||
public localPort: number;
|
||||
|
||||
constructor(obj: any) {
|
||||
Object.assign(this, obj);
|
||||
|
@ -6,12 +6,12 @@ import { Request } from "request";
|
||||
import logger from "../logger";
|
||||
|
||||
class ApiWatcher {
|
||||
private apiUrl: string
|
||||
private response: ServerResponse
|
||||
private watchRequest: Request
|
||||
private watch: Watch
|
||||
private processor: NodeJS.Timeout
|
||||
private eventBuffer: any[] = []
|
||||
private apiUrl: string;
|
||||
private response: ServerResponse;
|
||||
private watchRequest: Request;
|
||||
private watch: Watch;
|
||||
private processor: NodeJS.Timeout;
|
||||
private eventBuffer: any[] = [];
|
||||
|
||||
constructor(apiUrl: string, kubeConfig: KubeConfig, response: ServerResponse) {
|
||||
this.apiUrl = apiUrl;
|
||||
|
@ -13,11 +13,11 @@ import { appEventBus } from "../common/event-bus";
|
||||
import { userStore } from "../common/user-store";
|
||||
|
||||
export class ShellSession extends EventEmitter {
|
||||
static shellEnvs: Map<string, any> = new Map()
|
||||
static shellEnvs: Map<string, any> = new Map();
|
||||
|
||||
protected websocket: WebSocket
|
||||
protected shellProcess: pty.IPty
|
||||
protected kubeconfigPath: string
|
||||
protected websocket: WebSocket;
|
||||
protected shellProcess: pty.IPty;
|
||||
protected kubeconfigPath: string;
|
||||
protected nodeShellPod: string;
|
||||
protected kubectl: Kubectl;
|
||||
protected kubectlBinDir: string;
|
||||
|
@ -2,9 +2,9 @@ import { RoleBinding } from "./role-binding.api";
|
||||
import { KubeApi } from "../kube-api";
|
||||
|
||||
export class ClusterRoleBinding extends RoleBinding {
|
||||
static kind = "ClusterRoleBinding"
|
||||
static namespaced = false
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings"
|
||||
static kind = "ClusterRoleBinding";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings";
|
||||
}
|
||||
|
||||
export const clusterRoleBindingApi = new KubeApi({
|
||||
|
@ -4,9 +4,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class ClusterRole extends Role {
|
||||
static kind = "ClusterRole"
|
||||
static namespaced = false
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterroles"
|
||||
static kind = "ClusterRole";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterroles";
|
||||
}
|
||||
|
||||
export const clusterRoleApi = new KubeApi({
|
||||
|
@ -3,8 +3,8 @@ import { KubeObject } from "../kube-object";
|
||||
import { KubeApi } from "../kube-api";
|
||||
|
||||
export class ClusterApi extends KubeApi<Cluster> {
|
||||
static kind = "Cluster"
|
||||
static namespaced = true
|
||||
static kind = "Cluster";
|
||||
static namespaced = true;
|
||||
|
||||
async getMetrics(nodeNames: string[], params?: IMetricsReqParams): Promise<IClusterMetrics> {
|
||||
const nodes = nodeNames.join("|");
|
||||
@ -52,7 +52,7 @@ export interface IClusterMetrics<T = IMetrics> {
|
||||
|
||||
export class Cluster extends KubeObject {
|
||||
static kind = "Cluster";
|
||||
static apiBase = "/apis/cluster.k8s.io/v1alpha1/clusters"
|
||||
static apiBase = "/apis/cluster.k8s.io/v1alpha1/clusters";
|
||||
|
||||
spec: {
|
||||
clusterNetwork?: {
|
||||
@ -69,7 +69,7 @@ export class Cluster extends KubeObject {
|
||||
profile: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
status?: {
|
||||
apiEndpoints: {
|
||||
host: string;
|
||||
@ -84,7 +84,7 @@ export class Cluster extends KubeObject {
|
||||
};
|
||||
errorMessage?: string;
|
||||
errorReason?: string;
|
||||
}
|
||||
};
|
||||
|
||||
getStatus() {
|
||||
if (this.metadata.deletionTimestamp) return ClusterStatus.REMOVING;
|
||||
|
@ -8,11 +8,11 @@ export interface IComponentStatusCondition {
|
||||
}
|
||||
|
||||
export class ComponentStatus extends KubeObject {
|
||||
static kind = "ComponentStatus"
|
||||
static namespaced = false
|
||||
static apiBase = "/api/v1/componentstatuses"
|
||||
static kind = "ComponentStatus";
|
||||
static namespaced = false;
|
||||
static apiBase = "/api/v1/componentstatuses";
|
||||
|
||||
conditions: IComponentStatusCondition[]
|
||||
conditions: IComponentStatusCondition[];
|
||||
|
||||
getTruthyConditions() {
|
||||
return this.conditions.filter(c => c.status === "True");
|
||||
|
@ -7,7 +7,7 @@ import { KubeApi } from "../kube-api";
|
||||
export class ConfigMap extends KubeObject {
|
||||
static kind = "ConfigMap";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/configmaps"
|
||||
static apiBase = "/api/v1/configmaps";
|
||||
|
||||
constructor(data: KubeJsonApiData) {
|
||||
super(data);
|
||||
@ -16,7 +16,7 @@ export class ConfigMap extends KubeObject {
|
||||
|
||||
data: {
|
||||
[param: string]: string;
|
||||
}
|
||||
};
|
||||
|
||||
getKeys(): string[] {
|
||||
return Object.keys(this.data);
|
||||
|
@ -7,20 +7,20 @@ type AdditionalPrinterColumnsCommon = {
|
||||
type: "integer" | "number" | "string" | "boolean" | "date";
|
||||
priority: number;
|
||||
description: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type AdditionalPrinterColumnsV1 = AdditionalPrinterColumnsCommon & {
|
||||
jsonPath: string;
|
||||
}
|
||||
};
|
||||
|
||||
type AdditionalPrinterColumnsV1Beta = AdditionalPrinterColumnsCommon & {
|
||||
JSONPath: string;
|
||||
}
|
||||
};
|
||||
|
||||
export class CustomResourceDefinition extends KubeObject {
|
||||
static kind = "CustomResourceDefinition";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions"
|
||||
static apiBase = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions";
|
||||
|
||||
spec: {
|
||||
group: string;
|
||||
@ -45,7 +45,7 @@ export class CustomResourceDefinition extends KubeObject {
|
||||
webhook?: any;
|
||||
};
|
||||
additionalPrinterColumns?: AdditionalPrinterColumnsV1Beta[]; // removed in v1
|
||||
}
|
||||
};
|
||||
status: {
|
||||
conditions: {
|
||||
lastTransitionTime: string;
|
||||
@ -62,7 +62,7 @@ export class CustomResourceDefinition extends KubeObject {
|
||||
listKind: string;
|
||||
};
|
||||
storedVersions: string[];
|
||||
}
|
||||
};
|
||||
|
||||
getResourceUrl() {
|
||||
return crdResourcesURL({
|
||||
|
@ -7,12 +7,12 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class CronJob extends KubeObject {
|
||||
static kind = "CronJob"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/batch/v1beta1/cronjobs"
|
||||
static kind = "CronJob";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/batch/v1beta1/cronjobs";
|
||||
|
||||
kind: string
|
||||
apiVersion: string
|
||||
kind: string;
|
||||
apiVersion: string;
|
||||
metadata: {
|
||||
name: string;
|
||||
namespace: string;
|
||||
@ -26,7 +26,7 @@ export class CronJob extends KubeObject {
|
||||
annotations: {
|
||||
[key: string]: string;
|
||||
};
|
||||
}
|
||||
};
|
||||
spec: {
|
||||
schedule: string;
|
||||
concurrencyPolicy: string;
|
||||
@ -59,10 +59,10 @@ export class CronJob extends KubeObject {
|
||||
};
|
||||
successfulJobsHistoryLimit: number;
|
||||
failedJobsHistoryLimit: number;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
lastScheduleTime?: string;
|
||||
}
|
||||
};
|
||||
|
||||
getSuspendFlag() {
|
||||
return this.spec.suspend.toString();
|
||||
|
@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class DaemonSet extends WorkloadKubeObject {
|
||||
static kind = "DaemonSet"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/apps/v1/daemonsets"
|
||||
static kind = "DaemonSet";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/apps/v1/daemonsets";
|
||||
|
||||
spec: {
|
||||
selector: {
|
||||
@ -51,7 +51,7 @@ export class DaemonSet extends WorkloadKubeObject {
|
||||
};
|
||||
};
|
||||
revisionHistoryLimit: number;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
currentNumberScheduled: number;
|
||||
numberMisscheduled: number;
|
||||
@ -61,7 +61,7 @@ export class DaemonSet extends WorkloadKubeObject {
|
||||
updatedNumberScheduled: number;
|
||||
numberAvailable: number;
|
||||
numberUnavailable: number;
|
||||
}
|
||||
};
|
||||
|
||||
getImages() {
|
||||
const containers: IPodContainer[] = get(this, "spec.template.spec.containers", []);
|
||||
|
@ -48,9 +48,9 @@ export class DeploymentApi extends KubeApi<Deployment> {
|
||||
|
||||
@autobind()
|
||||
export class Deployment extends WorkloadKubeObject {
|
||||
static kind = "Deployment"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/apps/v1/deployments"
|
||||
static kind = "Deployment";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/apps/v1/deployments";
|
||||
|
||||
spec: {
|
||||
replicas: number;
|
||||
@ -151,7 +151,7 @@ export class Deployment extends WorkloadKubeObject {
|
||||
maxSurge: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
status: {
|
||||
observedGeneration: number;
|
||||
replicas: number;
|
||||
@ -167,7 +167,7 @@ export class Deployment extends WorkloadKubeObject {
|
||||
reason: string;
|
||||
message: string;
|
||||
}[];
|
||||
}
|
||||
};
|
||||
|
||||
getConditions(activeOnly = false) {
|
||||
const { conditions } = this.status;
|
||||
|
@ -98,11 +98,11 @@ export class EndpointSubset implements IEndpointSubset {
|
||||
|
||||
@autobind()
|
||||
export class Endpoint extends KubeObject {
|
||||
static kind = "Endpoints"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/endpoints"
|
||||
static kind = "Endpoints";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/endpoints";
|
||||
|
||||
subsets: IEndpointSubset[]
|
||||
subsets: IEndpointSubset[];
|
||||
|
||||
getEndpointSubsets(): EndpointSubset[] {
|
||||
const subsets = this.subsets || [];
|
||||
|
@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class KubeEvent extends KubeObject {
|
||||
static kind = "Event"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/events"
|
||||
static kind = "Event";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/events";
|
||||
|
||||
involvedObject: {
|
||||
kind: string;
|
||||
@ -18,20 +18,20 @@ export class KubeEvent extends KubeObject {
|
||||
apiVersion: string;
|
||||
resourceVersion: string;
|
||||
fieldPath: string;
|
||||
}
|
||||
reason: string
|
||||
message: string
|
||||
};
|
||||
reason: string;
|
||||
message: string;
|
||||
source: {
|
||||
component: string;
|
||||
host: string;
|
||||
}
|
||||
firstTimestamp: string
|
||||
lastTimestamp: string
|
||||
count: number
|
||||
type: string
|
||||
eventTime: null
|
||||
reportingComponent: string
|
||||
reportingInstance: string
|
||||
};
|
||||
firstTimestamp: string;
|
||||
lastTimestamp: string;
|
||||
count: number;
|
||||
type: string;
|
||||
eventTime: null;
|
||||
reportingComponent: string;
|
||||
reportingInstance: string;
|
||||
|
||||
isWarning() {
|
||||
return this.type === "Warning";
|
||||
|
@ -61,27 +61,27 @@ export class HelmChart {
|
||||
return new HelmChart(data);
|
||||
}
|
||||
|
||||
apiVersion: string
|
||||
name: string
|
||||
version: string
|
||||
repo: string
|
||||
kubeVersion?: string
|
||||
created: string
|
||||
description?: string
|
||||
digest: string
|
||||
keywords?: string[]
|
||||
home?: string
|
||||
sources?: string[]
|
||||
apiVersion: string;
|
||||
name: string;
|
||||
version: string;
|
||||
repo: string;
|
||||
kubeVersion?: string;
|
||||
created: string;
|
||||
description?: string;
|
||||
digest: string;
|
||||
keywords?: string[];
|
||||
home?: string;
|
||||
sources?: string[];
|
||||
maintainers?: {
|
||||
name: string;
|
||||
email: string;
|
||||
url: string;
|
||||
}[]
|
||||
engine?: string
|
||||
icon?: string
|
||||
appVersion?: string
|
||||
deprecated?: boolean
|
||||
tillerVersion?: string
|
||||
}[];
|
||||
engine?: string;
|
||||
icon?: string;
|
||||
appVersion?: string;
|
||||
deprecated?: boolean;
|
||||
tillerVersion?: string;
|
||||
|
||||
getId() {
|
||||
return this.digest;
|
||||
|
@ -135,13 +135,13 @@ export class HelmRelease implements ItemObject {
|
||||
return new HelmRelease(data);
|
||||
}
|
||||
|
||||
appVersion: string
|
||||
name: string
|
||||
namespace: string
|
||||
chart: string
|
||||
status: string
|
||||
updated: string
|
||||
revision: string
|
||||
appVersion: string;
|
||||
name: string;
|
||||
namespace: string;
|
||||
chart: string;
|
||||
status: string;
|
||||
updated: string;
|
||||
revision: string;
|
||||
|
||||
getId() {
|
||||
return this.namespace + this.name;
|
||||
|
@ -20,7 +20,7 @@ export type IHpaMetricData<T = any> = T & {
|
||||
currentAverageValue?: string;
|
||||
targetAverageUtilization?: number;
|
||||
targetAverageValue?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export interface IHpaMetric {
|
||||
[kind: string]: IHpaMetricData;
|
||||
@ -41,7 +41,7 @@ export interface IHpaMetric {
|
||||
export class HorizontalPodAutoscaler extends KubeObject {
|
||||
static kind = "HorizontalPodAutoscaler";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/autoscaling/v2beta1/horizontalpodautoscalers"
|
||||
static apiBase = "/apis/autoscaling/v2beta1/horizontalpodautoscalers";
|
||||
|
||||
spec: {
|
||||
scaleTargetRef: {
|
||||
@ -52,7 +52,7 @@ export class HorizontalPodAutoscaler extends KubeObject {
|
||||
minReplicas: number;
|
||||
maxReplicas: number;
|
||||
metrics: IHpaMetric[];
|
||||
}
|
||||
};
|
||||
status: {
|
||||
currentReplicas: number;
|
||||
desiredReplicas: number;
|
||||
@ -64,7 +64,7 @@ export class HorizontalPodAutoscaler extends KubeObject {
|
||||
status: string;
|
||||
type: string;
|
||||
}[];
|
||||
}
|
||||
};
|
||||
|
||||
getMaxPods() {
|
||||
return this.spec.maxReplicas || 0;
|
||||
|
@ -31,9 +31,9 @@ export interface ILoadBalancerIngress {
|
||||
}
|
||||
@autobind()
|
||||
export class Ingress extends KubeObject {
|
||||
static kind = "Ingress"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/extensions/v1beta1/ingresses"
|
||||
static kind = "Ingress";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/extensions/v1beta1/ingresses";
|
||||
|
||||
spec: {
|
||||
tls: {
|
||||
@ -55,12 +55,12 @@ export class Ingress extends KubeObject {
|
||||
serviceName: string;
|
||||
servicePort: number;
|
||||
};
|
||||
}
|
||||
};
|
||||
status: {
|
||||
loadBalancer: {
|
||||
ingress: ILoadBalancerIngress[];
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
getRoutes() {
|
||||
const { spec: { tls, rules } } = this;
|
||||
|
@ -7,9 +7,9 @@ import { JsonApiParams } from "../json-api";
|
||||
|
||||
@autobind()
|
||||
export class Job extends WorkloadKubeObject {
|
||||
static kind = "Job"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/batch/v1/jobs"
|
||||
static kind = "Job";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/batch/v1/jobs";
|
||||
|
||||
spec: {
|
||||
parallelism?: number;
|
||||
@ -56,7 +56,7 @@ export class Job extends WorkloadKubeObject {
|
||||
serviceAccountName?: string;
|
||||
serviceAccount?: string;
|
||||
schedulerName?: string;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
conditions: {
|
||||
type: string;
|
||||
@ -68,7 +68,7 @@ export class Job extends WorkloadKubeObject {
|
||||
startTime: string;
|
||||
completionTime: string;
|
||||
succeeded: number;
|
||||
}
|
||||
};
|
||||
|
||||
getDesiredCompletions() {
|
||||
return this.spec.completions || 0;
|
||||
|
@ -15,7 +15,7 @@ export class Namespace extends KubeObject {
|
||||
|
||||
status?: {
|
||||
phase: string;
|
||||
}
|
||||
};
|
||||
|
||||
getStatus() {
|
||||
return this.status ? this.status.phase : "-";
|
||||
|
@ -37,9 +37,9 @@ export interface IPolicyEgress {
|
||||
|
||||
@autobind()
|
||||
export class NetworkPolicy extends KubeObject {
|
||||
static kind = "NetworkPolicy"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/networking.k8s.io/v1/networkpolicies"
|
||||
static kind = "NetworkPolicy";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/networking.k8s.io/v1/networkpolicies";
|
||||
|
||||
spec: {
|
||||
podSelector: {
|
||||
@ -51,7 +51,7 @@ export class NetworkPolicy extends KubeObject {
|
||||
policyTypes: string[];
|
||||
ingress: IPolicyIngress[];
|
||||
egress: IPolicyEgress[];
|
||||
}
|
||||
};
|
||||
|
||||
getMatchLabels(): string[] {
|
||||
if (!this.spec.podSelector || !this.spec.podSelector.matchLabels) return [];
|
||||
|
@ -30,9 +30,9 @@ export interface INodeMetrics<T = IMetrics> {
|
||||
|
||||
@autobind()
|
||||
export class Node extends KubeObject {
|
||||
static kind = "Node"
|
||||
static namespaced = false
|
||||
static apiBase = "/api/v1/nodes"
|
||||
static kind = "Node";
|
||||
static namespaced = false;
|
||||
static apiBase = "/api/v1/nodes";
|
||||
|
||||
spec: {
|
||||
podCIDR: string;
|
||||
@ -43,7 +43,7 @@ export class Node extends KubeObject {
|
||||
effect: string;
|
||||
}[];
|
||||
unschedulable?: boolean;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
capacity: {
|
||||
cpu: string;
|
||||
@ -83,7 +83,7 @@ export class Node extends KubeObject {
|
||||
names: string[];
|
||||
sizeBytes: number;
|
||||
}[];
|
||||
}
|
||||
};
|
||||
|
||||
getNodeConditionText() {
|
||||
const { conditions } = this.status;
|
||||
|
@ -23,9 +23,9 @@ export interface IPvcMetrics<T = IMetrics> {
|
||||
|
||||
@autobind()
|
||||
export class PersistentVolumeClaim extends KubeObject {
|
||||
static kind = "PersistentVolumeClaim"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/persistentvolumeclaims"
|
||||
static kind = "PersistentVolumeClaim";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/persistentvolumeclaims";
|
||||
|
||||
spec: {
|
||||
accessModes: string[];
|
||||
@ -45,10 +45,10 @@ export class PersistentVolumeClaim extends KubeObject {
|
||||
storage: string; // 8Gi
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
status: {
|
||||
phase: string; // Pending
|
||||
}
|
||||
};
|
||||
|
||||
getPods(allPods: Pod[]): Pod[] {
|
||||
const pods = allPods.filter(pod => pod.getNs() === this.getNs());
|
||||
|
@ -5,9 +5,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class PersistentVolume extends KubeObject {
|
||||
static kind = "PersistentVolume"
|
||||
static namespaced = false
|
||||
static apiBase = "/api/v1/persistentvolumes"
|
||||
static kind = "PersistentVolume";
|
||||
static namespaced = false;
|
||||
static apiBase = "/api/v1/persistentvolumes";
|
||||
|
||||
spec: {
|
||||
capacity: {
|
||||
@ -38,12 +38,12 @@ export class PersistentVolume extends KubeObject {
|
||||
path: string;
|
||||
server: string;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
status: {
|
||||
phase: string;
|
||||
reason?: string;
|
||||
}
|
||||
};
|
||||
|
||||
getCapacity(inBytes = false) {
|
||||
const capacity = this.spec.capacity;
|
||||
|
@ -2,19 +2,19 @@ import { KubeObject } from "../kube-object";
|
||||
import { KubeApi } from "../kube-api";
|
||||
|
||||
export class PodMetrics extends KubeObject {
|
||||
static kind = "Pod"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/metrics.k8s.io/v1beta1/pods"
|
||||
static kind = "Pod";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/metrics.k8s.io/v1beta1/pods";
|
||||
|
||||
timestamp: string
|
||||
window: string
|
||||
timestamp: string;
|
||||
window: string;
|
||||
containers: {
|
||||
name: string;
|
||||
usage: {
|
||||
cpu: string;
|
||||
memory: string;
|
||||
};
|
||||
}[]
|
||||
}[];
|
||||
}
|
||||
|
||||
export const podMetricsApi = new KubeApi({
|
||||
|
@ -12,13 +12,13 @@ export class PodDisruptionBudget extends KubeObject {
|
||||
minAvailable: string;
|
||||
maxUnavailable: string;
|
||||
selector: { matchLabels: { [app: string]: string } };
|
||||
}
|
||||
};
|
||||
status: {
|
||||
currentHealthy: number
|
||||
desiredHealthy: number
|
||||
disruptionsAllowed: number
|
||||
expectedPods: number
|
||||
}
|
||||
};
|
||||
|
||||
getSelectors() {
|
||||
const selector = this.spec.selector;
|
||||
|
@ -171,9 +171,9 @@ export interface IPodContainerStatus {
|
||||
|
||||
@autobind()
|
||||
export class Pod extends WorkloadKubeObject {
|
||||
static kind = "Pod"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/pods"
|
||||
static kind = "Pod";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/pods";
|
||||
|
||||
spec: {
|
||||
volumes?: {
|
||||
@ -215,7 +215,7 @@ export class Pod extends WorkloadKubeObject {
|
||||
tolerationSeconds: number;
|
||||
}[];
|
||||
affinity: IAffinity;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
phase: string;
|
||||
conditions: {
|
||||
@ -231,7 +231,7 @@ export class Pod extends WorkloadKubeObject {
|
||||
containerStatuses?: IPodContainerStatus[];
|
||||
qosClass: string;
|
||||
reason?: string;
|
||||
}
|
||||
};
|
||||
|
||||
getInitContainers() {
|
||||
return this.spec.initContainers || [];
|
||||
|
@ -4,9 +4,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class PodSecurityPolicy extends KubeObject {
|
||||
static kind = "PodSecurityPolicy"
|
||||
static namespaced = false
|
||||
static apiBase = "/apis/policy/v1beta1/podsecuritypolicies"
|
||||
static kind = "PodSecurityPolicy";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/policy/v1beta1/podsecuritypolicies";
|
||||
|
||||
spec: {
|
||||
allowPrivilegeEscalation?: boolean;
|
||||
@ -66,7 +66,7 @@ export class PodSecurityPolicy extends KubeObject {
|
||||
ranges: { max: number; min: number }[];
|
||||
};
|
||||
volumes?: string[];
|
||||
}
|
||||
};
|
||||
|
||||
isPrivileged() {
|
||||
return !!this.spec.privileged;
|
||||
|
@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class ReplicaSet extends WorkloadKubeObject {
|
||||
static kind = "ReplicaSet"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/apps/v1/replicasets"
|
||||
static kind = "ReplicaSet";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/apps/v1/replicasets";
|
||||
|
||||
spec: {
|
||||
replicas?: number;
|
||||
@ -37,14 +37,14 @@ export class ReplicaSet extends WorkloadKubeObject {
|
||||
terminationGracePeriodSeconds?: number;
|
||||
dnsPolicy?: string;
|
||||
schedulerName?: string;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
replicas: number;
|
||||
fullyLabeledReplicas: number;
|
||||
readyReplicas: number;
|
||||
availableReplicas: number;
|
||||
observedGeneration: number;
|
||||
}
|
||||
};
|
||||
|
||||
getImages() {
|
||||
const containers: IPodContainer[] = get(this, "spec.template.spec.containers", []);
|
||||
|
@ -31,9 +31,9 @@ export interface IResourceQuotaValues {
|
||||
}
|
||||
|
||||
export class ResourceQuota extends KubeObject {
|
||||
static kind = "ResourceQuota"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/resourcequotas"
|
||||
static kind = "ResourceQuota";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/resourcequotas";
|
||||
|
||||
constructor(data: KubeJsonApiData) {
|
||||
super(data);
|
||||
@ -49,12 +49,12 @@ export class ResourceQuota extends KubeObject {
|
||||
values: string[];
|
||||
}[];
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
status: {
|
||||
hard: IResourceQuotaValues;
|
||||
used: IResourceQuotaValues;
|
||||
}
|
||||
};
|
||||
|
||||
getScopeSelector() {
|
||||
const { matchExpressions = [] } = this.spec.scopeSelector || {};
|
||||
|
@ -11,16 +11,16 @@ export interface IRoleBindingSubject {
|
||||
|
||||
@autobind()
|
||||
export class RoleBinding extends KubeObject {
|
||||
static kind = "RoleBinding"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/rolebindings"
|
||||
static kind = "RoleBinding";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/rolebindings";
|
||||
|
||||
subjects?: IRoleBindingSubject[]
|
||||
subjects?: IRoleBindingSubject[];
|
||||
roleRef: {
|
||||
kind: string;
|
||||
name: string;
|
||||
apiGroup?: string;
|
||||
}
|
||||
};
|
||||
|
||||
getSubjects() {
|
||||
return this.subjects || [];
|
||||
|
@ -2,16 +2,16 @@ import { KubeObject } from "../kube-object";
|
||||
import { KubeApi } from "../kube-api";
|
||||
|
||||
export class Role extends KubeObject {
|
||||
static kind = "Role"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/roles"
|
||||
static kind = "Role";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/roles";
|
||||
|
||||
rules: {
|
||||
verbs: string[];
|
||||
apiGroups: string[];
|
||||
resources: string[];
|
||||
resourceNames?: string[];
|
||||
}[]
|
||||
}[];
|
||||
|
||||
getRules() {
|
||||
return this.rules || [];
|
||||
|
@ -21,15 +21,15 @@ export interface ISecretRef {
|
||||
|
||||
@autobind()
|
||||
export class Secret extends KubeObject {
|
||||
static kind = "Secret"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/secrets"
|
||||
static kind = "Secret";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/secrets";
|
||||
|
||||
type: SecretType;
|
||||
data: {
|
||||
[prop: string]: string;
|
||||
token?: string;
|
||||
}
|
||||
};
|
||||
|
||||
constructor(data: KubeJsonApiData) {
|
||||
super(data);
|
||||
|
@ -21,20 +21,20 @@ export interface ISelfSubjectReviewRule {
|
||||
}
|
||||
|
||||
export class SelfSubjectRulesReview extends KubeObject {
|
||||
static kind = "SelfSubjectRulesReview"
|
||||
static namespaced = false
|
||||
static apiBase = "/apis/authorization.k8s.io/v1/selfsubjectrulesreviews"
|
||||
static kind = "SelfSubjectRulesReview";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/authorization.k8s.io/v1/selfsubjectrulesreviews";
|
||||
|
||||
spec: {
|
||||
// todo: add more types from api docs
|
||||
namespace?: string;
|
||||
}
|
||||
};
|
||||
|
||||
status: {
|
||||
resourceRules: ISelfSubjectReviewRule[];
|
||||
nonResourceRules: ISelfSubjectReviewRule[];
|
||||
incomplete: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
getResourceRules() {
|
||||
const rules = this.status && this.status.resourceRules || [];
|
||||
|
@ -6,14 +6,14 @@ import { KubeApi } from "../kube-api";
|
||||
export class ServiceAccount extends KubeObject {
|
||||
static kind = "ServiceAccount";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/serviceaccounts"
|
||||
static apiBase = "/api/v1/serviceaccounts";
|
||||
|
||||
secrets?: {
|
||||
name: string;
|
||||
}[]
|
||||
}[];
|
||||
imagePullSecrets?: {
|
||||
name: string;
|
||||
}[]
|
||||
}[];
|
||||
|
||||
getSecrets() {
|
||||
return this.secrets || [];
|
||||
|
@ -31,9 +31,9 @@ export class ServicePort implements IServicePort {
|
||||
|
||||
@autobind()
|
||||
export class Service extends KubeObject {
|
||||
static kind = "Service"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/services"
|
||||
static kind = "Service";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/services";
|
||||
|
||||
spec: {
|
||||
type: string;
|
||||
@ -44,7 +44,7 @@ export class Service extends KubeObject {
|
||||
selector: { [key: string]: string };
|
||||
ports: ServicePort[];
|
||||
externalIPs?: string[]; // https://kubernetes.io/docs/concepts/services-networking/service/#external-ips
|
||||
}
|
||||
};
|
||||
|
||||
status: {
|
||||
loadBalancer?: {
|
||||
@ -53,7 +53,7 @@ export class Service extends KubeObject {
|
||||
hostname?: string;
|
||||
}[];
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
getClusterIp() {
|
||||
return this.spec.clusterIP;
|
||||
|
@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class StatefulSet extends WorkloadKubeObject {
|
||||
static kind = "StatefulSet"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/apps/v1/statefulsets"
|
||||
static kind = "StatefulSet";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/apps/v1/statefulsets";
|
||||
|
||||
spec: {
|
||||
serviceName: string;
|
||||
@ -62,7 +62,7 @@ export class StatefulSet extends WorkloadKubeObject {
|
||||
};
|
||||
};
|
||||
}[];
|
||||
}
|
||||
};
|
||||
status: {
|
||||
observedGeneration: number;
|
||||
replicas: number;
|
||||
@ -70,7 +70,7 @@ export class StatefulSet extends WorkloadKubeObject {
|
||||
currentRevision: string;
|
||||
updateRevision: string;
|
||||
collisionCount: number;
|
||||
}
|
||||
};
|
||||
|
||||
getImages() {
|
||||
const containers: IPodContainer[] = get(this, "spec.template.spec.containers", []);
|
||||
|
@ -4,9 +4,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class StorageClass extends KubeObject {
|
||||
static kind = "StorageClass"
|
||||
static namespaced = false
|
||||
static apiBase = "/apis/storage.k8s.io/v1/storageclasses"
|
||||
static kind = "StorageClass";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/storage.k8s.io/v1/storageclasses";
|
||||
|
||||
provisioner: string; // e.g. "storage.k8s.io/v1"
|
||||
mountOptions?: string[];
|
||||
@ -14,7 +14,7 @@ export class StorageClass extends KubeObject {
|
||||
reclaimPolicy: string;
|
||||
parameters: {
|
||||
[param: string]: string; // every provisioner has own set of these parameters
|
||||
}
|
||||
};
|
||||
|
||||
isDefault() {
|
||||
const annotations = this.metadata.annotations || {};
|
||||
|
@ -62,14 +62,14 @@ export class KubeApi<T extends KubeObject = any> {
|
||||
return () => disposers.forEach(unwatch => unwatch());
|
||||
}
|
||||
|
||||
readonly kind: string
|
||||
readonly apiBase: string
|
||||
readonly apiPrefix: string
|
||||
readonly apiGroup: string
|
||||
readonly apiVersion: string
|
||||
readonly kind: string;
|
||||
readonly apiBase: string;
|
||||
readonly apiPrefix: string;
|
||||
readonly apiGroup: string;
|
||||
readonly apiVersion: string;
|
||||
readonly apiVersionPreferred?: string;
|
||||
readonly apiResource: string
|
||||
readonly isNamespaced: boolean
|
||||
readonly apiResource: string;
|
||||
readonly isNamespaced: boolean;
|
||||
|
||||
public objectConstructor: IKubeObjectConstructor<T>;
|
||||
protected request: KubeJsonApi;
|
||||
|
@ -72,8 +72,8 @@ export class KubeObject implements ItemObject {
|
||||
Object.assign(this, data);
|
||||
}
|
||||
|
||||
apiVersion: string
|
||||
kind: string
|
||||
apiVersion: string;
|
||||
kind: string;
|
||||
metadata: IKubeObjectMetadata;
|
||||
status?: any; // todo: type-safety support
|
||||
|
||||
|
@ -28,7 +28,7 @@ export type TerminalApiQuery = Record<string, string> & {
|
||||
id: string;
|
||||
node?: string;
|
||||
type?: string | "node";
|
||||
}
|
||||
};
|
||||
|
||||
export class TerminalApi extends WebSocketApi {
|
||||
protected size: { Width: number; Height: number };
|
||||
|
@ -18,7 +18,7 @@ import { extensionLoader } from "../extensions/extension-loader";
|
||||
|
||||
type AppComponent = React.ComponentType & {
|
||||
init?(): Promise<void>;
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
React,
|
||||
|
@ -39,10 +39,10 @@ export class AddCluster extends React.Component {
|
||||
@observable selectedContexts = observable.array<string>();
|
||||
@observable sourceTab = KubeConfigSourceTab.FILE;
|
||||
@observable kubeConfigPath = "";
|
||||
@observable customConfig = ""
|
||||
@observable proxyServer = ""
|
||||
@observable isWaiting = false
|
||||
@observable showSettings = false
|
||||
@observable customConfig = "";
|
||||
@observable proxyServer = "";
|
||||
@observable isWaiting = false;
|
||||
@observable showSettings = false;
|
||||
@observable dropAreaActive = false;
|
||||
|
||||
componentDidMount() {
|
||||
@ -117,7 +117,7 @@ export class AddCluster extends React.Component {
|
||||
if (!canceled && filePaths.length) {
|
||||
this.setKubeConfig(filePaths[0]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@action
|
||||
addClusters = () => {
|
||||
@ -183,7 +183,7 @@ export class AddCluster extends React.Component {
|
||||
} finally {
|
||||
this.isWaiting = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
renderInfo() {
|
||||
return (
|
||||
@ -328,13 +328,13 @@ export class AddCluster extends React.Component {
|
||||
this.setKubeConfig(userStore.kubeConfigPath); // revert to previous valid path
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onKubeConfigTabChange = (tabId: KubeConfigSourceTab) => {
|
||||
this.sourceTab = tabId;
|
||||
this.error = "";
|
||||
this.refreshContexts();
|
||||
}
|
||||
};
|
||||
|
||||
protected formatContextLabel = ({ value: context }: SelectOption<string>) => {
|
||||
const isNew = userStore.newContexts.has(context);
|
||||
|
@ -44,11 +44,11 @@ export class HelmCharts extends Component<Props> {
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
hideDetails = () => {
|
||||
this.showDetails(null);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
@ -94,13 +94,13 @@ export class ReleaseDetails extends Component<Props> {
|
||||
Notifications.error(err);
|
||||
}
|
||||
this.saving = false;
|
||||
}
|
||||
};
|
||||
|
||||
upgradeVersion = () => {
|
||||
const { release, hideDetails } = this.props;
|
||||
createUpgradeChartTab(release);
|
||||
hideDetails();
|
||||
}
|
||||
};
|
||||
|
||||
renderValues() {
|
||||
const { values, saving } = this;
|
||||
|
@ -46,7 +46,7 @@ export class ReleaseRollbackDialog extends React.Component<Props> {
|
||||
this.revisions.replace(releases);
|
||||
this.revision = this.revisions[0];
|
||||
this.isLoading = false;
|
||||
}
|
||||
};
|
||||
|
||||
rollback = async () => {
|
||||
const revisionNumber = this.revision.revision;
|
||||
@ -60,7 +60,7 @@ export class ReleaseRollbackDialog extends React.Component<Props> {
|
||||
|
||||
close = () => {
|
||||
ReleaseRollbackDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
renderContent() {
|
||||
const { revision, revisions } = this;
|
||||
|
@ -58,11 +58,11 @@ export class HelmReleases extends Component<Props> {
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
hideDetails = () => {
|
||||
this.showDetails(null);
|
||||
}
|
||||
};
|
||||
|
||||
renderRemoveDialogMessage(selectedItems: HelmRelease[]) {
|
||||
const releaseNames = selectedItems.map(item => item.getName()).join(", ");
|
||||
|
@ -45,7 +45,7 @@ export class ClusterSettings extends React.Component<Props> {
|
||||
await requestMain(clusterActivateHandler, this.cluster.id);
|
||||
await requestMain(clusterRefreshHandler, this.cluster.id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const cluster = this.cluster;
|
||||
|
@ -27,7 +27,7 @@ export class ClusterHomeDirSetting extends React.Component<Props> {
|
||||
|
||||
onChange = (value: string) => {
|
||||
this.directory = value;
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
@ -28,7 +28,7 @@ export class ClusterNameSetting extends React.Component<Props> {
|
||||
|
||||
onChange = (value: string) => {
|
||||
this.name = value;
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
@ -60,13 +60,13 @@ export class ClusterPrometheusSetting extends React.Component<Props> {
|
||||
port: parseInt(parsed[2]),
|
||||
prefix: apiPrefix
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
onSaveProvider = () => {
|
||||
this.props.cluster.preferences.prometheusProvider = this.provider ?
|
||||
{ type: this.provider } :
|
||||
null;
|
||||
}
|
||||
};
|
||||
|
||||
onSavePath = () => {
|
||||
this.props.cluster.preferences.prometheus = this.parsePrometheusPath();
|
||||
|
@ -28,7 +28,7 @@ export class ClusterProxySetting extends React.Component<Props> {
|
||||
|
||||
onChange = (value: string) => {
|
||||
this.proxy = value;
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
@ -18,7 +18,7 @@ export enum MetricNodeRole {
|
||||
|
||||
@autobind()
|
||||
export class ClusterStore extends KubeObjectStore<Cluster> {
|
||||
api = clusterApi
|
||||
api = clusterApi;
|
||||
|
||||
@observable metrics: Partial<IClusterMetrics> = {};
|
||||
@observable liveMetrics: Partial<IClusterMetrics> = {};
|
||||
|
@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class HPAStore extends KubeObjectStore<HorizontalPodAutoscaler> {
|
||||
api = hpaApi
|
||||
api = hpaApi;
|
||||
}
|
||||
|
||||
export const hpaStore = new HPAStore();
|
||||
|
@ -47,7 +47,7 @@ export class ConfigMapDetails extends React.Component<Props> {
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { object: configMap } = this.props;
|
||||
|
@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class ConfigMapsStore extends KubeObjectStore<ConfigMap> {
|
||||
api = configMapApi
|
||||
api = configMapApi;
|
||||
}
|
||||
|
||||
export const configMapsStore = new ConfigMapsStore();
|
||||
|
@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class PodDisruptionBudgetsStore extends KubeObjectStore<PodDisruptionBudget> {
|
||||
api = pdbApi
|
||||
api = pdbApi;
|
||||
}
|
||||
|
||||
export const podDisruptionBudgetsStore = new PodDisruptionBudgetsStore();
|
||||
|
@ -45,7 +45,7 @@ export class AddQuotaDialog extends React.Component<Props> {
|
||||
"count/deployments.extensions": "",
|
||||
};
|
||||
|
||||
public defaultNamespace = "default"
|
||||
public defaultNamespace = "default";
|
||||
|
||||
@observable quotaName = "";
|
||||
@observable quotaSelectValue = "";
|
||||
@ -83,11 +83,11 @@ export class AddQuotaDialog extends React.Component<Props> {
|
||||
if (!this.quotaSelectValue) return;
|
||||
this.quotas[this.quotaSelectValue] = this.quotaInputValue;
|
||||
this.quotaInputValue = "";
|
||||
}
|
||||
};
|
||||
|
||||
close = () => {
|
||||
AddQuotaDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
reset = () => {
|
||||
this.quotaName = "";
|
||||
@ -95,7 +95,7 @@ export class AddQuotaDialog extends React.Component<Props> {
|
||||
this.quotaInputValue = "";
|
||||
this.namespace = this.defaultNamespace;
|
||||
this.quotas = AddQuotaDialog.defaultQuotas;
|
||||
}
|
||||
};
|
||||
|
||||
addQuota = async () => {
|
||||
try {
|
||||
@ -113,7 +113,7 @@ export class AddQuotaDialog extends React.Component<Props> {
|
||||
} catch (err) {
|
||||
Notifications.error(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onInputQuota = (evt: React.KeyboardEvent) => {
|
||||
switch (evt.key) {
|
||||
@ -122,7 +122,7 @@ export class AddQuotaDialog extends React.Component<Props> {
|
||||
evt.preventDefault(); // don't submit form
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { ...dialogProps } = this.props;
|
||||
|
@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class ResourceQuotasStore extends KubeObjectStore<ResourceQuota> {
|
||||
api = resourceQuotaApi
|
||||
api = resourceQuotaApi;
|
||||
}
|
||||
|
||||
export const resourceQuotaStore = new ResourceQuotasStore();
|
||||
|
@ -58,7 +58,7 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
{ key: "kubernetes.io/service-account.uid", required: true }
|
||||
],
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
get types() {
|
||||
return Object.keys(this.secretTemplate) as SecretType[];
|
||||
@ -72,11 +72,11 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
reset = () => {
|
||||
this.name = "";
|
||||
this.secret = this.secretTemplate;
|
||||
}
|
||||
};
|
||||
|
||||
close = () => {
|
||||
AddSecretDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
private getDataFromFields = (fields: ISecretTemplateField[] = [], processValue?: (val: string) => string) => {
|
||||
return fields.reduce<any>((data, field) => {
|
||||
@ -86,7 +86,7 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
}
|
||||
return data;
|
||||
}, {});
|
||||
}
|
||||
};
|
||||
|
||||
createSecret = async () => {
|
||||
const { name, namespace, type } = this;
|
||||
@ -109,18 +109,18 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
} catch (err) {
|
||||
Notifications.error(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
addField = (field: ISecretField) => {
|
||||
const fields = this.secret[this.type][field] || [];
|
||||
fields.push({ key: "", value: "" });
|
||||
this.secret[this.type][field] = fields;
|
||||
}
|
||||
};
|
||||
|
||||
removeField = (field: ISecretField, index: number) => {
|
||||
const fields = this.secret[this.type][field] || [];
|
||||
fields.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
renderFields(field: ISecretField) {
|
||||
const fields = this.secret[this.type][field] || [];
|
||||
|
@ -49,11 +49,11 @@ export class SecretDetails extends React.Component<Props> {
|
||||
Notifications.error(err);
|
||||
}
|
||||
this.isSaving = false;
|
||||
}
|
||||
};
|
||||
|
||||
editData = (name: string, value: string, encoded: boolean) => {
|
||||
this.data[name] = encoded ? value : base64.encode(value);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { object: secret } = this.props;
|
||||
|
@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class SecretsStore extends KubeObjectStore<Secret> {
|
||||
api = secretsApi
|
||||
api = secretsApi;
|
||||
}
|
||||
|
||||
export const secretsStore = new SecretsStore();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user