Skip to content

Commit 00fbc3d

Browse files
simonostendorfmandre
authored andcommitted
[cinder-csi-plugin] enable secret injection and common annotations (kubernetes#2264)
* feat(cinder-csi): enable secret injection and common annotations * fix(cinder-csi): default secret value hostMount * fix(cinder-csi): pod annotations * fix(cinder-csi): pod annotations * fix(cinder-csi): values typo
1 parent 7dab2db commit 00fbc3d

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ metadata:
55
namespace: {{ .Release.Namespace }}
66
labels:
77
{{- include "cinder-csi.controllerplugin.labels" . | nindent 4 }}
8+
annotations:
9+
{{- with .Values.commonAnnotations }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
812
spec:
913
replicas: {{ .Values.csi.plugin.controllerPlugin.replicas }}
1014
strategy:
@@ -21,6 +25,10 @@ spec:
2125
metadata:
2226
labels:
2327
{{- include "cinder-csi.controllerplugin.labels" . | nindent 8 }}
28+
annotations:
29+
{{- with .Values.commonAnnotations }}
30+
{{- toYaml . | nindent 8 }}
31+
{{- end }}
2432
spec:
2533
serviceAccount: csi-cinder-controller-sa
2634
containers:
@@ -169,11 +177,13 @@ spec:
169177
volumes:
170178
- name: socket-dir
171179
emptyDir:
172-
- name: cloud-config
173180
{{- if .Values.secret.enabled }}
181+
- name: cloud-config
174182
secret:
175183
secretName: {{ .Values.secret.name }}
176-
{{- else }}
184+
{{- end }}
185+
{{- if .Values.secret.hostMount }}
186+
- name: cloud-config
177187
hostPath:
178188
path: /etc/kubernetes
179189
{{- end }}

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ metadata:
55
namespace: {{ .Release.Namespace }}
66
labels:
77
{{- include "cinder-csi.nodeplugin.labels" . | nindent 4 }}
8+
annotations:
9+
{{- with .Values.commonAnnotations }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
812
spec:
913
selector:
1014
matchLabels:
@@ -13,6 +17,10 @@ spec:
1317
metadata:
1418
labels:
1519
{{- include "cinder-csi.nodeplugin.labels" . | nindent 8 }}
20+
annotations:
21+
{{- with .Values.commonAnnotations }}
22+
{{- toYaml . | nindent 8 }}
23+
{{- end }}
1624
spec:
1725
serviceAccount: csi-cinder-node-sa
1826
hostNetwork: true
@@ -127,11 +135,13 @@ spec:
127135
hostPath:
128136
path: /dev
129137
type: Directory
130-
- name: cloud-config
131138
{{- if .Values.secret.enabled }}
139+
- name: cloud-config
132140
secret:
133141
secretName: {{ .Values.secret.name }}
134-
{{- else }}
142+
{{- end }}
143+
{{- if .Values.secret.hostMount }}
144+
- name: cloud-config
135145
hostPath:
136146
path: /etc/kubernetes
137147
{{- end }}

charts/cinder-csi-plugin/templates/secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.secret.create }}
1+
{{- if and (.Values.secret.create) (.Values.secret.enabled) }}
22
apiVersion: v1
33
kind: Secret
44
metadata:

charts/cinder-csi-plugin/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,15 @@ csi:
9898
# for description of individual verbosity levels.
9999
logVerbosityLevel: 2
100100

101+
# the secret should contain the openstack credentials
102+
# there are several options to inject the credentials:
103+
# 1) from kubernetes secret that doesn't exist: set "enabled" and "create" to true, this will create a secret from the values written to "data" down below
104+
# 2) from kubernetes secret that already exists: set "enabled" to true and "create" to false
105+
# 3) from host system path /etc/cloud/cloud.conf: set "enabled" to false and "hostMount" to true
106+
# 4) via agent-injector (e.g. hashicorp vault): set "enabled" and "hostMount" to false, you have to provide credentials on your own by injecting credentials into the pod
101107
secret:
102108
enabled: false
109+
hostMount: true
103110
create: false
104111
filename: cloud.conf
105112
# name: cinder-csi-cloud-config
@@ -149,3 +156,6 @@ priorityClassName: ""
149156

150157
imagePullSecrets: []
151158
# - name: my-imagepull-secret
159+
160+
# add annotations to all pods
161+
commonAnnotations: {}

0 commit comments

Comments
 (0)