Skip to content

Commit

Permalink
Merge pull request #6 from roehlc/feat/occm-csi-cinder/podLabels-podA…
Browse files Browse the repository at this point in the history
…nnotations

[charts] add support for podLabels and podAnnotations to occm and cinder-csi-plugin charts
  • Loading branch information
roehlc authored Aug 20, 2024
2 parents aa6c521 + 1a5b42c commit 358462c
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 12 deletions.
41 changes: 41 additions & 0 deletions charts/cinder-csi-plugin/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ component: controllerplugin
{{ include "cinder-csi.common.metaLabels" . }}
{{- end -}}

{{- define "cinder-csi.controllerplugin.podLabels" -}}
{{ include "cinder-csi.controllerplugin.labels" . }}
{{ if .Values.csi.plugin.controllerPlugin.podLabels }}
{{- toYaml .Values.csi.plugin.controllerPlugin.podLabels }}
{{- end }}
{{- end -}}

{{- define "cinder-csi.nodeplugin.matchLabels" -}}
component: nodeplugin
{{ include "cinder-csi.common.matchLabels" . }}
Expand All @@ -92,6 +99,13 @@ component: nodeplugin
{{ include "cinder-csi.common.metaLabels" . }}
{{- end -}}

{{- define "cinder-csi.nodeplugin.podLabels" -}}
{{ include "cinder-csi.nodeplugin.labels" . }}
{{ if .Values.csi.plugin.nodePlugin.podLabels }}
{{- toYaml .Values.csi.plugin.nodePlugin.podLabels }}
{{- end }}
{{- end -}}

{{- define "cinder-csi.snapshot-controller.matchLabels" -}}
component: snapshot-controller
{{ include "cinder-csi.common.matchLabels" . }}
Expand All @@ -101,3 +115,30 @@ component: snapshot-controller
{{ include "cinder-csi.snapshot-controller.matchLabels" . }}
{{ include "cinder-csi.common.metaLabels" . }}
{{- end -}}

{{/*
Common annotations
*/}}
{{- define "cinder-csi.annotations" -}}
{{- if .Values.commonAnnotations }}
{{- toYaml .Values.commonAnnotations }}
{{- end }}
{{- end -}}


{{/*
Create unified annotations for cinder-csi components
*/}}
{{- define "cinder-csi.controllerplugin.podAnnotations" -}}
{{ include "cinder-csi.annotations" . }}
{{ if .Values.csi.plugin.controllerPlugin.podAnnotations }}
{{- toYaml .Values.csi.plugin.controllerPlugin.podAnnotations }}
{{- end }}
{{- end -}}

{{- define "cinder-csi.nodeplugin.podAnnotations" -}}
{{ include "cinder-csi.annotations" . }}
{{ if .Values.csi.plugin.nodePlugin.podAnnotations }}
{{- toYaml .Values.csi.plugin.nodePlugin.podAnnotations }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ spec:
template:
metadata:
labels:
{{- include "cinder-csi.controllerplugin.labels" . | nindent 8 }}
{{- include "cinder-csi.controllerplugin.podLabels" . | nindent 8 }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "cinder-csi.controllerplugin.podAnnotations" . | nindent 8 }}
spec:
serviceAccount: csi-cinder-controller-sa
securityContext:
Expand Down
6 changes: 2 additions & 4 deletions charts/cinder-csi-plugin/templates/nodeplugin-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ spec:
template:
metadata:
labels:
{{- include "cinder-csi.nodeplugin.labels" . | nindent 8 }}
{{- include "cinder-csi.nodeplugin.podLabels" . | nindent 8 }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "cinder-csi.nodeplugin.podAnnotations" . | nindent 8 }}
spec:
serviceAccount: csi-cinder-node-sa
hostNetwork: true
Expand Down
10 changes: 9 additions & 1 deletion charts/cinder-csi-plugin/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ csi:
readOnly: true
nodePlugin:
dnsPolicy: ClusterFirstWithHostNet
# Optional additional annotations to add to the nodePlugin Pods.
podAnnotations: {}
# Optional additional labels to add to the nodePlugin Pods.
podLabels: {}
podSecurityContext: {}
securityContext: {}
# capabilities:
Expand Down Expand Up @@ -106,6 +110,10 @@ csi:
# maxSurge is the maximum number of pods that can be
# created over the desired number of pods.
maxSurge: 1
# Optional additional annotations to add to the controllerPlugin Pods.
podAnnotations: {}
# Optional additional labels to add to the controllerPlugin Pods.
podLabels: {}
podSecurityContext: {}
# runAsNonRoot: true
# runAsUser: 65532
Expand Down Expand Up @@ -204,5 +212,5 @@ priorityClassName: ""
imagePullSecrets: []
# - name: my-imagepull-secret

# add annotations to all pods
# add annotations to all pods, deployment, daemonset and podmonitor
commonAnnotations: {}
16 changes: 16 additions & 0 deletions charts/openstack-cloud-controller-manager/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,24 @@ component: controllermanager
{{- define "occm.controllermanager.labels" -}}
{{ include "occm.controllermanager.matchLabels" . }}
{{ include "occm.common.metaLabels" . }}
{{ if .Values.podLabels }}
{{- toYaml .Values.podLabels }}
{{- end }}
{{- end -}}

{{/*
Common annotations and pod annotations
*/}}
{{- define "occm.controllermanager.annotations" -}}
{{- if .Values.commonAnnotations }}
{{- toYaml .Values.commonAnnotations }}
{{- end }}
{{ if .Values.podAnnotations }}
{{- toYaml .Values.podAnnotations }}
{{- end }}
{{- end -}}


{{/*
Create cloud-config makro.
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ spec:
metadata:
annotations:
checksum/config: {{ include "cloudConfig" . | sha256sum }}
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "occm.controllermanager.annotations" . | nindent 8 }}
labels:
{{- include "occm.controllermanager.labels" . | nindent 8 }}
spec:
Expand Down
6 changes: 6 additions & 0 deletions charts/openstack-cloud-controller-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ tolerations:
- key: node-role.kubernetes.io/control-plane
effect: NoSchedule

# Optional additional annotations to add to the controller Pods.
podAnnotations: {}

# Optional additional labels to add to the controller Pods.
podLabels: {}

# Set security settings for the controller pods
# For all available options, see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#podsecuritycontext-v1-core
podSecurityContext:
Expand Down

0 comments on commit 358462c

Please sign in to comment.