From 77643ff018773b1fbaa2f5e9c674413a2fbcdbbf Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Tue, 30 Apr 2024 10:34:48 +0300 Subject: [PATCH] cleaner --- .../class/volsync/_replicationDestination.tpl | 18 ++++++++------- .../common/templates/lib/volsync/_storage.tpl | 22 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/library/common/templates/class/volsync/_replicationDestination.tpl b/library/common/templates/class/volsync/_replicationDestination.tpl index 74a39ac5..a1ff8f20 100644 --- a/library/common/templates/class/volsync/_replicationDestination.tpl +++ b/library/common/templates/class/volsync/_replicationDestination.tpl @@ -15,7 +15,15 @@ objectData: {{- $rootCtx := .rootCtx -}} {{- $objectData := .objectData -}} - {{- $volsyncData := .volsyncData }} + {{- $volsyncData := .volsyncData -}} + + {{- $capacity := $rootCtx.Values.global.fallbackDefaults.pvcSize -}} + {{- if $objectData.size -}} + {{- $capacity = $objectData.size -}} + {{- end -}} + {{- if $volsyncData.dest.capacity -}} + {{- $capacity = $volsyncData.dest.capacity -}} + {{- end }} --- apiVersion: volsync.backube/v1alpha1 kind: ReplicationDestination @@ -38,13 +46,7 @@ spec: {{ $volsyncData.type }}: repository: {{ $volsyncData.repository }} copyMethod: {{ $volsyncData.copyMethod | default "Snapshot"}} - {{- if $volsyncData.dest.capacity }} - capacity: {{ $volsyncData.dest.capacity }} - {{- else if $objectData.size }} - capacity: {{ $objectData.size }} - {{- else }} - capacity: {{ $rootCtx.Values.global.fallbackDefaults.pvcSize }} - {{- end }} + capacity: {{ $capacity }} {{- include "tc.v1.common.lib.volsync.storage" (dict "rootCtx" $rootCtx "objectData" $objectData "volsyncData" $volsyncData "target" "dest") | trim | nindent 4 }} {{- include "tc.v1.common.lib.volsync.cache" (dict "rootCtx" $rootCtx "objectData" $objectData "volsyncData" $volsyncData "target" "dest") | trim | nindent 4 }} diff --git a/library/common/templates/lib/volsync/_storage.tpl b/library/common/templates/lib/volsync/_storage.tpl index b24f4962..9b794b4e 100644 --- a/library/common/templates/lib/volsync/_storage.tpl +++ b/library/common/templates/lib/volsync/_storage.tpl @@ -6,24 +6,22 @@ {{- $volsyncData := .volsyncData -}} {{- $target := get $volsyncData .target -}} + {{- $accessModes := $rootCtx.Values.global.fallbackDefaults.accessModes -}} + {{- if $objectData.accessModes -}} + {{- $accessModes = $objectData.accessModes -}} + {{- end -}} + {{- if $target.accessModes -}} + {{- $accessModes = $target.accessModes -}} + {{- end -}} + {{- with $target.storageClassName }} storageClassName: {{ . }} {{- end -}} accessModes: - {{- if $target.accessModes }} - - {{- range $target.accessModes }} + {{- range $accessModes }} - {{ . }} - {{- end }} - {{- else if $objectData.accessModes }} - {{- range $objectData.accessModes }} - - {{ . }} - {{- end }} - {{- else }} - {{- range $rootCtx.Values.global.fallbackDefaults.accessModes }} - - {{ . }} - {{- end }} + {{- end -}} {{- end -}} {{- with $target.volumeSnapshotClassName }}