Skip to content

Commit af36bb7

Browse files
Jonatan Redondojonitich
Jonatan Redondo
authored andcommitted
Adapt labels to kubernetes recommended ones
1 parent 251508d commit af36bb7

7 files changed

+37
-8
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ Create chart name and version as used by the chart label.
3535
Common labels
3636
*/}}
3737
{{- define "cinder-csi.labels" -}}
38-
app.kubernetes.io/name: {{ include "cinder-csi.name" . }}
3938
helm.sh/chart: {{ include "cinder-csi.chart" . }}
40-
app.kubernetes.io/instance: {{ .Release.Name }}
4139
{{- if .Chart.AppVersion }}
4240
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4341
{{- end }}
@@ -60,13 +58,13 @@ Create the name of the service account to use
6058
Create unified labels for cinder-csi components
6159
*/}}
6260
{{- define "cinder-csi.common.matchLabels" -}}
63-
app: {{ template "cinder-csi.name" . }}
64-
release: {{ .Release.Name }}
61+
app.kubernetes.io/name: {{ include "cinder-csi.name" . }}
62+
app.kubernetes.io/instance: {{ .Release.Name }}
6563
{{- end -}}
6664

6765
{{- define "cinder-csi.common.metaLabels" -}}
68-
chart: {{ template "cinder-csi.chart" . }}
69-
heritage: {{ .Release.Service }}
66+
helm.sh/chart: {{ template "cinder-csi.chart" . }}
67+
app.kubernetes.io/managed-by: {{ .Release.Service }}
7068
{{- if .Values.extraLabels }}
7169
{{ toYaml .Values.extraLabels -}}
7270
{{- end }}
@@ -79,7 +77,7 @@ component: controllerplugin
7977

8078
{{- define "cinder-csi.controllerplugin.labels" -}}
8179
{{ include "cinder-csi.controllerplugin.matchLabels" . }}
82-
{{ include "cinder-csi.common.metaLabels" . }}
80+
{{ include "cinder-csi.labels" . }}
8381
{{- end -}}
8482

8583
{{- define "cinder-csi.controllerplugin.podLabels" -}}
@@ -96,7 +94,7 @@ component: nodeplugin
9694

9795
{{- define "cinder-csi.nodeplugin.labels" -}}
9896
{{ include "cinder-csi.nodeplugin.matchLabels" . }}
99-
{{ include "cinder-csi.common.metaLabels" . }}
97+
{{ include "cinder-csi.labels" . }}
10098
{{- end -}}
10199

