Skip to content

Commit 73fe8c7

Browse files
committed
feature(chart): allow configuring labels and annotations
lets users configure the labels and annotations in the Helm chart Resolves #2442
1 parent 4584e1f commit 73fe8c7

5 files changed

Lines changed: 92 additions & 3 deletions

File tree

chart/kube-flannel/templates/config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ metadata:
66
labels:
77
tier: node
88
app: flannel
9+
{{- with merge .Values.flannel.configMap.labels .Values.global.commonLabels }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- with merge .Values.flannel.configMap.annotations .Values.global.commonAnnotations }}
13+
annotations:
14+
{{- toYaml . | nindent 4 }}
15+
{{- end }}
916
data:
1017
cni-conf.json: {{ .Values.flannel.cniConf | toJson }}
1118
net-conf.json: |

chart/kube-flannel/templates/daemonset.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ metadata:
66
labels:
77
tier: node
88
app: flannel
9+
{{- with merge .Values.flannel.daemonSet.labels .Values.global.commonLabels }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- with merge .Values.flannel.daemonSet.annotations .Values.global.commonAnnotations }}
13+
annotations:
14+
{{- toYaml . | nindent 4 }}
15+
{{- end }}
916
spec:
1017
selector:
1118
matchLabels:
@@ -15,6 +22,13 @@ spec:
1522
labels:
1623
tier: node
1724
app: flannel
25+
{{- with merge .Values.flannel.podLabels .Values.global.commonLabels }}
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
{{- with merge .Values.flannel.podAnnotations .Values.global.commonAnnotations }}
29+
annotations:
30+
{{- toYaml . | nindent 8 }}
31+
{{- end }}
1832
spec:
1933
affinity:
2034
nodeAffinity:

chart/kube-flannel/templates/rbac.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ kind: ClusterRole
22
apiVersion: rbac.authorization.k8s.io/v1
33
metadata:
44
name: flannel
5+
labels:
6+
{{- with (merge .Values.flannel.rbac.clusterRole.labels .Values.flannel.rbac.labels .Values.global.commonLabels) }}
7+
{{- toYaml . | nindent 4 }}
8+
{{- end }}
9+
{{- with (merge .Values.flannel.rbac.clusterRole.annotations .Values.flannel.rbac.annotations .Values.global.commonAnnotations) }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
513
rules:
614
- apiGroups:
715
- ""
@@ -41,6 +49,14 @@ kind: ClusterRoleBinding
4149
apiVersion: rbac.authorization.k8s.io/v1
4250
metadata:
4351
name: flannel
52+
labels:
53+
{{- with (merge .Values.flannel.rbac.clusterRoleBinding.labels .Values.flannel.rbac.labels .Values.global.commonLabels) }}
54+
{{- toYaml . | nindent 4 }}
55+
{{- end }}
56+
{{- with (merge .Values.flannel.rbac.clusterRoleBinding.annotations .Values.flannel.rbac.annotations .Values.global.commonAnnotations) }}
57+
annotations:
58+
{{- toYaml . | nindent 4 }}
59+
{{- end }}
4460
roleRef:
4561
apiGroup: rbac.authorization.k8s.io
4662
kind: ClusterRole

chart/kube-flannel/templates/serviceaccount.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@ kind: ServiceAccount
33
metadata:
44
name: flannel
55
namespace: {{ .Release.Namespace }}
6+
{{- with merge .Values.flannel.serviceAccount.labels .Values.global.commonLabels }}
7+
labels:
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
{{- with merge .Values.flannel.serviceAccount.annotations .Values.global.commonAnnotations }}
11+
annotations:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}

chart/kube-flannel/values.yaml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
global:
33
imagePullSecrets:
44
# - name: "a-secret-name"
5+
# Labels to be applied to all deployed resources
6+
commonLabels: {}
7+
# Annotations to be applied to all deployed resources
8+
commonAnnotations: {}
59

610
# The IPv4 cidr pool to create on startup if none exists. Pod IPs will be
711
# chosen from this range.
@@ -35,7 +39,7 @@ flannel:
3539
backend: "vxlan"
3640
# Port used by the backend 0 means default value (VXLAN: 8472, Wireguard: 51821, UDP: 8285)
3741
#backendPort: 0
38-
# MTU to use for outgoing packets (VXLAN and Wiregurad) if not defined the MTU of the external interface is used.
42+
# MTU to use for outgoing packets (VXLAN and WireGuard) if not defined the MTU of the external interface is used.
3943
# mtu: 1500
4044
#
4145
# VXLAN Configs:
@@ -49,13 +53,13 @@ flannel:
4953
# MAC prefix to be used on Windows. (Defaults is 0E-2A)
5054
# macPrefix: "0E-2A"
5155
#
52-
# Wireguard Configs:
56+
# WireGuard Configs:
5357
#
5458
# UDP listen port used with IPv6
5559
# backendPortv6: 51821
5660
# Pre shared key to use
5761
# psk: 0
58-
# IP version to use on Wireguard
62+
# IP version to use on WireGuard
5963
# tunnelMode: "separate"
6064
# Persistent keep interval to use
6165
# keepaliveInterval: 0
@@ -94,6 +98,46 @@ flannel:
9498
operator: Exists
9599
nodeSelector: {}
96100

101+
configMap:
102+
# Additional labels to add to the ConfigMap
103+
labels: {}
104+
# Additional annotations to add to the ConfigMap
105+
annotations: {}
106+
107+
# Labels to be applied to the deployed pods
108+
podLabels: {}
109+
# Annotations to be applied to the deployed pods
110+
podAnnotations: {}
111+
112+
daemonSet:
113+
# Additional labels to add to the DaemonSet
114+
labels: {}
115+
# Additional annotations to add to the DaemonSet
116+
annotations: {}
117+
118+
serviceAccount:
119+
# Additional labels to add to the service account
120+
labels: {}
121+
# Additional annotations to add to the service account
122+
annotations: {}
123+
124+
rbac:
125+
# Additional labels to add to all RBAC-related resources
126+
labels: {}
127+
# Additional annotations to add to all RBAC-related resources
128+
annotations: {}
129+
clusterRole:
130+
# Additional labels to add to the ClusterRole
131+
labels: {}
132+
# Additional annotations to add to the ClusterRole
133+
annotations: {}
134+
clusterRoleBinding:
135+
# Additional labels to add to the ClusterRoleBinding
136+
labels: {}
137+
# Additional annotations to add to the ClusterRoleBinding
138+
annotations: {}
139+
140+
97141
netpol:
98142
enabled: false
99143
args:

0 commit comments

Comments
 (0)