Adding Flannel as a CNI plugin

Signed-off-by: Manuel Buil <mbuil@suse.com>
pull/392/head
Manuel Buil 2024-01-05 10:54:45 +01:00
parent 89c4269cc3
commit 3f2945862f
5 changed files with 112 additions and 0 deletions

View File

@ -0,0 +1,7 @@
{{- define "system_default_registry" -}}
{{- if .Values.global.systemDefaultRegistry -}}
{{- printf "%s/" .Values.global.systemDefaultRegistry -}}
{{- else -}}
{{- "" -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,20 @@
--- charts-original/templates/config.yaml
+++ charts/templates/config.yaml
@@ -29,13 +29,13 @@
}
net-conf.json: |
{
-{{- if .Values.podCidr }}
- "Network": {{ .Values.podCidr | quote }},
+{{- if .Values.global.clusterCIDRv4 }}
+ "Network": {{ .Values.global.clusterCIDRv4 | quote }},
{{- else }}
"EnableIPv4": false,
{{- end }}
-{{- if .Values.podCidrv6 }}
- "IPv6Network": {{ .Values.podCidrv6 | quote }},
+{{- if .Values.global.clusterCIDRv6 }}
+ "IPv6Network": {{ .Values.global.clusterCIDRv6 | quote }},
"EnableIPv6": true,
{{- end }}
"Backend": {

View File

@ -0,0 +1,43 @@
--- charts-original/templates/daemonset.yaml
+++ charts/templates/daemonset.yaml
@@ -32,19 +32,13 @@
effect: NoSchedule
serviceAccountName: flannel
initContainers:
- - name: install-cni-plugin
- image: {{ .Values.flannel.image_cni.repository }}:{{ .Values.flannel.image_cni.tag }}
- command:
- - cp
- args:
- - -f
- - /flannel
- - /opt/cni/bin/flannel
+ - name: install-cni-plugins
+ image: {{ template "system_default_registry" . }}{{ .Values.flannel.image_cni.repository }}:{{ .Values.flannel.image_cni.tag }}
volumeMounts:
- name: cni-plugin
- mountPath: /opt/cni/bin
+ mountPath: /host/opt/cni/bin
- name: install-cni
- image: {{ .Values.flannel.image.repository }}:{{ .Values.flannel.image.tag }}
+ image: {{ template "system_default_registry" . }}{{ .Values.flannel.image.repository }}:{{ .Values.flannel.image.tag }}
command:
- cp
args:
@@ -58,7 +52,7 @@
mountPath: /etc/kube-flannel/
containers:
- name: kube-flannel
- image: {{ .Values.flannel.image.repository }}:{{ .Values.flannel.image.tag }}
+ image: {{ template "system_default_registry" . }}{{ .Values.flannel.image.repository }}:{{ .Values.flannel.image.tag }}
command:
- "/opt/bin/flanneld"
{{- range .Values.flannel.args }}
@@ -97,6 +91,7 @@
- name: cni-plugin
hostPath:
path: /opt/cni/bin
+ type: DirectoryOrCreate
- name: cni
hostPath:
path: /etc/cni/net.d

View File

@ -0,0 +1,39 @@
--- charts-original/values.yaml
+++ charts/values.yaml
@@ -1,21 +1,13 @@
---
-global:
- imagePullSecrets:
-# - name: "a-secret-name"
-
-# The IPv4 cidr pool to create on startup if none exists. Pod IPs will be
-# chosen from this range.
-podCidr: "10.244.0.0/16"
-podCidrv6: ""
flannel:
# kube-flannel image
image:
- repository: docker.io/flannel/flannel
- tag: v0.24.0
+ repository: rancher/hardened-flannel
+ tag: v0.24.0-build20240108
image_cni:
- repository: docker.io/flannel/flannel-cni-plugin
- tag: v1.2.0
+ repository: rancher/hardened-cni-plugins
+ tag: v1.2.0-build20240108
# flannel command arguments
args:
- "--ip-masq"
@@ -50,3 +42,10 @@
#tunnelMode: "separate"
# Persistent keep interval to use
#keepaliveInterval: 0
+ #
+
+global:
+ systemDefaultRegistry: ""
+ clusterCIDRv4: ""
+ clusterCIDRv6: ""
+

View File

@ -0,0 +1,3 @@
url: https://github.com/flannel-io/flannel.git
subdirectory: chart/kube-flannel
commit: v0.24.0