1- import { IncomingMessage } from 'http' ;
2- import { AppsV1Api , BatchV1Api , BatchV1beta1Api , CoreV1Api , KubeConfig ,
3- V1ObjectMeta , V1OwnerReference , V1PodSpec } from '@kubernetes/client-node' ;
1+ import { IncomingMessage } from 'http' ;
2+ import {
3+ AppsV1Api ,
4+ BatchV1Api ,
5+ BatchV1beta1Api ,
6+ CoreV1Api ,
7+ CustomObjectsApi ,
8+ KubeConfig ,
9+ V1ObjectMeta ,
10+ V1OwnerReference ,
11+ V1PodSpec ,
12+ } from '@kubernetes/client-node' ;
413
514export enum WorkloadKind {
615 Deployment = 'Deployment' ,
@@ -11,6 +20,7 @@ export enum WorkloadKind {
1120 CronJob = 'CronJob' ,
1221 ReplicationController = 'ReplicationController' ,
1322 Pod = 'Pod' ,
23+ DeploymentConfig = 'DeploymentConfig' ,
1424}
1525
1626export interface IRequestError {
@@ -32,6 +42,7 @@ export interface IK8sClients {
3242 readonly coreClient : CoreV1Api ;
3343 readonly batchClient : BatchV1Api ;
3444 readonly batchUnstableClient : BatchV1beta1Api ;
45+ readonly customObjectsClient : CustomObjectsApi ;
3546}
3647
3748export class K8sClients implements IK8sClients {
@@ -41,12 +52,17 @@ export class K8sClients implements IK8sClients {
4152 // TODO: Keep an eye on this! We need v1beta1 API for CronJobs.
4253 // https://kubernetes.io/docs/concepts/overview/kubernetes-api/#api-versioning
4354 // CronJobs will appear in v2 API, but for now there' only v2alpha1, so it's a bad idea to use it.
55+ // TODO: https://kubernetes.io/blog/2021/04/09/kubernetes-release-1.21-cronjob-ga/
56+ // CronJobs are now GA in Kubernetes 1.21 in the batch/v1 API, we should add support for it!
4457 public readonly batchUnstableClient : BatchV1beta1Api ;
58+ /** This client is used to access Custom Resources in the cluster, e.g. DeploymentConfig on OpenShift. */
59+ public readonly customObjectsClient : CustomObjectsApi ;
4560
4661 constructor ( config : KubeConfig ) {
4762 this . appsClient = config . makeApiClient ( AppsV1Api ) ;
4863 this . coreClient = config . makeApiClient ( CoreV1Api ) ;
4964 this . batchClient = config . makeApiClient ( BatchV1Api ) ;
5065 this . batchUnstableClient = config . makeApiClient ( BatchV1beta1Api ) ;
66+ this . customObjectsClient = config . makeApiClient ( CustomObjectsApi ) ;
5167 }
5268}
0 commit comments