From e9c2291f8c8dd54fe70241f583d22a7ad00b57e6 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Wed, 30 Jun 2021 18:51:58 +0200 Subject: [PATCH 01/13] Add: refactoring kubernetes recommanded labels Signed-off-by: Nicolas Lamirault --- charts/velero/templates/_helpers.tpl | 26 +++++++++++++++++++ .../templates/backupstoragelocation.yaml | 5 +--- charts/velero/templates/cleanup-crds.yaml | 5 +--- .../velero/templates/clusterrolebinding.yaml | 6 +---- charts/velero/templates/configmaps.yaml | 5 +--- charts/velero/templates/deployment.yaml | 11 ++------ charts/velero/templates/restic-daemonset.yaml | 5 +--- charts/velero/templates/role.yaml | 6 +---- charts/velero/templates/rolebinding.yaml | 6 +---- charts/velero/templates/schedule.yaml | 5 +--- charts/velero/templates/secret.yaml | 5 +--- charts/velero/templates/service.yaml | 5 +--- .../templates/serviceaccount-server.yaml | 5 +--- charts/velero/templates/servicemonitor.yaml | 5 +--- charts/velero/templates/upgrade-crds.yaml | 5 +--- .../templates/volumesnapshotlocation.yaml | 5 +--- charts/velero/values.yaml | 4 +++ 17 files changed, 46 insertions(+), 68 deletions(-) diff --git a/charts/velero/templates/_helpers.tpl b/charts/velero/templates/_helpers.tpl index 6879678e..c52c179a 100644 --- a/charts/velero/templates/_helpers.tpl +++ b/charts/velero/templates/_helpers.tpl @@ -42,6 +42,32 @@ Create the name of the service account to use for creating or deleting the veler {{- end -}} {{- end -}} +{{/* +Generate basic labels +*/}} +{{- define "velero.labels" }} +helm.sh/chart: {{ include "velero.chart" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +app.kubernetes.io/component: metrics +app.kubernetes.io/part-of: {{ template "velero.name" . }} +{{- include "velero.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels }} +{{- end }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "velero.selectorLabels" }} +app.kubernetes.io/name: {{ include "velero.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + + {{/* Create the name for the credentials secret. */}} diff --git a/charts/velero/templates/backupstoragelocation.yaml b/charts/velero/templates/backupstoragelocation.yaml index 1a1a8039..05ad94fe 100644 --- a/charts/velero/templates/backupstoragelocation.yaml +++ b/charts/velero/templates/backupstoragelocation.yaml @@ -7,10 +7,7 @@ metadata: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} spec: provider: {{ include "velero.backupStorageLocation.provider" . }} {{- with .Values.configuration.backupStorageLocation.default }} diff --git a/charts/velero/templates/cleanup-crds.yaml b/charts/velero/templates/cleanup-crds.yaml index d8728150..499bcec9 100644 --- a/charts/velero/templates/cleanup-crds.yaml +++ b/charts/velero/templates/cleanup-crds.yaml @@ -10,10 +10,7 @@ metadata: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} spec: backoffLimit: 3 template: diff --git a/charts/velero/templates/clusterrolebinding.yaml b/charts/velero/templates/clusterrolebinding.yaml index 43c1ccb7..a25bf96c 100644 --- a/charts/velero/templates/clusterrolebinding.yaml +++ b/charts/velero/templates/clusterrolebinding.yaml @@ -4,11 +4,7 @@ kind: ClusterRoleBinding metadata: name: {{ include "velero.fullname" . }}-server labels: - app.kubernetes.io/component: server - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} subjects: - kind: ServiceAccount namespace: {{ .Release.Namespace }} diff --git a/charts/velero/templates/configmaps.yaml b/charts/velero/templates/configmaps.yaml index d090fb18..80237ff8 100644 --- a/charts/velero/templates/configmaps.yaml +++ b/charts/velero/templates/configmaps.yaml @@ -4,10 +4,7 @@ kind: ConfigMap metadata: name: {{ include "velero.fullname" $ }}-{{ $configMapName }} labels: - app.kubernetes.io/name: {{ include "velero.name" $ }} - app.kubernetes.io/instance: {{ $.Release.Name }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - helm.sh/chart: {{ include "velero.chart" $ }} + {{- include "velero.labels" . | indent 4 }} {{- with $configMap.labels }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/velero/templates/deployment.yaml b/charts/velero/templates/deployment.yaml index 88189b21..bca15fb7 100644 --- a/charts/velero/templates/deployment.yaml +++ b/charts/velero/templates/deployment.yaml @@ -11,11 +11,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} - component: velero + {{- include "velero.labels" . | indent 4 }} {{- with .Values.labels }} {{- toYaml . | nindent 4 }} {{- end }} @@ -29,10 +25,7 @@ spec: metadata: labels: name: velero - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} {{- if .Values.podLabels }} {{- toYaml .Values.podLabels | nindent 8 }} {{- end }} diff --git a/charts/velero/templates/restic-daemonset.yaml b/charts/velero/templates/restic-daemonset.yaml index 71b64d8e..4cda6e90 100644 --- a/charts/velero/templates/restic-daemonset.yaml +++ b/charts/velero/templates/restic-daemonset.yaml @@ -11,10 +11,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} {{- with .Values.restic.labels }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/velero/templates/role.yaml b/charts/velero/templates/role.yaml index a5978576..f27c484a 100644 --- a/charts/velero/templates/role.yaml +++ b/charts/velero/templates/role.yaml @@ -4,11 +4,7 @@ kind: Role metadata: name: {{ include "velero.fullname" . }}-server labels: - app.kubernetes.io/component: server - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} rules: - apiGroups: - "*" diff --git a/charts/velero/templates/rolebinding.yaml b/charts/velero/templates/rolebinding.yaml index 0e4e8464..15fa15a1 100644 --- a/charts/velero/templates/rolebinding.yaml +++ b/charts/velero/templates/rolebinding.yaml @@ -4,11 +4,7 @@ kind: RoleBinding metadata: name: {{ include "velero.fullname" . }}-server labels: - app.kubernetes.io/component: server - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} subjects: - kind: ServiceAccount namespace: {{ .Release.Namespace }} diff --git a/charts/velero/templates/schedule.yaml b/charts/velero/templates/schedule.yaml index cebf246b..4f2ae5e8 100644 --- a/charts/velero/templates/schedule.yaml +++ b/charts/velero/templates/schedule.yaml @@ -10,10 +10,7 @@ metadata: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation labels: - app.kubernetes.io/name: {{ include "velero.name" $ }} - app.kubernetes.io/instance: {{ $.Release.Name }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - helm.sh/chart: {{ include "velero.chart" $ }} + {{- include "velero.labels" . | indent 4 }} {{- if $schedule.labels }} {{- toYaml $schedule.labels | nindent 4 }} {{- end }} diff --git a/charts/velero/templates/secret.yaml b/charts/velero/templates/secret.yaml index e3a654e5..9ea17d8c 100644 --- a/charts/velero/templates/secret.yaml +++ b/charts/velero/templates/secret.yaml @@ -4,10 +4,7 @@ kind: Secret metadata: name: {{ include "velero.secretName" . }} labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} type: Opaque data: {{- range $key, $value := .Values.credentials.secretContents }} diff --git a/charts/velero/templates/service.yaml b/charts/velero/templates/service.yaml index ec07dc91..93d59617 100644 --- a/charts/velero/templates/service.yaml +++ b/charts/velero/templates/service.yaml @@ -8,10 +8,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} {{- with .Values.metrics.service.labels }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/velero/templates/serviceaccount-server.yaml b/charts/velero/templates/serviceaccount-server.yaml index e0608dd1..8203c135 100644 --- a/charts/velero/templates/serviceaccount-server.yaml +++ b/charts/velero/templates/serviceaccount-server.yaml @@ -8,10 +8,7 @@ metadata: {{ toYaml .Values.serviceAccount.server.annotations | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} {{- with .Values.serviceAccount.server.labels }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/velero/templates/servicemonitor.yaml b/charts/velero/templates/servicemonitor.yaml index 20297414..81da548f 100644 --- a/charts/velero/templates/servicemonitor.yaml +++ b/charts/velero/templates/servicemonitor.yaml @@ -7,10 +7,7 @@ metadata: namespace: {{ .Values.metrics.serviceMonitor.namespace }} {{- end }} labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} {{- with .Values.metrics.serviceMonitor.additionalLabels }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/velero/templates/upgrade-crds.yaml b/charts/velero/templates/upgrade-crds.yaml index 84ac6b66..a8826b19 100644 --- a/charts/velero/templates/upgrade-crds.yaml +++ b/charts/velero/templates/upgrade-crds.yaml @@ -8,10 +8,7 @@ metadata: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} spec: backoffLimit: 3 template: diff --git a/charts/velero/templates/volumesnapshotlocation.yaml b/charts/velero/templates/volumesnapshotlocation.yaml index 87d1a10f..a37f1ea0 100644 --- a/charts/velero/templates/volumesnapshotlocation.yaml +++ b/charts/velero/templates/volumesnapshotlocation.yaml @@ -7,10 +7,7 @@ metadata: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 4 }} spec: provider: {{ include "velero.volumeSnapshotLocation.provider" . }} {{- with .Values.configuration.volumeSnapshotLocation.config }} diff --git a/charts/velero/values.yaml b/charts/velero/values.yaml index 46dc52a0..d1ab1d84 100644 --- a/charts/velero/values.yaml +++ b/charts/velero/values.yaml @@ -15,6 +15,10 @@ image: imagePullSecrets: [] # - registrySecretName +## Additional labels to add to all resources +customLabels: {} + # app: velero + # Annotations to add to the Velero deployment's. Optional. # # If you are using reloader use the following annotation with your VELERO_SECRET_NAME From a90e32183d03296bbe7c56b6e9607670dfa29a0e Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Wed, 30 Jun 2021 19:12:21 +0200 Subject: [PATCH 02/13] Add: custom annotations Signed-off-by: Nicolas Lamirault --- charts/velero/templates/_helpers.tpl | 1 - charts/velero/templates/backupstoragelocation.yaml | 3 +++ charts/velero/templates/cleanup-crds.yaml | 3 +++ charts/velero/templates/clusterrolebinding.yaml | 4 ++++ charts/velero/templates/configmaps.yaml | 4 ++++ charts/velero/templates/deployment.yaml | 3 +++ charts/velero/templates/restic-daemonset.yaml | 3 +++ charts/velero/templates/role.yaml | 4 ++++ charts/velero/templates/rolebinding.yaml | 4 ++++ charts/velero/templates/schedule.yaml | 3 +++ charts/velero/templates/secret.yaml | 4 ++++ charts/velero/templates/service.yaml | 9 +++++++-- charts/velero/templates/serviceaccount-server.yaml | 4 ++++ charts/velero/templates/servicemonitor.yaml | 4 ++++ charts/velero/templates/upgrade-crds.yaml | 3 +++ charts/velero/templates/volumesnapshotlocation.yaml | 3 +++ charts/velero/values.yaml | 6 +++++- 17 files changed, 61 insertions(+), 4 deletions(-) diff --git a/charts/velero/templates/_helpers.tpl b/charts/velero/templates/_helpers.tpl index c52c179a..584f45fb 100644 --- a/charts/velero/templates/_helpers.tpl +++ b/charts/velero/templates/_helpers.tpl @@ -67,7 +67,6 @@ app.kubernetes.io/name: {{ include "velero.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} - {{/* Create the name for the credentials secret. */}} diff --git a/charts/velero/templates/backupstoragelocation.yaml b/charts/velero/templates/backupstoragelocation.yaml index 05ad94fe..59fdc0f1 100644 --- a/charts/velero/templates/backupstoragelocation.yaml +++ b/charts/velero/templates/backupstoragelocation.yaml @@ -6,6 +6,9 @@ metadata: annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation + {{- if .Values.customAnnotations }} + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} spec: diff --git a/charts/velero/templates/cleanup-crds.yaml b/charts/velero/templates/cleanup-crds.yaml index 499bcec9..c7216eee 100644 --- a/charts/velero/templates/cleanup-crds.yaml +++ b/charts/velero/templates/cleanup-crds.yaml @@ -9,6 +9,9 @@ metadata: annotations: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded + {{- if .Values.customAnnotations }} + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} spec: diff --git a/charts/velero/templates/clusterrolebinding.yaml b/charts/velero/templates/clusterrolebinding.yaml index a25bf96c..6f0c7dfb 100644 --- a/charts/velero/templates/clusterrolebinding.yaml +++ b/charts/velero/templates/clusterrolebinding.yaml @@ -3,6 +3,10 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: {{ include "velero.fullname" . }}-server + {{- if .Values.customAnnotations }} + annotations: + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} subjects: diff --git a/charts/velero/templates/configmaps.yaml b/charts/velero/templates/configmaps.yaml index 80237ff8..d6797260 100644 --- a/charts/velero/templates/configmaps.yaml +++ b/charts/velero/templates/configmaps.yaml @@ -3,6 +3,10 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ include "velero.fullname" $ }}-{{ $configMapName }} + {{- if .Values.customAnnotations }} + annotations: + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} {{- with $configMap.labels }} diff --git a/charts/velero/templates/deployment.yaml b/charts/velero/templates/deployment.yaml index bca15fb7..a90c5943 100644 --- a/charts/velero/templates/deployment.yaml +++ b/charts/velero/templates/deployment.yaml @@ -10,6 +10,9 @@ metadata: annotations: {{- toYaml . | nindent 4 }} {{- end }} + {{- if .Values.customAnnotations }} + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} {{- with .Values.labels }} diff --git a/charts/velero/templates/restic-daemonset.yaml b/charts/velero/templates/restic-daemonset.yaml index 4cda6e90..c9813012 100644 --- a/charts/velero/templates/restic-daemonset.yaml +++ b/charts/velero/templates/restic-daemonset.yaml @@ -10,6 +10,9 @@ metadata: annotations: {{- toYaml . | nindent 4 }} {{- end }} + {{- if .Values.customAnnotations }} + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} {{- with .Values.restic.labels }} diff --git a/charts/velero/templates/role.yaml b/charts/velero/templates/role.yaml index f27c484a..b2e8efda 100644 --- a/charts/velero/templates/role.yaml +++ b/charts/velero/templates/role.yaml @@ -3,6 +3,10 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: {{ include "velero.fullname" . }}-server + {{- if .Values.customAnnotations }} + annotations: + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} rules: diff --git a/charts/velero/templates/rolebinding.yaml b/charts/velero/templates/rolebinding.yaml index 15fa15a1..857a596a 100644 --- a/charts/velero/templates/rolebinding.yaml +++ b/charts/velero/templates/rolebinding.yaml @@ -3,6 +3,10 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: {{ include "velero.fullname" . }}-server + {{- if .Values.customAnnotations }} + annotations: + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} subjects: diff --git a/charts/velero/templates/schedule.yaml b/charts/velero/templates/schedule.yaml index 4f2ae5e8..4c1f96f4 100644 --- a/charts/velero/templates/schedule.yaml +++ b/charts/velero/templates/schedule.yaml @@ -6,6 +6,9 @@ metadata: annotations: {{- if $schedule.annotations }} {{- toYaml $schedule.annotations | nindent 4 }} + {{- end }} + {{- if .Values.customAnnotations }} + {{- toYaml .Values.customAnnotations | nindent 4 }} {{- end }} "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation diff --git a/charts/velero/templates/secret.yaml b/charts/velero/templates/secret.yaml index 9ea17d8c..892d8a59 100644 --- a/charts/velero/templates/secret.yaml +++ b/charts/velero/templates/secret.yaml @@ -3,6 +3,10 @@ apiVersion: v1 kind: Secret metadata: name: {{ include "velero.secretName" . }} + {{- if .Values.customAnnotations }} + annotations: + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} type: Opaque diff --git a/charts/velero/templates/service.yaml b/charts/velero/templates/service.yaml index 93d59617..e487643e 100644 --- a/charts/velero/templates/service.yaml +++ b/charts/velero/templates/service.yaml @@ -3,9 +3,14 @@ apiVersion: v1 kind: Service metadata: name: {{ include "velero.fullname" . }} - {{- with .Values.metrics.service.annotations }} + {{- if or .Values.customAnnotations .Values.metrics.service.annotations }} annotations: - {{- toYaml . | nindent 4 }} + {{- if .Values.metrics.service.annotations }} + {{- toYaml .Values.metrics.service.annotations | nindent 4 }} + {{- end }} + {{- if .Values.customAnnotations }} + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} {{- end }} labels: {{- include "velero.labels" . | indent 4 }} diff --git a/charts/velero/templates/serviceaccount-server.yaml b/charts/velero/templates/serviceaccount-server.yaml index 8203c135..b6b9dfb6 100644 --- a/charts/velero/templates/serviceaccount-server.yaml +++ b/charts/velero/templates/serviceaccount-server.yaml @@ -7,6 +7,10 @@ metadata: annotations: {{ toYaml .Values.serviceAccount.server.annotations | nindent 4 }} {{- end }} + {{- if .Values.customAnnotations }} + annotations: + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} {{- with .Values.serviceAccount.server.labels }} diff --git a/charts/velero/templates/servicemonitor.yaml b/charts/velero/templates/servicemonitor.yaml index 81da548f..c5101b8a 100644 --- a/charts/velero/templates/servicemonitor.yaml +++ b/charts/velero/templates/servicemonitor.yaml @@ -6,6 +6,10 @@ metadata: {{- if .Values.metrics.serviceMonitor.namespace }} namespace: {{ .Values.metrics.serviceMonitor.namespace }} {{- end }} + {{- if .Values.customAnnotations }} + annotations: + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} {{- with .Values.metrics.serviceMonitor.additionalLabels }} diff --git a/charts/velero/templates/upgrade-crds.yaml b/charts/velero/templates/upgrade-crds.yaml index a8826b19..a22f8020 100644 --- a/charts/velero/templates/upgrade-crds.yaml +++ b/charts/velero/templates/upgrade-crds.yaml @@ -7,6 +7,9 @@ metadata: annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded + {{- if .Values.customAnnotations }} + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} spec: diff --git a/charts/velero/templates/volumesnapshotlocation.yaml b/charts/velero/templates/volumesnapshotlocation.yaml index a37f1ea0..e82411b1 100644 --- a/charts/velero/templates/volumesnapshotlocation.yaml +++ b/charts/velero/templates/volumesnapshotlocation.yaml @@ -6,6 +6,9 @@ metadata: annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation + {{- if .Values.customAnnotations }} + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} spec: diff --git a/charts/velero/values.yaml b/charts/velero/values.yaml index d1ab1d84..4c418ca1 100644 --- a/charts/velero/values.yaml +++ b/charts/velero/values.yaml @@ -15,6 +15,10 @@ image: imagePullSecrets: [] # - registrySecretName +## Additional annotations to add to all resources +customAnnotations: {} + # velerio.io: x.y.z + ## Additional labels to add to all resources customLabels: {} # app: velero @@ -113,7 +117,7 @@ metrics: prometheus.io/path: "/metrics" serviceMonitor: - enabled: false + enabled: true #false additionalLabels: {} # ServiceMonitor namespace. Default to Velero namespace. # namespace: From 2e1db325c1d9fd91e588881609e3643a0e9f9f95 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Wed, 30 Jun 2021 19:16:20 +0200 Subject: [PATCH 03/13] Update: selector labels Signed-off-by: Nicolas Lamirault --- charts/velero/templates/deployment.yaml | 5 ++--- charts/velero/templates/service.yaml | 3 +-- charts/velero/templates/servicemonitor.yaml | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/charts/velero/templates/deployment.yaml b/charts/velero/templates/deployment.yaml index a90c5943..81ad4dad 100644 --- a/charts/velero/templates/deployment.yaml +++ b/charts/velero/templates/deployment.yaml @@ -22,13 +22,12 @@ spec: replicas: 1 selector: matchLabels: - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/name: {{ include "velero.name" . }} + {{- include "velero.selectorLabels" . | indent 6 }} template: metadata: labels: name: velero - {{- include "velero.labels" . | indent 4 }} + {{- include "velero.labels" . | indent 8 }} {{- if .Values.podLabels }} {{- toYaml .Values.podLabels | nindent 8 }} {{- end }} diff --git a/charts/velero/templates/service.yaml b/charts/velero/templates/service.yaml index e487643e..6f950285 100644 --- a/charts/velero/templates/service.yaml +++ b/charts/velero/templates/service.yaml @@ -25,6 +25,5 @@ spec: targetPort: monitoring selector: name: velero - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + {{- include "velero.selectorLabels" . | indent 4 }} {{- end }} diff --git a/charts/velero/templates/servicemonitor.yaml b/charts/velero/templates/servicemonitor.yaml index c5101b8a..8d03ae81 100644 --- a/charts/velero/templates/servicemonitor.yaml +++ b/charts/velero/templates/servicemonitor.yaml @@ -21,8 +21,7 @@ spec: - {{ .Release.Namespace }} selector: matchLabels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + {{- include "velero.selectorLabels" . | indent 6 }} endpoints: - port: monitoring interval: {{ .Values.metrics.scrapeInterval }} From f7f03db30265ed8bd59ca3bf77812720350cf6f7 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Wed, 30 Jun 2021 19:17:13 +0200 Subject: [PATCH 04/13] Update: remove name label Signed-off-by: Nicolas Lamirault --- charts/velero/templates/deployment.yaml | 1 - charts/velero/templates/service.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/charts/velero/templates/deployment.yaml b/charts/velero/templates/deployment.yaml index 81ad4dad..acc0e48b 100644 --- a/charts/velero/templates/deployment.yaml +++ b/charts/velero/templates/deployment.yaml @@ -26,7 +26,6 @@ spec: template: metadata: labels: - name: velero {{- include "velero.labels" . | indent 8 }} {{- if .Values.podLabels }} {{- toYaml .Values.podLabels | nindent 8 }} diff --git a/charts/velero/templates/service.yaml b/charts/velero/templates/service.yaml index 6f950285..feb8bfad 100644 --- a/charts/velero/templates/service.yaml +++ b/charts/velero/templates/service.yaml @@ -24,6 +24,5 @@ spec: port: 8085 targetPort: monitoring selector: - name: velero {{- include "velero.selectorLabels" . | indent 4 }} {{- end }} From 054a148f63dc1252e2f7886d2371c67c2d4d1d4b Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Wed, 30 Jun 2021 19:18:03 +0200 Subject: [PATCH 05/13] Update: bump chart version Signed-off-by: Nicolas Lamirault --- charts/velero/Chart.yaml | 2 +- charts/velero/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/velero/Chart.yaml b/charts/velero/Chart.yaml index 338b20a3..e1cb6e18 100644 --- a/charts/velero/Chart.yaml +++ b/charts/velero/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: 1.6.1 description: A Helm chart for velero name: velero -version: 2.23.1 +version: 2.23.2 home: https://github.com/vmware-tanzu/velero icon: https://cdn-images-1.medium.com/max/1600/1*-9mb3AKnKdcL_QD3CMnthQ.png sources: diff --git a/charts/velero/values.yaml b/charts/velero/values.yaml index 4c418ca1..9ac6caf7 100644 --- a/charts/velero/values.yaml +++ b/charts/velero/values.yaml @@ -117,7 +117,7 @@ metrics: prometheus.io/path: "/metrics" serviceMonitor: - enabled: true #false + enabled: false additionalLabels: {} # ServiceMonitor namespace. Default to Velero namespace. # namespace: From 0793450ab68eefe87c8c240dfd1479574b22fae3 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Mon, 5 Jul 2021 12:27:38 +0200 Subject: [PATCH 06/13] Fix: labels and annotations on schedule and deployment Signed-off-by: Nicolas Lamirault --- charts/velero/templates/deployment.yaml | 17 +++++++++++------ charts/velero/templates/schedule.yaml | 17 ++++++++++++++--- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/charts/velero/templates/deployment.yaml b/charts/velero/templates/deployment.yaml index acc0e48b..f5012069 100644 --- a/charts/velero/templates/deployment.yaml +++ b/charts/velero/templates/deployment.yaml @@ -6,12 +6,14 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "velero.fullname" . }} - {{- with .Values.annotations }} + {{- if or .Values.annotations .Values.customAnnotations }} annotations: - {{- toYaml . | nindent 4 }} - {{- end }} - {{- if .Values.customAnnotations }} - {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- if .Values.customAnnotations }} + {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- end }} + {{- if .Values.annotations }} + {{- toYaml .Values.annotations | nindent 4 }} + {{- end }} {{- end }} labels: {{- include "velero.labels" . | indent 4 }} @@ -30,8 +32,11 @@ spec: {{- if .Values.podLabels }} {{- toYaml .Values.podLabels | nindent 8 }} {{- end }} - {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- if or .Values.podAnnotations .Values.metrics.enabled .Values.customAnnotations }} annotations: + {{- if .Values.customAnnotations }} + {{- toYaml .Values.customAnnotations | nindent 8 }} + {{- end }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/velero/templates/schedule.yaml b/charts/velero/templates/schedule.yaml index 4c1f96f4..07474a60 100644 --- a/charts/velero/templates/schedule.yaml +++ b/charts/velero/templates/schedule.yaml @@ -7,13 +7,24 @@ metadata: {{- if $schedule.annotations }} {{- toYaml $schedule.annotations | nindent 4 }} {{- end }} - {{- if .Values.customAnnotations }} - {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- if $.Values.customAnnotations }} + {{- toYaml $.Values.customAnnotations | nindent 4 }} {{- end }} "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation labels: - {{- include "velero.labels" . | indent 4 }} + helm.sh/chart: {{ include "velero.chart" $ }} + app.kubernetes.io/managed-by: {{ $.Release.Service }} + app.kubernetes.io/component: backup + app.kubernetes.io/part-of: {{ template "velero.name" $ }} + app.kubernetes.io/name: {{ include "velero.name" $ }} + app.kubernetes.io/instance: {{ $.Release.Name }} + {{- if $.Chart.AppVersion }} + app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }} + {{- end }} + {{- if $.Values.customLabels }} + {{ toYaml $.Values.customLabels }} + {{- end }} {{- if $schedule.labels }} {{- toYaml $schedule.labels | nindent 4 }} {{- end }} From 14a7e00acf6f7f84c30058eaa25f9cf8bafa0356 Mon Sep 17 00:00:00 2001 From: JenTing Hsiao Date: Tue, 6 Jul 2021 10:22:47 +0800 Subject: [PATCH 07/13] CI: bump helm/kind-action version v1.2.0 Signed-off-by: JenTing Hsiao --- .github/workflows/lint-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index b4f5725f..782116b5 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -19,7 +19,7 @@ jobs: command: lint - name: Create kind cluster - uses: helm/kind-action@v1.0.0 + uses: helm/kind-action@v1.2.0 # Only build a kind cluster if there are chart changes to test. if: steps.lint.outputs.changed == 'true' From 6da20aa42f977995699c2fb089fea6ba92b2d77c Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Thu, 15 Jul 2021 19:20:00 +0200 Subject: [PATCH 08/13] Fix: component label Signed-off-by: Nicolas Lamirault --- charts/velero/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/velero/templates/_helpers.tpl b/charts/velero/templates/_helpers.tpl index 584f45fb..604a37fc 100644 --- a/charts/velero/templates/_helpers.tpl +++ b/charts/velero/templates/_helpers.tpl @@ -48,7 +48,7 @@ Generate basic labels {{- define "velero.labels" }} helm.sh/chart: {{ include "velero.chart" . }} app.kubernetes.io/managed-by: {{ .Release.Service }} -app.kubernetes.io/component: metrics +app.kubernetes.io/component: server app.kubernetes.io/part-of: {{ template "velero.name" . }} {{- include "velero.selectorLabels" . }} {{- if .Chart.AppVersion }} From 3893385ed158425bb3a3388a667e2e89bc9d2ad6 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Fri, 16 Jul 2021 10:43:17 +0200 Subject: [PATCH 09/13] Update: refactoring annotations and add labels for Job Signed-off-by: Nicolas Lamirault --- charts/velero/templates/cleanup-crds.yaml | 12 +++++++--- charts/velero/templates/deployment.yaml | 8 +++---- charts/velero/templates/restic-daemonset.yaml | 22 +++++++++++-------- charts/velero/templates/service.yaml | 4 ++-- .../templates/serviceaccount-server.yaml | 15 +++++++------ charts/velero/templates/upgrade-crds.yaml | 16 +++++++++----- .../templates/volumesnapshotlocation.yaml | 4 ++-- 7 files changed, 49 insertions(+), 32 deletions(-) diff --git a/charts/velero/templates/cleanup-crds.yaml b/charts/velero/templates/cleanup-crds.yaml index c7216eee..7c5ef5ec 100644 --- a/charts/velero/templates/cleanup-crds.yaml +++ b/charts/velero/templates/cleanup-crds.yaml @@ -19,13 +19,19 @@ spec: template: metadata: name: velero-cleanup-crds - {{- with .Values.kubectl.labels }} labels: + {{- include "velero.labels" . | indent 8 }} + {{- with .Values.kubectl.labels }} {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.kubectl.annotations }} + {{- end }} + {{- if or .Values.kubectl.annotations .Values.customAnnotations }} annotations: + {{- with .Values.kubectl.annotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.customAnnotations }} {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} spec: {{- if .Values.image.imagePullSecrets }} diff --git a/charts/velero/templates/deployment.yaml b/charts/velero/templates/deployment.yaml index f5012069..84f8665e 100644 --- a/charts/velero/templates/deployment.yaml +++ b/charts/velero/templates/deployment.yaml @@ -8,8 +8,8 @@ metadata: name: {{ include "velero.fullname" . }} {{- if or .Values.annotations .Values.customAnnotations }} annotations: - {{- if .Values.customAnnotations }} - {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 4 }} {{- end }} {{- if .Values.annotations }} {{- toYaml .Values.annotations | nindent 4 }} @@ -34,8 +34,8 @@ spec: {{- end }} {{- if or .Values.podAnnotations .Values.metrics.enabled .Values.customAnnotations }} annotations: - {{- if .Values.customAnnotations }} - {{- toYaml .Values.customAnnotations | nindent 8 }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} diff --git a/charts/velero/templates/restic-daemonset.yaml b/charts/velero/templates/restic-daemonset.yaml index c9813012..241081e9 100644 --- a/charts/velero/templates/restic-daemonset.yaml +++ b/charts/velero/templates/restic-daemonset.yaml @@ -6,12 +6,14 @@ apiVersion: apps/v1 kind: DaemonSet metadata: name: restic - {{- with .Values.restic.annotations }} + {{- if or .Values.restic.annotations .Values.customAnnotations }} annotations: - {{- toYaml . | nindent 4 }} + {{- with .Values.restic.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 4 }} {{- end }} - {{- if .Values.customAnnotations }} - {{- toYaml .Values.customAnnotations | nindent 4 }} {{- end }} labels: {{- include "velero.labels" . | indent 4 }} @@ -26,16 +28,18 @@ spec: metadata: labels: name: restic - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + {{- include "velero.labels" . | indent 8 }} {{- if .Values.podLabels }} {{ toYaml .Values.podLabels | nindent 8 }} {{- end }} - {{- with .Values.podAnnotations }} + {{- if or .Values.podAnnotations .Values.customAnnotations }} annotations: + {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} spec: {{- if .Values.image.imagePullSecrets }} diff --git a/charts/velero/templates/service.yaml b/charts/velero/templates/service.yaml index feb8bfad..8f74d926 100644 --- a/charts/velero/templates/service.yaml +++ b/charts/velero/templates/service.yaml @@ -8,8 +8,8 @@ metadata: {{- if .Values.metrics.service.annotations }} {{- toYaml .Values.metrics.service.annotations | nindent 4 }} {{- end }} - {{- if .Values.customAnnotations }} - {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 4 }} {{- end }} {{- end }} labels: diff --git a/charts/velero/templates/serviceaccount-server.yaml b/charts/velero/templates/serviceaccount-server.yaml index b6b9dfb6..904be885 100644 --- a/charts/velero/templates/serviceaccount-server.yaml +++ b/charts/velero/templates/serviceaccount-server.yaml @@ -3,14 +3,15 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "velero.serverServiceAccount" . }} -{{- if .Values.serviceAccount.server.annotations }} + {{- if or .Values.serviceAccount.server.annotations .Values.customAnnotations }} annotations: -{{ toYaml .Values.serviceAccount.server.annotations | nindent 4 }} -{{- end }} - {{- if .Values.customAnnotations }} - annotations: - {{- toYaml .Values.customAnnotations | nindent 4 }} - {{- end }} + {{- with .Values.serviceAccount.server.Annotations }} + {{ toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} labels: {{- include "velero.labels" . | indent 4 }} {{- with .Values.serviceAccount.server.labels }} diff --git a/charts/velero/templates/upgrade-crds.yaml b/charts/velero/templates/upgrade-crds.yaml index a22f8020..b1783919 100644 --- a/charts/velero/templates/upgrade-crds.yaml +++ b/charts/velero/templates/upgrade-crds.yaml @@ -7,8 +7,8 @@ metadata: annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded - {{- if .Values.customAnnotations }} - {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 4 }} {{- end }} labels: {{- include "velero.labels" . | indent 4 }} @@ -17,13 +17,19 @@ spec: template: metadata: name: velero-upgrade-crds - {{- with .Values.kubectl.labels }} labels: + {{- include "velero.labels" . | indent 8 }} + {{- with .Values.kubectl.labels }} {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.kubectl.annotations }} + {{- end }} + {{- if or .Values.kubectl.annotations .Values.customAnnotations }} annotations: + {{- with .Values.kubectl.annotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.customAnnotations }} {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} spec: {{- if .Values.image.imagePullSecrets }} diff --git a/charts/velero/templates/volumesnapshotlocation.yaml b/charts/velero/templates/volumesnapshotlocation.yaml index e82411b1..5aaa1730 100644 --- a/charts/velero/templates/volumesnapshotlocation.yaml +++ b/charts/velero/templates/volumesnapshotlocation.yaml @@ -6,8 +6,8 @@ metadata: annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation - {{- if .Values.customAnnotations }} - {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 4 }} {{- end }} labels: {{- include "velero.labels" . | indent 4 }} From 6485147a5e086fbb99fc2e7cb1774f9fd16206d1 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Fri, 16 Jul 2021 13:06:31 +0200 Subject: [PATCH 10/13] Update: refactoring annotations Signed-off-by: Nicolas Lamirault --- charts/velero/templates/backupstoragelocation.yaml | 4 ++-- charts/velero/templates/cleanup-crds.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/velero/templates/backupstoragelocation.yaml b/charts/velero/templates/backupstoragelocation.yaml index c5569b14..b37c79ea 100644 --- a/charts/velero/templates/backupstoragelocation.yaml +++ b/charts/velero/templates/backupstoragelocation.yaml @@ -6,8 +6,8 @@ metadata: annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation - {{- if .Values.customAnnotations }} - {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 4 }} {{- end }} labels: {{- include "velero.labels" . | indent 4 }} diff --git a/charts/velero/templates/cleanup-crds.yaml b/charts/velero/templates/cleanup-crds.yaml index 7c5ef5ec..5aa83a17 100644 --- a/charts/velero/templates/cleanup-crds.yaml +++ b/charts/velero/templates/cleanup-crds.yaml @@ -9,8 +9,8 @@ metadata: annotations: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded - {{- if .Values.customAnnotations }} - {{- toYaml .Values.customAnnotations | nindent 4 }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 4 }} {{- end }} labels: {{- include "velero.labels" . | indent 4 }} From 04b850e1665027430551ffbaf9bb975920d433a0 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Fri, 16 Jul 2021 13:19:33 +0200 Subject: [PATCH 11/13] Fix: use with Signed-off-by: Nicolas Lamirault --- charts/velero/templates/schedule.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/velero/templates/schedule.yaml b/charts/velero/templates/schedule.yaml index e0737b01..f24b3122 100644 --- a/charts/velero/templates/schedule.yaml +++ b/charts/velero/templates/schedule.yaml @@ -8,9 +8,9 @@ metadata: {{- if $schedule.annotations }} {{- toYaml $schedule.annotations | nindent 4 }} {{- end }} - {{- if $.Values.customAnnotations }} - {{- toYaml $.Values.customAnnotations | nindent 4 }} - {{- end }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation labels: From 26d5ba20d48931dd18b2df7cbbac5c3455695db0 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Mon, 30 Aug 2021 16:20:32 +0200 Subject: [PATCH 12/13] Fix: custom annotations Signed-off-by: Nicolas Lamirault --- charts/velero/templates/schedule.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/velero/templates/schedule.yaml b/charts/velero/templates/schedule.yaml index f24b3122..4c38c9d5 100644 --- a/charts/velero/templates/schedule.yaml +++ b/charts/velero/templates/schedule.yaml @@ -8,7 +8,7 @@ metadata: {{- if $schedule.annotations }} {{- toYaml $schedule.annotations | nindent 4 }} {{- end }} - {{- with .Values.customAnnotations }} + {{- with $.Values.customAnnotations }} {{- toYaml . | nindent 4 }} {{- end }} "helm.sh/hook": post-install,post-upgrade,post-rollback From aaf9713bd3a1c2c79203d71a8192a6b6f81b95e1 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Wed, 22 Dec 2021 15:13:55 +0100 Subject: [PATCH 13/13] Update: use helper labels Signed-off-by: Nicolas Lamirault --- charts/velero/templates/schedule.yaml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/charts/velero/templates/schedule.yaml b/charts/velero/templates/schedule.yaml index 4c38c9d5..480c76b5 100644 --- a/charts/velero/templates/schedule.yaml +++ b/charts/velero/templates/schedule.yaml @@ -14,18 +14,7 @@ metadata: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation labels: - helm.sh/chart: {{ include "velero.chart" $ }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - app.kubernetes.io/component: backup - app.kubernetes.io/part-of: {{ template "velero.name" $ }} - app.kubernetes.io/name: {{ include "velero.name" $ }} - app.kubernetes.io/instance: {{ $.Release.Name }} - {{- if $.Chart.AppVersion }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }} - {{- end }} - {{- if $.Values.customLabels }} - {{ toYaml $.Values.customLabels }} - {{- end }} + {{- include "velero.labels" $ | indent 4 }} {{- if $schedule.labels }} {{- toYaml $schedule.labels | nindent 4 }} {{- end }}