Skip to content

eks: TaintEffect Enum has unsupported values #34780

@v4de

Description

@v4de

Describe the bug

When trying to use the TaintEffect Enum for a kubernetes manifest describing a Karpenter NodePool, the string value is all uppercase and does not seem to match what a taint is as a string in k8s docs so the validation fails. This however does work for k8s nodegroups.

From the python docs it looks like the python lib uses the proper values for the TaintEffect Enum. I am not sure why that is, if TS is the source.

As a workaround I would need to specify it as a string and not use the TaintSpec interface or TaintEffect enum when using the TypeScript lib.

When using CDK to create a Karpenter nodepool manifest in the eks cluster I am seeing this error:
Error: b'The NodePool "default-nodepool" is invalid: \n* spec.template.spec.taints[0].effect: Unsupported value: "NO_EXECUTE": supported values: "NoSchedule", "PreferNoSchedule", "NoExecute"\n*

(P.S. Prompted a song for fun: https://suno.com/s/8JD1CY0RmFeOjSBJ)

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

N/A

Expected Behavior

I expect to not have an error when using the TaintEffect enum to configure a karpenter nodepool manifest with the NoExecute taint.

Current Behavior

| Custom::AWSCDK-EKS-KubernetesResource | rKarpenter/rNodeClass-default-nodeclass/rNodePool-default-nodepool/rNodePool-default-nodepool/Resource/Default (rKarpenterrNodeClassdefaultnodeclassrNodePooldefaultnodepoolDC25F7A7) Received response status [FAILED] from custom resource. Message returned: Error: b'The NodePool "default-nodepool" is invalid: \n* spec.template.spec.taints[0].effect: Unsupported value: "NO_EXECUTE": supported values: "NoSchedule", "PreferNoSchedule", "NoExecute"\n* <nil>: Invalid value: "null": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation\n'

Reproduction Steps

I believe this is a short enough example that can explain what I am trying to accomplish and be copied and reused. However if you need a larger, more complete, example I can try to work on a sample test stack and upload it to a public repo.

import { Nodegroup, KubernetesManifest, TaintEffect, TaintSpec } from 'aws-cdk-lib/aws-eks';

const ciliumTaint: TaintSpec = {
  key: 'node.cilium.io/agent-not-ready',
  value: 'true',
  effect: TaintEffect.NO_EXECUTE
}

// NodeGroups
const nodeGroup = new Nodegroup(this, id, {
    cluster: cluster,
    subnets: subnets,
    taints: [ciliumTaint]
  };
}

// NodePool
const chart = new KubernetesManifest(this, id, {
  cluster: cluster,
  manifest: [{
    apiVersion: `karpenter.sh/${apiVersion}`,
    kind: 'NodePool',
    metadata: {
      name: name
    },
    spec: {
      template: {
        spec: {
          taints: [ciliumTaint]
        }
      }
    }
  }]
});

Possible Solution

Update the enum to match k8s taint values.

export enum TaintEffect {
  /**
   * NoSchedule
   */
  NO_SCHEDULE = 'NoSchedule',
  /**
   * PreferNoSchedule
   */
  PREFER_NO_SCHEDULE = 'PreferNoSchedule',
  /**
   * NoExecute
   */
  NO_EXECUTE = 'NoExecute',
}

Additional Information/Context

EKS Version: 1.32
Cilium Version: 1.17.2
Karpenter-crd Version: 1.5.1
Karpenter Version: 1.5.1

Addons:

  • addonName: coredns
    addonVersion: v1.11.4-eksbuild.2
    preserveOnDelete: false
  • addonName: aws-ebs-csi-driver
    addonVersion: v1.41.0-eksbuild.1
    preserveOnDelete: false
  • addonName: aws-mountpoint-s3-csi-driver
    addonVersion: v1.13.0-eksbuild.1
    preserveOnDelete: false

AWS CDK Library version (aws-cdk-lib)

aws-cdk-lib@2.195.0

AWS CDK CLI version

2.1016.0 (build 66e0b2d)

Node.js Version

v22.13.1

OS

Windows 10 22H2 (19045.3930)

Language

TypeScript

Language Version

5.8.3

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-eksRelated to Amazon Elastic Kubernetes ServicebugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions