diff --git a/bundle/manifests/ocs-client-operator-config_v1_configmap.yaml b/bundle/manifests/ocs-client-operator-config_v1_configmap.yaml index 360b979a..b0b1a4e2 100644 --- a/bundle/manifests/ocs-client-operator-config_v1_configmap.yaml +++ b/bundle/manifests/ocs-client-operator-config_v1_configmap.yaml @@ -1,4 +1,6 @@ apiVersion: v1 +data: + generateRbdOMapInfo: "true" kind: ConfigMap metadata: name: ocs-client-operator-config diff --git a/bundle/manifests/ocs-client-operator.clusterserviceversion.yaml b/bundle/manifests/ocs-client-operator.clusterserviceversion.yaml index 80de0fd4..2037463a 100644 --- a/bundle/manifests/ocs-client-operator.clusterserviceversion.yaml +++ b/bundle/manifests/ocs-client-operator.clusterserviceversion.yaml @@ -7,7 +7,7 @@ metadata: categories: Storage console.openshift.io/plugins: '["odf-client-console"]' containerImage: quay.io/ocs-dev/ocs-client-operator:latest - createdAt: "2024-10-29T07:06:57Z" + createdAt: "2024-11-14T15:13:37Z" description: OpenShift Data Foundation client operator enables consumption of storage services from a remote centralized OpenShift Data Foundation provider cluster. @@ -21,7 +21,7 @@ metadata: support: Red Hat labels: operatorframework.io/arch.amd64: supported - name: ocs-client-operator.v4.17.0 + name: ocs-client-operator.v4.18.0 namespace: placeholder spec: apiservicedefinitions: {} @@ -397,6 +397,12 @@ spec: verbs: - get - list + - apiGroups: + - quota.openshift.io + resources: + - clusterresourcequotas + verbs: + - get serviceAccountName: ocs-client-operator-status-reporter deployments: - label: @@ -661,4 +667,4 @@ spec: maturity: alpha provider: name: Red Hat - version: 4.17.0 + version: 4.18.0 diff --git a/bundle/metadata/dependencies.yaml b/bundle/metadata/dependencies.yaml index 16044a9b..88144c9c 100644 --- a/bundle/metadata/dependencies.yaml +++ b/bundle/metadata/dependencies.yaml @@ -2,12 +2,12 @@ dependencies: - type: olm.package value: packageName: csi-addons - version: '>=0.9.1' + version: '>=0.10.0' - type: olm.package value: packageName: cephcsi-operator - version: 4.17.0 + version: 4.18.0 - type: olm.package value: packageName: noobaa-operator - version: ">=5.16.0 <=5.17.0" + version: ">=5.17.0 <=5.18.0" diff --git a/cmd/main.go b/cmd/main.go index f9f2d91d..e348a777 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -31,7 +31,7 @@ import ( // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) // to ensure that exec-entrypoint and run can make use of them. csiopv1a1 "github.com/ceph/ceph-csi-operator/api/v1alpha1" - snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" + snapapi "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" nbapis "github.com/noobaa/noobaa-operator/v5/pkg/apis" configv1 "github.com/openshift/api/config/v1" consolev1 "github.com/openshift/api/console/v1" diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 23a2e734..c351400d 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -9,7 +9,9 @@ configMapGenerator: - files: - controller_manager_config.yaml name: manager-config -- name: config +- literals: + - generateRbdOMapInfo=true + name: config apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization diff --git a/config/metadata/dependencies.yaml b/config/metadata/dependencies.yaml index 16044a9b..88144c9c 100644 --- a/config/metadata/dependencies.yaml +++ b/config/metadata/dependencies.yaml @@ -2,12 +2,12 @@ dependencies: - type: olm.package value: packageName: csi-addons - version: '>=0.9.1' + version: '>=0.10.0' - type: olm.package value: packageName: cephcsi-operator - version: 4.17.0 + version: 4.18.0 - type: olm.package value: packageName: noobaa-operator - version: ">=5.16.0 <=5.17.0" + version: ">=5.17.0 <=5.18.0" diff --git a/config/rbac/status-reporter-clusterrole.yaml b/config/rbac/status-reporter-clusterrole.yaml index a3e9830f..40e69e41 100644 --- a/config/rbac/status-reporter-clusterrole.yaml +++ b/config/rbac/status-reporter-clusterrole.yaml @@ -29,3 +29,9 @@ rules: verbs: - get - list + - apiGroups: + - quota.openshift.io + resources: + - clusterresourcequotas + verbs: + - get diff --git a/go.mod b/go.mod index c0d6f482..c922468a 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ exclude ( require ( github.com/ceph/ceph-csi-operator/api v0.0.0-20240812072523-4d50cf3a32a0 github.com/go-logr/logr v1.4.2 - github.com/kubernetes-csi/external-snapshotter/client/v6 v6.3.0 + github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.34.1 github.com/openshift/api v0.0.0-20240828125535-01b3675ba7b3 @@ -28,7 +28,7 @@ require ( github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 github.com/ramendr/ramen/api v0.0.0-20241001141243-29d6f22ad237 github.com/red-hat-storage/ocs-client-operator/api v0.0.0-00010101000000-000000000000 - github.com/red-hat-storage/ocs-operator/services/provider/api/v4 v4.0.0-20240917115204-741b9d6f263d + github.com/red-hat-storage/ocs-operator/services/provider/api/v4 v4.0.0-20241113175552-201c936738fd github.com/stretchr/testify v1.9.0 google.golang.org/grpc v1.66.0 k8s.io/api v0.31.0 diff --git a/go.sum b/go.sum index 5482fdc7..f9204213 100644 --- a/go.sum +++ b/go.sum @@ -254,8 +254,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1 h1:dQEHhTfi+bSIOSViQrKY9PqJvZenD6tFz+3lPzux58o= github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1/go.mod h1:my+EVjOJLeQ9lUR9uVkxRvNNkhO2saSGIgzV8GZT9HY= -github.com/kubernetes-csi/external-snapshotter/client/v6 v6.3.0 h1:qS4r4ljINLWKJ9m9Ge3Q3sGZ/eIoDVDT2RhAdQFHb1k= -github.com/kubernetes-csi/external-snapshotter/client/v6 v6.3.0/go.mod h1:oGXx2XTEzs9ikW2V6IC1dD8trgjRsS/Mvc2JRiC618Y= +github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0 h1:mjQG0Vakr2h246kEDR85U8y8ZhPgT3bguTCajRa/jaw= +github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0/go.mod h1:E3vdYxHj2C2q6qo8/Da4g7P+IcwqRZyy3gJBzYybV9Y= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -325,8 +325,8 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/ramendr/ramen/api v0.0.0-20241001141243-29d6f22ad237 h1:ig6ePD0yopC5Qi5BRmhsIsKaOkdsGXTSmG3HTYIpquo= github.com/ramendr/ramen/api v0.0.0-20241001141243-29d6f22ad237/go.mod h1:nO6VM/+PEhcPGyFIQJdhY6ip822cA61PAy/s6IjenAA= -github.com/red-hat-storage/ocs-operator/services/provider/api/v4 v4.0.0-20240917115204-741b9d6f263d h1:RK/zCM6xRwyeJ06u6xSLEwl5Q1g/6EZRQmSgzbqleT0= -github.com/red-hat-storage/ocs-operator/services/provider/api/v4 v4.0.0-20240917115204-741b9d6f263d/go.mod h1:t9GJk69TGXABBF8fFPB+ImpbA9mJyRS86wW6+Qn8xHo= +github.com/red-hat-storage/ocs-operator/services/provider/api/v4 v4.0.0-20241113175552-201c936738fd h1:WIdoP1CE/8yl9tnHFVY7g/h4ZDFk+2Y9Ri0PrHXfx1g= +github.com/red-hat-storage/ocs-operator/services/provider/api/v4 v4.0.0-20241113175552-201c936738fd/go.mod h1:t9GJk69TGXABBF8fFPB+ImpbA9mJyRS86wW6+Qn8xHo= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= diff --git a/hack/make-bundle-vars.mk b/hack/make-bundle-vars.mk index 17c71bba..8450044e 100644 --- a/hack/make-bundle-vars.mk +++ b/hack/make-bundle-vars.mk @@ -3,7 +3,7 @@ # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= 4.17.0 +VERSION ?= 4.18.0 # DEFAULT_CHANNEL defines the default channel used in the bundle. # Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable") @@ -49,12 +49,12 @@ IMAGE_TAG ?= latest IMAGE_NAME ?= ocs-client-operator BUNDLE_IMAGE_NAME ?= $(IMAGE_NAME)-bundle CSI_ADDONS_BUNDLE_IMAGE_NAME ?= k8s-bundle -CSI_ADDONS_BUNDLE_IMAGE_TAG ?= v0.9.1 +CSI_ADDONS_BUNDLE_IMAGE_TAG ?= v0.10.0 CATALOG_IMAGE_NAME ?= $(IMAGE_NAME)-catalog NOOBAA_BUNDLE_NAME ?= noobaa-operator NOOBAA_BUNDLE_IMG_NAME ?= $(NOOBAA_BUNDLE_NAME)-bundle -NOOBAA_BUNDLE_VERSION ?= v5.17.0 +NOOBAA_BUNDLE_VERSION ?= v5.18.0 NOOBAA_BUNDLE_IMG_TAG ?= master-20240514 NOOBAA_BUNDLE_IMG_NAMESPACE ?= noobaa NOOBAA_BUNDLE_IMG ?= $(IMAGE_REGISTRY)/$(NOOBAA_BUNDLE_IMG_NAMESPACE)/$(NOOBAA_BUNDLE_IMG_NAME):$(NOOBAA_BUNDLE_IMG_TAG) @@ -106,7 +106,7 @@ endif # csi-addons dependencies CSI_ADDONS_PACKAGE_NAME ?= csi-addons -CSI_ADDONS_PACKAGE_VERSION ?= 0.9.1 +CSI_ADDONS_PACKAGE_VERSION ?= 0.10.0 # The following variables are here as a convenience for developers so we don't have # to retype things, because we're lazy. diff --git a/internal/controller/operatorconfigmap_controller.go b/internal/controller/operatorconfigmap_controller.go index 3920269f..1a57278d 100644 --- a/internal/controller/operatorconfigmap_controller.go +++ b/internal/controller/operatorconfigmap_controller.go @@ -67,6 +67,7 @@ const ( manageNoobaaSubKey = "manageNoobaaSubscription" subscriptionLabelKey = "managed-by" subscriptionLabelValue = "webhook.subscription.ocs.openshift.io" + generateRbdOMapInfoKey = "generateRbdOMapInfo" operatorConfigMapFinalizer = "ocs-client-operator.ocs.openshift.io/storageused" subPackageIndexName = "index:subscriptionPackage" @@ -341,6 +342,7 @@ func (c *OperatorConfigMapReconciler) reconcileDelegatedCSI() error { if err := c.own(rbdDriver); err != nil { return fmt.Errorf("failed to own csi rbd driver: %v", err) } + rbdDriver.Spec.GenerateOMapInfo = ptr.To(c.shouldGenerateRBDOmapInfo()) return nil }); err != nil { return fmt.Errorf("failed to reconcile rbd driver: %v", err) @@ -507,6 +509,11 @@ func (c *OperatorConfigMapReconciler) getNoobaaSubManagementConfig() bool { return val } +func (c *OperatorConfigMapReconciler) shouldGenerateRBDOmapInfo() bool { + valAsString := strings.ToLower(c.operatorConfigMap.Data[generateRbdOMapInfoKey]) + return valAsString == strconv.FormatBool(true) +} + func (c *OperatorConfigMapReconciler) get(obj client.Object, opts ...client.GetOption) error { return c.Get(c.ctx, client.ObjectKeyFromObject(obj), obj, opts...) } diff --git a/internal/controller/storageclaim_controller.go b/internal/controller/storageclaim_controller.go index 6c3d8e47..fe52bf50 100644 --- a/internal/controller/storageclaim_controller.go +++ b/internal/controller/storageclaim_controller.go @@ -20,7 +20,6 @@ import ( "context" "encoding/json" "fmt" - "reflect" "slices" "strings" "time" @@ -31,7 +30,8 @@ import ( csiopv1a1 "github.com/ceph/ceph-csi-operator/api/v1alpha1" "github.com/go-logr/logr" - snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" + + snapapi "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" ramenv1alpha1 "github.com/ramendr/ramen/api/v1alpha1" providerclient "github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client" corev1 "k8s.io/api/core/v1" @@ -40,7 +40,6 @@ import ( "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/klog/v2" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/cache" @@ -57,9 +56,8 @@ const ( storageClaimAnnotation = "ocs.openshift.io/storageclaim" keyRotationAnnotation = "keyrotation.csiaddons.openshift.io/schedule" - pvClusterIDIndexName = "index:persistentVolumeClusterID" - vscClusterIDIndexName = "index:volumeSnapshotContentCSIDriver" - + pvClusterIDIndexName = "index:persistentVolumeClusterID" + vscClusterIDIndexName = "index:volumeSnapshotContentCSIDriver" drClusterConfigCRDName = "drclusterconfigs.ramendr.openshift.io" ) @@ -117,6 +115,7 @@ func (r *StorageClaimReconciler) SetupWithManager(mgr ctrl.Manager) error { For(&v1alpha1.StorageClaim{}, builder.WithPredicates(generationChangePredicate)). Owns(&storagev1.StorageClass{}). Owns(&snapapi.VolumeSnapshotClass{}). + Owns(&csiopv1a1.ClientProfile{}, builder.WithPredicates(generationChangePredicate)). Watches( &extv1.CustomResourceDefinition{}, &handler.EnqueueRequestForObject{}, @@ -125,8 +124,7 @@ func (r *StorageClaimReconciler) SetupWithManager(mgr ctrl.Manager) error { utils.CrdCreateAndDeletePredicate(&r.log, drClusterConfigCRDName, r.AvailableCrds[drClusterConfigCRDName]), ), builder.OnlyMetadata, - ). - Owns(&csiopv1a1.ClientProfile{}, builder.WithPredicates(generationChangePredicate)) + ) if r.AvailableCrds[drClusterConfigCRDName] { bldr = bldr.Owns(&ramenv1alpha1.DRClusterConfig{}, builder.WithPredicates(generationChangePredicate)) @@ -387,12 +385,16 @@ func (r *StorageClaimReconciler) reconcilePhases() (reconcile.Result, error) { data["clusterID"] = r.storageClaimHash if resource.Name == "cephfs" { - storageClass = r.getCephFSStorageClass(data) + storageClass = r.getCephFSStorageClass() } else if resource.Name == "ceph-rbd" { - storageClass = r.getCephRBDStorageClass(data) + storageClass = r.getCephRBDStorageClass() } - utils.AddAnnotation(storageClass, storageClaimAnnotation, r.storageClaim.Name) - err = r.createOrReplaceStorageClass(storageClass) + err = utils.CreateOrReplace(r.ctx, r.Client, storageClass, func() error { + utils.AddLabels(storageClass, resource.Labels) + utils.AddAnnotation(storageClass, storageClaimAnnotation, r.storageClaim.Name) + storageClass.Parameters = data + return nil + }) if err != nil { return reconcile.Result{}, fmt.Errorf("failed to create or update StorageClass: %s", err) } @@ -409,12 +411,17 @@ func (r *StorageClaimReconciler) reconcilePhases() (reconcile.Result, error) { // hash as the clusterID data["clusterID"] = r.storageClaimHash if resource.Name == "cephfs" { - volumeSnapshotClass = r.getCephFSVolumeSnapshotClass(data) + volumeSnapshotClass = r.getCephFSVolumeSnapshotClass() } else if resource.Name == "ceph-rbd" { - volumeSnapshotClass = r.getCephRBDVolumeSnapshotClass(data) + volumeSnapshotClass = r.getCephRBDVolumeSnapshotClass() } - utils.AddAnnotation(volumeSnapshotClass, storageClaimAnnotation, r.storageClaim.Name) - if err := r.createOrReplaceVolumeSnapshotClass(volumeSnapshotClass); err != nil { + err = utils.CreateOrReplace(r.ctx, r.Client, volumeSnapshotClass, func() error { + utils.AddLabels(volumeSnapshotClass, resource.Labels) + utils.AddAnnotation(volumeSnapshotClass, storageClaimAnnotation, r.storageClaim.Name) + volumeSnapshotClass.Parameters = data + return nil + }) + if err != nil { return reconcile.Result{}, fmt.Errorf("failed to create or update VolumeSnapshotClass: %s", err) } case "ClientProfile": @@ -482,7 +489,7 @@ func (r *StorageClaimReconciler) reconcilePhases() (reconcile.Result, error) { return reconcile.Result{}, nil } -func (r *StorageClaimReconciler) getCephFSStorageClass(data map[string]string) *storagev1.StorageClass { +func (r *StorageClaimReconciler) getCephFSStorageClass() *storagev1.StorageClass { pvReclaimPolicy := corev1.PersistentVolumeReclaimDelete allowVolumeExpansion := true storageClass := &storagev1.StorageClass{ @@ -495,12 +502,11 @@ func (r *StorageClaimReconciler) getCephFSStorageClass(data map[string]string) * ReclaimPolicy: &pvReclaimPolicy, AllowVolumeExpansion: &allowVolumeExpansion, Provisioner: templates.CephFsDriverName, - Parameters: data, } return storageClass } -func (r *StorageClaimReconciler) getCephRBDStorageClass(data map[string]string) *storagev1.StorageClass { +func (r *StorageClaimReconciler) getCephRBDStorageClass() *storagev1.StorageClass { pvReclaimPolicy := corev1.PersistentVolumeReclaimDelete allowVolumeExpansion := true storageClass := &storagev1.StorageClass{ @@ -514,7 +520,6 @@ func (r *StorageClaimReconciler) getCephRBDStorageClass(data map[string]string) ReclaimPolicy: &pvReclaimPolicy, AllowVolumeExpansion: &allowVolumeExpansion, Provisioner: templates.RBDDriverName, - Parameters: data, } if r.storageClaim.Spec.EncryptionMethod != "" { @@ -523,68 +528,28 @@ func (r *StorageClaimReconciler) getCephRBDStorageClass(data map[string]string) return storageClass } -func (r *StorageClaimReconciler) getCephFSVolumeSnapshotClass(data map[string]string) *snapapi.VolumeSnapshotClass { +func (r *StorageClaimReconciler) getCephFSVolumeSnapshotClass() *snapapi.VolumeSnapshotClass { volumesnapshotclass := &snapapi.VolumeSnapshotClass{ ObjectMeta: metav1.ObjectMeta{ Name: r.storageClaim.Name, }, Driver: templates.CephFsDriverName, DeletionPolicy: snapapi.VolumeSnapshotContentDelete, - Parameters: data, } return volumesnapshotclass } -func (r *StorageClaimReconciler) getCephRBDVolumeSnapshotClass(data map[string]string) *snapapi.VolumeSnapshotClass { +func (r *StorageClaimReconciler) getCephRBDVolumeSnapshotClass() *snapapi.VolumeSnapshotClass { volumesnapshotclass := &snapapi.VolumeSnapshotClass{ ObjectMeta: metav1.ObjectMeta{ Name: r.storageClaim.Name, }, Driver: templates.RBDDriverName, DeletionPolicy: snapapi.VolumeSnapshotContentDelete, - Parameters: data, } return volumesnapshotclass } -func (r *StorageClaimReconciler) createOrReplaceStorageClass(storageClass *storagev1.StorageClass) error { - existing := &storagev1.StorageClass{} - existing.Name = r.storageClaim.Name - - if err := r.own(storageClass); err != nil { - return fmt.Errorf("failed to own storageclass: %v", err) - } - - if err := r.get(existing); err != nil && !errors.IsNotFound(err) { - return fmt.Errorf("failed to get StorageClass: %v", err) - } - - // If present then compare the existing StorageClass with the received StorageClass, and only proceed if they differ. - if reflect.DeepEqual(existing.Parameters, storageClass.Parameters) { - return nil - } - - // StorageClass already exists, but parameters have changed. Delete the existing StorageClass and create a new one. - if existing.UID != "" { - - // Since we have to update the existing StorageClass, so we will delete the existing StorageClass and create a new one. - r.log.Info("StorageClass needs to be updated, deleting it.", "StorageClass", klog.KRef(storageClass.Namespace, existing.Name)) - - // Delete the StorageClass. - err := r.delete(existing) - if err != nil { - r.log.Error(err, "Failed to delete StorageClass.", "StorageClass", klog.KRef(storageClass.Namespace, existing.Name)) - return fmt.Errorf("failed to delete StorageClass: %v", err) - } - } - r.log.Info("Creating StorageClass.", "StorageClass", klog.KRef(storageClass.Namespace, existing.Name)) - err := r.Client.Create(r.ctx, storageClass) - if err != nil { - return fmt.Errorf("failed to create StorageClass: %v", err) - } - return nil -} - func (r *StorageClaimReconciler) get(obj client.Object) error { key := client.ObjectKeyFromObject(obj) return r.Client.Get(r.ctx, key, obj) @@ -598,53 +563,10 @@ func (r *StorageClaimReconciler) list(obj client.ObjectList, listOptions ...clie return r.Client.List(r.ctx, obj, listOptions...) } -func (r *StorageClaimReconciler) delete(obj client.Object) error { - if err := r.Client.Delete(r.ctx, obj); err != nil && !errors.IsNotFound(err) { - return err - } - return nil -} - func (r *StorageClaimReconciler) own(resource metav1.Object) error { return controllerutil.SetControllerReference(r.storageClaim, resource, r.Scheme) } -func (r *StorageClaimReconciler) createOrReplaceVolumeSnapshotClass(volumeSnapshotClass *snapapi.VolumeSnapshotClass) error { - existing := &snapapi.VolumeSnapshotClass{} - existing.Name = r.storageClaim.Name - - if err := r.own(volumeSnapshotClass); err != nil { - return fmt.Errorf("failed to own volumesnapshotclass: %v", err) - } - - if err := r.get(existing); err != nil && !errors.IsNotFound(err) { - return fmt.Errorf("failed to get VolumeSnapshotClass: %v", err) - } - - // If present then compare the existing VolumeSnapshotClass parameters with - // the received VolumeSnapshotClass parameters, and only proceed if they differ. - if reflect.DeepEqual(existing.Parameters, volumeSnapshotClass.Parameters) { - return nil - } - - // VolumeSnapshotClass already exists, but parameters have changed. Delete the existing VolumeSnapshotClass and create a new one. - if existing.UID != "" { - // Since we have to update the existing VolumeSnapshotClass, so we will delete the existing VolumeSnapshotClass and create a new one. - r.log.Info("VolumeSnapshotClass needs to be updated, deleting it.", "Name", existing.Name) - - // Delete the VolumeSnapshotClass. - if err := r.delete(existing); err != nil { - r.log.Error(err, "Failed to delete VolumeSnapshotClass.", "Name", existing.Name) - return fmt.Errorf("failed to delete VolumeSnapshotClass: %v", err) - } - } - r.log.Info("Creating VolumeSnapshotClass.", "Name", existing.Name) - if err := r.Client.Create(r.ctx, volumeSnapshotClass); err != nil { - return fmt.Errorf("failed to create VolumeSnapshotClass: %v", err) - } - return nil -} - func (r *StorageClaimReconciler) hasPersistentVolumes() (bool, error) { pvList := &corev1.PersistentVolumeList{} if err := r.list(pvList, client.MatchingFields{pvClusterIDIndexName: r.storageClaimHash}, client.Limit(1)); err != nil { diff --git a/internal/controller/storageclient_controller.go b/internal/controller/storageclient_controller.go index 74d1c92a..27b6d97c 100644 --- a/internal/controller/storageclient_controller.go +++ b/internal/controller/storageclient_controller.go @@ -311,7 +311,7 @@ func (r *StorageClientReconciler) reconcilePhases() (ctrl.Result, error) { func (r *StorageClientReconciler) reconcileClusterResourceQuota(spec *quotav1.ClusterResourceQuotaSpec) error { clusterResourceQuota := "av1.ClusterResourceQuota{} - clusterResourceQuota.Name = fmt.Sprintf("storage-client-%s-resourceqouta", utils.GetMD5Hash(r.storageClient.Name)) + clusterResourceQuota.Name = utils.GetClusterResourceQuotaName(r.storageClient.Name) _, err := controllerutil.CreateOrUpdate(r.ctx, r.Client, clusterResourceQuota, func() error { if err := r.own(clusterResourceQuota); err != nil { diff --git a/pkg/utils/k8sutils.go b/pkg/utils/k8sutils.go index 8f1a98a4..c3f97bbf 100644 --- a/pkg/utils/k8sutils.go +++ b/pkg/utils/k8sutils.go @@ -17,13 +17,18 @@ limitations under the License. package utils import ( + "context" "crypto/md5" "encoding/hex" "fmt" "maps" "os" + "reflect" + "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" ) // OperatorNamespaceEnvVar is the constant for env variable OPERATOR_NAMESPACE @@ -113,3 +118,55 @@ func GetMD5Hash(text string) string { hash := md5.Sum([]byte(text)) return hex.EncodeToString(hash[:]) } + +func CreateOrReplace(ctx context.Context, c client.Client, obj client.Object, f controllerutil.MutateFn) error { + key := client.ObjectKeyFromObject(obj) + if err := c.Get(ctx, key, obj); err != nil { + if !errors.IsNotFound(err) { + return err + } + if err := mutate(f, key, obj); err != nil { + return err + } + if err := c.Create(ctx, obj); err != nil { + return err + } + return nil + } + + existing := obj.DeepCopyObject() + if err := mutate(f, key, obj); err != nil { + return err + } + + if reflect.DeepEqual(existing, obj) { + return nil + } + + if err := c.Delete(ctx, obj); err != nil { + return err + } + + // k8s doesn't allow us to create objects when resourceVersion is set, as we are DeepCopying the + // object, the resource version also gets copied, hence we need to set it to empty before creating it + obj.SetResourceVersion("") + if err := c.Create(ctx, obj); err != nil { + return err + } + return nil +} + +// mutate wraps a MutateFn and applies validation to its result. +func mutate(f controllerutil.MutateFn, key client.ObjectKey, obj client.Object) error { + if err := f(); err != nil { + return err + } + if newKey := client.ObjectKeyFromObject(obj); key != newKey { + return fmt.Errorf("MutateFn cannot mutate object name and/or object namespace") + } + return nil +} + +func GetClusterResourceQuotaName(name string) string { + return fmt.Sprintf("storage-client-%s-resourceqouta", GetMD5Hash(name)) +} diff --git a/service/status-report/main.go b/service/status-report/main.go index 27381e10..41b65924 100644 --- a/service/status-report/main.go +++ b/service/status-report/main.go @@ -20,6 +20,7 @@ import ( "context" "encoding/json" "fmt" + "math" "os" "reflect" "strings" @@ -32,6 +33,7 @@ import ( csiopv1a1 "github.com/ceph/ceph-csi-operator/api/v1alpha1" configv1 "github.com/openshift/api/config/v1" + quotav1 "github.com/openshift/api/quota/v1" opv1a1 "github.com/operator-framework/api/pkg/operators/v1alpha1" providerclient "github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client" "k8s.io/apimachinery/pkg/runtime" @@ -69,6 +71,10 @@ func main() { klog.Exitf("Failed to add csiopv1a1 to scheme: %v", err) } + if err := quotav1.AddToScheme(scheme); err != nil { + klog.Exitf("Failed to add quotav1 to scheme: %v", err) + } + config, err := config.GetConfig() if err != nil { klog.Exitf("Failed to get config: %v", err) @@ -107,10 +113,12 @@ func main() { defer providerClient.Close() status := providerclient.NewStorageClientStatus(). - SetClientName(storageClientName) + SetClientName(storageClientName). + SetClientID(string(storageClient.UID)) setPlatformInformation(ctx, cl, status) setOperatorInformation(ctx, cl, status, operatorNamespace) setClusterInformation(ctx, cl, status) + setStorageQuotaUtilizationRatio(ctx, cl, status) statusResponse, err := providerClient.ReportStatus(ctx, storageClient.Status.ConsumerID, status) if err != nil { klog.Exitf("Failed to report status of storageClient %v: %v", storageClient.Status.ConsumerID, err) @@ -198,6 +206,26 @@ func setClusterInformation(ctx context.Context, cl client.Client, status interfa } +func setStorageQuotaUtilizationRatio(ctx context.Context, cl client.Client, status interfaces.StorageClientStatus) { + clusterResourceQuota := "av1.ClusterResourceQuota{} + clusterResourceQuota.Name = utils.GetClusterResourceQuotaName(status.GetClientName()) + + // No need to check for NotFound because unlimited quota client will not have CRQ resource + if err := cl.Get(ctx, client.ObjectKeyFromObject(clusterResourceQuota), clusterResourceQuota); client.IgnoreNotFound(err) != nil { + klog.Warningf("Failed to get clusterResourceQuota %q: %v", clusterResourceQuota.Name, err) + } + + if clusterResourceQuota.Status.Total.Hard != nil { + total, totalExists := clusterResourceQuota.Status.Total.Hard["requests.storage"] + used, usedExists := clusterResourceQuota.Status.Total.Used["requests.storage"] + if totalExists && usedExists && total.AsApproximateFloat64() > 0 { + ratio := used.AsApproximateFloat64() / total.AsApproximateFloat64() + status.SetStorageQuotaUtilizationRatio(math.Min(ratio, 1.0)) + } + } + +} + func setOperatorInformation(ctx context.Context, cl client.Client, status interfaces.StorageClientStatus, operatorNamespace string) { var operatorVersion string diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/LICENSE b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/LICENSE similarity index 100% rename from vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/LICENSE rename to vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/LICENSE diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1/doc.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/doc.go similarity index 100% rename from vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1/doc.go rename to vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/doc.go diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1/register.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/register.go similarity index 100% rename from vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1/register.go rename to vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/register.go diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1/types.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/types.go similarity index 90% rename from vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1/types.go rename to vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/types.go index 60809461..36f60dc9 100644 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1/types.go +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/types.go @@ -91,6 +91,7 @@ type VolumeSnapshotSpec struct { // CreateSnapshot will fail and generate an event. // Empty string is not allowed for this field. // +optional + // +kubebuilder:validation:XValidation:rule="size(self) > 0",message="volumeSnapshotClassName must not be the empty string when set" VolumeSnapshotClassName *string `json:"volumeSnapshotClassName,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotClassName"` } @@ -99,6 +100,9 @@ type VolumeSnapshotSpec struct { // object should be used. // Exactly one of its members must be set. // Members in VolumeSnapshotSource are immutable. +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.persistentVolumeClaimName) || has(self.persistentVolumeClaimName)", message="persistentVolumeClaimName is required once set" +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.volumeSnapshotContentName) || has(self.volumeSnapshotContentName)", message="volumeSnapshotContentName is required once set" +// +kubebuilder:validation:XValidation:rule="(has(self.volumeSnapshotContentName) && !has(self.persistentVolumeClaimName)) || (!has(self.volumeSnapshotContentName) && has(self.persistentVolumeClaimName))", message="exactly one of volumeSnapshotContentName and persistentVolumeClaimName must be set" type VolumeSnapshotSource struct { // persistentVolumeClaimName specifies the name of the PersistentVolumeClaim // object representing the volume from which a snapshot should be created. @@ -108,6 +112,7 @@ type VolumeSnapshotSource struct { // created. // This field is immutable. // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="persistentVolumeClaimName is immutable" PersistentVolumeClaimName *string `json:"persistentVolumeClaimName,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeClaimName"` // volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent @@ -115,6 +120,7 @@ type VolumeSnapshotSource struct { // This field should be set if the snapshot already exists and only needs a representation in Kubernetes. // This field is immutable. // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeSnapshotContentName is immutable" VolumeSnapshotContentName *string `json:"volumeSnapshotContentName,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotContentName"` } @@ -258,6 +264,7 @@ type VolumeSnapshotClassList struct { // +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.spec.driver`,description="Name of the CSI driver used to create the physical snapshot on the underlying storage system." // +kubebuilder:printcolumn:name="VolumeSnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="Name of the VolumeSnapshotClass to which this snapshot belongs." // +kubebuilder:printcolumn:name="VolumeSnapshot",type=string,JSONPath=`.spec.volumeSnapshotRef.name`,description="Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound." +// +kubebuilder:printcolumn:name="VolumeSnapshotNamespace",type=string,JSONPath=`.spec.volumeSnapshotRef.namespace`,description="Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound." // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` type VolumeSnapshotContent struct { metav1.TypeMeta `json:",inline"` @@ -289,6 +296,7 @@ type VolumeSnapshotContentList struct { } // VolumeSnapshotContentSpec is the specification of a VolumeSnapshotContent +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.sourceVolumeMode) || has(self.sourceVolumeMode)", message="sourceVolumeMode is required once set" type VolumeSnapshotContentSpec struct { // volumeSnapshotRef specifies the VolumeSnapshot object to which this // VolumeSnapshotContent object is bound. @@ -298,6 +306,7 @@ type VolumeSnapshotContentSpec struct { // VolumeSnapshot object MUST be provided for binding to happen. // This field is immutable after creation. // Required. + // +kubebuilder:validation:XValidation:rule="has(self.name) && has(self.__namespace__)",message="both spec.volumeSnapshotRef.name and spec.volumeSnapshotRef.namespace must be set" VolumeSnapshotRef core_v1.ObjectReference `json:"volumeSnapshotRef" protobuf:"bytes,1,opt,name=volumeSnapshotRef"` // deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on @@ -340,17 +349,22 @@ type VolumeSnapshotContentSpec struct { // This field is immutable. // This field is an alpha field. // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="sourceVolumeMode is immutable" SourceVolumeMode *core_v1.PersistentVolumeMode `json:"sourceVolumeMode" protobuf:"bytes,6,opt,name=sourceVolumeMode"` } // VolumeSnapshotContentSource represents the CSI source of a snapshot. // Exactly one of its members must be set. // Members in VolumeSnapshotContentSource are immutable. +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.volumeHandle) || has(self.volumeHandle)", message="volumeHandle is required once set" +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.snapshotHandle) || has(self.snapshotHandle)", message="snapshotHandle is required once set" +// +kubebuilder:validation:XValidation:rule="(has(self.volumeHandle) && !has(self.snapshotHandle)) || (!has(self.volumeHandle) && has(self.snapshotHandle))", message="exactly one of volumeHandle and snapshotHandle must be set" type VolumeSnapshotContentSource struct { // volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot // should be dynamically taken from. // This field is immutable. // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeHandle is immutable" VolumeHandle *string `json:"volumeHandle,omitempty" protobuf:"bytes,1,opt,name=volumeHandle"` // snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on @@ -358,6 +372,7 @@ type VolumeSnapshotContentSource struct { // was (or should be) created. // This field is immutable. // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="snapshotHandle is immutable" SnapshotHandle *string `json:"snapshotHandle,omitempty" protobuf:"bytes,2,opt,name=snapshotHandle"` } @@ -421,10 +436,10 @@ type VolumeSnapshotContentStatus struct { // +optional Error *VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,5,opt,name=error,casttype=VolumeSnapshotError"` - // VolumeGroupSnapshotContentName is the name of the VolumeGroupSnapshotContent of - // which this VolumeSnapshotContent is a part of. + // VolumeGroupSnapshotHandle is the CSI "group_snapshot_id" of a group snapshot + // on the underlying storage system. // +optional - VolumeGroupSnapshotContentName *string `json:"volumeGroupSnapshotContentName,omitempty" protobuf:"bytes,6,opt,name=volumeGroupSnapshotContentName"` + VolumeGroupSnapshotHandle *string `json:"volumeGroupSnapshotHandle,omitempty" protobuf:"bytes,6,opt,name=volumeGroupSnapshotHandle"` } // DeletionPolicy describes a policy for end-of-life maintenance of volume snapshot contents diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1/zz_generated.deepcopy.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/zz_generated.deepcopy.go similarity index 98% rename from vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1/zz_generated.deepcopy.go rename to vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/zz_generated.deepcopy.go index 46030926..a590aef0 100644 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1/zz_generated.deepcopy.go +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* -Copyright 2023 The Kubernetes Authors. +Copyright 2024 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -271,8 +271,8 @@ func (in *VolumeSnapshotContentStatus) DeepCopyInto(out *VolumeSnapshotContentSt *out = new(VolumeSnapshotError) (*in).DeepCopyInto(*out) } - if in.VolumeGroupSnapshotContentName != nil { - in, out := &in.VolumeGroupSnapshotContentName, &out.VolumeGroupSnapshotContentName + if in.VolumeGroupSnapshotHandle != nil { + in, out := &in.VolumeGroupSnapshotHandle, &out.VolumeGroupSnapshotHandle *out = new(string) **out = **in } diff --git a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client/client.go b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client/client.go index fe05dff2..490c97b0 100644 --- a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client/client.go +++ b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client/client.go @@ -211,3 +211,19 @@ func (cc *OCSProviderClient) ReportStatus(ctx context.Context, consumerUUID stri return cc.Client.ReportStatus(apiCtx, req) } + +func (cc *OCSProviderClient) PeerStorageCluster(ctx context.Context, onboardingToken, storageClusterUID string) (*pb.PeerStorageClusterResponse, error) { + if cc.Client == nil || cc.clientConn == nil { + return nil, fmt.Errorf("OCS client is closed") + } + + req := &pb.PeerStorageClusterRequest{ + OnboardingToken: onboardingToken, + StorageClusterUID: storageClusterUID, + } + + apiCtx, cancel := context.WithTimeout(ctx, cc.timeout) + defer cancel() + + return cc.Client.PeerStorageCluster(apiCtx, req) +} diff --git a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/interfaces/interfaces.go b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/interfaces/interfaces.go index 4188cc1f..596342c3 100644 --- a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/interfaces/interfaces.go +++ b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/interfaces/interfaces.go @@ -9,12 +9,16 @@ type StorageClientStatus interface { GetClusterID() string GetClusterName() string GetClientName() string + GetClientID() string + GetStorageQuotaUtilizationRatio() float64 SetPlatformVersion(string) StorageClientStatus SetOperatorVersion(string) StorageClientStatus SetClusterID(string) StorageClientStatus SetClusterName(string) StorageClientStatus SetClientName(string) StorageClientStatus + SetClientID(string) StorageClientStatus + SetStorageQuotaUtilizationRatio(float64) StorageClientStatus } type StorageClientOnboarding interface { diff --git a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/provider.pb.go b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/provider.pb.go index 76caf74c..261e53a2 100644 --- a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/provider.pb.go +++ b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/provider.pb.go @@ -897,6 +897,10 @@ type ReportStatusRequest struct { ClusterName string `protobuf:"bytes,5,opt,name=clusterName,proto3" json:"clusterName,omitempty"` // clientName is the name of the connected storageclient ClientName string `protobuf:"bytes,6,opt,name=clientName,proto3" json:"clientName,omitempty"` + // storageQuotaUtilizationRatio is the ratio of utilized quota of connected client + StorageQuotaUtilizationRatio float64 `protobuf:"fixed64,7,opt,name=storageQuotaUtilizationRatio,proto3" json:"storageQuotaUtilizationRatio,omitempty"` + // clientID is the k8s UID of storageClient + ClientID string `protobuf:"bytes,8,opt,name=clientID,proto3" json:"clientID,omitempty"` } func (x *ReportStatusRequest) Reset() { @@ -973,6 +977,20 @@ func (x *ReportStatusRequest) GetClientName() string { return "" } +func (x *ReportStatusRequest) GetStorageQuotaUtilizationRatio() float64 { + if x != nil { + return x.StorageQuotaUtilizationRatio + } + return 0 +} + +func (x *ReportStatusRequest) GetClientID() string { + if x != nil { + return x.ClientID + } + return "" +} + type ReportStatusResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1029,6 +1047,103 @@ func (x *ReportStatusResponse) GetDesiredConfigHash() string { return "" } +// PeerStorageClusterRequest holds the required information to Peer to remote StorageCluster +type PeerStorageClusterRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // onboardingToken authenticates the StorageCluster + OnboardingToken string `protobuf:"bytes,1,opt,name=onboardingToken,proto3" json:"onboardingToken,omitempty"` + // storageClusterUID is the k8s UID of the StorageCluster in the same namespace + StorageClusterUID string `protobuf:"bytes,2,opt,name=storageClusterUID,proto3" json:"storageClusterUID,omitempty"` +} + +func (x *PeerStorageClusterRequest) Reset() { + *x = PeerStorageClusterRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_provider_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerStorageClusterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerStorageClusterRequest) ProtoMessage() {} + +func (x *PeerStorageClusterRequest) ProtoReflect() protoreflect.Message { + mi := &file_provider_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerStorageClusterRequest.ProtoReflect.Descriptor instead. +func (*PeerStorageClusterRequest) Descriptor() ([]byte, []int) { + return file_provider_proto_rawDescGZIP(), []int{17} +} + +func (x *PeerStorageClusterRequest) GetOnboardingToken() string { + if x != nil { + return x.OnboardingToken + } + return "" +} + +func (x *PeerStorageClusterRequest) GetStorageClusterUID() string { + if x != nil { + return x.StorageClusterUID + } + return "" +} + +// PeerStorageClusterResponse holds the response for OnboardStorageClusterPeer API request +type PeerStorageClusterResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PeerStorageClusterResponse) Reset() { + *x = PeerStorageClusterResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_provider_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerStorageClusterResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerStorageClusterResponse) ProtoMessage() {} + +func (x *PeerStorageClusterResponse) ProtoReflect() protoreflect.Message { + mi := &file_provider_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerStorageClusterResponse.ProtoReflect.Descriptor instead. +func (*PeerStorageClusterResponse) Descriptor() ([]byte, []int) { + return file_provider_proto_rawDescGZIP(), []int{18} +} + var File_provider_proto protoreflect.FileDescriptor var file_provider_proto_rawDesc = []byte{ @@ -1146,7 +1261,7 @@ var file_provider_proto_rawDesc = []byte{ 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x10, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x22, 0x93, 0x02, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, + 0x72, 0x63, 0x65, 0x22, 0xf3, 0x02, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x13, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x55, 0x55, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, @@ -1163,7 +1278,13 @@ var file_provider_proto_rawDesc = []byte{ 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x14, 0x52, 0x65, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x1c, 0x73, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x55, 0x74, 0x69, 0x6c, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x1c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x55, 0x74, 0x69, + 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x1a, 0x0a, + 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x22, 0x88, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x1c, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, @@ -1172,57 +1293,72 @@ var file_provider_proto_rawDesc = []byte{ 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x2c, 0x0a, 0x11, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x48, 0x61, 0x73, 0x68, 0x32, 0x87, 0x06, 0x0a, 0x0b, 0x4f, 0x43, 0x53, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x0f, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x43, - 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, - 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, - 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x43, 0x6f, 0x6e, 0x73, - 0x75, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, - 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x10, 0x4f, 0x66, 0x66, 0x62, 0x6f, 0x61, 0x72, - 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x2e, 0x4f, 0x66, 0x66, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x43, 0x6f, 0x6e, - 0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x70, + 0x48, 0x61, 0x73, 0x68, 0x22, 0x73, 0x0a, 0x19, 0x50, 0x65, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6f, 0x6e, 0x62, 0x6f, + 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x73, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x55, 0x49, 0x44, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x55, 0x49, 0x44, 0x22, 0x1c, 0x0a, 0x1a, 0x50, 0x65, 0x65, + 0x72, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xea, 0x06, 0x0a, 0x0b, 0x4f, 0x43, 0x53, 0x50, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x0f, 0x4f, 0x6e, 0x62, 0x6f, 0x61, + 0x72, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x43, 0x6f, 0x6e, + 0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x43, + 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x55, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x10, 0x4f, 0x66, 0x66, 0x62, + 0x6f, 0x61, 0x72, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x4f, 0x66, 0x66, 0x62, 0x6f, 0x61, 0x72, 0x64, - 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x6a, 0x0a, 0x15, 0x41, 0x63, 0x6b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, - 0x65, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x41, 0x63, 0x6b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, - 0x67, 0x65, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x41, - 0x63, 0x6b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, - 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, - 0x0a, 0x13, 0x46, 0x75, 0x6c, 0x66, 0x69, 0x6c, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x2e, 0x46, 0x75, 0x6c, 0x66, 0x69, 0x6c, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, - 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x46, 0x75, 0x6c, 0x66, 0x69, 0x6c, 0x6c, 0x53, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x61, 0x0a, 0x12, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x53, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x23, 0x2e, 0x70, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x53, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, - 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, - 0x0c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x2e, - 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0f, - 0x5a, 0x0d, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x4f, 0x66, 0x66, 0x62, 0x6f, + 0x61, 0x72, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6a, 0x0a, 0x15, 0x41, 0x63, 0x6b, 0x6e, 0x6f, 0x77, 0x6c, + 0x65, 0x64, 0x67, 0x65, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x26, + 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x41, 0x63, 0x6b, 0x6e, 0x6f, 0x77, + 0x6c, 0x65, 0x64, 0x67, 0x65, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x2e, 0x41, 0x63, 0x6b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x4f, 0x6e, 0x62, + 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x64, 0x0a, 0x13, 0x46, 0x75, 0x6c, 0x66, 0x69, 0x6c, 0x6c, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x2e, 0x46, 0x75, 0x6c, 0x66, 0x69, 0x6c, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, + 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x46, 0x75, 0x6c, 0x66, 0x69, 0x6c, + 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x61, 0x0a, 0x12, 0x52, 0x65, 0x76, 0x6f, 0x6b, + 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x23, 0x2e, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x53, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, + 0x76, 0x6f, 0x6b, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, 0x15, 0x47, 0x65, + 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x53, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x4f, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x61, 0x0a, 0x12, 0x50, 0x65, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1238,7 +1374,7 @@ func file_provider_proto_rawDescGZIP() []byte { } var file_provider_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_provider_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_provider_proto_msgTypes = make([]protoimpl.MessageInfo, 21) var file_provider_proto_goTypes = []interface{}{ (FulfillStorageClaimRequest_StorageType)(0), // 0: provider.FulfillStorageClaimRequest.StorageType (*OnboardConsumerRequest)(nil), // 1: provider.OnboardConsumerRequest @@ -1258,12 +1394,14 @@ var file_provider_proto_goTypes = []interface{}{ (*StorageClaimConfigResponse)(nil), // 15: provider.StorageClaimConfigResponse (*ReportStatusRequest)(nil), // 16: provider.ReportStatusRequest (*ReportStatusResponse)(nil), // 17: provider.ReportStatusResponse - nil, // 18: provider.ExternalResource.LabelsEntry - nil, // 19: provider.ExternalResource.AnnotationsEntry + (*PeerStorageClusterRequest)(nil), // 18: provider.PeerStorageClusterRequest + (*PeerStorageClusterResponse)(nil), // 19: provider.PeerStorageClusterResponse + nil, // 20: provider.ExternalResource.LabelsEntry + nil, // 21: provider.ExternalResource.AnnotationsEntry } var file_provider_proto_depIdxs = []int32{ - 18, // 0: provider.ExternalResource.Labels:type_name -> provider.ExternalResource.LabelsEntry - 19, // 1: provider.ExternalResource.Annotations:type_name -> provider.ExternalResource.AnnotationsEntry + 20, // 0: provider.ExternalResource.Labels:type_name -> provider.ExternalResource.LabelsEntry + 21, // 1: provider.ExternalResource.Annotations:type_name -> provider.ExternalResource.AnnotationsEntry 4, // 2: provider.StorageConfigResponse.externalResource:type_name -> provider.ExternalResource 0, // 3: provider.FulfillStorageClaimRequest.storageType:type_name -> provider.FulfillStorageClaimRequest.StorageType 4, // 4: provider.StorageClaimConfigResponse.externalResource:type_name -> provider.ExternalResource @@ -1275,16 +1413,18 @@ var file_provider_proto_depIdxs = []int32{ 12, // 10: provider.OCSProvider.RevokeStorageClaim:input_type -> provider.RevokeStorageClaimRequest 14, // 11: provider.OCSProvider.GetStorageClaimConfig:input_type -> provider.StorageClaimConfigRequest 16, // 12: provider.OCSProvider.ReportStatus:input_type -> provider.ReportStatusRequest - 2, // 13: provider.OCSProvider.OnboardConsumer:output_type -> provider.OnboardConsumerResponse - 5, // 14: provider.OCSProvider.GetStorageConfig:output_type -> provider.StorageConfigResponse - 7, // 15: provider.OCSProvider.OffboardConsumer:output_type -> provider.OffboardConsumerResponse - 9, // 16: provider.OCSProvider.AcknowledgeOnboarding:output_type -> provider.AcknowledgeOnboardingResponse - 11, // 17: provider.OCSProvider.FulfillStorageClaim:output_type -> provider.FulfillStorageClaimResponse - 13, // 18: provider.OCSProvider.RevokeStorageClaim:output_type -> provider.RevokeStorageClaimResponse - 15, // 19: provider.OCSProvider.GetStorageClaimConfig:output_type -> provider.StorageClaimConfigResponse - 17, // 20: provider.OCSProvider.ReportStatus:output_type -> provider.ReportStatusResponse - 13, // [13:21] is the sub-list for method output_type - 5, // [5:13] is the sub-list for method input_type + 18, // 13: provider.OCSProvider.PeerStorageCluster:input_type -> provider.PeerStorageClusterRequest + 2, // 14: provider.OCSProvider.OnboardConsumer:output_type -> provider.OnboardConsumerResponse + 5, // 15: provider.OCSProvider.GetStorageConfig:output_type -> provider.StorageConfigResponse + 7, // 16: provider.OCSProvider.OffboardConsumer:output_type -> provider.OffboardConsumerResponse + 9, // 17: provider.OCSProvider.AcknowledgeOnboarding:output_type -> provider.AcknowledgeOnboardingResponse + 11, // 18: provider.OCSProvider.FulfillStorageClaim:output_type -> provider.FulfillStorageClaimResponse + 13, // 19: provider.OCSProvider.RevokeStorageClaim:output_type -> provider.RevokeStorageClaimResponse + 15, // 20: provider.OCSProvider.GetStorageClaimConfig:output_type -> provider.StorageClaimConfigResponse + 17, // 21: provider.OCSProvider.ReportStatus:output_type -> provider.ReportStatusResponse + 19, // 22: provider.OCSProvider.PeerStorageCluster:output_type -> provider.PeerStorageClusterResponse + 14, // [14:23] is the sub-list for method output_type + 5, // [5:14] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name 5, // [5:5] is the sub-list for extension extendee 0, // [0:5] is the sub-list for field type_name @@ -1500,6 +1640,30 @@ func file_provider_proto_init() { return nil } } + file_provider_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerStorageClusterRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_provider_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerStorageClusterResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1507,7 +1671,7 @@ func file_provider_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_provider_proto_rawDesc, NumEnums: 1, - NumMessages: 19, + NumMessages: 21, NumExtensions: 0, NumServices: 1, }, diff --git a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/provider_grpc.pb.go b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/provider_grpc.pb.go index 64c45e2b..6a7c6596 100644 --- a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/provider_grpc.pb.go +++ b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/provider_grpc.pb.go @@ -37,6 +37,8 @@ type OCSProviderClient interface { // specific resources. GetStorageClaimConfig(ctx context.Context, in *StorageClaimConfigRequest, opts ...grpc.CallOption) (*StorageClaimConfigResponse, error) ReportStatus(ctx context.Context, in *ReportStatusRequest, opts ...grpc.CallOption) (*ReportStatusResponse, error) + // PeerStorageCluster RPC call to Peer the local Storage Cluster to the remote + PeerStorageCluster(ctx context.Context, in *PeerStorageClusterRequest, opts ...grpc.CallOption) (*PeerStorageClusterResponse, error) } type oCSProviderClient struct { @@ -119,6 +121,15 @@ func (c *oCSProviderClient) ReportStatus(ctx context.Context, in *ReportStatusRe return out, nil } +func (c *oCSProviderClient) PeerStorageCluster(ctx context.Context, in *PeerStorageClusterRequest, opts ...grpc.CallOption) (*PeerStorageClusterResponse, error) { + out := new(PeerStorageClusterResponse) + err := c.cc.Invoke(ctx, "/provider.OCSProvider/PeerStorageCluster", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // OCSProviderServer is the server API for OCSProvider service. // All implementations must embed UnimplementedOCSProviderServer // for forward compatibility @@ -142,6 +153,8 @@ type OCSProviderServer interface { // specific resources. GetStorageClaimConfig(context.Context, *StorageClaimConfigRequest) (*StorageClaimConfigResponse, error) ReportStatus(context.Context, *ReportStatusRequest) (*ReportStatusResponse, error) + // PeerStorageCluster RPC call to Peer the local Storage Cluster to the remote + PeerStorageCluster(context.Context, *PeerStorageClusterRequest) (*PeerStorageClusterResponse, error) mustEmbedUnimplementedOCSProviderServer() } @@ -173,6 +186,9 @@ func (UnimplementedOCSProviderServer) GetStorageClaimConfig(context.Context, *St func (UnimplementedOCSProviderServer) ReportStatus(context.Context, *ReportStatusRequest) (*ReportStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ReportStatus not implemented") } +func (UnimplementedOCSProviderServer) PeerStorageCluster(context.Context, *PeerStorageClusterRequest) (*PeerStorageClusterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PeerStorageCluster not implemented") +} func (UnimplementedOCSProviderServer) mustEmbedUnimplementedOCSProviderServer() {} // UnsafeOCSProviderServer may be embedded to opt out of forward compatibility for this service. @@ -330,6 +346,24 @@ func _OCSProvider_ReportStatus_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _OCSProvider_PeerStorageCluster_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PeerStorageClusterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OCSProviderServer).PeerStorageCluster(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/provider.OCSProvider/PeerStorageCluster", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OCSProviderServer).PeerStorageCluster(ctx, req.(*PeerStorageClusterRequest)) + } + return interceptor(ctx, in, info, handler) +} + // OCSProvider_ServiceDesc is the grpc.ServiceDesc for OCSProvider service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -369,6 +403,10 @@ var OCSProvider_ServiceDesc = grpc.ServiceDesc{ MethodName: "ReportStatus", Handler: _OCSProvider_ReportStatus_Handler, }, + { + MethodName: "PeerStorageCluster", + Handler: _OCSProvider_PeerStorageCluster_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "provider.proto", diff --git a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/storageclient.go b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/storageclient.go index 36359f2d..59439ea5 100644 --- a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/storageclient.go +++ b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/storageclient.go @@ -40,6 +40,16 @@ func (r *ReportStatusRequest) SetClusterName(clusterName string) ifaces.StorageC return r } +func (r *ReportStatusRequest) SetClientID(clientID string) ifaces.StorageClientStatus { + r.ClientID = clientID + return r +} + +func (r *ReportStatusRequest) SetStorageQuotaUtilizationRatio(storageQuotaUtilizationRatio float64) ifaces.StorageClientStatus { + r.StorageQuotaUtilizationRatio = storageQuotaUtilizationRatio + return r +} + // ensure OnboardConsumerRequest satisfies StorageClientOnboarding interface var _ ifaces.StorageClientOnboarding = &OnboardConsumerRequest{} diff --git a/vendor/modules.txt b/vendor/modules.txt index 6ebdb2a1..a0861f01 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -104,9 +104,9 @@ github.com/klauspost/compress/zstd/internal/xxhash github.com/kube-object-storage/lib-bucket-provisioner/pkg/apis/objectbucket.io github.com/kube-object-storage/lib-bucket-provisioner/pkg/apis/objectbucket.io/v1alpha1 github.com/kube-object-storage/lib-bucket-provisioner/pkg/provisioner/api -# github.com/kubernetes-csi/external-snapshotter/client/v6 v6.3.0 -## explicit; go 1.20 -github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1 +# github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0 +## explicit; go 1.22.0 +github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1 # github.com/mailru/easyjson v0.7.7 ## explicit; go 1.12 github.com/mailru/easyjson/buffer @@ -216,7 +216,7 @@ github.com/ramendr/ramen/api/v1alpha1 # github.com/red-hat-storage/ocs-client-operator/api v0.0.0-00010101000000-000000000000 => ./api ## explicit; go 1.22.5 github.com/red-hat-storage/ocs-client-operator/api/v1alpha1 -# github.com/red-hat-storage/ocs-operator/services/provider/api/v4 v4.0.0-20240917115204-741b9d6f263d +# github.com/red-hat-storage/ocs-operator/services/provider/api/v4 v4.0.0-20241113175552-201c936738fd ## explicit; go 1.22.5 github.com/red-hat-storage/ocs-operator/services/provider/api/v4 github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client