import { BlockDeviceMapping, Hour, Min, Sec, Taint, Values } from "../../spi"; export declare const KARPENTER = "karpenter"; export declare const RELEASE = "blueprints-addon-karpenter"; /** * Utility type for Karpenter requirement values for NodePools */ export type NodePoolRequirementValues = { key: string; operator: "In" | "NotIn" | "Exists" | "DoesNotExist" | "Gt" | "Lt"; values: string[]; }[]; export type DisruptionBudget = { nodes: string; schedule?: string; duration?: string; }; export type BetaSubnetTerm = { id?: string; tags?: Values; }; export type BetaSecurityGroupTerm = { tags?: Values; id?: string; name?: string; }; export type AmiSelectorTerm = { tags?: Values; name?: string; owner?: string; alias?: string; } | { id?: string; }; /** * Utility type for Karpenter EC2NodeClass Specs */ export type Ec2NodeClassSpec = { /** * Tags needed for subnets - Subnet tags and security group tags are required for the provisioner to be created * Required for Alpha CRDS * @deprecated */ subnetSelector?: Values; /** * Tags needed for security groups - Subnet tags and security group tags are required for the provisioner to be created * Required for Alpha CRDS * @deprecated */ securityGroupSelector?: Values; /** * Subnet selector terms (subnet id or tags) used for Beta CRDs * Required for Beta CRDS */ subnetSelectorTerms?: BetaSubnetTerm[]; /** * Security Group selector terms (security group id, tags or names) used for Beta CRDs * Required for Beta CRDS */ securityGroupSelectorTerms?: BetaSecurityGroupTerm[]; /** * AMI Selector */ amiSelector?: Values; /** * AMI Selector terms used for Beta CRDs */ amiSelectorTerms?: AmiSelectorTerm[]; /** * AMI Family: required for v0.32.0 and above, optional otherwise * Karpenter will automatically query the appropriate EKS optimized AMI via AWS Systems Manager */ amiFamily?: "AL2" | "AL2023" | "Bottlerocket" | "Ubuntu" | "Windows2019" | "Windows2022"; /** * Optional field to control how instance store volumes are handled. Set it to RAID0 * for faster ephemeral storage */ instanceStorePolicy?: "RAID0"; /** * Optional user provided UserData applied to the worker nodes, * i.e. custom scripts or pass-through custom configurations at start-up */ userData?: string; /** * Optional field to use the name of the IAM Instance profile, * instead of the role generated by Karpenter. * User must pre-provision an IAM instance profile and assign a role to it. */ instanceProfile?: string; /** * Tags adds tags to all resources created, including EC2 Instances, EBS volumes and Launch Templates. * Karpenter allows overrides of the default "Name" tag but does not allow overrides to restricted domains * (such as "karpenter.sh", "karpenter.k8s.aws", and "kubernetes.io/cluster"). * This ensures that Karpenter is able to correctly auto-discover machines that it owns. */ tags?: Values; /** * Control the exposure of Instance Metadata service using this configuration */ metadataOptions?: Values; /** * BlockDeviceMappings allows you to specify the block device mappings for the instances. * This is a list of mappings, where each mapping consists of a device name and an EBS configuration. * If you leave this blank, it will use the Karpenter default. */ blockDeviceMappings?: BlockDeviceMapping[]; /** * Detailed monitoring on EC2 */ detailedMonitoring?: boolean; }; /** * Utility type for Karpenter EC2NodeClass Specs for v1. * Removes amiSelector and subnetSelector and make amiSelectorTerms mandatory. */ export type Ec2NodeClassV1Spec = Omit & Required>; /** * Utility type for Karpenter NodePool Specs */ export type NodePoolSpec = { /** * Labels applied to all nodes */ labels?: Values; /** * Annotations applied to all nodes */ annotations?: Values; /** * Taints for the provisioned nodes - Taints may prevent pods from scheduling if they are not tolerated by the pod. */ taints?: Taint[]; /** * Provisioned nodes will have these taints, but pods do not need to tolerate these taints to be provisioned by this * provisioner. These taints are expected to be temporary and some other entity (e.g. a DaemonSet) is responsible for * removing the taint after it has finished initializing the node. */ startupTaints?: Taint[]; /** * Requirement properties for Node Pool (Optional) - If not provided, the add-on will * deploy one with no value, providing no restrictions when Karpenter optimizes. */ requirements?: NodePoolRequirementValues; /** * Enables consolidation which attempts to reduce cluster cost by both removing un-needed nodes and down-sizing those that can't be removed. * Mutually exclusive with the ttlSecondsAfterEmpty parameter. * * Replaced with disruption.consolidationPolicy for versions v0.32.x and later * @deprecated */ consolidation?: { enabled: boolean; }; /** * If omitted, the feature is disabled and nodes will never expire. * If set to less time than it requires for a node to become ready, * the node may expire before any pods successfully start. * * Replaced with disruption.expireAfter for versions v0.32.x and later * @deprecated */ ttlSecondsUntilExpired?: number; /** * How many seconds Karpenter will wailt until it deletes empty/unnecessary instances (in seconds). * Mutually exclusive with the consolidation parameter. * * Replaced with disruption.consolidationPolicy and disruption.consolidateAfter for versions v0.32.x and later * @deprecated */ ttlSecondsAfterEmpty?: number; /** * Disruption section which describes the ways in which Karpenter can disrupt and replace Nodes * Configuration in this section constrains how aggressive Karpenter can be with performing operations * like rolling Nodes due to them hitting their maximum lifetime (expiry) or scaling down nodes to reduce cluster cost * Only applicable for versions v0.32 or later * * @param consolidationPolicy consolidation policy - will default to WhenUnderutilized if not provided * @param consolidateAfter How long Karpenter waits to consolidate nodes - cannot be set when the policy is WhenUnderutilized * @param expireAfter How long Karpenter waits to expire nodes */ disruption?: { consolidationPolicy?: "WhenUnderutilized" | "WhenEmpty"; consolidateAfter?: Sec | Min | Hour; expireAfter?: "Never" | Sec | Min | Hour; budgets?: DisruptionBudget[]; }; /** * Limits define a set of bounds for provisioning capacity. * Resource limits constrain the total size of the cluster. * Limits prevent Karpenter from creating new instances once the limit is exceeded. */ limits?: { cpu?: number; memory?: string; /** * Extended resources are fully-qualified resource names outside the kubernetes.io domain. * They allow cluster operators to advertise and users to consume the non-Kubernetes-built-in * resources such as hardware devices GPUs, RDMAs, SR-IOVs... * e.g nvidia.com/gpu, amd.com/gpu, etc... */ [k: string]: unknown; }; /** * Priority given to the provisioner when the scheduler considers which provisioner * to select. Higher weights indicate higher priority when comparing provisioners. */ weight?: number; }; /** * Utility type for Karpenter NodePool Specs for v1 */ export type NodePoolV1Spec = { /** * Optional: Number of nodes to maintain for static capacity * When set, NodePool operates in static mode maintaining fixed node count */ replicas?: number; /** * Labels applied to all nodes */ labels?: Values; /** * Annotations applied to all nodes */ annotations?: Values; /** * Taints for the provisioned nodes - Taints may prevent pods from scheduling if they are not tolerated by the pod. */ taints?: Taint[]; /** * Provisioned nodes will have these taints, but pods do not need to tolerate these taints to be provisioned by this * provisioner. These taints are expected to be temporary and some other entity (e.g. a DaemonSet) is responsible for * removing the taint after it has finished initializing the node. */ startupTaints?: Taint[]; /** * Requirement properties for Node Pool (Optional) - If not provided, the add-on will * deploy one with no value, providing no restrictions when Karpenter optimizes. */ requirements?: NodePoolRequirementValues; /** * The amount of time a Node can live on the cluster before being removed * Avoiding long-running Nodes helps to reduce security vulnerabilities as well as to reduce the chance of issues that can plague Nodes with long uptimes such as file fragmentation or memory leaks from system processes * You can choose to disable expiration entirely by setting the string value 'Never' here * Note: changing this value in the nodepool will drift the nodeclaims. */ expireAfter?: "Never" | Sec | Min | Hour; /** * Disruption section which describes the ways in which Karpenter can disrupt and replace Nodes * Configuration in this section constrains how aggressive Karpenter can be with performing operations * like rolling Nodes due to them hitting their maximum lifetime (expiry) or scaling down nodes to reduce cluster cost * Only applicable for versions v0.32 or later * * @param consolidationPolicy consolidation policy - will default to WhenUnderutilized if not provided * @param consolidateAfter How long Karpenter waits to consolidate nodes - cannot be set when the policy is WhenUnderutilized * @param expireAfter How long Karpenter waits to expire nodes */ disruption?: { consolidationPolicy?: "WhenEmptyOrUnderutilized" | "WhenEmpty"; consolidateAfter?: Sec | Min | Hour; budgets?: DisruptionBudget[]; }; /** * Limits define a set of bounds for provisioning capacity. * Resource limits constrain the total size of the cluster. * Limits prevent Karpenter from creating new instances once the limit is exceeded. */ limits?: { cpu?: number; memory?: string; /** * Extended resources are fully-qualified resource names outside the kubernetes.io domain. * They allow cluster operators to advertise and users to consume the non-Kubernetes-built-in * resources such as hardware devices GPUs, RDMAs, SR-IOVs... * e.g nvidia.com/gpu, amd.com/gpu, etc... */ [k: string]: unknown; }; /** * Priority given to the provisioner when the scheduler considers which provisioner * to select. Higher weights indicate higher priority when comparing provisioners. */ weight?: number; };