Skip to content

Commit

Permalink
export KubernetesPatch
Browse files Browse the repository at this point in the history
  • Loading branch information
mattchrist committed Mar 19, 2020
1 parent 4be1883 commit ed88be9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-eks/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export * from './cluster';
export * from './eks.generated';
export * from './fargate-profile';
export * from './helm-chart';
export * from './k8s-patch';
export * from './k8s-resource';
export * from './fargate-cluster';
22 changes: 19 additions & 3 deletions packages/@aws-cdk/aws-eks/lib/k8s-patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ import { Construct, Stack } from "@aws-cdk/core";
import { Cluster } from "./cluster";
import { KubectlProvider } from "./kubectl-provider";

export interface CoreDnsComputeTypeProps extends KubernetesPatchProps {}
/**
* Properties for KubernetesPatch
*/
export interface KubernetesPatchProps {
/**
* The cluster to apply the patch to.
* [disable-awslint:ref-via-interface]
*/
readonly cluster: Cluster;

/**
* The JSON object to pass to `kubectl patch` when the resource is created/updated.
*/
readonly applyPatch: any;
readonly applyPatch: { [key: string]: any };

/**
* The JSON object to pass to `kubectl patch` when the resource is removed.
*/
readonly restorePatch: any;
readonly restorePatch: { [key: string]: any };

/**
* The full name of the resource to patch (e.g. `deployment/coredns`).
Expand All @@ -41,15 +44,28 @@ export interface KubernetesPatchProps {
readonly patchType?: PatchType;
}

/**
* Values for `kubectl patch` --type argument
*/
export enum PatchType {
/**
* JSON Patch, RFC 6902
*/
JSON = "json",
/**
* JSON Merge patch
*/
MERGE = "merge",
/**
* Strategic merge patch
*/
STRATEGIC = "strategic"
}

/**
* A CloudFormation resource which applies/restores a JSON patch into a
* Kubernetes resource.
* @see https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/
*/
export class KubernetesPatch extends Construct {
constructor(scope: Construct, id: string, props: KubernetesPatchProps) {
Expand Down

0 comments on commit ed88be9

Please sign in to comment.