Skip to content

Commit

Permalink
Rename CopyMethod None to CopyMethod Direct
Browse files Browse the repository at this point in the history
Signed-off-by: Tesshu Flower <tflower@redhat.com>
  • Loading branch information
tesshuflower committed Oct 28, 2021
1 parent dda3ba0 commit f4d62c5
Show file tree
Hide file tree
Showing 33 changed files with 334 additions and 237 deletions.
6 changes: 4 additions & 2 deletions api/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ package v1alpha1

// CopyMethodType defines the methods for creating point-in-time copies of
// volumes.
//+kubebuilder:validation:Enum=None;Clone;Snapshot
//+kubebuilder:validation:Enum=Direct;None;Clone;Snapshot
type CopyMethodType string

const (
// CopyMethodNone indicates a copy should not be performed.
// CopyMethodDirect indicates a copy should not be performed. Data will be copied directly to/from the PVC.
CopyMethodDirect CopyMethodType = "Direct"
// CopyMethodNone indicates a copy should not be performed. Deprecated (replaced by CopyMethodDirect).
CopyMethodNone CopyMethodType = "None"
// CopyMethodClone indicates a copy should be created using volume cloning.
CopyMethodClone CopyMethodType = "Clone"
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/volsync.backube_replicationdestinations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ spec:
description: copyMethod describes how a point-in-time (PiT) image
of the destination volume should be created.
enum:
- Direct
- None
- Clone
- Snapshot
Expand Down Expand Up @@ -164,6 +165,7 @@ spec:
description: copyMethod describes how a point-in-time (PiT) image
of the destination volume should be created.
enum:
- Direct
- None
- Clone
- Snapshot
Expand Down Expand Up @@ -224,6 +226,7 @@ spec:
description: copyMethod describes how a point-in-time (PiT) image
of the destination volume should be created.
enum:
- Direct
- None
- Clone
- Snapshot
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/volsync.backube_replicationsources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ spec:
description: copyMethod describes how a point-in-time (PiT) image
of the source volume should be created.
enum:
- Direct
- None
- Clone
- Snapshot
Expand Down Expand Up @@ -160,6 +161,7 @@ spec:
description: copyMethod describes how a point-in-time (PiT) image
of the source volume should be created.
enum:
- Direct
- None
- Clone
- Snapshot
Expand Down Expand Up @@ -241,6 +243,7 @@ spec:
description: copyMethod describes how a point-in-time (PiT) image
of the source volume should be created.
enum:
- Direct
- None
- Clone
- Snapshot
Expand Down
14 changes: 14 additions & 0 deletions controllers/mover/restic/restic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,20 @@ var _ = Describe("Restic as a source", func() {
Expect(dataPVC.Labels).NotTo(HaveKey("volsync.backube/cleanup"))
})
})
When("CopyMethod is Direct", func() {
BeforeEach(func() {
rs.Spec.Restic.CopyMethod = volsyncv1alpha1.CopyMethodDirect
})
It("the source is used as the data PVC", func() {
dataPVC, err := mover.ensureSourcePVC(ctx)
Expect(err).ToNot(HaveOccurred())
Expect(dataPVC.Name).To(Equal(sPVC.Name))
// It's not owned by the CR
Expect(dataPVC.OwnerReferences).To(BeEmpty())
// It won't be cleaned up at the end of the transfer
Expect(dataPVC.Labels).NotTo(HaveKey("volsync.backube/cleanup"))
})
})
When("CopyMethod is Clone", func() {
BeforeEach(func() {
rs.Spec.Restic.CopyMethod = volsyncv1alpha1.CopyMethodClone
Expand Down
Loading

0 comments on commit f4d62c5

Please sign in to comment.