UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

96 lines (95 loc) 3.11 kB
import type { IConstruct } from 'constructs'; import { Construct } from 'constructs'; import type { ICluster } from './cluster'; import * as iam from '../../aws-iam'; import type { RemovalPolicy } from '../../core'; import { NestedStack } from '../../core'; /** * Properties for a KubectlProvider */ export interface KubectlProviderProps { /** * The cluster to control. */ readonly cluster: ICluster; /** * The removal policy applied to the custom resource that provides kubectl. * * The removal policy controls what happens to the resource if it stops being managed by CloudFormation. * This can happen in one of three situations: * * - The resource is removed from the template, so CloudFormation stops managing it * - A change to the resource is made that requires it to be replaced, so CloudFormation stops managing it * - The stack is deleted, so CloudFormation stops managing all resources in it * * @default RemovalPolicy.DESTROY */ readonly removalPolicy?: RemovalPolicy; } /** * Kubectl Provider Attributes */ export interface KubectlProviderAttributes { /** * The custom resource provider's service token. */ readonly functionArn: string; /** * The IAM role to assume in order to perform kubectl operations against this cluster. */ readonly kubectlRoleArn: string; /** * The IAM execution role of the handler. This role must be able to assume kubectlRoleArn */ readonly handlerRole: iam.IRole; } /** * Imported KubectlProvider that can be used in place of the default one created by CDK */ export interface IKubectlProvider extends IConstruct { /** * The custom resource provider's service token. */ readonly serviceToken: string; /** * The IAM role to assume in order to perform kubectl operations against this cluster. */ readonly roleArn: string; /** * The IAM execution role of the handler. */ readonly handlerRole: iam.IRole; } /** * Implementation of Kubectl Lambda */ export declare class KubectlProvider extends NestedStack implements IKubectlProvider { /** * Take existing provider or create new based on cluster * * @param scope Construct * @param cluster k8s cluster */ static getOrCreate(scope: Construct, cluster: ICluster): IKubectlProvider; /** * Import an existing provider * * @param scope Construct * @param id an id of resource * @param attrs attributes for the provider */ static fromKubectlProviderAttributes(scope: Construct, id: string, attrs: KubectlProviderAttributes): IKubectlProvider; /** * The custom resource provider's service token. */ readonly serviceToken: string; /** * The IAM role to assume in order to perform kubectl operations against this cluster. */ readonly roleArn: string; /** * The IAM execution role of the handler. */ readonly handlerRole: iam.IRole; constructor(scope: Construct, id: string, props: KubectlProviderProps); }