add cronjobs and jobs to k8s backend

Signed-off-by: Andrew Tran <atran@brex.com>
This commit is contained in:
Andrew Tran
2021-11-19 11:29:11 -06:00
parent c4328a1274
commit 361aad1a0f
5 changed files with 37 additions and 0 deletions
@@ -16,6 +16,7 @@
import {
AppsV1Api,
BatchV1Api,
AutoscalingV1Api,
CoreV1Api,
KubeConfig,
@@ -74,6 +75,12 @@ export class KubernetesClientProvider {
return kc.makeApiClient(AutoscalingV1Api);
}
getBatchClientByClusterDetails(clusterDetails: ClusterDetails) {
const kc = this.getKubeConfig(clusterDetails);
return kc.makeApiClient(BatchV1Api);
}
getNetworkingBeta1Client(clusterDetails: ClusterDetails) {
const kc = this.getKubeConfig(clusterDetails);
@@ -68,6 +68,18 @@ export const DEFAULT_OBJECTS: ObjectToFetch[] = [
plural: 'horizontalpodautoscalers',
objectType: 'horizontalpodautoscalers',
},
{
group: 'batch',
apiVersion: 'v1',
plural: 'jobs',
objectType: 'jobs',
},
{
group: 'batch',
apiVersion: 'v1',
plural: 'cronjobs',
objectType: 'cronjobs',
},
{
group: 'networking.k8s.io',
apiVersion: 'v1',
@@ -17,6 +17,7 @@
import {
AppsV1Api,
AutoscalingV1Api,
BatchV1Api,
CoreV1Api,
NetworkingV1beta1Api,
} from '@kubernetes/client-node';
@@ -41,6 +42,7 @@ export interface Clients {
core: CoreV1Api;
apps: AppsV1Api;
autoscaling: AutoscalingV1Api;
batch: BatchV1Api;
networkingBeta1: NetworkingV1beta1Api;
}
@@ -67,6 +67,8 @@ export type KubernetesObjectTypes =
| 'deployments'
| 'replicasets'
| 'horizontalpodautoscalers'
| 'jobs'
| 'cronjobs'
| 'ingresses'
| 'customresources';
+14
View File
@@ -17,8 +17,10 @@
import {
ExtensionsV1beta1Ingress,
V1ConfigMap,
V1CronJob,
V1Deployment,
V1HorizontalPodAutoscaler,
V1Job,
V1Pod,
V1ReplicaSet,
V1Service,
@@ -83,6 +85,8 @@ export type FetchResponse =
| DeploymentFetchResponse
| ReplicaSetsFetchResponse
| HorizontalPodAutoscalersFetchResponse
| JobsFetchResponse
| CronJobsFetchResponse
| IngressesFetchResponse
| CustomResourceFetchResponse;
@@ -116,6 +120,16 @@ export interface HorizontalPodAutoscalersFetchResponse {
resources: Array<V1HorizontalPodAutoscaler>;
}
export interface JobsFetchResponse {
type: 'jobs';
resources: Array<V1Job>;
}
export interface CronJobsFetchResponse {
type: 'cronjobs';
resources: Array<V1CronJob>;
}
export interface IngressesFetchResponse {
type: 'ingresses';
resources: Array<ExtensionsV1beta1Ingress>;