diff --git a/docs/get-started.md b/docs/get-started.md index 73193cc85..d55109790 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -61,16 +61,14 @@ These instructions start the Velero server and a Minio instance that is accessib --provider aws \ --bucket velero \ --secret-file ./credentials-velero \ + --use-volume-snapshots=false \ --backup-location-config region=minio,s3ForcePathStyle="true",s3Url=http://minio.velero.svc:9000 ``` + This example assumes that it is running within a local cluster without a volume provider capable of snapshots, so no `VolumeSnapshotLocation` is created (`--use-volume-snapshots=false`). + Additionally, you can specify `--use-restic` to enable restic support, and `--wait` to wait for the deployment to be ready. -1. Once the installation is complete, remove the default `VolumeSnapshotLocation` that was created by `velero install`, since it's not relevant for this scenario: - - ```bash - kubectl -n velero delete volumesnapshotlocation.velero.io default - ``` 1. Deploy the example nginx application: diff --git a/docs/ibm-config.md b/docs/ibm-config.md index 737e36524..7d495b29c 100644 --- a/docs/ibm-config.md +++ b/docs/ibm-config.md @@ -59,10 +59,13 @@ Install Velero, including all prerequisites, into the cluster and start the depl velero install \ --provider aws \ --bucket \ - --secret-file ./credentials-velero + --secret-file ./credentials-velero \ + --use-volume-snapshots=false \ --backup-location-config region=,s3ForcePathStyle="true",s3Url= ``` +Velero does not currently have a volume snapshot plugin for IBM Cloud, so creating volume snapshots is disabled. + Additionally, you can specify `--use-restic` to enable restic support, and `--wait` to wait for the deployment to be ready. Once the installation is complete, remove the default `VolumeSnapshotLocation` that was created by `velero install`, since it's specific to AWS and won't work for IBM Cloud: diff --git a/docs/install-overview.md b/docs/install-overview.md index 698d04961..3a964c8dc 100644 --- a/docs/install-overview.md +++ b/docs/install-overview.md @@ -24,6 +24,8 @@ The Velero client includes an `install` command to specify the settings for each [--backup-location-config] [--snapshot-location-config] [--namespace] + [--use-volume-snapshots] + [--use-restic] ``` For provider-specific instructions, see: @@ -33,6 +35,8 @@ For provider-specific instructions, see: * [Run Velero on Azure][2] * [Use IBM Cloud Object Store as Velero's storage destination][4] +When using restic on a storage provider that doesn't currently have Velero support for snapshots, the `--use-volume-snapshots=false` flag prevents an unused `VolumeSnapshotLocation` from being created on installation. + To see the YAML applied by the `velero install` command, use the `--dry-run -o yaml` arguments. For more complex installation needs, use either the generated YAML, or the Helm chart. diff --git a/pkg/cmd/cli/install/install.go b/pkg/cmd/cli/install/install.go index 4fa9dd941..8b4374ff0 100644 --- a/pkg/cmd/cli/install/install.go +++ b/pkg/cmd/cli/install/install.go @@ -50,6 +50,7 @@ type InstallOptions struct { VolumeSnapshotConfig flag.Map UseRestic bool Wait bool + UseVolumeSnapshots bool } // BindFlags adds command line values to the options struct. @@ -62,6 +63,7 @@ func (o *InstallOptions) BindFlags(flags *pflag.FlagSet) { flags.StringVar(&o.Namespace, "namespace", o.Namespace, "namespace to install Velero and associated data into. Optional.") flags.Var(&o.BackupStorageConfig, "backup-location-config", "configuration to use for the backup storage location. Format is key1=value1,key2=value2") flags.Var(&o.VolumeSnapshotConfig, "snapshot-location-config", "configuration to use for the volume snapshot location. Format is key1=value1,key2=value2") + flags.BoolVar(&o.UseVolumeSnapshots, "use-volume-snapshots", o.UseVolumeSnapshots, "whether or not to create snapshot location automatically. Set to false if you do not plan to create volume snapshots via a storage provider.") flags.BoolVar(&o.RestoreOnly, "restore-only", o.RestoreOnly, "run the server in restore-only mode. Optional.") flags.BoolVar(&o.DryRun, "dry-run", o.DryRun, "generate resources, but don't send them to the cluster. Use with -o. Optional.") flags.BoolVar(&o.UseRestic, "use-restic", o.UseRestic, "create restic deployment. Optional.") @@ -75,6 +77,8 @@ func NewInstallOptions() *InstallOptions { Image: install.DefaultImage, BackupStorageConfig: flag.NewMap(), VolumeSnapshotConfig: flag.NewMap(), + // Default to creating a VSL unless we're told otherwise + UseVolumeSnapshots: true, } } @@ -89,16 +93,17 @@ func (o *InstallOptions) AsVeleroOptions() (*install.VeleroOptions, error) { return nil, err } return &install.VeleroOptions{ - Namespace: o.Namespace, - Image: o.Image, - ProviderName: o.ProviderName, - Bucket: o.BucketName, - Prefix: o.Prefix, - SecretData: secretData, - RestoreOnly: o.RestoreOnly, - UseRestic: o.UseRestic, - BSLConfig: o.BackupStorageConfig.Data(), - VSLConfig: o.VolumeSnapshotConfig.Data(), + Namespace: o.Namespace, + Image: o.Image, + ProviderName: o.ProviderName, + Bucket: o.BucketName, + Prefix: o.Prefix, + SecretData: secretData, + RestoreOnly: o.RestoreOnly, + UseRestic: o.UseRestic, + UseVolumeSnapshots: o.UseVolumeSnapshots, + BSLConfig: o.BackupStorageConfig.Data(), + VSLConfig: o.VolumeSnapshotConfig.Data(), }, nil } diff --git a/pkg/install/resources.go b/pkg/install/resources.go index 2ef145218..18d4d5891 100644 --- a/pkg/install/resources.go +++ b/pkg/install/resources.go @@ -175,16 +175,17 @@ func appendUnstructured(list *unstructured.UnstructuredList, obj runtime.Object) } type VeleroOptions struct { - Namespace string - Image string - ProviderName string - Bucket string - Prefix string - SecretData []byte - RestoreOnly bool - UseRestic bool - BSLConfig map[string]string - VSLConfig map[string]string + Namespace string + Image string + ProviderName string + Bucket string + Prefix string + SecretData []byte + RestoreOnly bool + UseRestic bool + UseVolumeSnapshots bool + BSLConfig map[string]string + VSLConfig map[string]string } // AllResources returns a list of all resources necessary to install Velero, in the appropriate order, into a Kubernetes cluster. @@ -213,8 +214,11 @@ func AllResources(o *VeleroOptions) (*unstructured.UnstructuredList, error) { bsl := BackupStorageLocation(o.Namespace, o.ProviderName, o.Bucket, o.Prefix, o.BSLConfig) appendUnstructured(resources, bsl) - vsl := VolumeSnapshotLocation(o.Namespace, o.ProviderName, o.VSLConfig) - appendUnstructured(resources, vsl) + // A snapshot location may not be desirable for users relying on restic + if o.UseVolumeSnapshots { + vsl := VolumeSnapshotLocation(o.Namespace, o.ProviderName, o.VSLConfig) + appendUnstructured(resources, vsl) + } deploy := Deployment(o.Namespace, WithImage(o.Image),