diff --git a/packages/stacks/api/src/cluster.ts b/packages/stacks/api/src/cluster.ts index 4408cbad..02b8de11 100644 --- a/packages/stacks/api/src/cluster.ts +++ b/packages/stacks/api/src/cluster.ts @@ -96,7 +96,11 @@ export const tagKarpenter = (stack: blueprints.EksBlueprint) => { * @param clusterName Cluster name to target. Defaults to lazy lookup. * @param subnetNames Subnet names to target. Defaults to lazy lookup. */ -export const buildKarpenter = (clusterName?: string, subnetNames?: string) => { +export const buildKarpenter = ( + clusterName?: string, + subnetNames?: string, + instanceTypes?: string[], +) => { const sgTag = clusterName ?? Lazy.uncachedString( @@ -121,7 +125,11 @@ export const buildKarpenter = (clusterName?: string, subnetNames?: string) => { requirements: [ { key: Label.ARCH, op: 'In', vals: ['arm64'] }, { key: Label.CAPACITY_TYPE, op: 'In', vals: ['spot', 'on-demand'] }, - { key: Label.INSTANCE_CATEGORY, op: 'In', vals: ['c', 'm', 'r', 't'] }, + { + key: Label.INSTANCE_CATEGORY, + op: 'In', + vals: instanceTypes ?? ['c', 'm', 'r', 't'], + }, { key: Label.INSTANCE_HYPERVISOR, op: 'In', vals: ['nitro'] }, ], subnetTags: { diff --git a/packages/stacks/api/src/pipeline.ts b/packages/stacks/api/src/pipeline.ts index 5b274314..9df68ee7 100644 --- a/packages/stacks/api/src/pipeline.ts +++ b/packages/stacks/api/src/pipeline.ts @@ -171,7 +171,11 @@ export class Pipeline { ).build(), ) .addOns( - buildKarpenter(), + buildKarpenter( + undefined, + undefined, + config.apiStack!.eks.instanceTypes ?? undefined, + ), new CrisisCleanupAddOn({ config, secretsProvider, diff --git a/packages/stacks/api/src/schema.ts b/packages/stacks/api/src/schema.ts index c9250fc4..bd89a455 100644 --- a/packages/stacks/api/src/schema.ts +++ b/packages/stacks/api/src/schema.ts @@ -35,6 +35,11 @@ export const eksConfigSchema = eksAddonSchema.extend({ .array(z.string()) .describe('ARNs to add to platform team.') .default([]), + instanceTypes: z + .array(z.string()) + .nullable() + .default(null) + .describe('List of instance families for karpenter to provision.'), }) export interface EKSConfig extends z.infer {}