Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNM - first pass at including velero-openstack plugin #1592

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions api/v1alpha1/cloud_storage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ type CloudStorage struct {
type CloudStorageProvider string

const (
AWSBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginAWS)
AzureBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginMicrosoftAzure)
GCPBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginGCP)
AWSBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginAWS)
AzureBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginMicrosoftAzure)
GCPBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginGCP)
OpenStackBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginOpenStack)
)

type CloudStorageSpec struct {
Expand Down
5 changes: 4 additions & 1 deletion api/v1alpha1/oadp_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ReconcileCompleteMessage = "Reconcile complete"
const OadpOperatorLabel = "openshift.io/oadp"
const RegistryDeploymentLabel = "openshift.io/oadp-registry"

// +kubebuilder:validation:Enum=aws;legacy-aws;gcp;azure;csi;vsm;openshift;kubevirt
// +kubebuilder:validation:Enum=aws;legacy-aws;gcp;azure;csi;vsm;openshift;kubevirt;openstack
type DefaultPlugin string

const DefaultPluginAWS DefaultPlugin = "aws"
Expand All @@ -46,6 +46,7 @@ const DefaultPluginCSI DefaultPlugin = "csi"
const DefaultPluginVSM DefaultPlugin = "vsm"
const DefaultPluginOpenShift DefaultPlugin = "openshift"
const DefaultPluginKubeVirt DefaultPlugin = "kubevirt"
const DefaultPluginOpenStack DefaultPlugin = "openstack"

type CustomPlugin struct {
Name string `json:"name"`
Expand All @@ -63,6 +64,7 @@ const AzurePluginImageKey UnsupportedImageKey = "azurePluginImageFqin"
const GCPPluginImageKey UnsupportedImageKey = "gcpPluginImageFqin"
const ResticRestoreImageKey UnsupportedImageKey = "resticRestoreImageFqin"
const KubeVirtPluginImageKey UnsupportedImageKey = "kubevirtPluginImageFqin"
const OpenStackPluginImageKey UnsupportedImageKey = "openstackPluginImageFqin"
const NonAdminControllerImageKey UnsupportedImageKey = "nonAdminControllerImageFqin"
const OperatorTypeKey UnsupportedImageKey = "operator-type"
const TechPreviewAck UnsupportedImageKey = "tech-preview-ack"
Expand Down Expand Up @@ -557,6 +559,7 @@ type DataProtectionApplicationSpec struct {
// - awsPluginImageFqin
// - legacyAWSPluginImageFqin
// - openshiftPluginImageFqin
// - openstackPluginImageFqin
// - azurePluginImageFqin
// - gcpPluginImageFqin
// - resticRestoreImageFqin
Expand Down
4 changes: 4 additions & 0 deletions bundle/manifests/oadp-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,8 @@ spec:
value: quay.io/konveyor/velero-plugin-for-microsoft-azure:latest
- name: RELATED_IMAGE_VELERO_PLUGIN_FOR_GCP
value: quay.io/konveyor/velero-plugin-for-gcp:latest
- name: RELATED_IMAGE_VELERO_PLUGIN_FOR_OPENSTACK
value: quay.io/konveyor/velero-plugin-for-openstack:latest
- name: RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN
value: quay.io/konveyor/kubevirt-velero-plugin:v0.7.0
- name: RELATED_IMAGE_MUSTGATHER
Expand Down Expand Up @@ -1095,6 +1097,8 @@ spec:
name: velero-plugin-for-microsoft-azure
- image: quay.io/konveyor/velero-plugin-for-gcp:latest
name: velero-plugin-for-gcp
- image: quay.io/konveyor/velero-plugin-for-openstack:latest
name: velero-plugin-for-openstack
- image: quay.io/konveyor/kubevirt-velero-plugin:v0.7.0
name: kubevirt-velero-plugin
- image: registry.redhat.io/oadp/oadp-mustgather-rhel8:v1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ spec:
- vsm
- openshift
- kubevirt
- openstack
type: string
type: array
defaultSnapshotMoveData:
Expand Down Expand Up @@ -1776,6 +1777,7 @@ spec:
- awsPluginImageFqin
- legacyAWSPluginImageFqin
- openshiftPluginImageFqin
- openstackPluginImageFqin
- azurePluginImageFqin
- gcpPluginImageFqin
- resticRestoreImageFqin
Expand Down
3,663 changes: 1,938 additions & 1,725 deletions config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ spec:
value: quay.io/konveyor/velero-plugin-for-microsoft-azure:latest
- name: RELATED_IMAGE_VELERO_PLUGIN_FOR_GCP
value: quay.io/konveyor/velero-plugin-for-gcp:latest
- name: RELATED_IMAGE_VELERO_PLUGIN_FOR_OPENSTACK
value: quay.io/konveyor/velero-plugin-for-openstack:latest
- name: RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN
value: quay.io/konveyor/kubevirt-velero-plugin:v0.7.0
- name: RELATED_IMAGE_MUSTGATHER
Expand Down
28 changes: 28 additions & 0 deletions controllers/bsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func (r *DPAReconciler) ValidateBackupStorageLocations() (bool, error) {
if err != nil {
return false, err
}
case OpenstackProvider, "community.openstack.org/openstack":
err := r.validateOpenstackBackupStorageLocation(*bslSpec.Velero)
if err != nil {
return false, err
}
default:
return false, fmt.Errorf("invalid provider")
}
Expand Down Expand Up @@ -399,6 +404,29 @@ func (r *DPAReconciler) validateGCPBackupStorageLocation(bslSpec velerov1.Backup
return nil
}

func (r *DPAReconciler) validateOpenstackBackupStorageLocation(bslSpec velerov1.BackupStorageLocationSpec) error {
// validate provider plugin and secret
err := r.validateProviderPluginAndSecret(bslSpec)
if err != nil {
return err
}

// check for bsl non-optional bsl configs and object storage
if bslSpec.ObjectStorage == nil {
return fmt.Errorf("object storage configuration for OpenStack backupstoragelocation cannot be nil")
}

if len(bslSpec.ObjectStorage.Bucket) == 0 {
return fmt.Errorf("bucket name for OpenStack backupstoragelocation cannot be empty")
}

if len(bslSpec.StorageType.ObjectStorage.Prefix) == 0 && r.dpa.BackupImages() {
return fmt.Errorf("prefix for OpenStack backupstoragelocation object storage cannot be empty. it is required for backing up images")
}

return nil
}

func pluginExistsInVeleroCR(configuredPlugins []oadpv1alpha1.DefaultPlugin, expectedProvider string) bool {
for _, plugin := range configuredPlugins {
if credentials.PluginSpecificFields[plugin].ProviderName == expectedProvider {
Expand Down
1 change: 1 addition & 0 deletions controllers/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const (
AWSProvider = "aws"
AzureProvider = "azure"
GCPProvider = "gcp"
OpenstackProvider = "openstack"
Region = "region"
Profile = "profile"
S3URL = "s3Url"
Expand Down
1 change: 1 addition & 0 deletions docs/config/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ installing Velero:
- `OpenShift` [OpenShift Velero Plugin](https://github.com/openshift/openshift-velero-plugin)
- `CSI` [Plugins for CSI](https://github.com/vmware-tanzu/velero-plugin-for-csi)
- `kubevirt` [Plugins for Kubevirt](https://github.com/kubevirt/kubevirt-velero-plugin)
- `Openstack` [Plugins for Openstack](https://github.com/openshift/lirt-velero-plugin-for-openstack)
- `VSM (OADP 1.2 or below)` [Plugin for Volume-Snapshot-Mover](https://github.com/migtools/velero-plugin-for-vsm)

Note that only one of `AWS` and `Legacy AWS` may be installed at the same time. `Legacy AWS` is intended for use with certain S3 providers that do not support the V2 AWS SDK APIs used in the `AWS` plugin.
Expand Down
1 change: 1 addition & 0 deletions hack/disconnected-prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ IMG_MAP[gcpplugin_repo]="velero-plugin-for-gcp"
IMG_MAP[awsplugin_repo]="velero-plugin-for-aws"
IMG_MAP[legacyawsplugin_repo]="velero-plugin-for-legacy-aws"
IMG_MAP[azureplugin_repo]="velero-plugin-for-microsoft-azure"
IMG_MAP[openstackplugin_repo]="velero-plugin-for-openstack"
IMG_MAP[registry_repo]="registry"

#Get latest images
Expand Down
2 changes: 2 additions & 0 deletions pkg/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const (
GCPPluginImage = "quay.io/konveyor/velero-plugin-for-gcp:latest"
RegistryImage = "quay.io/konveyor/registry:latest"
KubeVirtPluginImage = "quay.io/konveyor/kubevirt-velero-plugin:v0.7.0"
OpenstackPluginImage = "quay.io/konveyor/velero-plugin-for-openstack:latest"
)

// Plugin names
Expand All @@ -78,6 +79,7 @@ const (
VeleroPluginForGCP = "velero-plugin-for-gcp"
VeleroPluginForOpenshift = "openshift-velero-plugin"
KubeVirtPlugin = "kubevirt-velero-plugin"
VeleroPluginForOpenstack = "velero-plugin-for-openstack"
)

// Environment Vars keys
Expand Down