diff --git a/charts/karpenter_nodes/Chart.yaml b/charts/karpenter_nodes/Chart.yaml index 506646a..b73bca0 100644 --- a/charts/karpenter_nodes/Chart.yaml +++ b/charts/karpenter_nodes/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: karpenter_nodes -version: 1.0.1 +version: 1.0.2 description: A Helm chart for generating NodeClasses and NodePools for Karpenter maintainers: - name: nadavbuc diff --git a/charts/karpenter_nodes/README.md b/charts/karpenter_nodes/README.md index c87b312..586103a 100644 --- a/charts/karpenter_nodes/README.md +++ b/charts/karpenter_nodes/README.md @@ -74,6 +74,8 @@ Note - Most of the values can be overridden per nodegroup (If not specified, it | `headRoom` | Generate Ultra Low Priority Class for Headroom (see below) | `String` | ✓ | x | | `additionalRequirements` | add NodePool requirements which are not covered by this chart | `List(map)` | ✓ | ✓ | | `autoTaint` | add NodePool taint with `dedicated` as key and nodegroup name as value (`-` replaced with `_`) | `Boolean(String)` | ✓ | ✓ | +| `cilium` | Add startupTaints for Cilium | `Boolean` | ✓ | ✓ | +| `ciliumEffect` | Set Effect on CiliumStartupTaint (Default `NoExecute`) [Documentation](https://docs.cilium.io/en/stable/installation/taints/) | `String` | ✓ | ✓ | ### NodeGroup Configuration | Key Name | Description | Type | Optional? | Optional Per NodeGroup? | diff --git a/charts/karpenter_nodes/templates/nodepool.yaml b/charts/karpenter_nodes/templates/nodepool.yaml index c2521c7..018a70e 100644 --- a/charts/karpenter_nodes/templates/nodepool.yaml +++ b/charts/karpenter_nodes/templates/nodepool.yaml @@ -43,12 +43,19 @@ spec: {{- end }} {{- end }} {{- end }} - {{- if hasKey $v "startupTaints" }} + {{- if or (hasKey $v "startupTaints") ($v.cilium | default $.Values.cilium) }} startupTaints: - {{- range $v.startupTaints }} + {{- if hasKey $v "startupTaints" }} + {{- range $v.startupTaints }} - key: {{ .key }} value: {{ .value }} effect: {{ .effect }} + {{- end }} + {{- end }} + {{- if $v.cilium | default $.Values.cilium }} + - key: node.cilium.io/agent-not-ready + value: "true" + effect: {{ $v.ciliumEffect | default $.Values.ciliumEffect }} {{- end }} {{- end }} requirements: diff --git a/charts/karpenter_nodes/tests/nodepool_nodes_explicittypes_test.yaml b/charts/karpenter_nodes/tests/nodepool_nodes_explicittypes_test.yaml index 1deb47c..565e6db 100644 --- a/charts/karpenter_nodes/tests/nodepool_nodes_explicittypes_test.yaml +++ b/charts/karpenter_nodes/tests/nodepool_nodes_explicittypes_test.yaml @@ -52,3 +52,12 @@ tests: value: t3a.xlarge - isNull: path: spec.template.spec.requirements[6] + - equal: + path: spec.template.spec.startupTaints[0].key + value: "node.cilium.io/agent-not-ready" + - equal: + path: spec.template.spec.startupTaints[0].value + value: "true" + - equal: + path: spec.template.spec.startupTaints[0].effect + value: NoExecute diff --git a/charts/karpenter_nodes/tests/nodepool_nodes_noclass_test.yaml b/charts/karpenter_nodes/tests/nodepool_nodes_noclass_test.yaml index a088dae..798230d 100644 --- a/charts/karpenter_nodes/tests/nodepool_nodes_noclass_test.yaml +++ b/charts/karpenter_nodes/tests/nodepool_nodes_noclass_test.yaml @@ -86,3 +86,12 @@ tests: - equal: path: spec.template.spec.requirements[6].values[0] value: "linux" + - equal: + path: spec.template.spec.startupTaints[0].key + value: "node.cilium.io/agent-not-ready" + - equal: + path: spec.template.spec.startupTaints[0].value + value: "true" + - equal: + path: spec.template.spec.startupTaints[0].effect + value: NoSchedule diff --git a/charts/karpenter_nodes/tests/nodepool_nodes_workers_test.yaml b/charts/karpenter_nodes/tests/nodepool_nodes_workers_test.yaml index 91d0a11..33f897d 100644 --- a/charts/karpenter_nodes/tests/nodepool_nodes_workers_test.yaml +++ b/charts/karpenter_nodes/tests/nodepool_nodes_workers_test.yaml @@ -58,7 +58,6 @@ tests: path: spec.template.spec.taints[0].effect value: NoSchedule - - it: Verify nodes-workers requirements documentIndex: 3 asserts: @@ -210,4 +209,3 @@ tests: - equal: path: spec.weight value: 3 - diff --git a/charts/karpenter_nodes/tests/values.yaml b/charts/karpenter_nodes/tests/values.yaml index 21148e0..2382c10 100644 --- a/charts/karpenter_nodes/tests/values.yaml +++ b/charts/karpenter_nodes/tests/values.yaml @@ -25,6 +25,8 @@ nodeGroups: instances: {} nodeClassRef: name: default + cilium: true + ciliumEffect: "NoSchedule" nodes-workers: additionalNodeTags: @@ -137,6 +139,7 @@ nodeGroups: - t3a.xlarge nodeClassRef: name: default + cilium: true #Default cluster Settings clusterName: "eks-dev" diff --git a/charts/karpenter_nodes/values.yaml b/charts/karpenter_nodes/values.yaml index 809a965..d548ae9 100644 --- a/charts/karpenter_nodes/values.yaml +++ b/charts/karpenter_nodes/values.yaml @@ -140,3 +140,6 @@ nodeGroups: {} # additionalRequirements: # - key: "karpenter.k8s.aws/instance-local-nvme" # operator: "Exists" + +cilium: false +ciliumEffect: "NoExecute" # "NoSchedule"