Skip to content

Align Cinder-plugin Helm Chart Labels with recommended ones by K8s. #2855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions charts/cinder-csi-plugin/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ Create chart name and version as used by the chart label.
Common labels
*/}}
{{- define "cinder-csi.labels" -}}
app.kubernetes.io/name: {{ include "cinder-csi.name" . }}
helm.sh/chart: {{ include "cinder-csi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -60,13 +58,13 @@ Create the name of the service account to use
Create unified labels for cinder-csi components
*/}}
{{- define "cinder-csi.common.matchLabels" -}}
app: {{ template "cinder-csi.name" . }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "cinder-csi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{- define "cinder-csi.common.metaLabels" -}}
chart: {{ template "cinder-csi.chart" . }}
heritage: {{ .Release.Service }}
helm.sh/chart: {{ template "cinder-csi.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{ toYaml .Values.extraLabels -}}
{{- end }}
Expand All @@ -79,7 +77,7 @@ component: controllerplugin

{{- define "cinder-csi.controllerplugin.labels" -}}
{{ include "cinder-csi.controllerplugin.matchLabels" . }}
{{ include "cinder-csi.common.metaLabels" . }}
{{ include "cinder-csi.labels" . }}
{{- end -}}

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

{{- define "cinder-csi.nodeplugin.labels" -}}
{{ include "cinder-csi.nodeplugin.matchLabels" . }}
{{ include "cinder-csi.common.metaLabels" . }}
{{ include "cinder-csi.labels" . }}
{{- end -}}

{{- define "cinder-csi.nodeplugin.podLabels" -}}
Expand Down
2 changes: 2 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,8 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: cinder.csi.openstack.org
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
spec:
attachRequired: true
podInfoOnMount: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ kind: PodMonitor
metadata:
labels:
{{- include "cinder-csi.controllerplugin.labels" . | nindent 4 }}
{{- include "cinder-csi.labels" . | nindent 4 }}
{{- if .Values.csi.plugin.podMonitor.additionalLabels }}
{{- toYaml .Values.csi.plugin.podMonitor.additionalLabels | nindent 4 }}
{{- end }}
Expand Down
18 changes: 18 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,15 @@ kind: ServiceAccount
metadata:
name: csi-cinder-controller-sa
namespace: {{ .Release.Namespace }}
labels:
{{- include "cinder-csi.controllerplugin.labels" . | nindent 4 }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-attacher-role
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
Expand All @@ -32,6 +36,8 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-attacher-binding
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: csi-cinder-controller-sa
Expand All @@ -46,6 +52,8 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-provisioner-role
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
Expand Down Expand Up @@ -79,6 +87,8 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-provisioner-binding
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: csi-cinder-controller-sa
Expand All @@ -93,6 +103,8 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-snapshotter-role
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["events"]
Expand Down Expand Up @@ -121,6 +133,8 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-snapshotter-binding
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: csi-cinder-controller-sa
Expand All @@ -134,6 +148,8 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-resizer-role
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
rules:
# The following rule should be uncommented for plugins that require secrets
# for provisioning.
Expand Down Expand Up @@ -163,6 +179,8 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-resizer-binding
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: csi-cinder-controller-sa
Expand Down
6 changes: 6 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,15 @@ kind: ServiceAccount
metadata:
name: csi-cinder-node-sa
namespace: {{ .Release.Namespace }}
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-nodeplugin-role
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["events"]
Expand All @@ -18,6 +22,8 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-nodeplugin-binding
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: csi-cinder-node-sa
Expand Down
2 changes: 2 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,8 @@ kind: Secret
metadata:
name: {{ .Values.secret.name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
type: Opaque
stringData:
{{ .Values.secret.data | toYaml | trimSuffix "\n" | nindent 2 }}
Expand Down
2 changes: 2 additions & 0 deletions charts/cinder-csi-plugin/templates/storageclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ metadata:
annotations:
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
labels:
{{- include "cinder-csi.labels" . | nindent 4 }}
provisioner: cinder.csi.openstack.org
reclaimPolicy: Delete
allowVolumeExpansion: {{ .Values.storageClass.delete.allowVolumeExpansion }}
Expand Down
Loading