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