Add velero backup
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
Check that the velero is up and running:
|
||||
|
||||
kubectl get deployment/{{ include "velero.fullname" . }} -n {{ .Release.Namespace }}
|
||||
|
||||
Check that the secret has been created:
|
||||
|
||||
kubectl get secret/{{ include "velero.fullname" . }} -n {{ .Release.Namespace }}
|
||||
|
||||
Once velero server is up and running you need the client before you can use it
|
||||
1. wget https://github.com/vmware-tanzu/velero/releases/download/{{ .Values.image.tag }}/velero-{{ .Values.image.tag }}-darwin-amd64.tar.gz
|
||||
2. tar -xvf velero-{{ .Values.image.tag }}-darwin-amd64.tar.gz -C velero-client
|
||||
|
||||
More info on the official site: https://velero.io/docs
|
||||
|
||||
{{- /*
|
||||
Breaking changes.
|
||||
*/}}
|
||||
|
||||
{{- $breaking := "" }}
|
||||
{{- $breaking_title := "\n" }}
|
||||
{{- $breaking_title = print $breaking_title "\n#################################################################################" }}
|
||||
{{- $breaking_title = print $breaking_title "\n###### BREAKING: The config values passed contained no longer accepted #####" }}
|
||||
{{- $breaking_title = print $breaking_title "\n###### options. See the messages below for more details. #####" }}
|
||||
{{- $breaking_title = print $breaking_title "\n###### #####" }}
|
||||
{{- $breaking_title = print $breaking_title "\n###### To verify your updated config is accepted, you can use #####" }}
|
||||
{{- $breaking_title = print $breaking_title "\n###### the `helm template` command. #####" }}
|
||||
{{- $breaking_title = print $breaking_title "\n#################################################################################" }}
|
||||
|
||||
{{- if typeIs "map[string]interface {}" .Values.configuration.backupStorageLocation }}
|
||||
{{- $breaking = print $breaking "\n\nERROR: Please make .configuration.backupStorageLocation from map to slice" }}
|
||||
{{- end }}
|
||||
|
||||
{{- if typeIs "map[string]interface {}" .Values.configuration.volumeSnapshotLocation }}
|
||||
{{- $breaking = print $breaking "\n\nERROR: Please make .configuration.volumeSnapshotLocation from map to slice" }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.configuration "provider" }}
|
||||
{{- $breaking = print $breaking "\n\nREMOVED: .configuration.provider has been removed, instead each backupStorageLocation and volumeSnapshotLocation has a provider configured" }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values "resticTimeout" }}
|
||||
{{- $breaking = print $breaking "\n\nREMOVED: resticTimeout has been removed, and it is named fsBackupTimeout" }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values "defaultVolumesToRestic" }}
|
||||
{{- $breaking = print $breaking "\n\nREMOVED: defaultVolumesToRestic has been removed, and it is named defaultVolumesToFsBackup" }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values "defaultResticPruneFrequency" }}
|
||||
{{- $breaking = print $breaking "\n\nREMOVED: defaultResticPruneFrequency has been removed, and it is named defaultRepoMaintainFrequency" }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values "deployRestic" }}
|
||||
{{- $breaking = print $breaking "\n\nREMOVED: deployRestic has been removed, and it is named deployNodeAgent" }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values "restic" }}
|
||||
{{- $breaking = print $breaking "\n\nREMOVED: restic has been removed, and it is named nodeAgent" }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.configMaps "restic-restore-action-config" }}
|
||||
{{- $breaking = print $breaking "\n\nREMOVED: restic-restore-action-config has been removed, and it is named fs-restore-action-config" }}
|
||||
{{- end }}
|
||||
|
||||
{{- range $key, $value := .Values.configMaps }}
|
||||
{{- eq $key "fs-restore-action-config" }}
|
||||
{{- if hasKey $value.labels "velero.io/restic" }}
|
||||
{{- $breaking = print $breaking "\n\nREMOVED: velero.io/restic has been removed, and it is named velero.io/pod-volume-restore" }}
|
||||
{{- end }}
|
||||
{{- if and $value.data.image }}
|
||||
{{- if contains "velero-restic-restore-helper" $value.data.image }}
|
||||
{{- $breaking = print $breaking "\n\nREMOVED: restore helper image velero-restic-restore-helper has been changed to velero-restore-helper" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $breaking }}
|
||||
{{- fail (print $breaking_title $breaking) }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,88 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "velero.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "velero.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "velero.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use for creating or deleting the velero server
|
||||
*/}}
|
||||
{{- define "velero.serverServiceAccount" -}}
|
||||
{{- if .Values.serviceAccount.server.create -}}
|
||||
{{ default (printf "%s-%s" (include "velero.fullname" .) "server") .Values.serviceAccount.server.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.server.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name for the credentials secret.
|
||||
*/}}
|
||||
{{- define "velero.secretName" -}}
|
||||
{{- if .Values.credentials.existingSecret -}}
|
||||
{{- .Values.credentials.existingSecret -}}
|
||||
{{- else -}}
|
||||
{{ default (include "velero.fullname" .) .Values.credentials.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the Velero priority class name.
|
||||
*/}}
|
||||
{{- define "velero.priorityClassName" -}}
|
||||
{{- if .Values.priorityClassName -}}
|
||||
{{- .Values.priorityClassName -}}
|
||||
{{- else -}}
|
||||
{{- include "velero.fullname" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the node-Agent priority class name.
|
||||
*/}}
|
||||
{{- define "velero.nodeAgent.priorityClassName" -}}
|
||||
{{- if .Values.nodeAgent.priorityClassName -}}
|
||||
{{- .Values.nodeAgent.priorityClassName -}}
|
||||
{{- else -}}
|
||||
{{- include "velero.fullname" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Kubernetes version
|
||||
Built-in object .Capabilities.KubeVersion.Minor can provide non-number output
|
||||
For examples:
|
||||
- on GKE it returns "18+" instead of "18"
|
||||
- on EKS it returns "20+" instead of "20"
|
||||
*/}}
|
||||
{{- define "chart.KubernetesVersion" -}}
|
||||
{{- $minorVersion := .Capabilities.KubeVersion.Minor | regexFind "[0-9]+" -}}
|
||||
{{- printf "%s.%s" .Capabilities.KubeVersion.Major $minorVersion -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,50 @@
|
||||
{{- if .Values.backupsEnabled }}
|
||||
|
||||
{{- if typeIs "[]interface {}" .Values.configuration.backupStorageLocation }}
|
||||
{{- range .Values.configuration.backupStorageLocation }}
|
||||
---
|
||||
apiVersion: velero.io/v1
|
||||
kind: BackupStorageLocation
|
||||
metadata:
|
||||
name: {{ .name | default "default" }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
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" $ }}
|
||||
spec:
|
||||
{{- if not (empty .credential) }}
|
||||
credential:
|
||||
{{- with .credential.name }}
|
||||
name: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .credential.key }}
|
||||
key: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
provider: {{ .provider }}
|
||||
accessMode: {{ .accessMode | default "ReadWrite" }}
|
||||
{{- with .default }}
|
||||
default: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .validationFrequency }}
|
||||
validationFrequency: {{ . }}
|
||||
{{- end }}
|
||||
objectStorage:
|
||||
bucket: {{ .bucket | quote }}
|
||||
{{- with .prefix }}
|
||||
prefix: {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- with .caCert }}
|
||||
caCert: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .config }}
|
||||
config:
|
||||
{{- range $key, $value := . }}
|
||||
{{- $key | nindent 4 }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,85 @@
|
||||
{{- if .Values.cleanUpCRDs }}
|
||||
# This job is meant primarily for cleaning up on CI systems.
|
||||
# Using this on production systems, especially those that have multiple releases of Velero, will be destructive.
|
||||
{{/* 'securityContext' got renamed to 'podSecurityContext', merge both dicts into one for backward compatibility */}}
|
||||
{{- $podSecurityContext := merge (.Values.podSecurityContext | default dict) (.Values.securityContext | default dict) -}}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "velero.fullname" . }}-cleanup-crds
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
"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" . }}
|
||||
spec:
|
||||
backoffLimit: 3
|
||||
template:
|
||||
metadata:
|
||||
name: velero-cleanup-crds
|
||||
{{- with .Values.kubectl.labels }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.kubectl.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.image.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.imagePullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "velero.serverServiceAccount" . }}
|
||||
containers:
|
||||
- name: kubectl
|
||||
{{- if .Values.kubectl.image.digest }}
|
||||
image: "{{ .Values.kubectl.image.repository }}@{{ .Values.kubectl.image.digest }}"
|
||||
{{- else if .Values.kubectl.image.tag }}
|
||||
image: "{{ .Values.kubectl.image.repository }}:{{ .Values.kubectl.image.tag }}"
|
||||
{{- else }}
|
||||
image: "{{ .Values.kubectl.image.repository }}:{{ template "chart.KubernetesVersion" . }}"
|
||||
{{- end }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- >
|
||||
kubectl delete restore --all;
|
||||
kubectl delete backup --all;
|
||||
kubectl delete backupstoragelocation --all;
|
||||
kubectl delete volumesnapshotlocation --all;
|
||||
kubectl delete podvolumerestore --all;
|
||||
kubectl delete crd -l component=velero;
|
||||
{{- with .Values.kubectl.containerSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.kubectl.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
restartPolicy: OnFailure
|
||||
{{- with $podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and .Values.rbac.create .Values.rbac.clusterAdministrator }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
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" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
namespace: {{ .Release.Namespace }}
|
||||
name: {{ include "velero.serverServiceAccount" . }}
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: {{ .Values.rbac.clusterAdministratorName }}
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- range $configMapName, $configMap := .Values.configMaps }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "velero.fullname" $ }}-{{ $configMapName }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
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" $ }}
|
||||
{{- with $configMap.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- toYaml $configMap.data | nindent 2 }}
|
||||
---
|
||||
{{- end }}
|
||||
@@ -0,0 +1,278 @@
|
||||
{{/* 'securityContext' got renamed to 'podSecurityContext', merge both dicts into one for backward compatibility */}}
|
||||
{{- $podSecurityContext := merge (.Values.podSecurityContext | default dict) (.Values.securityContext | default dict) -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "velero.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- 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
|
||||
{{- with .Values.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: 1
|
||||
{{- if .Values.revisionHistoryLimit }}
|
||||
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
||||
{{- end }}
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/name: {{ include "velero.name" . }}
|
||||
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" . }}
|
||||
{{- if .Values.podLabels }}
|
||||
{{- toYaml .Values.podLabels | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.podAnnotations .Values.metrics.enabled }}
|
||||
annotations:
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and (.Values.metrics.enabled) (not .Values.metrics.serviceMonitor.enabled) }}
|
||||
{{- with .Values.metrics.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.image.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.imagePullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
restartPolicy: Always
|
||||
serviceAccountName: {{ include "velero.serverServiceAccount" . }}
|
||||
{{- if .Values.priorityClassName }}
|
||||
priorityClassName: {{ include "velero.priorityClassName" . }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
containers:
|
||||
- name: velero
|
||||
{{- if .Values.image.digest }}
|
||||
image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}"
|
||||
{{- else }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
{{- end }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
ports:
|
||||
- name: http-monitoring
|
||||
containerPort: 8085
|
||||
{{- end }}
|
||||
command:
|
||||
- /velero
|
||||
args:
|
||||
- server
|
||||
### Flags
|
||||
{{- with .Values.configuration }}
|
||||
- --uploader-type={{ default "restic" .uploaderType }}
|
||||
{{- with .backupSyncPeriod }}
|
||||
- --backup-sync-period={{ . }}
|
||||
{{- end }}
|
||||
{{- with .fsBackupTimeout }}
|
||||
- --fs-backup-timeout={{ . }}
|
||||
{{- end }}
|
||||
{{- with .clientBurst }}
|
||||
- --client-burst={{ . }}
|
||||
{{- end }}
|
||||
{{- with .clientPageSize }}
|
||||
- --client-page-size={{ . }}
|
||||
{{- end }}
|
||||
{{- with .clientQPS }}
|
||||
- --client-qps={{ . }}
|
||||
{{- end }}
|
||||
{{- with .defaultBackupStorageLocation }}
|
||||
- --default-backup-storage-location={{ . }}
|
||||
{{- end }}
|
||||
{{- with .defaultBackupTTL }}
|
||||
- --default-backup-ttl={{ . }}
|
||||
{{- end }}
|
||||
{{- with .defaultVolumeSnapshotLocations }}
|
||||
- --default-volume-snapshot-locations={{ . }}
|
||||
{{- end }}
|
||||
{{- if .defaultVolumesToFsBackup }}
|
||||
- --default-volumes-to-fs-backup
|
||||
{{- end }}
|
||||
{{- with .defaultRepoMaintainFrequency }}
|
||||
- --default-repo-maintain-frequency={{ . }}
|
||||
{{- end }}
|
||||
{{- with .disableControllers }}
|
||||
- --disable-controllers={{ . }}
|
||||
{{- end }}
|
||||
{{- with .garbageCollectionFrequency }}
|
||||
- --garbage-collection-frequency={{ . }}
|
||||
{{- end }}
|
||||
{{- with .logFormat }}
|
||||
- --log-format={{ . }}
|
||||
{{- end }}
|
||||
{{- with .logLevel }}
|
||||
- --log-level={{ . }}
|
||||
{{- end }}
|
||||
{{- with .metricsAddress }}
|
||||
- --metrics-address={{ . }}
|
||||
{{- end }}
|
||||
{{- with .pluginDir }}
|
||||
- --plugin-dir={{ . }}
|
||||
{{- end }}
|
||||
{{- with .profilerAddress }}
|
||||
- --profiler-address={{ . }}
|
||||
{{- end }}
|
||||
{{- if .restoreOnlyMode }}
|
||||
- --restore-only
|
||||
{{- end }}
|
||||
{{- with .restoreResourcePriorities }}
|
||||
- --restore-resource-priorities={{ . }}
|
||||
{{- end }}
|
||||
{{- with .storeValidationFrequency }}
|
||||
- --store-validation-frequency={{ . }}
|
||||
{{- end }}
|
||||
{{- with .terminatingResourceTimeout }}
|
||||
- --terminating-resource-timeout={{ . }}
|
||||
{{- end }}
|
||||
### Global Flags
|
||||
{{- with .features }}
|
||||
- --features={{ . }}
|
||||
{{- end }}
|
||||
{{- with .namespace }}
|
||||
- --namespace={{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
{{- with .Values.livenessProbe }}
|
||||
livenessProbe: {{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.readinessProbe }}
|
||||
readinessProbe: {{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.containerSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: plugins
|
||||
mountPath: /plugins
|
||||
{{- if .Values.credentials.useSecret }}
|
||||
- name: cloud-credentials
|
||||
mountPath: /credentials
|
||||
{{- end }}
|
||||
- name: scratch
|
||||
mountPath: /scratch
|
||||
{{- if .Values.containerSecurityContext.readOnlyRootFilesystem }}
|
||||
- name: tmpdir
|
||||
mountPath: /tmp
|
||||
{{- end }}
|
||||
{{- if .Values.extraVolumeMounts }}
|
||||
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.credentials.extraSecretRef }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ .Values.credentials.extraSecretRef }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: VELERO_SCRATCH_DIR
|
||||
value: /scratch
|
||||
- name: VELERO_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.namespace
|
||||
- name: LD_LIBRARY_PATH
|
||||
value: /plugins
|
||||
{{- if .Values.credentials.useSecret }}
|
||||
- name: AWS_SHARED_CREDENTIALS_FILE
|
||||
value: /credentials/cloud
|
||||
- name: GOOGLE_APPLICATION_CREDENTIALS
|
||||
value: /credentials/cloud
|
||||
- name: AZURE_CREDENTIALS_FILE
|
||||
value: /credentials/cloud
|
||||
- name: ALIBABA_CLOUD_CREDENTIALS_FILE
|
||||
value: /credentials/cloud
|
||||
{{- end }}
|
||||
{{- with .Values.configuration.extraEnvVars }}
|
||||
{{- range $key, $value := . }}
|
||||
- name: {{ default "none" $key }}
|
||||
value: {{ default "none" $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.credentials.extraEnvVars }}
|
||||
{{- range $key, $value := . }}
|
||||
- name: {{ default "none" $key }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "velero.secretName" $ }}
|
||||
key: {{ default "none" $key }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.lifecycle }}
|
||||
lifecycle: {{ toYaml .Values.lifecycle | nindent 12 }}
|
||||
{{- end }}
|
||||
dnsPolicy: {{ .Values.dnsPolicy }}
|
||||
{{- if .Values.initContainers }}
|
||||
initContainers:
|
||||
{{- if eq (typeOf .Values.initContainers) "string" }}
|
||||
{{- tpl .Values.initContainers . | nindent 8 }}
|
||||
{{- else }}
|
||||
{{- toYaml .Values.initContainers | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if .Values.credentials.useSecret }}
|
||||
- name: cloud-credentials
|
||||
secret:
|
||||
secretName: {{ include "velero.secretName" . }}
|
||||
{{- end }}
|
||||
- name: plugins
|
||||
emptyDir: {}
|
||||
- name: scratch
|
||||
emptyDir: {}
|
||||
{{- if .Values.containerSecurityContext.readOnlyRootFilesystem }}
|
||||
- name: tmpdir
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.extraVolumes }}
|
||||
{{- toYaml .Values.extraVolumes | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.dnsConfig }}
|
||||
dnsConfig:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,4 @@
|
||||
{{ range .Values.extraObjects }}
|
||||
---
|
||||
{{ tpl (toYaml .) $ }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,39 @@
|
||||
{{- if .Values.namespace }}
|
||||
{{- if gt (len .Values.namespace.labels) 0 }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "velero.fullname" . }}-label-namespace
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-upgrade,post-rollback
|
||||
"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" . }}
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
serviceAccountName: {{ include "velero.serverServiceAccount" . }}
|
||||
containers:
|
||||
- name: label-namespace
|
||||
{{- if .Values.kubectl.image.digest }}
|
||||
image: "{{ .Values.kubectl.image.repository }}@{{ .Values.kubectl.image.digest }}"
|
||||
{{- else if .Values.kubectl.image.tag }}
|
||||
image: "{{ .Values.kubectl.image.repository }}:{{ .Values.kubectl.image.tag }}"
|
||||
{{- else }}
|
||||
image: "{{ .Values.kubectl.image.repository }}:{{ template "chart.KubernetesVersion" . }}"
|
||||
{{- end }}
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
{{- range .Values.namespace.labels }}
|
||||
kubectl label namespace {{ $.Release.Namespace }} {{ .key }}={{ .value }}
|
||||
{{- end }}
|
||||
restartPolicy: Never
|
||||
backoffLimit: 3
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,199 @@
|
||||
{{- if .Values.deployNodeAgent }}
|
||||
{{/* 'nodeAgent.securityContext' got renamed to 'nodeAgent.containerSecurityContext', merge both dicts into one for backward compatibility */}}
|
||||
{{- $containerSecurityContext := merge (.Values.nodeAgent.containerSecurityContext | default dict) (.Values.nodeAgent.securityContext | default dict) -}}
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: node-agent
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.nodeAgent.annotations }}
|
||||
annotations:
|
||||
{{- 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" . }}
|
||||
{{- with .Values.nodeAgent.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
name: node-agent
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: node-agent
|
||||
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" . }}
|
||||
{{- if .Values.podLabels }}
|
||||
{{- toYaml .Values.podLabels | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.podAnnotations .Values.metrics.enabled }}
|
||||
annotations:
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and (.Values.metrics.enabled) (not .Values.metrics.nodeAgentPodMonitor.enabled) }}
|
||||
{{- with .Values.metrics.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.image.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.imagePullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "velero.serverServiceAccount" . }}
|
||||
{{- with .Values.nodeAgent.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.nodeAgent.priorityClassName }}
|
||||
priorityClassName: {{ include "velero.nodeAgent.priorityClassName" . }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
volumes:
|
||||
{{- if .Values.credentials.useSecret }}
|
||||
- name: cloud-credentials
|
||||
secret:
|
||||
secretName: {{ include "velero.secretName" . }}
|
||||
{{- end }}
|
||||
- name: host-pods
|
||||
hostPath:
|
||||
path: {{ .Values.nodeAgent.podVolumePath }}
|
||||
{{- if .Values.nodeAgent.useScratchEmptyDir }}
|
||||
- name: scratch
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.nodeAgent.extraVolumes }}
|
||||
{{- toYaml .Values.nodeAgent.extraVolumes | nindent 8 }}
|
||||
{{- end }}
|
||||
dnsPolicy: {{ .Values.nodeAgent.dnsPolicy }}
|
||||
containers:
|
||||
- name: node-agent
|
||||
{{- if .Values.image.digest }}
|
||||
image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}"
|
||||
{{- else }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
{{- end }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
ports:
|
||||
- name: http-monitoring
|
||||
containerPort: 8085
|
||||
{{- end }}
|
||||
command:
|
||||
- /velero
|
||||
args:
|
||||
- node-agent
|
||||
- server
|
||||
{{- with .Values.configuration }}
|
||||
{{- with .features }}
|
||||
- --features={{ . }}
|
||||
{{- end }}
|
||||
{{- with .logLevel }}
|
||||
- --log-level={{ . }}
|
||||
{{- end }}
|
||||
{{- with .logFormat }}
|
||||
- --log-format={{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.credentials.useSecret }}
|
||||
- name: cloud-credentials
|
||||
mountPath: /credentials
|
||||
{{- end }}
|
||||
- name: host-pods
|
||||
mountPath: /host_pods
|
||||
mountPropagation: HostToContainer
|
||||
{{- if .Values.nodeAgent.useScratchEmptyDir }}
|
||||
- name: scratch
|
||||
mountPath: /scratch
|
||||
{{- end }}
|
||||
{{- if .Values.nodeAgent.extraVolumeMounts }}
|
||||
{{- toYaml .Values.nodeAgent.extraVolumeMounts | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.credentials.extraSecretRef }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ .Values.credentials.extraSecretRef }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: VELERO_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: VELERO_SCRATCH_DIR
|
||||
value: /scratch
|
||||
{{- if .Values.credentials.useSecret }}
|
||||
- name: AWS_SHARED_CREDENTIALS_FILE
|
||||
value: /credentials/cloud
|
||||
- name: GOOGLE_APPLICATION_CREDENTIALS
|
||||
value: /credentials/cloud
|
||||
- name: AZURE_CREDENTIALS_FILE
|
||||
value: /credentials/cloud
|
||||
- name: ALIBABA_CLOUD_CREDENTIALS_FILE
|
||||
value: /credentials/cloud
|
||||
{{- end }}
|
||||
{{- with .Values.configuration.extraEnvVars }}
|
||||
{{- range $key, $value := . }}
|
||||
- name: {{ default "none" $key }}
|
||||
value: {{ default "none" $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.credentials.extraEnvVars }}
|
||||
{{- range $key, $value := . }}
|
||||
- name: {{ default "none" $key }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "velero.secretName" $ }}
|
||||
key: {{ default "none" $key }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeAgent.extraEnvVars }}
|
||||
{{- range $key, $value := . }}
|
||||
- name: {{ default "none" $key }}
|
||||
value: {{ default "none" $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.lifecycle }}
|
||||
lifecycle: {{ toYaml .Values.nodeAgent.lifecycle | nindent 12 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
privileged: {{ .Values.nodeAgent.privileged }}
|
||||
{{- with $containerSecurityContext }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeAgent.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeAgent.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeAgent.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeAgent.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeAgent.dnsConfig }}
|
||||
dnsConfig:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,44 @@
|
||||
{{ if and (and .Values.metrics.enabled .Values.metrics.nodeAgentPodMonitor.enabled) (or (not .Values.metrics.nodeAgentPodMonitor.autodetect) (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1")) }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PodMonitor
|
||||
metadata:
|
||||
name: node-agent
|
||||
{{- if .Values.metrics.nodeAgentPodMonitor.namespace }}
|
||||
namespace: {{ .Values.metrics.nodeAgentPodMonitor.namespace }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.nodeAgentPodMonitor.annotations }}
|
||||
annotations:
|
||||
{{- 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" . }}
|
||||
{{- with .Values.metrics.nodeAgentPodMonitor.additionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "velero.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
name: node-agent
|
||||
{{- with .Values.nodeAgent.labels }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
podMetricsEndpoints:
|
||||
- port: http-monitoring
|
||||
interval: {{ .Values.metrics.scrapeInterval }}
|
||||
scrapeTimeout: {{ .Values.metrics.scrapeTimeout }}
|
||||
{{- if .Values.metrics.nodeAgentPodMonitor.scheme }}
|
||||
scheme: {{ .Values.metrics.nodeAgentPodMonitor.scheme }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.nodeAgentPodMonitor.tlsConfig }}
|
||||
tlsConfig:
|
||||
{{- toYaml .Values.metrics.nodeAgentPodMonitor.tlsConfig | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- if and (and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled) (or (not .Values.metrics.prometheusRule.autodetect) (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1")) (.Values.metrics.prometheusRule.spec) }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ include "velero.fullname" . }}
|
||||
{{- if .Values.metrics.prometheusRule.namespace }}
|
||||
namespace: {{ .Values.metrics.prometheusRule.namespace }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "velero.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- if .Values.metrics.prometheusRule.additionalLabels }}
|
||||
{{- toYaml .Values.metrics.prometheusRule.additionalLabels | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
groups:
|
||||
- name: {{ include "velero.name" . }}
|
||||
rules:
|
||||
{{- toYaml .Values.metrics.prometheusRule.spec | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- if .Values.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ include "velero.fullname" . }}-server
|
||||
namespace: {{ .Release.Namespace }}
|
||||
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" . }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "*"
|
||||
resources:
|
||||
- "*"
|
||||
verbs:
|
||||
- "*"
|
||||
|
||||
{{- end }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- if .Values.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ include "velero.fullname" . }}-server
|
||||
namespace: {{ .Release.Namespace }}
|
||||
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" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
namespace: {{ .Release.Namespace }}
|
||||
name: {{ include "velero.serverServiceAccount" . }}
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: {{ include "velero.fullname" . }}-server
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
{{- end }}
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- range $scheduleName, $schedule := .Values.schedules }}
|
||||
{{- if (not $schedule.disabled) }}
|
||||
apiVersion: velero.io/v1
|
||||
kind: Schedule
|
||||
metadata:
|
||||
name: {{ include "velero.fullname" $ }}-{{ $scheduleName }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
annotations:
|
||||
{{- if $schedule.annotations }}
|
||||
{{- toYaml $schedule.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" $ }}
|
||||
{{- if $schedule.labels }}
|
||||
{{- toYaml $schedule.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if $schedule.useOwnerReferencesInBackup }}
|
||||
useOwnerReferencesInBackup: {{ $schedule.useOwnerReferencesInBackup }}
|
||||
{{- end }}
|
||||
schedule: {{ $schedule.schedule | quote }}
|
||||
{{- with $schedule.template }}
|
||||
template:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if and .Values.credentials.useSecret (not .Values.credentials.existingSecret) -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "velero.secretName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.secretAnnotations }}
|
||||
annotations:
|
||||
{{- 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" . }}
|
||||
type: Opaque
|
||||
data:
|
||||
{{- range $key, $value := .Values.credentials.secretContents }}
|
||||
{{ $key }}: {{ $value | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.credentials.extraEnvVars }}
|
||||
{{ $key }}: {{ $value | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,29 @@
|
||||
{{- if .Values.metrics.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "velero.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.metrics.service.annotations }}
|
||||
annotations:
|
||||
{{- 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" . }}
|
||||
{{- with .Values.metrics.service.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: http-monitoring
|
||||
port: 8085
|
||||
targetPort: http-monitoring
|
||||
selector:
|
||||
name: velero
|
||||
app.kubernetes.io/name: {{ include "velero.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- if .Values.serviceAccount.server.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "velero.serverServiceAccount" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if .Values.serviceAccount.server.annotations }}
|
||||
annotations:
|
||||
{{ 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" . }}
|
||||
{{- with .Values.serviceAccount.server.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,46 @@
|
||||
{{ if and (and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled) (or (not .Values.metrics.serviceMonitor.autodetect) (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1")) }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "velero.fullname" . }}
|
||||
{{- if .Values.metrics.serviceMonitor.namespace }}
|
||||
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.serviceMonitor.annotations }}
|
||||
annotations:
|
||||
{{- 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" . }}
|
||||
{{- with .Values.metrics.serviceMonitor.additionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "velero.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
endpoints:
|
||||
- port: http-monitoring
|
||||
interval: {{ .Values.metrics.scrapeInterval }}
|
||||
scrapeTimeout: {{ .Values.metrics.scrapeTimeout }}
|
||||
{{- if .Values.metrics.serviceMonitor.scheme }}
|
||||
scheme: {{ .Values.metrics.serviceMonitor.scheme }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.relabelings }}
|
||||
relabelings: {{ toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.tlsConfig }}
|
||||
tlsConfig:
|
||||
{{- toYaml .Values.metrics.serviceMonitor.tlsConfig | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,27 @@
|
||||
{{- if .Values.upgradeCRDs }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "velero.fullname" . }}-upgrade-crds
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install,pre-upgrade,pre-rollback
|
||||
"helm.sh/hook-weight": "-5"
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
labels:
|
||||
app.kubernetes.io/component: upgrade-crds
|
||||
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" . }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "apiextensions.k8s.io"
|
||||
resources:
|
||||
- "customresourcedefinitions"
|
||||
verbs:
|
||||
- create
|
||||
- patch
|
||||
- update
|
||||
- get
|
||||
- list
|
||||
{{- end }}
|
||||
@@ -0,0 +1,25 @@
|
||||
{{- if .Values.upgradeCRDs }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "velero.fullname" . }}-upgrade-crds
|
||||
labels:
|
||||
app.kubernetes.io/component: upgrade-crds
|
||||
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" . }}
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install,pre-upgrade,pre-rollback
|
||||
"helm.sh/hook-weight": "-3"
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
namespace: {{ .Release.Namespace }}
|
||||
name: {{ include "velero.serverServiceAccount" . }}-upgrade-crds
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: {{ include "velero.fullname" . }}-upgrade-crds
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{{- if .Values.upgradeCRDs }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "velero.serverServiceAccount" . }}-upgrade-crds
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install,pre-upgrade,pre-rollback
|
||||
"helm.sh/hook-weight": "-4"
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
{{- if .Values.serviceAccount.server.annotations }}
|
||||
{{ 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" . }}
|
||||
{{- with .Values.serviceAccount.server.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,109 @@
|
||||
{{- if .Values.upgradeCRDs }}
|
||||
{{/* 'securityContext' got renamed to 'podSecurityContext', merge both dicts into one for backward compatibility */}}
|
||||
{{- $podSecurityContext := merge (.Values.podSecurityContext | default dict) (.Values.securityContext | default dict) -}}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "velero.fullname" . }}-upgrade-crds
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install,pre-upgrade,pre-rollback
|
||||
"helm.sh/hook-weight": "5"
|
||||
"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" . }}
|
||||
spec:
|
||||
backoffLimit: 3
|
||||
template:
|
||||
metadata:
|
||||
name: velero-upgrade-crds
|
||||
{{- with .Values.kubectl.labels }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.kubectl.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.image.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.imagePullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "velero.serverServiceAccount" . }}-upgrade-crds
|
||||
initContainers:
|
||||
- name: kubectl
|
||||
{{- if .Values.kubectl.image.digest }}
|
||||
image: "{{ .Values.kubectl.image.repository }}@{{ .Values.kubectl.image.digest }}"
|
||||
{{- else if .Values.kubectl.image.tag }}
|
||||
image: "{{ .Values.kubectl.image.repository }}:{{ .Values.kubectl.image.tag }}"
|
||||
{{- else }}
|
||||
image: "{{ .Values.kubectl.image.repository }}:{{ template "chart.KubernetesVersion" . }}"
|
||||
{{- end }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- /bin/sh
|
||||
args:
|
||||
- -c
|
||||
- cp `which sh` /tmp && cp `which kubectl` /tmp
|
||||
{{- with .Values.kubectl.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.kubectl.containerSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: /tmp
|
||||
name: crds
|
||||
containers:
|
||||
- name: velero
|
||||
{{- if .Values.image.digest }}
|
||||
image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}"
|
||||
{{- else }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
{{- end }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- /tmp/sh
|
||||
args:
|
||||
- -c
|
||||
- /velero install --crds-only --dry-run -o yaml | /tmp/kubectl apply -f -
|
||||
{{- with .Values.upgradeJobResources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.containerSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: /tmp
|
||||
name: crds
|
||||
volumes:
|
||||
- name: crds
|
||||
emptyDir: {}
|
||||
restartPolicy: OnFailure
|
||||
{{- with $podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{- if .Values.snapshotsEnabled }}
|
||||
|
||||
{{- if typeIs "[]interface {}" .Values.configuration.volumeSnapshotLocation }}
|
||||
{{- range .Values.configuration.volumeSnapshotLocation }}
|
||||
---
|
||||
apiVersion: velero.io/v1
|
||||
kind: VolumeSnapshotLocation
|
||||
metadata:
|
||||
name: {{ .name | default "default" }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
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" $ }}
|
||||
spec:
|
||||
{{- if not (empty .credential) }}
|
||||
credential:
|
||||
{{- with .credential.name }}
|
||||
name: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .credential.key }}
|
||||
key: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
provider: {{ .provider }}
|
||||
{{- with .config }}
|
||||
config:
|
||||
{{- range $key, $value := . }}
|
||||
{{- $key | nindent 4 }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user