Skip to content

Commit

Permalink
build: create resources with k8s recommended labels
Browse files Browse the repository at this point in the history
Adding Recommended Labels on the rook resources,
for better visuals and management of k8s object

Closes: rook#8400
Signed-off-by: parth-gr <paarora@redhat.com>
  • Loading branch information
parth-gr committed Sep 15, 2021
1 parent 235d5a3 commit 55bb69f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
12 changes: 12 additions & 0 deletions cluster/charts/rook-ceph/templates/_helpers.tpl
Expand Up @@ -24,3 +24,15 @@ imagePullSecrets:
{{ toYaml .Values.imagePullSecrets }}
{{- end -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "rook-ceph.labels" -}}
app.kubernetes.io/name: rook-ceph
app.kubernetes.io/instance: rook-ceph
app.kubernetes.io/component: csi
app.kubernetes.io/part-of: rook-ceph
app.kubernetes.io/managed-by: rook-ceph-operator
app.kubernetes.io/created-by: rook-ceph-operator
{{- end -}}
3 changes: 2 additions & 1 deletion cluster/charts/rook-ceph/templates/clusterrole.yaml
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
{{- include "rook-ceph.labels" . | nindent 4 }}
rules:
# Most resources are represented by a string representation of their name, such as “pods”, just as it appears in the URL for the relevant API endpoint.
# However, some Kubernetes APIs involve a “subresource”, such as the logs for a pod. [...]
Expand Down Expand Up @@ -460,7 +461,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
rules:
- apiGroups:
- policy
Expand Down
8 changes: 4 additions & 4 deletions cluster/charts/rook-ceph/templates/clusterrolebinding.yaml
Expand Up @@ -23,7 +23,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down Expand Up @@ -122,7 +122,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -140,7 +140,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -157,7 +157,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
4 changes: 2 additions & 2 deletions cluster/charts/rook-ceph/templates/deployment.yaml
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
spec:
replicas: 1
selector:
Expand All @@ -15,7 +15,7 @@ spec:
metadata:
labels:
app: rook-ceph-operator
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
{{- if .Values.annotations }}
annotations:
{{ toYaml .Values.annotations | indent 8 }}
Expand Down
8 changes: 4 additions & 4 deletions cluster/charts/rook-ceph/templates/serviceaccount.yaml
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
{{ template "imagePullSecrets" . }}
---
# Service account for the Ceph OSDs. Must exist and cannot be renamed.
Expand All @@ -19,7 +19,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
{{ template "imagePullSecrets" . }}
---
# Service account for the Ceph Mgr. Must exist and cannot be renamed.
Expand All @@ -31,7 +31,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
{{ template "imagePullSecrets" . }}
---
apiVersion: v1
Expand All @@ -42,7 +42,7 @@ metadata:
labels:
operator: rook
storage-backend: ceph
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
{{ template "imagePullSecrets" . }}
---
# Service account for the cephfs csi driver
Expand Down

0 comments on commit 55bb69f

Please sign in to comment.