Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v1alpha1/velero_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const ResticRestoreImageKey UnsupportedImageKey = "resticRestoreImageFqin"
// VeleroSpec defines the desired state of Velero
type VeleroSpec struct {
// BackupStorageLocations defines the list of desired configuration to use for BackupStorageLocations
// +optional
BackupStorageLocations []velero.BackupStorageLocationSpec `json:"backupStorageLocations"`
// VolumeSnapshotLocations defines the list of desired configuration to use for VolumeSnapshotLocations
// +optional
Expand Down Expand Up @@ -118,6 +119,9 @@ type VeleroSpec struct {
// BackupImages is used to specify whether you want to deploy a registry for enabling backup and restore of images
// +optional
BackupImages *bool `json:"backupImages,omitempty"`
// If you need to install Velero without a default backup storage location NoDefaultBackupLocation flag is required for confirmation
// +optional
NoDefaultBackupLocation bool `json:"noDefaultBackupLocation,omitempty"`
}

// VeleroStatus defines the observed state of Velero
Expand Down
6 changes: 4 additions & 2 deletions config/crd/bases/oadp.openshift.io_veleroes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ spec:
description: EnableRestic is a boolean to specify if restic daemonset
instance should be created or not
type: boolean
noDefaultBackupLocation:
description: If you need to install Velero without a default backup
storage location NoDefaultBackupLocation flag is required for confirmation
type: boolean
noobaa:
description: Noobaa is a boolean to specify if we should install backup
storage from OCS operator with Noobaa
Expand Down Expand Up @@ -380,8 +384,6 @@ spec:
- provider
type: object
type: array
required:
- backupStorageLocations
type: object
status:
description: VeleroStatus defines the observed state of Velero
Expand Down
2 changes: 1 addition & 1 deletion controllers/bsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (r *VeleroReconciler) ValidateBackupStorageLocations(log logr.Logger) (bool
return false, err
}
// Ensure we have a BSL or user has specified noobaa install
if len(velero.Spec.BackupStorageLocations) == 0 && !velero.Spec.Noobaa {
if len(velero.Spec.BackupStorageLocations) == 0 && !(velero.Spec.Noobaa || velero.Spec.NoDefaultBackupLocation) {
return false, errors.New("no backupstoragelocations configured, ensure a backupstoragelocation or noobaa has been configured")
}

Expand Down
22 changes: 21 additions & 1 deletion controllers/bsl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestVeleroReconciler_ValidateBackupStorageLocations(t *testing.T) {
wantErr bool
}{
{
name: "test no BSLs, no noobaa",
name: "test no BSLs, no noobaa, no NoDefaultBackupLocation",
VeleroCR: &oadpv1alpha1.Velero{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Expand All @@ -69,6 +69,26 @@ func TestVeleroReconciler_ValidateBackupStorageLocations(t *testing.T) {
},
},
},
{
name: "test no BSLs, no noobaa, with NoDefaultBackupLocation",
VeleroCR: &oadpv1alpha1.Velero{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: "test-ns",
},
Spec: oadpv1alpha1.VeleroSpec{
NoDefaultBackupLocation: true,
},
},
want: true,
wantErr: false,
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "cloud-credentials",
Namespace: "test-ns",
},
},
},
{
name: "test BSLs specified, no noobaa",
VeleroCR: &oadpv1alpha1.Velero{
Expand Down
3 changes: 2 additions & 1 deletion docs/API_ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
| veleroResourceAllocations | [corev1.ResourceRequirements](https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements) | Set specific resource `limits` and `requests` for the Velero pod. For more information, go [here](config/resource_req_limits.md). |
| veleroTolerations | [[]corev1.Toleration](https://pkg.go.dev/k8s.io/api/core/v1#Toleration) | |
| volumeSnapshotLocations | [[]velero.VolumeSnapshotLocationSpec](https://velero.io/docs/v1.6/api-types/volumesnapshotlocation/) | Location to store volume snapshots. For further deatils, see [here](config/bsl_and_vsl.md). |
| NoDefaultBackupLocation | [bool](https://pkg.go.dev/builtin#bool) | Assert that you do not want to use velero with a backup storage location. See [Velero Docs](https://velero.io/docs/v1.7/customize-installation/#do-not-configure-a-backup-storage-location-during-install). |

See also [![Go Reference](https://pkg.go.dev/badge/github.com/openshift/oadp-operator.svg)](https://pkg.go.dev/github.com/openshift/oadp-operator) for a deeper dive.
See also [![Go Reference](https://pkg.go.dev/badge/github.com/openshift/oadp-operator.svg)](https://pkg.go.dev/github.com/openshift/oadp-operator) for a deeper dive.
15 changes: 15 additions & 0 deletions tests/e2e/install_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,20 @@ var _ = Describe("Configuration testing for Velero Custom Resource", func() {
"foo": "bar",
},
}, nil),
Entry("NoDefaultBackupLocation", InstallCase{
Name: "default-cr-node-selector",
VeleroSpec: &oadpv1alpha1.VeleroSpec{
EnableRestic: pointer.Bool(true),
BackupStorageLocations: []velero.BackupStorageLocationSpec{},
NoDefaultBackupLocation: true,
DefaultVeleroPlugins: []oadpv1alpha1.DefaultPlugin{
oadpv1alpha1.DefaultPluginOpenShift,
},
},
ExpectRestic: true,
ExpectedPlugins: []string{
common.VeleroPluginForOpenshift,
},
}, nil),
)
})