Skip to content

Commit 04bd8e1

Browse files
authored
[charts] add support for podLabels and podAnnotations to occm and cinder-csi-plugin charts (#2533)
* feat(occm): add support for podLabels and podAnnotations * fix(csi-cinder-plugin): apply commonAnnotation to all resources needed if we want to be consistent with commonAnnotations defined in the occm chart * feat(cinder-csi-plugin): add support for podLabels and podAnnotations * refactor(occm): define helper template for podAnnotations * refactor(cinder-csi-plugin): define helper templates for podLabels, podAnnotations * Revert "fix(csi-cinder-plugin): apply commonAnnotation to all resources" This reverts commit 7a5bfcd. * fix(cinder-csi-plugin): describe what `commonAnnotations` do * fix/charts: bump versions
1 parent ffd6a76 commit 04bd8e1

File tree

9 files changed

+79
-14
lines changed

9 files changed

+79
-14
lines changed

charts/cinder-csi-plugin/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v1
22
appVersion: v1.31.0
33
description: Cinder CSI Chart for OpenStack
44
name: openstack-cinder-csi
5-
version: 2.31.2
5+
version: 2.31.3
66
home: https://github.com/kubernetes/cloud-provider-openstack
77
icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png
88
maintainers:

charts/cinder-csi-plugin/templates/_helpers.tpl

+41
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ component: controllerplugin
8282
{{ include "cinder-csi.common.metaLabels" . }}
8383
{{- end -}}
8484

85+
{{- define "cinder-csi.controllerplugin.podLabels" -}}
86+
{{ include "cinder-csi.controllerplugin.labels" . }}
87+
{{ if .Values.csi.plugin.controllerPlugin.podLabels }}
88+
{{- toYaml .Values.csi.plugin.controllerPlugin.podLabels }}
89+
{{- end }}
90+
{{- end -}}
91+
8592
{{- define "cinder-csi.nodeplugin.matchLabels" -}}
8693
component: nodeplugin
8794
{{ include "cinder-csi.common.matchLabels" . }}
@@ -92,6 +99,13 @@ component: nodeplugin
9299
{{ include "cinder-csi.common.metaLabels" . }}
93100
{{- end -}}
94101

102+
{{- define "cinder-csi.nodeplugin.podLabels" -}}
103+
{{ include "cinder-csi.nodeplugin.labels" . }}
104+
{{ if .Values.csi.plugin.nodePlugin.podLabels }}
105+
{{- toYaml .Values.csi.plugin.nodePlugin.podLabels }}
106+
{{- end }}
107+
{{- end -}}
108+
95109
{{- define "cinder-csi.snapshot-controller.matchLabels" -}}
96110
component: snapshot-controller
97111
{{ include "cinder-csi.common.matchLabels" . }}
@@ -101,3 +115,30 @@ component: snapshot-controller
101115
{{ include "cinder-csi.snapshot-controller.matchLabels" . }}
102116
{{ include "cinder-csi.common.metaLabels" . }}
103117
{{- end -}}
118+
119+
{{/*
120+
Common annotations
121+
*/}}
122+
{{- define "cinder-csi.annotations" -}}
123+
{{- if .Values.commonAnnotations }}
124+
{{- toYaml .Values.commonAnnotations }}
125+
{{- end }}
126+
{{- end -}}
127+
128+
129+
{{/*
130+
Create unified annotations for cinder-csi components
131+
*/}}
132+
{{- define "cinder-csi.controllerplugin.podAnnotations" -}}
133+
{{ include "cinder-csi.annotations" . }}
134+
{{ if .Values.csi.plugin.controllerPlugin.podAnnotations }}
135+
{{- toYaml .Values.csi.plugin.controllerPlugin.podAnnotations }}
136+
{{- end }}
137+
{{- end -}}
138+
139+
{{- define "cinder-csi.nodeplugin.podAnnotations" -}}
140+
{{ include "cinder-csi.annotations" . }}
141+
{{ if .Values.csi.plugin.nodePlugin.podAnnotations }}
142+
{{- toYaml .Values.csi.plugin.nodePlugin.podAnnotations }}
143+
{{- end }}
144+
{{- end -}}

charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ spec:
2424
template:
2525
metadata:
2626
labels:
27-
{{- include "cinder-csi.controllerplugin.labels" . | nindent 8 }}
27+
{{- include "cinder-csi.controllerplugin.podLabels" . | nindent 8 }}
2828
annotations:
29-
{{- with .Values.commonAnnotations }}
30-
{{- toYaml . | nindent 8 }}
31-
{{- end }}
29+
{{- include "cinder-csi.controllerplugin.podAnnotations" . | nindent 8 }}
3230
spec:
3331
serviceAccount: csi-cinder-controller-sa
3432
securityContext:

charts/cinder-csi-plugin/templates/nodeplugin-daemonset.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ spec:
1616
template:
1717
metadata:
1818
labels:
19-
{{- include "cinder-csi.nodeplugin.labels" . | nindent 8 }}
19+
{{- include "cinder-csi.nodeplugin.podLabels" . | nindent 8 }}
2020
annotations:
21-
{{- with .Values.commonAnnotations }}
22-
{{- toYaml . | nindent 8 }}
23-
{{- end }}
21+
{{- include "cinder-csi.nodeplugin.podAnnotations" . | nindent 8 }}
2422
spec:
2523
serviceAccount: csi-cinder-node-sa
2624
hostNetwork: true

charts/cinder-csi-plugin/values.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ csi:
7676
readOnly: true
7777
nodePlugin:
7878
dnsPolicy: ClusterFirstWithHostNet
79+
# Optional additional annotations to add to the nodePlugin Pods.
80+
podAnnotations: {}
81+
# Optional additional labels to add to the nodePlugin Pods.
82+
podLabels: {}
7983
podSecurityContext: {}
8084
securityContext: {}
8185
# capabilities:
@@ -106,6 +110,10 @@ csi:
106110
# maxSurge is the maximum number of pods that can be
107111
# created over the desired number of pods.
108112
maxSurge: 1
113+
# Optional additional annotations to add to the controllerPlugin Pods.
114+
podAnnotations: {}
115+
# Optional additional labels to add to the controllerPlugin Pods.
116+
podLabels: {}
109117
podSecurityContext: {}
110118
# runAsNonRoot: true
111119
# runAsUser: 65532
@@ -204,5 +212,5 @@ priorityClassName: ""
204212
imagePullSecrets: []
205213
# - name: my-imagepull-secret
206214

207-
# add annotations to all pods
215+
# add annotations to all pods, deployment, daemonset and podmonitor
208216
commonAnnotations: {}

charts/openstack-cloud-controller-manager/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Openstack Cloud Controller Manager Helm Chart
44
icon: https://object-storage-ca-ymq-1.vexxhost.net/swift/v1/6e4619c416ff4bd19e1c087f27a43eea/www-images-prod/openstack-logo/OpenStack-Logo-Vertical.png
55
home: https://github.com/kubernetes/cloud-provider-openstack
66
name: openstack-cloud-controller-manager
7-
version: 2.31.0
7+
version: 2.31.1
88
maintainers:
99
- name: eumel8
1010
email: f.kloeker@telekom.de

charts/openstack-cloud-controller-manager/templates/_helpers.tpl

+16
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,24 @@ component: controllermanager
3030
{{- define "occm.controllermanager.labels" -}}
3131
{{ include "occm.controllermanager.matchLabels" . }}
3232
{{ include "occm.common.metaLabels" . }}
33+
{{ if .Values.podLabels }}
34+
{{- toYaml .Values.podLabels }}
35+
{{- end }}
36+
{{- end -}}
37+
38+
{{/*
39+
Common annotations and pod annotations
40+
*/}}
41+
{{- define "occm.controllermanager.annotations" -}}
42+
{{- if .Values.commonAnnotations }}
43+
{{- toYaml .Values.commonAnnotations }}
44+
{{- end }}
45+
{{ if .Values.podAnnotations }}
46+
{{- toYaml .Values.podAnnotations }}
47+
{{- end }}
3348
{{- end -}}
3449

50+
3551
{{/*
3652
Create cloud-config makro.
3753
*/}}

charts/openstack-cloud-controller-manager/templates/daemonset.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ spec:
1818
metadata:
1919
annotations:
2020
checksum/config: {{ include "cloudConfig" . | sha256sum }}
21-
{{- with .Values.commonAnnotations }}
22-
{{- toYaml . | nindent 8 }}
23-
{{- end }}
21+
{{- include "occm.controllermanager.annotations" . | nindent 8 }}
2422
labels:
2523
{{- include "occm.controllermanager.labels" . | nindent 8 }}
2624
spec:

charts/openstack-cloud-controller-manager/values.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ tolerations:
6161
- key: node-role.kubernetes.io/control-plane
6262
effect: NoSchedule
6363

64+
# Optional additional annotations to add to the controller Pods.
65+
podAnnotations: {}
66+
67+
# Optional additional labels to add to the controller Pods.
68+
podLabels: {}
69+
6470
# Set security settings for the controller pods
6571
# For all available options, see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#podsecuritycontext-v1-core
6672
podSecurityContext:

0 commit comments

Comments
 (0)