From 3127c331511a54812453ff9de11e8bf3998141b0 Mon Sep 17 00:00:00 2001 From: Thomas Ferrandiz Date: Thu, 27 Apr 2023 11:02:58 +0000 Subject: [PATCH 1/2] add optional dhcp daemonset to rke2-multus --- .../charts/templates/dhcp-daemonSet.yaml | 62 +++++++++++++++++++ packages/rke2-multus/charts/values.yaml | 1 + packages/rke2-multus/package.yaml | 2 +- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 packages/rke2-multus/charts/templates/dhcp-daemonSet.yaml diff --git a/packages/rke2-multus/charts/templates/dhcp-daemonSet.yaml b/packages/rke2-multus/charts/templates/dhcp-daemonSet.yaml new file mode 100644 index 00000000..e929a051 --- /dev/null +++ b/packages/rke2-multus/charts/templates/dhcp-daemonSet.yaml @@ -0,0 +1,62 @@ +--- +{{- if .Values.manifests.dhcpDaemonSet }} +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: multus-dhcp-ds + namespace: {{ .Release.Namespace }} + labels: +{{- include "multus.labels" . | indent 4 }} +spec: + selector: + matchLabels: + app: {{ .Chart.Name }} + updateStrategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 + template: + metadata: + labels: +{{- include "multus.labels" . | indent 8 }} + spec: + hostNetwork: true + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + nodeSelector: {{- toYaml .Values.labels.nodeSelector | nindent 8 }} + initContainers: + - name: kube-{{ .Chart.Name }}-dhcp-cleanup + image: busybox + command: ["rm", "-f", "/run/cni/dhcp.sock"] + securityContext: + privileged: true + volumeMounts: + - name: socketpath + mountPath: /host/run/cni + containers: + - name: kube-{{ .Chart.Name }}-dhcp + image: busybox + command: ["/opt/cni/bin/dhcp", "daemon"] + securityContext: + privileged: true + volumeMounts: + - name: binpath + mountPath: /opt/cni + - name: socketpath + mountPath: /run/cni + - name: netnspath + mountPath: /var/run/netns + mountPropagation: HostToContainer + volumes: + - name: binpath + hostPath: + path: /opt/cni + - name: socketpath + hostPath: + path: /run/cni + - name: netnspath + hostPath: + path: /run/netns +{{- end }} diff --git a/packages/rke2-multus/charts/values.yaml b/packages/rke2-multus/charts/values.yaml index c433c694..26586d25 100755 --- a/packages/rke2-multus/charts/values.yaml +++ b/packages/rke2-multus/charts/values.yaml @@ -108,6 +108,7 @@ manifests: configMap: false daemonSet: true customResourceDefinition: true + dhcpDaemonSet: false #tolerations: [] diff --git a/packages/rke2-multus/package.yaml b/packages/rke2-multus/package.yaml index 0c7cda39..1b8bd495 100644 --- a/packages/rke2-multus/package.yaml +++ b/packages/rke2-multus/package.yaml @@ -1,3 +1,3 @@ url: local workingDir: charts -packageVersion: 03 +packageVersion: 04 From 069e98c4e67a4b5574063906c2f8428301726e00 Mon Sep 17 00:00:00 2001 From: Thomas Ferrandiz Date: Mon, 18 Dec 2023 09:18:11 +0000 Subject: [PATCH 2/2] remove -ds in daemonset names --- packages/rke2-multus/charts/templates/daemonSet.yaml | 2 +- packages/rke2-multus/charts/templates/dhcp-daemonSet.yaml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/rke2-multus/charts/templates/daemonSet.yaml b/packages/rke2-multus/charts/templates/daemonSet.yaml index 59aee494..5dbe49da 100755 --- a/packages/rke2-multus/charts/templates/daemonSet.yaml +++ b/packages/rke2-multus/charts/templates/daemonSet.yaml @@ -15,7 +15,7 @@ apiVersion: apps/v1 kind: DaemonSet metadata: - name: {{ .Release.Name }}-ds + name: {{ .Release.Name }} namespace: {{ .Release.Namespace }} labels: {{- include "multus.labels" . | indent 4 }} diff --git a/packages/rke2-multus/charts/templates/dhcp-daemonSet.yaml b/packages/rke2-multus/charts/templates/dhcp-daemonSet.yaml index e929a051..a3d48407 100644 --- a/packages/rke2-multus/charts/templates/dhcp-daemonSet.yaml +++ b/packages/rke2-multus/charts/templates/dhcp-daemonSet.yaml @@ -1,9 +1,8 @@ ---- {{- if .Values.manifests.dhcpDaemonSet }} apiVersion: apps/v1 kind: DaemonSet metadata: - name: multus-dhcp-ds + name: {{ .Release.Name }}-dhcp namespace: {{ .Release.Namespace }} labels: {{- include "multus.labels" . | indent 4 }}