diff --git a/.github/workflows/common-tests.yaml b/.github/workflows/common-tests.yaml index 94f344cacdd..ea0e7cb2f28 100644 --- a/.github/workflows/common-tests.yaml +++ b/.github/workflows/common-tests.yaml @@ -159,6 +159,8 @@ jobs: ## TODO: reenable when we've some credentials ready to rock for testing # - volsync-dest-values.yaml # - volsync-src-values.yaml + # - volsync-dest-direct-values.yaml + # - volsync-src-direct-values.yaml steps: - name: Checkout diff --git a/charts/library/common-test/ci/volsync-dest-direct-values.yaml b/charts/library/common-test/ci/volsync-dest-direct-values.yaml new file mode 100644 index 00000000000..fc1592317ac --- /dev/null +++ b/charts/library/common-test/ci/volsync-dest-direct-values.yaml @@ -0,0 +1,62 @@ +service: + main: + enabled: true + primary: true + ports: + main: + enabled: true + primary: true + port: 8080 + +workload: + main: + enabled: true + primary: true + type: Deployment + podSpec: + containers: + main: + enabled: true + primary: true + args: + - --port + - "8080" + probes: + liveness: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + readiness: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + startup: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + +persistence: + destbackup: + enabled: true + type: pvc + mountPath: /backedup + copyMethod: Direct + targetSelectAll: true + volsync: + - name: mybackup + type: restic + copyMethod: Direct + credentials: mys3 + dest: + enabled: true + src: + enabled: false + +credentials: + mys3: + type: s3 + url: "http://test" + bucket: "test" + accessKey: "test" + secretKey: "test" + encrKey: "test" diff --git a/charts/library/common-test/ci/volsync-dest-values.yaml b/charts/library/common-test/ci/volsync-dest-values.yaml index 498cf38aa7b..6ce07c63515 100644 --- a/charts/library/common-test/ci/volsync-dest-values.yaml +++ b/charts/library/common-test/ci/volsync-dest-values.yaml @@ -53,7 +53,7 @@ persistence: credentials: mys3: type: s3 - url: "test" + url: "http://test" bucket: "test" accessKey: "test" secretKey: "test" diff --git a/charts/library/common-test/ci/volsync-src-direct-values.yaml b/charts/library/common-test/ci/volsync-src-direct-values.yaml new file mode 100644 index 00000000000..b74cf240be6 --- /dev/null +++ b/charts/library/common-test/ci/volsync-src-direct-values.yaml @@ -0,0 +1,62 @@ +service: + main: + enabled: true + primary: true + ports: + main: + enabled: true + primary: true + port: 8080 + +workload: + main: + enabled: true + primary: true + type: Deployment + podSpec: + containers: + main: + enabled: true + primary: true + args: + - --port + - "8080" + probes: + liveness: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + readiness: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + startup: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + +persistence: + srcbackup: + enabled: true + type: pvc + mountPath: /backedup + copyMethod: Direct + targetSelectAll: true + volsync: + - name: mybackup + type: restic + credentials: mys3 + copyMethod: Direct + dest: + enabled: false + src: + enabled: true + +credentials: + mys3: + type: s3 + url: "http://test" + bucket: "test" + accessKey: "test" + secretKey: "test" + encrKey: "test" diff --git a/charts/library/common-test/ci/volsync-src-values.yaml b/charts/library/common-test/ci/volsync-src-values.yaml index b5293c33ea3..260bd552ae9 100644 --- a/charts/library/common-test/ci/volsync-src-values.yaml +++ b/charts/library/common-test/ci/volsync-src-values.yaml @@ -53,7 +53,7 @@ persistence: credentials: mys3: type: s3 - url: "test" + url: "http://test" bucket: "test" accessKey: "test" secretKey: "test" diff --git a/charts/library/common-test/tests/volsync/replication_dest_spec_test.yaml b/charts/library/common-test/tests/volsync/replication_dest_spec_test.yaml index 28592db08fd..680f0223e00 100644 --- a/charts/library/common-test/tests/volsync/replication_dest_spec_test.yaml +++ b/charts/library/common-test/tests/volsync/replication_dest_spec_test.yaml @@ -304,3 +304,49 @@ tests: fsGroup: 568 runAsUser: 568 runAsGroup: 568 + + - it: should generate correct spec with destinationPVC + set: + persistence: + destbackup: + enabled: true + type: pvc + mountPath: /backedup + volsync: + - name: mybackup1 + type: restic + credentials: mys3 + copyMethod: Direct + dest: + enabled: true + capacity: 200Gi + src: + enabled: false + credentials: *credentials + asserts: + - documentIndex: *replicationDestDoc + isKind: + of: ReplicationDestination + - documentIndex: *replicationDestDoc + isAPIVersion: + of: volsync.backube/v1alpha1 + - documentIndex: *replicationDestDoc + equal: + path: spec + value: + trigger: + manual: restore-once + restic: + repository: test-release-name-common-test-destbackup-volsync-mybackup1 + copyMethod: Direct + cleanupTempPVC: false + cleanupCachePVC: false + destinationPVC: test-release-name-common-test-destbackup + cacheCapacity: 10Gi + capacity: 200Gi + accessModes: + - ReadWriteOnce + moverSecurityContext: + fsGroup: 568 + runAsUser: 568 + runAsGroup: 568 diff --git a/charts/library/common/templates/class/volsync/_replicationDestination.tpl b/charts/library/common/templates/class/volsync/_replicationDestination.tpl index ed0cc38ff81..7ca2322c411 100644 --- a/charts/library/common/templates/class/volsync/_replicationDestination.tpl +++ b/charts/library/common/templates/class/volsync/_replicationDestination.tpl @@ -26,6 +26,7 @@ objectData: {{- $cleanupCachePVC = $volsyncData.cleanupCachePVC -}} {{- end -}} + {{- $copyMethod := $volsyncData.copyMethod | default "Snapshot" -}} {{- $capacity := $rootCtx.Values.global.fallbackDefaults.pvcSize -}} {{- if $objectData.size -}} {{- $capacity = $objectData.size -}} @@ -54,8 +55,11 @@ spec: manual: restore-once {{ $volsyncData.type }}: repository: {{ $volsyncData.repository }} - copyMethod: {{ $volsyncData.copyMethod | default "Snapshot"}} + copyMethod: {{ $copyMethod }} capacity: {{ $capacity }} + {{- if eq $copyMethod "Direct" }} + destinationPVC: {{ $objectData.name }} + {{- end }} cleanupTempPVC: {{ $cleanupTempPVC }} cleanupCachePVC: {{ $cleanupCachePVC }} {{- include "tc.v1.common.lib.volsync.storage" (dict "rootCtx" $rootCtx "objectData" $objectData "volsyncData" $volsyncData "target" "dest") | trim | nindent 4 }}