Skip to content

Commit

Permalink
Merge pull request #2150 from vasrem/feature/allow-skipping-cni-conf-…
Browse files Browse the repository at this point in the history
…installation

feat: add bool to control CNI config installation using Helm
  • Loading branch information
thomasferrandiz authored Jan 10, 2025
2 parents fb196ec + 8037999 commit ffc4749
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 ffc4749

Please sign in to comment.