Skip to content

Commit

Permalink
feat: add bool to control CNI config installation using Helm
Browse files Browse the repository at this point in the history
This feature enables more controlled installation of CNI configs in
setups where more than one CNI is used. It helps prevent race conditions
during initial node bootstrapping.

Signed-off-by: Vasilis Remmas <[email protected]>
  • Loading branch information
vasrem committed Jan 3, 2025
1 parent 69ce8cb commit 8037999
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chart/kube-flannel/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ spec:
volumeMounts:
- name: cni-plugin
mountPath: /opt/cni/bin
{{- if not .Values.flannel.skipCNIConfigInstallation }}
- name: install-cni
image: {{ .Values.flannel.image.repository }}:{{ .Values.flannel.image.tag }}
command:
Expand All @@ -57,6 +58,7 @@ spec:
mountPath: /etc/cni/net.d
- name: flannel-cfg
mountPath: /etc/kube-flannel/
{{- end }}
containers:
- name: kube-flannel
image: {{ .Values.flannel.image.repository }}:{{ .Values.flannel.image.tag }}
Expand Down
18 changes: 18 additions & 0 deletions chart/kube-flannel/tests/daemonset_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,21 @@ tests:
path: spec.template.spec.imagePullSecrets
value:
- name: "a-test-secret"

- it: should add the install-cni init container when default values are used
asserts:
- contains:
path: spec.template.spec.initContainers
content:
name: install-cni
any: true

- it: should not add the install-cni init container when skipCNIConfigInstallation is set
set:
flannel.skipCNIConfigInstallation: true
asserts:
- notContains:
path: spec.template.spec.initContainers
content:
name: install-cni
any: true
3 changes: 3 additions & 0 deletions chart/kube-flannel/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ flannel:
image_cni:
repository: docker.io/flannel/flannel-cni-plugin
tag: v1.6.0-flannel1
# skipCNIConfigInstallation skips the installation of the flannel CNI config. This is useful when the CNI config is
# provided externally.
skipCNIConfigInstallation: false
# flannel command arguments
enableNFTables: false
args:
Expand Down

0 comments on commit 8037999

Please sign in to comment.