Update _schedule.tpl

This commit is contained in:
Kjeld Schouten
2024-02-06 22:07:03 +01:00
committed by GitHub
parent 49839326bf
commit 8f85d05b4c

View File

@@ -14,12 +14,22 @@ objectData:
{{- $rootCtx := .rootCtx -}}
{{- $objectData := .objectData }}
{{- $namespace := ( include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Schedule" ) -}}
{{- $lookupBSL := (lookup "velero.io/v1" "BackupStorageLocation" "" "") -}}
{{- if and $lookupBSL $lookupBSL.items -}}
{{- with (index $lookupBSL.items 0) }}
{{- $lookupBSL = . -}}
{{- end }}
{{- end -}}
{{- if $lookupBSL -}}
{{- $namespace = $lookupBSL.metadata.namespace -}}
{{- end -}}
---
apiVersion: velero.io/v1
kind: Schedule
metadata:
name: {{ $objectData.name }}
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Schedule") }}
namespace: {{ $namespace }}
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
labels:
@@ -35,8 +45,13 @@ spec:
{{- if (kindIs "bool" $objectData.useOwnerReferencesInBackup) }}
useOwnerReferencesInBackup: {{ $objectData.useOwnerReferencesInBackup }}
{{- end -}}
{{- with $objectData.template }}
template:
{{- if or ( not $objectData.template ) ( and ( not $objectData.template ) ( not $objectData.template.includedNamespaces ) ) -}}
includedNamespaces:
- {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Schedule") }}
{{- end -}}
{{- with $objectData.template }}
{{- toYaml . | nindent 4 }}
{{- end -}}
{{- end -}}
{{- end -}}