Skip to content

Commit

Permalink
fix(csi-cinder-plugin): apply commonAnnotation to all resources
Browse files Browse the repository at this point in the history
needed if we want to be consistent with commonAnnotations defined in the occm chart
  • Loading branch information
roehlc committed Jul 22, 2024
1 parent 463b380 commit f349a95
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 5 deletions.
4 changes: 4 additions & 0 deletions charts/cinder-csi-plugin/templates/cinder-csi-driver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: cinder.csi.openstack.org
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
36 changes: 36 additions & 0 deletions charts/cinder-csi-plugin/templates/controllerplugin-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ kind: ServiceAccount
metadata:
name: csi-cinder-controller-sa
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-attacher-role
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
Expand All @@ -32,6 +40,10 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-attacher-binding
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: csi-cinder-controller-sa
Expand All @@ -46,6 +58,10 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-provisioner-role
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
Expand Down Expand Up @@ -79,6 +95,10 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-provisioner-binding
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: csi-cinder-controller-sa
Expand All @@ -93,6 +113,10 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-snapshotter-role
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- apiGroups: [""]
resources: ["events"]
Expand Down Expand Up @@ -121,6 +145,10 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-snapshotter-binding
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: csi-cinder-controller-sa
Expand All @@ -134,6 +162,10 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-resizer-role
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
# The following rule should be uncommented for plugins that require secrets
# for provisioning.
Expand Down Expand Up @@ -163,6 +195,10 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-resizer-binding
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: csi-cinder-controller-sa
Expand Down
12 changes: 12 additions & 0 deletions charts/cinder-csi-plugin/templates/nodeplugin-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ kind: ServiceAccount
metadata:
name: csi-cinder-node-sa
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-nodeplugin-role
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- apiGroups: [""]
resources: ["events"]
Expand All @@ -18,6 +26,10 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-nodeplugin-binding
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: csi-cinder-node-sa
Expand Down
4 changes: 4 additions & 0 deletions charts/cinder-csi-plugin/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ kind: Secret
metadata:
name: {{ .Values.secret.name }}
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
type: Opaque
stringData:
{{ .Values.secret.data | toYaml | trimSuffix "\n" | nindent 2 }}
Expand Down
14 changes: 10 additions & 4 deletions charts/cinder-csi-plugin/templates/storageclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-cinder-sc-delete
{{- if .Values.storageClass.delete.isDefault }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.storageClass.delete.isDefault }}
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
{{- end }}
provisioner: cinder.csi.openstack.org
reclaimPolicy: Delete
allowVolumeExpansion: {{ .Values.storageClass.delete.allowVolumeExpansion }}
Expand All @@ -15,10 +18,13 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-cinder-sc-retain
{{- if .Values.storageClass.retain.isDefault }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.storageClass.retain.isDefault }}
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
{{- end }}
provisioner: cinder.csi.openstack.org
reclaimPolicy: Retain
allowVolumeExpansion: {{ .Values.storageClass.retain.allowVolumeExpansion }}
Expand Down
2 changes: 1 addition & 1 deletion charts/cinder-csi-plugin/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,5 @@ priorityClassName: ""
imagePullSecrets: []
# - name: my-imagepull-secret

# add annotations to all pods
## Annotations to apply to all resources
commonAnnotations: {}

0 comments on commit f349a95

Please sign in to comment.