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:
1 parent
0b182ccf6f
commit
460dfe4d2b
179 files changed
+556
-554
No files matched your search
@@ -2,9 +2,9 @@ import { RoleBinding } from "./role-binding.api";
|
||||
import { KubeApi } from "../kube-api";
|
||||
|
||||
export class ClusterRoleBinding extends RoleBinding {
|
||||
static kind = "ClusterRoleBinding"
|
||||
static namespaced = false
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings"
|
||||
static kind = "ClusterRoleBinding";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings";
|
||||
}
|
||||
|
||||
export const clusterRoleBindingApi = new KubeApi({
|
||||
|
||||
@@ -4,9 +4,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class ClusterRole extends Role {
|
||||
static kind = "ClusterRole"
|
||||
static namespaced = false
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterroles"
|
||||
static kind = "ClusterRole";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterroles";
|
||||
}
|
||||
|
||||
export const clusterRoleApi = new KubeApi({
|
||||
|
||||
@@ -3,8 +3,8 @@ import { KubeObject } from "../kube-object";
|
||||
import { KubeApi } from "../kube-api";
|
||||
|
||||
export class ClusterApi extends KubeApi<Cluster> {
|
||||
static kind = "Cluster"
|
||||
static namespaced = true
|
||||
static kind = "Cluster";
|
||||
static namespaced = true;
|
||||
|
||||
async getMetrics(nodeNames: string[], params?: IMetricsReqParams): Promise<IClusterMetrics> {
|
||||
const nodes = nodeNames.join("|");
|
||||
@@ -52,7 +52,7 @@ export interface IClusterMetrics<T = IMetrics> {
|
||||
|
||||
export class Cluster extends KubeObject {
|
||||
static kind = "Cluster";
|
||||
static apiBase = "/apis/cluster.k8s.io/v1alpha1/clusters"
|
||||
static apiBase = "/apis/cluster.k8s.io/v1alpha1/clusters";
|
||||
|
||||
spec: {
|
||||
clusterNetwork?: {
|
||||
@@ -69,7 +69,7 @@ export class Cluster extends KubeObject {
|
||||
profile: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
status?: {
|
||||
apiEndpoints: {
|
||||
host: string;
|
||||
@@ -84,7 +84,7 @@ export class Cluster extends KubeObject {
|
||||
};
|
||||
errorMessage?: string;
|
||||
errorReason?: string;
|
||||
}
|
||||
};
|
||||
|
||||
getStatus() {
|
||||
if (this.metadata.deletionTimestamp) return ClusterStatus.REMOVING;
|
||||
|
||||
@@ -8,11 +8,11 @@ export interface IComponentStatusCondition {
|
||||
}
|
||||
|
||||
export class ComponentStatus extends KubeObject {
|
||||
static kind = "ComponentStatus"
|
||||
static namespaced = false
|
||||
static apiBase = "/api/v1/componentstatuses"
|
||||
static kind = "ComponentStatus";
|
||||
static namespaced = false;
|
||||
static apiBase = "/api/v1/componentstatuses";
|
||||
|
||||
conditions: IComponentStatusCondition[]
|
||||
conditions: IComponentStatusCondition[];
|
||||
|
||||
getTruthyConditions() {
|
||||
return this.conditions.filter(c => c.status === "True");
|
||||
|
||||
@@ -7,7 +7,7 @@ import { KubeApi } from "../kube-api";
|
||||
export class ConfigMap extends KubeObject {
|
||||
static kind = "ConfigMap";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/configmaps"
|
||||
static apiBase = "/api/v1/configmaps";
|
||||
|
||||
constructor(data: KubeJsonApiData) {
|
||||
super(data);
|
||||
@@ -16,7 +16,7 @@ export class ConfigMap extends KubeObject {
|
||||
|
||||
data: {
|
||||
[param: string]: string;
|
||||
}
|
||||
};
|
||||
|
||||
getKeys(): string[] {
|
||||
return Object.keys(this.data);
|
||||
|
||||
@@ -7,20 +7,20 @@ type AdditionalPrinterColumnsCommon = {
|
||||
type: "integer" | "number" | "string" | "boolean" | "date";
|
||||
priority: number;
|
||||
description: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type AdditionalPrinterColumnsV1 = AdditionalPrinterColumnsCommon & {
|
||||
jsonPath: string;
|
||||
}
|
||||
};
|
||||
|
||||
type AdditionalPrinterColumnsV1Beta = AdditionalPrinterColumnsCommon & {
|
||||
JSONPath: string;
|
||||
}
|
||||
};
|
||||
|
||||
export class CustomResourceDefinition extends KubeObject {
|
||||
static kind = "CustomResourceDefinition";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions"
|
||||
static apiBase = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions";
|
||||
|
||||
spec: {
|
||||
group: string;
|
||||
@@ -45,7 +45,7 @@ export class CustomResourceDefinition extends KubeObject {
|
||||
webhook?: any;
|
||||
};
|
||||
additionalPrinterColumns?: AdditionalPrinterColumnsV1Beta[]; // removed in v1
|
||||
}
|
||||
};
|
||||
status: {
|
||||
conditions: {
|
||||
lastTransitionTime: string;
|
||||
@@ -62,7 +62,7 @@ export class CustomResourceDefinition extends KubeObject {
|
||||
listKind: string;
|
||||
};
|
||||
storedVersions: string[];
|
||||
}
|
||||
};
|
||||
|
||||
getResourceUrl() {
|
||||
return crdResourcesURL({
|
||||
|
||||
@@ -7,12 +7,12 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class CronJob extends KubeObject {
|
||||
static kind = "CronJob"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/batch/v1beta1/cronjobs"
|
||||
static kind = "CronJob";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/batch/v1beta1/cronjobs";
|
||||
|
||||
kind: string
|
||||
apiVersion: string
|
||||
kind: string;
|
||||
apiVersion: string;
|
||||
metadata: {
|
||||
name: string;
|
||||
namespace: string;
|
||||
@@ -26,7 +26,7 @@ export class CronJob extends KubeObject {
|
||||
annotations: {
|
||||
[key: string]: string;
|
||||
};
|
||||
}
|
||||
};
|
||||
spec: {
|
||||
schedule: string;
|
||||
concurrencyPolicy: string;
|
||||
@@ -59,10 +59,10 @@ export class CronJob extends KubeObject {
|
||||
};
|
||||
successfulJobsHistoryLimit: number;
|
||||
failedJobsHistoryLimit: number;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
lastScheduleTime?: string;
|
||||
}
|
||||
};
|
||||
|
||||
getSuspendFlag() {
|
||||
return this.spec.suspend.toString();
|
||||
|
||||
@@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class DaemonSet extends WorkloadKubeObject {
|
||||
static kind = "DaemonSet"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/apps/v1/daemonsets"
|
||||
static kind = "DaemonSet";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/apps/v1/daemonsets";
|
||||
|
||||
spec: {
|
||||
selector: {
|
||||
@@ -51,7 +51,7 @@ export class DaemonSet extends WorkloadKubeObject {
|
||||
};
|
||||
};
|
||||
revisionHistoryLimit: number;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
currentNumberScheduled: number;
|
||||
numberMisscheduled: number;
|
||||
@@ -61,7 +61,7 @@ export class DaemonSet extends WorkloadKubeObject {
|
||||
updatedNumberScheduled: number;
|
||||
numberAvailable: number;
|
||||
numberUnavailable: number;
|
||||
}
|
||||
};
|
||||
|
||||
getImages() {
|
||||
const containers: IPodContainer[] = get(this, "spec.template.spec.containers", []);
|
||||
|
||||
@@ -48,9 +48,9 @@ export class DeploymentApi extends KubeApi<Deployment> {
|
||||
|
||||
@autobind()
|
||||
export class Deployment extends WorkloadKubeObject {
|
||||
static kind = "Deployment"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/apps/v1/deployments"
|
||||
static kind = "Deployment";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/apps/v1/deployments";
|
||||
|
||||
spec: {
|
||||
replicas: number;
|
||||
@@ -151,7 +151,7 @@ export class Deployment extends WorkloadKubeObject {
|
||||
maxSurge: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
status: {
|
||||
observedGeneration: number;
|
||||
replicas: number;
|
||||
@@ -167,7 +167,7 @@ export class Deployment extends WorkloadKubeObject {
|
||||
reason: string;
|
||||
message: string;
|
||||
}[];
|
||||
}
|
||||
};
|
||||
|
||||
getConditions(activeOnly = false) {
|
||||
const { conditions } = this.status;
|
||||
|
||||
@@ -98,11 +98,11 @@ export class EndpointSubset implements IEndpointSubset {
|
||||
|
||||
@autobind()
|
||||
export class Endpoint extends KubeObject {
|
||||
static kind = "Endpoints"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/endpoints"
|
||||
static kind = "Endpoints";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/endpoints";
|
||||
|
||||
subsets: IEndpointSubset[]
|
||||
subsets: IEndpointSubset[];
|
||||
|
||||
getEndpointSubsets(): EndpointSubset[] {
|
||||
const subsets = this.subsets || [];
|
||||
|
||||
@@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class KubeEvent extends KubeObject {
|
||||
static kind = "Event"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/events"
|
||||
static kind = "Event";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/events";
|
||||
|
||||
involvedObject: {
|
||||
kind: string;
|
||||
@@ -18,20 +18,20 @@ export class KubeEvent extends KubeObject {
|
||||
apiVersion: string;
|
||||
resourceVersion: string;
|
||||
fieldPath: string;
|
||||
}
|
||||
reason: string
|
||||
message: string
|
||||
};
|
||||
reason: string;
|
||||
message: string;
|
||||
source: {
|
||||
component: string;
|
||||
host: string;
|
||||
}
|
||||
firstTimestamp: string
|
||||
lastTimestamp: string
|
||||
count: number
|
||||
type: string
|
||||
eventTime: null
|
||||
reportingComponent: string
|
||||
reportingInstance: string
|
||||
};
|
||||
firstTimestamp: string;
|
||||
lastTimestamp: string;
|
||||
count: number;
|
||||
type: string;
|
||||
eventTime: null;
|
||||
reportingComponent: string;
|
||||
reportingInstance: string;
|
||||
|
||||
isWarning() {
|
||||
return this.type === "Warning";
|
||||
|
||||
@@ -61,27 +61,27 @@ export class HelmChart {
|
||||
return new HelmChart(data);
|
||||
}
|
||||
|
||||
apiVersion: string
|
||||
name: string
|
||||
version: string
|
||||
repo: string
|
||||
kubeVersion?: string
|
||||
created: string
|
||||
description?: string
|
||||
digest: string
|
||||
keywords?: string[]
|
||||
home?: string
|
||||
sources?: string[]
|
||||
apiVersion: string;
|
||||
name: string;
|
||||
version: string;
|
||||
repo: string;
|
||||
kubeVersion?: string;
|
||||
created: string;
|
||||
description?: string;
|
||||
digest: string;
|
||||
keywords?: string[];
|
||||
home?: string;
|
||||
sources?: string[];
|
||||
maintainers?: {
|
||||
name: string;
|
||||
email: string;
|
||||
url: string;
|
||||
}[]
|
||||
engine?: string
|
||||
icon?: string
|
||||
appVersion?: string
|
||||
deprecated?: boolean
|
||||
tillerVersion?: string
|
||||
}[];
|
||||
engine?: string;
|
||||
icon?: string;
|
||||
appVersion?: string;
|
||||
deprecated?: boolean;
|
||||
tillerVersion?: string;
|
||||
|
||||
getId() {
|
||||
return this.digest;
|
||||
|
||||
@@ -135,13 +135,13 @@ export class HelmRelease implements ItemObject {
|
||||
return new HelmRelease(data);
|
||||
}
|
||||
|
||||
appVersion: string
|
||||
name: string
|
||||
namespace: string
|
||||
chart: string
|
||||
status: string
|
||||
updated: string
|
||||
revision: string
|
||||
appVersion: string;
|
||||
name: string;
|
||||
namespace: string;
|
||||
chart: string;
|
||||
status: string;
|
||||
updated: string;
|
||||
revision: string;
|
||||
|
||||
getId() {
|
||||
return this.namespace + this.name;
|
||||
|
||||
@@ -20,7 +20,7 @@ export type IHpaMetricData<T = any> = T & {
|
||||
currentAverageValue?: string;
|
||||
targetAverageUtilization?: number;
|
||||
targetAverageValue?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export interface IHpaMetric {
|
||||
[kind: string]: IHpaMetricData;
|
||||
@@ -41,7 +41,7 @@ export interface IHpaMetric {
|
||||
export class HorizontalPodAutoscaler extends KubeObject {
|
||||
static kind = "HorizontalPodAutoscaler";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/autoscaling/v2beta1/horizontalpodautoscalers"
|
||||
static apiBase = "/apis/autoscaling/v2beta1/horizontalpodautoscalers";
|
||||
|
||||
spec: {
|
||||
scaleTargetRef: {
|
||||
@@ -52,7 +52,7 @@ export class HorizontalPodAutoscaler extends KubeObject {
|
||||
minReplicas: number;
|
||||
maxReplicas: number;
|
||||
metrics: IHpaMetric[];
|
||||
}
|
||||
};
|
||||
status: {
|
||||
currentReplicas: number;
|
||||
desiredReplicas: number;
|
||||
@@ -64,7 +64,7 @@ export class HorizontalPodAutoscaler extends KubeObject {
|
||||
status: string;
|
||||
type: string;
|
||||
}[];
|
||||
}
|
||||
};
|
||||
|
||||
getMaxPods() {
|
||||
return this.spec.maxReplicas || 0;
|
||||
|
||||
@@ -31,9 +31,9 @@ export interface ILoadBalancerIngress {
|
||||
}
|
||||
@autobind()
|
||||
export class Ingress extends KubeObject {
|
||||
static kind = "Ingress"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/extensions/v1beta1/ingresses"
|
||||
static kind = "Ingress";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/extensions/v1beta1/ingresses";
|
||||
|
||||
spec: {
|
||||
tls: {
|
||||
@@ -55,12 +55,12 @@ export class Ingress extends KubeObject {
|
||||
serviceName: string;
|
||||
servicePort: number;
|
||||
};
|
||||
}
|
||||
};
|
||||
status: {
|
||||
loadBalancer: {
|
||||
ingress: ILoadBalancerIngress[];
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
getRoutes() {
|
||||
const { spec: { tls, rules } } = this;
|
||||
|
||||
@@ -7,9 +7,9 @@ import { JsonApiParams } from "../json-api";
|
||||
|
||||
@autobind()
|
||||
export class Job extends WorkloadKubeObject {
|
||||
static kind = "Job"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/batch/v1/jobs"
|
||||
static kind = "Job";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/batch/v1/jobs";
|
||||
|
||||
spec: {
|
||||
parallelism?: number;
|
||||
@@ -56,7 +56,7 @@ export class Job extends WorkloadKubeObject {
|
||||
serviceAccountName?: string;
|
||||
serviceAccount?: string;
|
||||
schedulerName?: string;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
conditions: {
|
||||
type: string;
|
||||
@@ -68,7 +68,7 @@ export class Job extends WorkloadKubeObject {
|
||||
startTime: string;
|
||||
completionTime: string;
|
||||
succeeded: number;
|
||||
}
|
||||
};
|
||||
|
||||
getDesiredCompletions() {
|
||||
return this.spec.completions || 0;
|
||||
|
||||
@@ -15,7 +15,7 @@ export class Namespace extends KubeObject {
|
||||
|
||||
status?: {
|
||||
phase: string;
|
||||
}
|
||||
};
|
||||
|
||||
getStatus() {
|
||||
return this.status ? this.status.phase : "-";
|
||||
|
||||
@@ -37,9 +37,9 @@ export interface IPolicyEgress {
|
||||
|
||||
@autobind()
|
||||
export class NetworkPolicy extends KubeObject {
|
||||
static kind = "NetworkPolicy"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/networking.k8s.io/v1/networkpolicies"
|
||||
static kind = "NetworkPolicy";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/networking.k8s.io/v1/networkpolicies";
|
||||
|
||||
spec: {
|
||||
podSelector: {
|
||||
@@ -51,7 +51,7 @@ export class NetworkPolicy extends KubeObject {
|
||||
policyTypes: string[];
|
||||
ingress: IPolicyIngress[];
|
||||
egress: IPolicyEgress[];
|
||||
}
|
||||
};
|
||||
|
||||
getMatchLabels(): string[] {
|
||||
if (!this.spec.podSelector || !this.spec.podSelector.matchLabels) return [];
|
||||
|
||||
@@ -30,9 +30,9 @@ export interface INodeMetrics<T = IMetrics> {
|
||||
|
||||
@autobind()
|
||||
export class Node extends KubeObject {
|
||||
static kind = "Node"
|
||||
static namespaced = false
|
||||
static apiBase = "/api/v1/nodes"
|
||||
static kind = "Node";
|
||||
static namespaced = false;
|
||||
static apiBase = "/api/v1/nodes";
|
||||
|
||||
spec: {
|
||||
podCIDR: string;
|
||||
@@ -43,7 +43,7 @@ export class Node extends KubeObject {
|
||||
effect: string;
|
||||
}[];
|
||||
unschedulable?: boolean;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
capacity: {
|
||||
cpu: string;
|
||||
@@ -83,7 +83,7 @@ export class Node extends KubeObject {
|
||||
names: string[];
|
||||
sizeBytes: number;
|
||||
}[];
|
||||
}
|
||||
};
|
||||
|
||||
getNodeConditionText() {
|
||||
const { conditions } = this.status;
|
||||
|
||||
@@ -23,9 +23,9 @@ export interface IPvcMetrics<T = IMetrics> {
|
||||
|
||||
@autobind()
|
||||
export class PersistentVolumeClaim extends KubeObject {
|
||||
static kind = "PersistentVolumeClaim"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/persistentvolumeclaims"
|
||||
static kind = "PersistentVolumeClaim";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/persistentvolumeclaims";
|
||||
|
||||
spec: {
|
||||
accessModes: string[];
|
||||
@@ -45,10 +45,10 @@ export class PersistentVolumeClaim extends KubeObject {
|
||||
storage: string; // 8Gi
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
status: {
|
||||
phase: string; // Pending
|
||||
}
|
||||
};
|
||||
|
||||
getPods(allPods: Pod[]): Pod[] {
|
||||
const pods = allPods.filter(pod => pod.getNs() === this.getNs());
|
||||
|
||||
@@ -5,9 +5,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class PersistentVolume extends KubeObject {
|
||||
static kind = "PersistentVolume"
|
||||
static namespaced = false
|
||||
static apiBase = "/api/v1/persistentvolumes"
|
||||
static kind = "PersistentVolume";
|
||||
static namespaced = false;
|
||||
static apiBase = "/api/v1/persistentvolumes";
|
||||
|
||||
spec: {
|
||||
capacity: {
|
||||
@@ -38,12 +38,12 @@ export class PersistentVolume extends KubeObject {
|
||||
path: string;
|
||||
server: string;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
status: {
|
||||
phase: string;
|
||||
reason?: string;
|
||||
}
|
||||
};
|
||||
|
||||
getCapacity(inBytes = false) {
|
||||
const capacity = this.spec.capacity;
|
||||
|
||||
@@ -2,19 +2,19 @@ import { KubeObject } from "../kube-object";
|
||||
import { KubeApi } from "../kube-api";
|
||||
|
||||
export class PodMetrics extends KubeObject {
|
||||
static kind = "Pod"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/metrics.k8s.io/v1beta1/pods"
|
||||
static kind = "Pod";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/metrics.k8s.io/v1beta1/pods";
|
||||
|
||||
timestamp: string
|
||||
window: string
|
||||
timestamp: string;
|
||||
window: string;
|
||||
containers: {
|
||||
name: string;
|
||||
usage: {
|
||||
cpu: string;
|
||||
memory: string;
|
||||
};
|
||||
}[]
|
||||
}[];
|
||||
}
|
||||
|
||||
export const podMetricsApi = new KubeApi({
|
||||
|
||||
@@ -12,13 +12,13 @@ export class PodDisruptionBudget extends KubeObject {
|
||||
minAvailable: string;
|
||||
maxUnavailable: string;
|
||||
selector: { matchLabels: { [app: string]: string } };
|
||||
}
|
||||
};
|
||||
status: {
|
||||
currentHealthy: number
|
||||
desiredHealthy: number
|
||||
disruptionsAllowed: number
|
||||
expectedPods: number
|
||||
}
|
||||
};
|
||||
|
||||
getSelectors() {
|
||||
const selector = this.spec.selector;
|
||||
|
||||
@@ -171,9 +171,9 @@ export interface IPodContainerStatus {
|
||||
|
||||
@autobind()
|
||||
export class Pod extends WorkloadKubeObject {
|
||||
static kind = "Pod"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/pods"
|
||||
static kind = "Pod";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/pods";
|
||||
|
||||
spec: {
|
||||
volumes?: {
|
||||
@@ -215,7 +215,7 @@ export class Pod extends WorkloadKubeObject {
|
||||
tolerationSeconds: number;
|
||||
}[];
|
||||
affinity: IAffinity;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
phase: string;
|
||||
conditions: {
|
||||
@@ -231,7 +231,7 @@ export class Pod extends WorkloadKubeObject {
|
||||
containerStatuses?: IPodContainerStatus[];
|
||||
qosClass: string;
|
||||
reason?: string;
|
||||
}
|
||||
};
|
||||
|
||||
getInitContainers() {
|
||||
return this.spec.initContainers || [];
|
||||
|
||||
@@ -4,9 +4,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class PodSecurityPolicy extends KubeObject {
|
||||
static kind = "PodSecurityPolicy"
|
||||
static namespaced = false
|
||||
static apiBase = "/apis/policy/v1beta1/podsecuritypolicies"
|
||||
static kind = "PodSecurityPolicy";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/policy/v1beta1/podsecuritypolicies";
|
||||
|
||||
spec: {
|
||||
allowPrivilegeEscalation?: boolean;
|
||||
@@ -66,7 +66,7 @@ export class PodSecurityPolicy extends KubeObject {
|
||||
ranges: { max: number; min: number }[];
|
||||
};
|
||||
volumes?: string[];
|
||||
}
|
||||
};
|
||||
|
||||
isPrivileged() {
|
||||
return !!this.spec.privileged;
|
||||
|
||||
@@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class ReplicaSet extends WorkloadKubeObject {
|
||||
static kind = "ReplicaSet"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/apps/v1/replicasets"
|
||||
static kind = "ReplicaSet";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/apps/v1/replicasets";
|
||||
|
||||
spec: {
|
||||
replicas?: number;
|
||||
@@ -37,14 +37,14 @@ export class ReplicaSet extends WorkloadKubeObject {
|
||||
terminationGracePeriodSeconds?: number;
|
||||
dnsPolicy?: string;
|
||||
schedulerName?: string;
|
||||
}
|
||||
};
|
||||
status: {
|
||||
replicas: number;
|
||||
fullyLabeledReplicas: number;
|
||||
readyReplicas: number;
|
||||
availableReplicas: number;
|
||||
observedGeneration: number;
|
||||
}
|
||||
};
|
||||
|
||||
getImages() {
|
||||
const containers: IPodContainer[] = get(this, "spec.template.spec.containers", []);
|
||||
|
||||
@@ -31,9 +31,9 @@ export interface IResourceQuotaValues {
|
||||
}
|
||||
|
||||
export class ResourceQuota extends KubeObject {
|
||||
static kind = "ResourceQuota"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/resourcequotas"
|
||||
static kind = "ResourceQuota";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/resourcequotas";
|
||||
|
||||
constructor(data: KubeJsonApiData) {
|
||||
super(data);
|
||||
@@ -49,12 +49,12 @@ export class ResourceQuota extends KubeObject {
|
||||
values: string[];
|
||||
}[];
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
status: {
|
||||
hard: IResourceQuotaValues;
|
||||
used: IResourceQuotaValues;
|
||||
}
|
||||
};
|
||||
|
||||
getScopeSelector() {
|
||||
const { matchExpressions = [] } = this.spec.scopeSelector || {};
|
||||
|
||||
@@ -11,16 +11,16 @@ export interface IRoleBindingSubject {
|
||||
|
||||
@autobind()
|
||||
export class RoleBinding extends KubeObject {
|
||||
static kind = "RoleBinding"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/rolebindings"
|
||||
static kind = "RoleBinding";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/rolebindings";
|
||||
|
||||
subjects?: IRoleBindingSubject[]
|
||||
subjects?: IRoleBindingSubject[];
|
||||
roleRef: {
|
||||
kind: string;
|
||||
name: string;
|
||||
apiGroup?: string;
|
||||
}
|
||||
};
|
||||
|
||||
getSubjects() {
|
||||
return this.subjects || [];
|
||||
|
||||
@@ -2,16 +2,16 @@ import { KubeObject } from "../kube-object";
|
||||
import { KubeApi } from "../kube-api";
|
||||
|
||||
export class Role extends KubeObject {
|
||||
static kind = "Role"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/roles"
|
||||
static kind = "Role";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/rbac.authorization.k8s.io/v1/roles";
|
||||
|
||||
rules: {
|
||||
verbs: string[];
|
||||
apiGroups: string[];
|
||||
resources: string[];
|
||||
resourceNames?: string[];
|
||||
}[]
|
||||
}[];
|
||||
|
||||
getRules() {
|
||||
return this.rules || [];
|
||||
|
||||
@@ -21,15 +21,15 @@ export interface ISecretRef {
|
||||
|
||||
@autobind()
|
||||
export class Secret extends KubeObject {
|
||||
static kind = "Secret"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/secrets"
|
||||
static kind = "Secret";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/secrets";
|
||||
|
||||
type: SecretType;
|
||||
data: {
|
||||
[prop: string]: string;
|
||||
token?: string;
|
||||
}
|
||||
};
|
||||
|
||||
constructor(data: KubeJsonApiData) {
|
||||
super(data);
|
||||
|
||||
@@ -21,20 +21,20 @@ export interface ISelfSubjectReviewRule {
|
||||
}
|
||||
|
||||
export class SelfSubjectRulesReview extends KubeObject {
|
||||
static kind = "SelfSubjectRulesReview"
|
||||
static namespaced = false
|
||||
static apiBase = "/apis/authorization.k8s.io/v1/selfsubjectrulesreviews"
|
||||
static kind = "SelfSubjectRulesReview";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/authorization.k8s.io/v1/selfsubjectrulesreviews";
|
||||
|
||||
spec: {
|
||||
// todo: add more types from api docs
|
||||
namespace?: string;
|
||||
}
|
||||
};
|
||||
|
||||
status: {
|
||||
resourceRules: ISelfSubjectReviewRule[];
|
||||
nonResourceRules: ISelfSubjectReviewRule[];
|
||||
incomplete: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
getResourceRules() {
|
||||
const rules = this.status && this.status.resourceRules || [];
|
||||
|
||||
@@ -6,14 +6,14 @@ import { KubeApi } from "../kube-api";
|
||||
export class ServiceAccount extends KubeObject {
|
||||
static kind = "ServiceAccount";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/serviceaccounts"
|
||||
static apiBase = "/api/v1/serviceaccounts";
|
||||
|
||||
secrets?: {
|
||||
name: string;
|
||||
}[]
|
||||
}[];
|
||||
imagePullSecrets?: {
|
||||
name: string;
|
||||
}[]
|
||||
}[];
|
||||
|
||||
getSecrets() {
|
||||
return this.secrets || [];
|
||||
|
||||
@@ -31,9 +31,9 @@ export class ServicePort implements IServicePort {
|
||||
|
||||
@autobind()
|
||||
export class Service extends KubeObject {
|
||||
static kind = "Service"
|
||||
static namespaced = true
|
||||
static apiBase = "/api/v1/services"
|
||||
static kind = "Service";
|
||||
static namespaced = true;
|
||||
static apiBase = "/api/v1/services";
|
||||
|
||||
spec: {
|
||||
type: string;
|
||||
@@ -44,7 +44,7 @@ export class Service extends KubeObject {
|
||||
selector: { [key: string]: string };
|
||||
ports: ServicePort[];
|
||||
externalIPs?: string[]; // https://kubernetes.io/docs/concepts/services-networking/service/#external-ips
|
||||
}
|
||||
};
|
||||
|
||||
status: {
|
||||
loadBalancer?: {
|
||||
@@ -53,7 +53,7 @@ export class Service extends KubeObject {
|
||||
hostname?: string;
|
||||
}[];
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
getClusterIp() {
|
||||
return this.spec.clusterIP;
|
||||
|
||||
@@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class StatefulSet extends WorkloadKubeObject {
|
||||
static kind = "StatefulSet"
|
||||
static namespaced = true
|
||||
static apiBase = "/apis/apps/v1/statefulsets"
|
||||
static kind = "StatefulSet";
|
||||
static namespaced = true;
|
||||
static apiBase = "/apis/apps/v1/statefulsets";
|
||||
|
||||
spec: {
|
||||
serviceName: string;
|
||||
@@ -62,7 +62,7 @@ export class StatefulSet extends WorkloadKubeObject {
|
||||
};
|
||||
};
|
||||
}[];
|
||||
}
|
||||
};
|
||||
status: {
|
||||
observedGeneration: number;
|
||||
replicas: number;
|
||||
@@ -70,7 +70,7 @@ export class StatefulSet extends WorkloadKubeObject {
|
||||
currentRevision: string;
|
||||
updateRevision: string;
|
||||
collisionCount: number;
|
||||
}
|
||||
};
|
||||
|
||||
getImages() {
|
||||
const containers: IPodContainer[] = get(this, "spec.template.spec.containers", []);
|
||||
|
||||
@@ -4,9 +4,9 @@ import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class StorageClass extends KubeObject {
|
||||
static kind = "StorageClass"
|
||||
static namespaced = false
|
||||
static apiBase = "/apis/storage.k8s.io/v1/storageclasses"
|
||||
static kind = "StorageClass";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/storage.k8s.io/v1/storageclasses";
|
||||
|
||||
provisioner: string; // e.g. "storage.k8s.io/v1"
|
||||
mountOptions?: string[];
|
||||
@@ -14,7 +14,7 @@ export class StorageClass extends KubeObject {
|
||||
reclaimPolicy: string;
|
||||
parameters: {
|
||||
[param: string]: string; // every provisioner has own set of these parameters
|
||||
}
|
||||
};
|
||||
|
||||
isDefault() {
|
||||
const annotations = this.metadata.annotations || {};
|
||||
|
||||
@@ -62,14 +62,14 @@ export class KubeApi<T extends KubeObject = any> {
|
||||
return () => disposers.forEach(unwatch => unwatch());
|
||||
}
|
||||
|
||||
readonly kind: string
|
||||
readonly apiBase: string
|
||||
readonly apiPrefix: string
|
||||
readonly apiGroup: string
|
||||
readonly apiVersion: string
|
||||
readonly kind: string;
|
||||
readonly apiBase: string;
|
||||
readonly apiPrefix: string;
|
||||
readonly apiGroup: string;
|
||||
readonly apiVersion: string;
|
||||
readonly apiVersionPreferred?: string;
|
||||
readonly apiResource: string
|
||||
readonly isNamespaced: boolean
|
||||
readonly apiResource: string;
|
||||
readonly isNamespaced: boolean;
|
||||
|
||||
public objectConstructor: IKubeObjectConstructor<T>;
|
||||
protected request: KubeJsonApi;
|
||||
|
||||
@@ -72,8 +72,8 @@ export class KubeObject implements ItemObject {
|
||||
Object.assign(this, data);
|
||||
}
|
||||
|
||||
apiVersion: string
|
||||
kind: string
|
||||
apiVersion: string;
|
||||
kind: string;
|
||||
metadata: IKubeObjectMetadata;
|
||||
status?: any; // todo: type-safety support
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export type TerminalApiQuery = Record<string, string> & {
|
||||
id: string;
|
||||
node?: string;
|
||||
type?: string | "node";
|
||||
}
|
||||
};
|
||||
|
||||
export class TerminalApi extends WebSocketApi {
|
||||
protected size: { Width: number; Height: number };
|
||||
|
||||
Reference in new issue
Block a user