cdk-eks-karpenter
Version:
CDK construct library that allows you install Karpenter in an AWS EKS cluster
121 lines (120 loc) • 4.48 kB
TypeScript
import { Cluster } from 'aws-cdk-lib/aws-eks';
import { IManagedPolicy, Role } from 'aws-cdk-lib/aws-iam';
import { Construct } from 'constructs';
export interface KarpenterProps {
/**
* The EKS Cluster to attach to
*/
readonly cluster: Cluster;
/**
* The Kubernetes namespace to install to
*
* @default karpenter
*/
readonly namespace?: string;
/**
* The Kubernetes ServiceAccount name to use
*
* @default karpenter
*/
readonly serviceAccountName?: string;
/**
* The helm chart version to install
*
* @default - latest
*/
readonly version: string;
/**
* Extra values to pass to the Karpenter Helm chart
*/
readonly helmExtraValues?: Record<string, any>;
/**
* Custom NodeRole to pass for Karpenter Nodes
*/
readonly nodeRole?: Role;
}
export declare class Karpenter extends Construct {
readonly cluster: Cluster;
readonly namespace: string;
readonly serviceAccountName: string;
readonly version: string;
readonly nodeRole: Role;
readonly helmExtraValues: any;
private readonly chart;
private readonly serviceAccount;
helmChartValues: Record<string, any>;
private controllerIAMPolicyStatements;
private interruptionQueue;
constructor(scope: Construct, id: string, props: KarpenterProps);
/**
* addEC2NodeClass adds a EC2NodeClass to the Karpenter configuration.
*
* @param id must consist of lower case alphanumeric characters, \'-\' or \'.\', and must start and end with an alphanumeric character
* @param ec2NodeClassSpec spec of Karpenters EC2NodeClass API
*
* @returns the metadata object of the created manifest
*/
addEC2NodeClass(id: string, ec2NodeClassSpec: Record<string, any>): Record<string, any>;
/**
* addNodePool adds a NodePool to the Karpenter configuration.
*
* @param id must consist of lower case alphanumeric characters, \'-\' or \'.\', and must start and end with an alphanumeric character
* @param nodePoolSpec spec of Karpenters NodePool API
*
* @returns the metadata object of the created manifest
*/
addNodePool(id: string, nodePoolSpec: Record<string, any>): Record<string, any>;
/**
* addProvisioner adds a provisioner manifest to the cluster. Currently the provisioner spec
* parameter is relatively free form.
*
* @param id - must consist of lower case alphanumeric characters, \'-\' or \'.\', and must start and end with an alphanumeric character
* @param provisionerSpec - spec of Karpenters Provisioner object.
*
* @deprecated This method should not be used with Karpenter >v0.32.0
*/
addProvisioner(id: string, provisionerSpec: Record<string, any>): void;
/**
* addNodeTemplate adds a node template manifest to the cluster. Currently the node template spec
* parameter is relatively free form.
*
* @param id - must consist of lower case alphanumeric characters, \'-\' or \'.\', and must start and end with an alphanumeric character
* @param nodeTemplateSpec - spec of Karpenters Node Template object.
*
* @deprecated This method should not be used with Karpenter >v0.32.0
*/
addNodeTemplate(id: string, nodeTemplateSpec: Record<string, any>): void;
/**
* addManifest crafts Kubernetes manifests for the specific APIs
*
* @param id
* @param apiVersion
* @param kind
* @param metadata
* @param spec
*
* @returns the metadata object of the created manifest
*/
private addManifest;
/**
* addManagedPolicyToKarpenterRole adds Managed Policies To Karpenter Role.
*
* @param managedPolicy - iam managed policy to add to the karpenter role.
*/
addManagedPolicyToKarpenterRole(managedPolicy: IManagedPolicy): void;
/**
* Get the Helm repo URL based on the Karpenter version
*
* @returns string
*/
private helmRepoURLFromKarpenterVersion;
/**
* addInterruptionQueue adds the interruption queue setup if neceesary
*/
private addInterruptionQueue;
/**
* Configure the IAM Policy StatementsPolicies for the Controller
* taken from https://raw.githubusercontent.com/aws/karpenter/v0.32.0/website/content/en/preview/getting-started/getting-started-with-karpenter/cloudformation.yaml
*/
private addControllerPolicyIAMPolicyStatements;
}