diff --git a/charts/velero/Chart.yaml b/charts/velero/Chart.yaml index 7900cc19..6321b9f9 100644 --- a/charts/velero/Chart.yaml +++ b/charts/velero/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: 1.7.1 description: A Helm chart for velero name: velero -version: 2.27.1 +version: 2.28.0 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/templates/_helpers.tpl b/charts/velero/templates/_helpers.tpl index 913277a7..49d47382 100644 --- a/charts/velero/templates/_helpers.tpl +++ b/charts/velero/templates/_helpers.tpl @@ -42,6 +42,31 @@ 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: server +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 1dfaa9a3..b37c79ea 100644 --- a/charts/velero/templates/backupstoragelocation.yaml +++ b/charts/velero/templates/backupstoragelocation.yaml @@ -6,11 +6,11 @@ metadata: annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation + {{- with .Values.customAnnotations }} + {{- 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 }} 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 443619b0..047e31cf 100644 --- a/charts/velero/templates/cleanup-crds.yaml +++ b/charts/velero/templates/cleanup-crds.yaml @@ -9,23 +9,29 @@ metadata: annotations: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded + {{- with .Values.customAnnotations }} + {{- 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 }} spec: backoffLimit: 3 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/clusterrolebinding.yaml b/charts/velero/templates/clusterrolebinding.yaml index 43c1ccb7..6f0c7dfb 100644 --- a/charts/velero/templates/clusterrolebinding.yaml +++ b/charts/velero/templates/clusterrolebinding.yaml @@ -3,12 +3,12 @@ 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: - 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..d6797260 100644 --- a/charts/velero/templates/configmaps.yaml +++ b/charts/velero/templates/configmaps.yaml @@ -3,11 +3,12 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ include "velero.fullname" $ }}-{{ $configMapName }} + {{- if .Values.customAnnotations }} + annotations: + {{- toYaml .Values.customAnnotations | 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 $configMap.labels }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/velero/templates/deployment.yaml b/charts/velero/templates/deployment.yaml index 1b723573..c0917e75 100644 --- a/charts/velero/templates/deployment.yaml +++ b/charts/velero/templates/deployment.yaml @@ -6,16 +6,17 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "velero.fullname" . }} - {{- with .Values.annotations }} + {{- if or .Values.annotations .Values.customAnnotations }} annotations: + {{- with .Values.customAnnotations }} {{- toYaml . | nindent 4 }} + {{- end }} + {{- if .Values.annotations }} + {{- toYaml .Values.annotations | nindent 4 }} + {{- end }} {{- 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 }} @@ -23,21 +24,19 @@ 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 - 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 }} - {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- if or .Values.podAnnotations .Values.metrics.enabled .Values.customAnnotations }} annotations: + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/velero/templates/restic-daemonset.yaml b/charts/velero/templates/restic-daemonset.yaml index f257569a..589c8670 100644 --- a/charts/velero/templates/restic-daemonset.yaml +++ b/charts/velero/templates/restic-daemonset.yaml @@ -6,15 +6,17 @@ 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 }} {{- 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 }} @@ -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/role.yaml b/charts/velero/templates/role.yaml index a5978576..b2e8efda 100644 --- a/charts/velero/templates/role.yaml +++ b/charts/velero/templates/role.yaml @@ -3,12 +3,12 @@ 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: - 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..857a596a 100644 --- a/charts/velero/templates/rolebinding.yaml +++ b/charts/velero/templates/rolebinding.yaml @@ -3,12 +3,12 @@ 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: - 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 983fcba2..480c76b5 100644 --- a/charts/velero/templates/schedule.yaml +++ b/charts/velero/templates/schedule.yaml @@ -8,13 +8,13 @@ metadata: {{- if $schedule.annotations }} {{- toYaml $schedule.annotations | 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: - 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..892d8a59 100644 --- a/charts/velero/templates/secret.yaml +++ b/charts/velero/templates/secret.yaml @@ -3,11 +3,12 @@ apiVersion: v1 kind: Secret metadata: name: {{ include "velero.secretName" . }} + {{- if .Values.customAnnotations }} + annotations: + {{- toYaml .Values.customAnnotations | 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 }} type: Opaque data: {{- range $key, $value := .Values.credentials.secretContents }} diff --git a/charts/velero/templates/service.yaml b/charts/velero/templates/service.yaml index 76015053..4a3583fc 100644 --- a/charts/velero/templates/service.yaml +++ b/charts/velero/templates/service.yaml @@ -3,15 +3,17 @@ apiVersion: v1 kind: Service metadata: name: {{ include "velero.fullname" . }} - {{- with .Values.metrics.service.annotations }} + {{- if or .Values.customAnnotations .Values.metrics.service.annotations }} annotations: + {{- if .Values.metrics.service.annotations }} + {{- toYaml .Values.metrics.service.annotations | nindent 4 }} + {{- end }} + {{- with .Values.customAnnotations }} {{- toYaml . | nindent 4 }} + {{- end }} {{- 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 }} @@ -22,7 +24,5 @@ spec: port: 8085 targetPort: http-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/serviceaccount-server.yaml b/charts/velero/templates/serviceaccount-server.yaml index e0608dd1..904be885 100644 --- a/charts/velero/templates/serviceaccount-server.yaml +++ b/charts/velero/templates/serviceaccount-server.yaml @@ -3,15 +3,17 @@ 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 }} + {{- with .Values.serviceAccount.server.Annotations }} + {{ toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.customAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- 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 83bf6ad0..197f88fb 100644 --- a/charts/velero/templates/servicemonitor.yaml +++ b/charts/velero/templates/servicemonitor.yaml @@ -6,11 +6,12 @@ metadata: {{- if .Values.metrics.serviceMonitor.namespace }} namespace: {{ .Values.metrics.serviceMonitor.namespace }} {{- end }} + {{- if .Values.customAnnotations }} + annotations: + {{- toYaml .Values.customAnnotations | 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.serviceMonitor.additionalLabels }} {{- toYaml . | nindent 4 }} {{- end }} @@ -20,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: http-monitoring interval: {{ .Values.metrics.scrapeInterval }} diff --git a/charts/velero/templates/upgrade-crds.yaml b/charts/velero/templates/upgrade-crds.yaml index 8445568a..a51d8fa0 100644 --- a/charts/velero/templates/upgrade-crds.yaml +++ b/charts/velero/templates/upgrade-crds.yaml @@ -7,23 +7,29 @@ metadata: annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded + {{- with .Values.customAnnotations }} + {{- 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 }} spec: backoffLimit: 3 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 87d1a10f..5aaa1730 100644 --- a/charts/velero/templates/volumesnapshotlocation.yaml +++ b/charts/velero/templates/volumesnapshotlocation.yaml @@ -6,11 +6,11 @@ metadata: annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation + {{- with .Values.customAnnotations }} + {{- 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 }} spec: provider: {{ include "velero.volumeSnapshotLocation.provider" . }} {{- with .Values.configuration.volumeSnapshotLocation.config }} diff --git a/charts/velero/values.yaml b/charts/velero/values.yaml index 0ffa44e6..3289a6b7 100644 --- a/charts/velero/values.yaml +++ b/charts/velero/values.yaml @@ -15,6 +15,14 @@ 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 + # Annotations to add to the Velero deployment's. Optional. # # If you are using reloader use the following annotation with your VELERO_SECRET_NAME