102100
{{- define "cinder-csi.nodeplugin.podLabels" -}}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ apiVersion: storage.k8s.io/v1
22
kind: CSIDriver
33
metadata:
44
name: cinder.csi.openstack.org
5+
labels:
6+
{{- include "cinder-csi.labels" . | nindent 4 }}
57
spec:
68
attachRequired: true
79
podInfoOnMount: true

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ kind: PodMonitor
44
metadata:
55
labels:
66
{{- include "cinder-csi.controllerplugin.labels" . | nindent 4 }}
7+
{{- include "cinder-csi.labels" . | nindent 4 }}
78
{{- if .Values.csi.plugin.podMonitor.additionalLabels }}
89
{{- toYaml .Values.csi.plugin.podMonitor.additionalLabels | nindent 4 }}
910
{{- end }}

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ kind: ServiceAccount
66
metadata:
77
name: csi-cinder-controller-sa
88
namespace: {{ .Release.Namespace }}
9+
labels:
10+
{{- include "cinder-csi.controllerplugin.labels" . | nindent 4 }}
911
---
1012
kind: ClusterRole
1113
apiVersion: rbac.authorization.k8s.io/v1
1214
metadata:
1315
name: csi-attacher-role
16+
labels:
17+
{{- include "cinder-csi.labels" . | nindent 4 }}
1418
rules:
1519
- apiGroups: [""]
1620
resources: ["persistentvolumes"]
@@ -32,6 +36,8 @@ kind: ClusterRoleBinding
3236
apiVersion: rbac.authorization.k8s.io/v1
3337
metadata:
3438
name: csi-attacher-binding
39+
labels:
40+
{{- include "cinder-csi.labels" . | nindent 4 }}
3541
subjects:
3642
- kind: ServiceAccount
3743
name: csi-cinder-controller-sa
@@ -46,6 +52,8 @@ kind: ClusterRole
4652
apiVersion: rbac.authorization.k8s.io/v1
4753
metadata:
4854
name: csi-provisioner-role
55+
labels:
56+
{{- include "cinder-csi.labels" . | nindent 4 }}
4957
rules:
5058
- apiGroups: [""]
5159
resources: ["persistentvolumes"]
@@ -79,6 +87,8 @@ kind: ClusterRoleBinding
7987
apiVersion: rbac.authorization.k8s.io/v1
8088
metadata:
8189
name: csi-provisioner-binding
90+
labels:
91+
{{- include "cinder-csi.labels" . | nindent 4 }}
8292
subjects:
8393
- kind: ServiceAccount
8494
name: csi-cinder-controller-sa
@@ -93,6 +103,8 @@ kind: ClusterRole
93103
apiVersion: rbac.authorization.k8s.io/v1
94104
metadata:
95105
name: csi-snapshotter-role
106+
labels:
107+
{{- include "cinder-csi.labels" . | nindent 4 }}
96108
rules:
97109
- apiGroups: [""]
98110
resources: ["events"]
@@ -121,6 +133,8 @@ kind: ClusterRoleBinding
121133
apiVersion: rbac.authorization.k8s.io/v1
122134
metadata:
123135
name: csi-snapshotter-binding
136+
labels:
137+
{{- include "cinder-csi.labels" . | nindent 4 }}
124138
subjects:
125139
- kind: ServiceAccount
126140
name: csi-cinder-controller-sa
@@ -134,6 +148,8 @@ kind: ClusterRole
134148
apiVersion: rbac.authorization.k8s.io/v1
135149
metadata:
136150
name: csi-resizer-role
151+
labels:
152+
{{- include "cinder-csi.labels" . | nindent 4 }}
137153
rules:
138154
# The following rule should be uncommented for plugins that require secrets
139155
# for provisioning.
@@ -163,6 +179,8 @@ kind: ClusterRoleBinding
163179
apiVersion: rbac.authorization.k8s.io/v1
164180
metadata:
165181
name: csi-resizer-binding
182+
labels:
183+
{{- include "cinder-csi.labels" . | nindent 4 }}
166184
subjects:
167185
- kind: ServiceAccount
168186
name: csi-cinder-controller-sa

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ kind: ServiceAccount
33
metadata:
44
name: csi-cinder-node-sa
55
namespace: {{ .Release.Namespace }}
6+
labels:
7+
{{- include "cinder-csi.labels" . | nindent 4 }}
68
---
79
kind: ClusterRole
810
apiVersion: rbac.authorization.k8s.io/v1
911
metadata:
1012
name: csi-nodeplugin-role
13+
labels:
14+
{{- include "cinder-csi.labels" . | nindent 4 }}
1115
rules:
1216
- apiGroups: [""]
1317
resources: ["events"]
@@ -18,6 +22,8 @@ kind: ClusterRoleBinding
1822
apiVersion: rbac.authorization.k8s.io/v1
1923
metadata:
2024
name: csi-nodeplugin-binding
25+
labels:
26+
{{- include "cinder-csi.labels" . | nindent 4 }}
2127
subjects:
2228
- kind: ServiceAccount
2329
name: csi-cinder-node-sa

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ kind: Secret
44
metadata:
55
name: {{ .Values.secret.name }}
66
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "cinder-csi.labels" . | nindent 4 }}
79
type: Opaque
810
stringData:
911
{{ .Values.secret.data | toYaml | trimSuffix "\n" | nindent 2 }}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ metadata:
77
annotations:
88
storageclass.kubernetes.io/is-default-class: "true"
99
{{- end }}
10+
labels:
11+
{{- include "cinder-csi.labels" . | nindent 4 }}
1012
provisioner: cinder.csi.openstack.org
1113
reclaimPolicy: Delete
1214
allowVolumeExpansion: {{ .Values.storageClass.delete.allowVolumeExpansion }}

0 commit comments

Comments
 (0)