From 5af8ff3acc96c1b2708b47ffea7b92586e888f0f Mon Sep 17 00:00:00 2001 From: raaizik <132667934+raaizik@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:37:12 +0300 Subject: [PATCH] controllers: Generates VGSClass Signed-off-by: raaizik <132667934+raaizik@users.noreply.github.com> --- ...client-operator.clusterserviceversion.yaml | 18 + config/rbac/role.yaml | 18 + go.mod | 11 +- go.sum | 12 +- .../operatorconfigmap_controller.go | 4 + .../controller/storageclaim_controller.go | 125 ++++- .../apis/volumegroupsnapshot/v1beta1/doc.go | 20 + .../volumegroupsnapshot/v1beta1/register.go | 57 +++ .../apis/volumegroupsnapshot/v1beta1/types.go | 401 ++++++++++++++++ .../v1beta1/zz_generated.deepcopy.go | 433 ++++++++++++++++++ .../ramen/api/v1alpha1/drpolicy_types.go | 47 ++ .../v1alpha1/volumereplicationgroup_types.go | 16 +- .../api/v1alpha1/zz_generated.deepcopy.go | 87 +++- vendor/modules.txt | 10 +- 14 files changed, 1234 insertions(+), 25 deletions(-) create mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/doc.go create mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/register.go create mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/types.go create mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/zz_generated.deepcopy.go diff --git a/bundle/manifests/ocs-client-operator.clusterserviceversion.yaml b/bundle/manifests/ocs-client-operator.clusterserviceversion.yaml index c58b1255..826184af 100644 --- a/bundle/manifests/ocs-client-operator.clusterserviceversion.yaml +++ b/bundle/manifests/ocs-client-operator.clusterserviceversion.yaml @@ -208,6 +208,24 @@ spec: - list - update - watch + - apiGroups: + - groupsnapshot.storage.k8s.io + resources: + - volumegroupsnapshotclasses + verbs: + - create + - delete + - get + - list + - watch + - apiGroups: + - groupsnapshot.storage.k8s.io + resources: + - volumegroupsnapshotcontents + verbs: + - get + - list + - watch - apiGroups: - monitoring.coreos.com resources: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 8f15013a..8de797a4 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -165,6 +165,24 @@ rules: - list - update - watch +- apiGroups: + - groupsnapshot.storage.k8s.io + resources: + - volumegroupsnapshotclasses + verbs: + - create + - delete + - get + - list + - watch +- apiGroups: + - groupsnapshot.storage.k8s.io + resources: + - volumegroupsnapshotcontents + verbs: + - get + - list + - watch - apiGroups: - monitoring.coreos.com resources: diff --git a/go.mod b/go.mod index a9e2eef8..fbeca497 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.22.7 replace ( github.com/portworx/sched-ops => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by Rook v1.12 github.com/red-hat-storage/ocs-client-operator/api => ./api + k8s.io/client-go v12.0.0+incompatible => k8s.io/client-go v0.29.0 vbom.ml/util => github.com/fvbommel/util v0.0.0-20180919145318-efcd4e0f9787 ) @@ -18,20 +19,22 @@ exclude ( ) require ( - github.com/ceph/ceph-csi-operator/api v0.0.0-20241114115439-f325f74205d3 + github.com/ceph/ceph-csi-operator/api v0.0.0-20241119082218-62dc94e55c32 github.com/csi-addons/kubernetes-csi-addons v0.10.0 github.com/go-logr/logr v1.4.2 - github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0 + github.com/kubernetes-csi/external-snapshotter/client/v8 v8.2.0 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.34.2 github.com/openshift/api v0.0.0-20240828125535-01b3675ba7b3 github.com/operator-framework/api v0.27.0 + github.com/pkg/errors v0.9.1 // indirect github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 - github.com/ramendr/ramen/api v0.0.0-20241001141243-29d6f22ad237 + github.com/ramendr/ramen/api v0.0.0-20241105140706-d8587766acb3 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-20241120160011-2e7cf0127dd4 github.com/stretchr/testify v1.9.0 google.golang.org/grpc v1.68.0 + gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/api v0.31.1 k8s.io/apiextensions-apiserver v0.31.0 k8s.io/apimachinery v0.31.1 @@ -46,10 +49,8 @@ require ( github.com/klauspost/compress v1.17.9 // indirect github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1 // indirect github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/x448/float16 v0.8.4 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/component-base v0.31.0 // indirect sigs.k8s.io/container-object-storage-interface-api v0.1.0 // indirect ) diff --git a/go.sum b/go.sum index 33ea437d..a041e3ea 100644 --- a/go.sum +++ b/go.sum @@ -54,8 +54,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/ceph/ceph-csi-operator/api v0.0.0-20241114115439-f325f74205d3 h1:ft8h5V7BfQqIGJAyiTvn6x86Oi/yMs8yqW7rfKvN9SQ= -github.com/ceph/ceph-csi-operator/api v0.0.0-20241114115439-f325f74205d3/go.mod h1:odEUoarG26wXBCC2l4O4nMWhAz6VTKr2FRkv9yELgi8= +github.com/ceph/ceph-csi-operator/api v0.0.0-20241119082218-62dc94e55c32 h1:IawGJ9fPalvY77XtDElI4ZoVfU5aLnEKL3kwWBn3YEA= +github.com/ceph/ceph-csi-operator/api v0.0.0-20241119082218-62dc94e55c32/go.mod h1:odEUoarG26wXBCC2l4O4nMWhAz6VTKr2FRkv9yELgi8= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -256,8 +256,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/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/kubernetes-csi/external-snapshotter/client/v8 v8.2.0 h1:Q3jQ1NkFqv5o+F8dMmHd8SfEmlcwNeo1immFApntEwE= +github.com/kubernetes-csi/external-snapshotter/client/v8 v8.2.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/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVho github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= 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/ramendr/ramen/api v0.0.0-20241105140706-d8587766acb3 h1:q4UjNvv3jzKOeG/S+S1Ms2FV3WajBIE6266/7BIxdX4= +github.com/ramendr/ramen/api v0.0.0-20241105140706-d8587766acb3/go.mod h1:O7VpTy8MMrh31DF4fv+2SZBSouAr8NlzIY4KYx7K75U= github.com/red-hat-storage/ocs-operator/services/provider/api/v4 v4.0.0-20241120160011-2e7cf0127dd4 h1:ppE7R+yh9I2PZuGPaUDdwQ45ZFV8YfHFNKccOxTo8tg= github.com/red-hat-storage/ocs-operator/services/provider/api/v4 v4.0.0-20241120160011-2e7cf0127dd4/go.mod h1:XEZxUtzjlARPV8YvzcX2p7iiRbrUbDP4Q/CXx9ly5lw= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= diff --git a/internal/controller/operatorconfigmap_controller.go b/internal/controller/operatorconfigmap_controller.go index 6b7ceea2..b612125a 100644 --- a/internal/controller/operatorconfigmap_controller.go +++ b/internal/controller/operatorconfigmap_controller.go @@ -351,6 +351,10 @@ func (c *OperatorConfigMapReconciler) reconcileDelegatedCSI() error { templates.CSIOperatorConfigSpec.DeepCopyInto(&csiOperatorConfig.Spec) csiOperatorConfig.Spec.DriverSpecDefaults.ImageSet = &corev1.LocalObjectReference{Name: cmName} csiOperatorConfig.Spec.DriverSpecDefaults.ClusterName = ptr.To(string(clusterVersion.Spec.ClusterID)) + if c.AvailableCrds[volumeGroupSnapshotClassCrd] { + csiOperatorConfig.Spec.DriverSpecDefaults.SnapshotPolicy = csiopv1a1.VolumeGroupSnapshotPolicy + } + return nil }); err != nil { return fmt.Errorf("failed to reconcile csi operator config: %v", err) diff --git a/internal/controller/storageclaim_controller.go b/internal/controller/storageclaim_controller.go index 9111654a..d953a9a0 100644 --- a/internal/controller/storageclaim_controller.go +++ b/internal/controller/storageclaim_controller.go @@ -20,20 +20,23 @@ import ( "context" "encoding/json" "fmt" + "slices" + "strings" + v1alpha1 "github.com/red-hat-storage/ocs-client-operator/api/v1alpha1" "github.com/red-hat-storage/ocs-client-operator/pkg/templates" "github.com/red-hat-storage/ocs-client-operator/pkg/utils" - "slices" - "strings" csiopv1a1 "github.com/ceph/ceph-csi-operator/api/v1alpha1" "github.com/go-logr/logr" replicationv1alpha1 "github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1" + groupsnapapi "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1" snapapi "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" providerclient "github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client" corev1 "k8s.io/api/core/v1" storagev1 "k8s.io/api/storage/v1" + extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -42,6 +45,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/handler" ctrllog "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" @@ -52,8 +56,11 @@ const ( storageClaimAnnotation = "ocs.openshift.io/storageclaim" keyRotationAnnotation = "keyrotation.csiaddons.openshift.io/schedule" - pvClusterIDIndexName = "index:persistentVolumeClusterID" - vscClusterIDIndexName = "index:volumeSnapshotContentCSIDriver" + pvClusterIDIndexName = "index:persistentVolumeClusterID" + vscClusterIDIndexName = "index:volumeSnapshotContentCSIDriver" + vgscClusterIDIndexName = "index:volumeGroupSnapshotContentCSIDriver" + volumeGroupSnapshotClassCrd = "groupsnapshot.storage.k8s.io/volumegroupsnapshotclass" + drClusterConfigCRDName = "drclusterconfigs.ramendr.openshift.io" ) // StorageClaimReconciler reconciles a StorageClaim object @@ -62,6 +69,7 @@ type StorageClaimReconciler struct { cache.Cache Scheme *runtime.Scheme OperatorNamespace string + AvailableCrds map[string]bool log logr.Logger ctx context.Context @@ -104,13 +112,46 @@ func (r *StorageClaimReconciler) SetupWithManager(mgr ctrl.Manager) error { return fmt.Errorf("unable to set up FieldIndexer for VSC csi driver name: %v", err) } + if err := mgr.GetCache().IndexField(ctx, &groupsnapapi.VolumeGroupSnapshotContent{}, vgscClusterIDIndexName, func(o client.Object) []string { + vgsc := o.(*groupsnapapi.VolumeGroupSnapshotContent) + if vgsc != nil && + slices.Contains(csiDrivers, vgsc.Spec.Driver) && + vgsc.Status != nil && + vgsc.Status.VolumeGroupSnapshotHandle != nil { + parts := strings.Split(*vgsc.Status.VolumeGroupSnapshotHandle, "-") + if len(parts) == 9 { + // second entry in the volumeID is clusterID which is unique across the cluster + return []string{parts[2]} + } + } + return nil + }); err != nil { + return fmt.Errorf("unable to set up FieldIndexer for VSC csi driver name: %v", err) + } + generationChangePredicate := predicate.GenerationChangedPredicate{} bldr := ctrl.NewControllerManagedBy(mgr). For(&v1alpha1.StorageClaim{}, builder.WithPredicates(generationChangePredicate)). Owns(&storagev1.StorageClass{}). Owns(&snapapi.VolumeSnapshotClass{}). - Owns(&replicationv1alpha1.VolumeReplicationClass{}, builder.WithPredicates(generationChangePredicate)). - Owns(&csiopv1a1.ClientProfile{}, builder.WithPredicates(generationChangePredicate)) + Owns(&csiopv1a1.ClientProfile{}, builder.WithPredicates(generationChangePredicate)). + Watches( + &extv1.CustomResourceDefinition{}, + &handler.EnqueueRequestForObject{}, + builder.WithPredicates( + utils.NamePredicate(volumeGroupSnapshotClassCrd), + utils.EventTypePredicate( + !r.AvailableCrds[volumeGroupSnapshotClassCrd], + false, + r.AvailableCrds[volumeGroupSnapshotClassCrd], + false, + ), + ), + builder.OnlyMetadata, + ) + if r.AvailableCrds[volumeGroupSnapshotClassCrd] { + bldr = bldr.Owns(&groupsnapapi.VolumeGroupSnapshotClass{}) + } return bldr.Complete(r) } @@ -121,8 +162,10 @@ func (r *StorageClaimReconciler) SetupWithManager(mgr ctrl.Manager) error { //+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch;create;update;delete //+kubebuilder:rbac:groups=storage.k8s.io,resources=storageclasses,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=snapshot.storage.k8s.io,resources=volumesnapshotclasses,verbs=get;list;watch;create;delete +//+kubebuilder:rbac:groups=groupsnapshot.storage.k8s.io,resources=volumegroupsnapshotclasses,verbs=create;delete;get;list;watch //+kubebuilder:rbac:groups=core,resources=persistentvolumes,verbs=get;list;watch //+kubebuilder:rbac:groups=snapshot.storage.k8s.io,resources=volumesnapshotcontents,verbs=get;list;watch +//+kubebuilder:rbac:groups=groupsnapshot.storage.k8s.io,resources=volumegroupsnapshotcontents,verbs=get;list;watch //+kubebuilder:rbac:groups=csi.ceph.io,resources=clientprofiles,verbs=get;list;update;create;watch;delete //+kubebuilder:rbac:groups=replication.storage.openshift.io,resources=volumereplicationclasses,verbs=get;list;watch;create;delete @@ -141,6 +184,17 @@ func (r *StorageClaimReconciler) Reconcile(ctx context.Context, req ctrl.Request r.ctx = ctrllog.IntoContext(ctx, r.log) r.log.Info("Reconciling StorageClaim.") + crd := &metav1.PartialObjectMetadata{} + for _, crdName := range []string{volumeGroupSnapshotClassCrd, drClusterConfigCRDName} { + crd.SetGroupVersionKind(extv1.SchemeGroupVersion.WithKind("CustomResourceDefinition")) + crd.Name = crdName + if err := r.Client.Get(ctx, client.ObjectKeyFromObject(crd), crd); client.IgnoreNotFound(err) != nil { + r.log.Error(err, "Failed to get CRD", "CRD", crdName) + return reconcile.Result{}, err + } + } + utils.AssertEqual(r.AvailableCrds[crd.Name], crd.UID != "", utils.ExitCodeThatShouldRestartTheProcess) + // Fetch the StorageClaim instance r.storageClaim = &v1alpha1.StorageClaim{} r.storageClaim.Name = req.Name @@ -401,7 +455,31 @@ func (r *StorageClaimReconciler) reconcilePhases() (reconcile.Result, error) { return nil }) if err != nil { - return reconcile.Result{}, fmt.Errorf("failed to create or update VolumeSnapshotClass: %s", err) + return reconcile.Result{}, fmt.Errorf("failed to create or update StorageClass: %s", err) + } + case "VolumeGroupSnapshotClass": + // check for CRD availability + if r.AvailableCrds[("VolumeGroupSnapshotClass")] { + var volumeGroupSnapshotClass *groupsnapapi.VolumeGroupSnapshotClass + data := map[string]string{} + err = json.Unmarshal(resource.Data, &data) + if err != nil { + return reconcile.Result{}, fmt.Errorf("failed to unmarshal StorageClaim configuration response: %v", err) + } + data["csi.storage.k8s.io/group-snapshotter-secret-namespace"] = r.OperatorNamespace + // generate a new clusterID for cephfs subvolumegroup, as + // storageclaim is clusterscoped resources using its + // hash as the clusterID + data["clusterID"] = r.storageClaimHash + volumeGroupSnapshotClass = r.getCephDriverVolumeGroupSnapshotClass(resource.Labels, resource.Annotations) + utils.AddAnnotation(volumeGroupSnapshotClass, storageClaimAnnotation, r.storageClaim.Name) + err = utils.CreateOrReplace(r.ctx, r.Client, volumeGroupSnapshotClass, func() error { + volumeGroupSnapshotClass.Parameters = data + return nil + }) + if err != nil { + return reconcile.Result{}, fmt.Errorf("failed to create or update StorageClass: %s", err) + } } case "VolumeReplicationClass": vrc := &replicationv1alpha1.VolumeReplicationClass{} @@ -466,6 +544,11 @@ func (r *StorageClaimReconciler) reconcilePhases() (reconcile.Result, error) { } else if exist { return reconcile.Result{}, fmt.Errorf("one or more volumesnapshotcontents exist that are dependent on storageclaim %s", r.storageClaim.Name) } + if exist, err := r.hasVolumeGroupSnapshotContents(); err != nil { + return reconcile.Result{}, fmt.Errorf("failed to verify volumegroupsnapshotcontents dependent on storageclaim %q: %v", r.storageClaim.Name, err) + } else if exist { + return reconcile.Result{}, fmt.Errorf("one or more volumegroupsnapshotcontents exist that are dependent on storageclaim %s", r.storageClaim.Name) + } // Call `RevokeStorageClaim` service on the provider server with StorageClaim as a request message. // Check if StorageClaim is still exists (it might have been manually removed during the StorageClass @@ -550,6 +633,20 @@ func (r *StorageClaimReconciler) getCephRBDVolumeSnapshotClass() *snapapi.Volume return volumesnapshotclass } +func (r *StorageClaimReconciler) getCephDriverVolumeGroupSnapshotClass( + labels map[string]string, annotations map[string]string) *groupsnapapi.VolumeGroupSnapshotClass { + volumegroupsnapshotclass := &groupsnapapi.VolumeGroupSnapshotClass{ + ObjectMeta: metav1.ObjectMeta{ + Name: r.storageClaim.Name, + Labels: labels, + Annotations: annotations, + }, + Driver: templates.RBDDriverName, + DeletionPolicy: snapapi.VolumeSnapshotContentDelete, + } + return volumegroupsnapshotclass +} + func (r *StorageClaimReconciler) get(obj client.Object) error { key := client.ObjectKeyFromObject(obj) return r.Client.Get(r.ctx, key, obj) @@ -594,3 +691,17 @@ func (r *StorageClaimReconciler) hasVolumeSnapshotContents() (bool, error) { return false, nil } + +func (r *StorageClaimReconciler) hasVolumeGroupSnapshotContents() (bool, error) { + vscList := &groupsnapapi.VolumeGroupSnapshotContentList{} + if err := r.list(vscList, client.MatchingFields{vgscClusterIDIndexName: r.storageClaimHash}); err != nil { + return false, fmt.Errorf("failed to list volume group snapshot content resources: %v", err) + } + + if len(vscList.Items) != 0 { + r.log.Info(fmt.Sprintf("VolumeGroupSnapshotContent referring storageclaim %q exists", r.storageClaim.Name)) + return true, nil + } + + return false, nil +} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/doc.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/doc.go new file mode 100644 index 00000000..f2fdf6b8 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2023 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. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package +// +groupName=groupsnapshot.storage.k8s.io + +package v1beta1 diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/register.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/register.go new file mode 100644 index 00000000..22cebf94 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/register.go @@ -0,0 +1,57 @@ +/* +Copyright 2023 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. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package. +const GroupName = "groupsnapshot.storage.k8s.io" + +var ( + // SchemeBuilder is the new scheme builder + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme adds to scheme + AddToScheme = SchemeBuilder.AddToScheme + // SchemeGroupVersion is the group version used to register these objects. + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} +) + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + SchemeBuilder.Register(addKnownTypes) +} + +// addKnownTypes adds the set of types defined in this package to the supplied scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &VolumeGroupSnapshotClass{}, + &VolumeGroupSnapshotClassList{}, + &VolumeGroupSnapshot{}, + &VolumeGroupSnapshotList{}, + &VolumeGroupSnapshotContent{}, + &VolumeGroupSnapshotContentList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/types.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/types.go new file mode 100644 index 00000000..da0540bc --- /dev/null +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/types.go @@ -0,0 +1,401 @@ +/* +Copyright 2023 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. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// +kubebuilder:object:generate=true +package v1beta1 + +import ( + core_v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" +) + +// VolumeGroupSnapshotSpec defines the desired state of a volume group snapshot. +type VolumeGroupSnapshotSpec struct { + // Source specifies where a group snapshot will be created from. + // This field is immutable after creation. + // Required. + Source VolumeGroupSnapshotSource `json:"source" protobuf:"bytes,1,opt,name=source"` + + // VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass + // requested by the VolumeGroupSnapshot. + // VolumeGroupSnapshotClassName may be left nil to indicate that the default + // class will be used. + // Empty string is not allowed for this field. + // +optional + // +kubebuilder:validation:XValidation:rule="size(self) > 0",message="volumeGroupSnapshotClassName must not be the empty string when set" + VolumeGroupSnapshotClassName *string `json:"volumeGroupSnapshotClassName,omitempty" protobuf:"bytes,2,opt,name=volumeGroupSnapshotClassName"` +} + +// VolumeGroupSnapshotSource specifies whether the underlying group snapshot should be +// dynamically taken upon creation or if a pre-existing VolumeGroupSnapshotContent +// object should be used. +// Exactly one of its members must be set. +// Members in VolumeGroupSnapshotSource are immutable. +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.selector) || has(self.selector)", message="selector is required once set" +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.volumeGroupSnapshotContentName) || has(self.volumeGroupSnapshotContentName)", message="volumeGroupSnapshotContentName is required once set" +// +kubebuilder:validation:XValidation:rule="(has(self.selector) && !has(self.volumeGroupSnapshotContentName)) || (!has(self.selector) && has(self.volumeGroupSnapshotContentName))", message="exactly one of selector and volumeGroupSnapshotContentName must be set" +type VolumeGroupSnapshotSource struct { + // Selector is a label query over persistent volume claims that are to be + // grouped together for snapshotting. + // This labelSelector will be used to match the label added to a PVC. + // If the label is added or removed to a volume after a group snapshot + // is created, the existing group snapshots won't be modified. + // Once a VolumeGroupSnapshotContent is created and the sidecar starts to process + // it, the volume list will not change with retries. + // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="selector is immutable" + Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,1,opt,name=selector"` + + // VolumeGroupSnapshotContentName specifies the name of a pre-existing VolumeGroupSnapshotContent + // object representing an existing volume group snapshot. + // This field should be set if the volume group snapshot already exists and + // only needs a representation in Kubernetes. + // This field is immutable. + // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupSnapshotContentName is immutable" + VolumeGroupSnapshotContentName *string `json:"volumeGroupSnapshotContentName,omitempty" protobuf:"bytes,2,opt,name=volumeGroupSnapshotContentName"` +} + +// VolumeGroupSnapshotStatus defines the observed state of volume group snapshot. +type VolumeGroupSnapshotStatus struct { + // BoundVolumeGroupSnapshotContentName is the name of the VolumeGroupSnapshotContent + // object to which this VolumeGroupSnapshot object intends to bind to. + // If not specified, it indicates that the VolumeGroupSnapshot object has not + // been successfully bound to a VolumeGroupSnapshotContent object yet. + // NOTE: To avoid possible security issues, consumers must verify binding between + // VolumeGroupSnapshot and VolumeGroupSnapshotContent objects is successful + // (by validating that both VolumeGroupSnapshot and VolumeGroupSnapshotContent + // point at each other) before using this object. + // +optional + BoundVolumeGroupSnapshotContentName *string `json:"boundVolumeGroupSnapshotContentName,omitempty" protobuf:"bytes,1,opt,name=boundVolumeGroupSnapshotContentName"` + + // CreationTime is the timestamp when the point-in-time group snapshot is taken + // by the underlying storage system. + // If not specified, it may indicate that the creation time of the group snapshot + // is unknown. + // The format of this field is a Unix nanoseconds time encoded as an int64. + // On Unix, the command date +%s%N returns the current time in nanoseconds + // since 1970-01-01 00:00:00 UTC. + // This field is updated based on the CreationTime field in VolumeGroupSnapshotContentStatus + // +optional + CreationTime *metav1.Time `json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"` + + // ReadyToUse indicates if all the individual snapshots in the group are ready + // to be used to restore a group of volumes. + // ReadyToUse becomes true when ReadyToUse of all individual snapshots become true. + // If not specified, it means the readiness of a group snapshot is unknown. + // +optional + ReadyToUse *bool `json:"readyToUse,omitempty" protobuf:"varint,3,opt,name=readyToUse"` + + // Error is the last observed error during group snapshot creation, if any. + // This field could be helpful to upper level controllers (i.e., application + // controller) to decide whether they should continue on waiting for the group + // snapshot to be created based on the type of error reported. + // The snapshot controller will keep retrying when an error occurs during the + // group snapshot creation. Upon success, this error field will be cleared. + // +optional + Error *snapshotv1.VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,4,opt,name=error,casttype=VolumeSnapshotError"` +} + +//+genclient +//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VolumeGroupSnapshot is a user's request for creating either a point-in-time +// group snapshot or binding to a pre-existing group snapshot. +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Namespaced,shortName=vgs +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="ReadyToUse",type=boolean,JSONPath=`.status.readyToUse`,description="Indicates if all the individual snapshots in the group are ready to be used to restore a group of volumes." +// +kubebuilder:printcolumn:name="VolumeGroupSnapshotClass",type=string,JSONPath=`.spec.volumeGroupSnapshotClassName`,description="The name of the VolumeGroupSnapshotClass requested by the VolumeGroupSnapshot." +// +kubebuilder:printcolumn:name="VolumeGroupSnapshotContent",type=string,JSONPath=`.status.boundVolumeGroupSnapshotContentName`,description="Name of the VolumeGroupSnapshotContent object to which the VolumeGroupSnapshot object intends to bind to. Please note that verification of binding actually requires checking both VolumeGroupSnapshot and VolumeGroupSnapshotContent to ensure both are pointing at each other. Binding MUST be verified prior to usage of this object." +// +kubebuilder:printcolumn:name="CreationTime",type=date,JSONPath=`.status.creationTime`,description="Timestamp when the point-in-time group snapshot was taken by the underlying storage system." +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +type VolumeGroupSnapshot struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec defines the desired characteristics of a group snapshot requested by a user. + // Required. + Spec VolumeGroupSnapshotSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + // Status represents the current information of a group snapshot. + // Consumers must verify binding between VolumeGroupSnapshot and + // VolumeGroupSnapshotContent objects is successful (by validating that both + // VolumeGroupSnapshot and VolumeGroupSnapshotContent point to each other) before + // using this object. + // +optional + Status *VolumeGroupSnapshotStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// VolumeGroupSnapshotList contains a list of VolumeGroupSnapshot objects. +type VolumeGroupSnapshotList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + // Items is the list of VolumeGroupSnapshots. + Items []VolumeGroupSnapshot `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +//+genclient +//+genclient:nonNamespaced +//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VolumeGroupSnapshotClass specifies parameters that a underlying storage system +// uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass +// is used by specifying its name in a VolumeGroupSnapshot object. +// VolumeGroupSnapshotClasses are non-namespaced. +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=vgsclass;vgsclasses +// +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.driver` +// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.deletionPolicy`,description="Determines whether a VolumeGroupSnapshotContent created through the VolumeGroupSnapshotClass should be deleted when its bound VolumeGroupSnapshot is deleted." +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +type VolumeGroupSnapshotClass struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass. + // Required. + Driver string `json:"driver" protobuf:"bytes,2,opt,name=driver"` + + // Parameters is a key-value map with storage driver specific parameters for + // creating group snapshots. + // These values are opaque to Kubernetes and are passed directly to the driver. + // +optional + Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"` + + // DeletionPolicy determines whether a VolumeGroupSnapshotContent created + // through the VolumeGroupSnapshotClass should be deleted when its bound + // VolumeGroupSnapshot is deleted. + // Supported values are "Retain" and "Delete". + // "Retain" means that the VolumeGroupSnapshotContent and its physical group + // snapshot on underlying storage system are kept. + // "Delete" means that the VolumeGroupSnapshotContent and its physical group + // snapshot on underlying storage system are deleted. + // Required. + DeletionPolicy snapshotv1.DeletionPolicy `json:"deletionPolicy" protobuf:"bytes,4,opt,name=deletionPolicy"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VolumeGroupSnapshotClassList is a collection of VolumeGroupSnapshotClasses. +// +kubebuilder:object:root=true +type VolumeGroupSnapshotClassList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of VolumeGroupSnapshotClasses. + Items []VolumeGroupSnapshotClass `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VolumeGroupSnapshotContent represents the actual "on-disk" group snapshot object +// in the underlying storage system +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=vgsc;vgscs +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="ReadyToUse",type=boolean,JSONPath=`.status.readyToUse`,description="Indicates if all the individual snapshots in the group are ready to be used to restore a group of volumes." +// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.spec.deletionPolicy`,description="Determines whether this VolumeGroupSnapshotContent and its physical group snapshot on the underlying storage system should be deleted when its bound VolumeGroupSnapshot is deleted." +// +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.spec.driver`,description="Name of the CSI driver used to create the physical group snapshot on the underlying storage system." +// +kubebuilder:printcolumn:name="VolumeGroupSnapshotClass",type=string,JSONPath=`.spec.volumeGroupSnapshotClassName`,description="Name of the VolumeGroupSnapshotClass from which this group snapshot was (or will be) created." +// +kubebuilder:printcolumn:name="VolumeGroupSnapshotNamespace",type=string,JSONPath=`.spec.volumeGroupSnapshotRef.namespace`,description="Namespace of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent object is bound." +// +kubebuilder:printcolumn:name="VolumeGroupSnapshot",type=string,JSONPath=`.spec.volumeGroupSnapshotRef.name`,description="Name of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent object is bound." +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +type VolumeGroupSnapshotContent struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec defines properties of a VolumeGroupSnapshotContent created by the underlying storage system. + // Required. + Spec VolumeGroupSnapshotContentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + // status represents the current information of a group snapshot. + // +optional + Status *VolumeGroupSnapshotContentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VolumeGroupSnapshotContentList is a list of VolumeGroupSnapshotContent objects +// +kubebuilder:object:root=true +type VolumeGroupSnapshotContentList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of VolumeGroupSnapshotContents. + Items []VolumeGroupSnapshotContent `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// VolumeGroupSnapshotContentSpec describes the common attributes of a group snapshot content +type VolumeGroupSnapshotContentSpec struct { + // VolumeGroupSnapshotRef specifies the VolumeGroupSnapshot object to which this + // VolumeGroupSnapshotContent object is bound. + // VolumeGroupSnapshot.Spec.VolumeGroupSnapshotContentName field must reference to + // this VolumeGroupSnapshotContent's name for the bidirectional binding to be valid. + // For a pre-existing VolumeGroupSnapshotContent object, name and namespace of the + // VolumeGroupSnapshot 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 volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set" + VolumeGroupSnapshotRef core_v1.ObjectReference `json:"volumeGroupSnapshotRef" protobuf:"bytes,1,opt,name=volumeGroupSnapshotRef"` + + // DeletionPolicy determines whether this VolumeGroupSnapshotContent and the + // physical group snapshot on the underlying storage system should be deleted + // when the bound VolumeGroupSnapshot is deleted. + // Supported values are "Retain" and "Delete". + // "Retain" means that the VolumeGroupSnapshotContent and its physical group + // snapshot on underlying storage system are kept. + // "Delete" means that the VolumeGroupSnapshotContent and its physical group + // snapshot on underlying storage system are deleted. + // For dynamically provisioned group snapshots, this field will automatically + // be filled in by the CSI snapshotter sidecar with the "DeletionPolicy" field + // defined in the corresponding VolumeGroupSnapshotClass. + // For pre-existing snapshots, users MUST specify this field when creating the + // VolumeGroupSnapshotContent object. + // Required. + DeletionPolicy snapshotv1.DeletionPolicy `json:"deletionPolicy" protobuf:"bytes,2,opt,name=deletionPolicy"` + + // Driver is the name of the CSI driver used to create the physical group snapshot on + // the underlying storage system. + // This MUST be the same as the name returned by the CSI GetPluginName() call for + // that driver. + // Required. + Driver string `json:"driver" protobuf:"bytes,3,opt,name=driver"` + + // VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass from + // which this group snapshot was (or will be) created. + // Note that after provisioning, the VolumeGroupSnapshotClass may be deleted or + // recreated with different set of values, and as such, should not be referenced + // post-snapshot creation. + // For dynamic provisioning, this field must be set. + // This field may be unset for pre-provisioned snapshots. + // +optional + VolumeGroupSnapshotClassName *string `json:"volumeGroupSnapshotClassName,omitempty" protobuf:"bytes,4,opt,name=volumeGroupSnapshotClassName"` + + // Source specifies whether the snapshot is (or should be) dynamically provisioned + // or already exists, and just requires a Kubernetes object representation. + // This field is immutable after creation. + // Required. + Source VolumeGroupSnapshotContentSource `json:"source" protobuf:"bytes,5,opt,name=source"` +} + +// VolumeGroupSnapshotContentStatus defines the observed state of VolumeGroupSnapshotContent. +type VolumeGroupSnapshotContentStatus struct { + // VolumeGroupSnapshotHandle is a unique id returned by the CSI driver + // to identify the VolumeGroupSnapshot on the storage system. + // If a storage system does not provide such an id, the + // CSI driver can choose to return the VolumeGroupSnapshot name. + // +optional + VolumeGroupSnapshotHandle *string `json:"volumeGroupSnapshotHandle,omitempty" protobuf:"bytes,1,opt,name=volumeGroupSnapshotHandle"` + + // CreationTime is the timestamp when the point-in-time group snapshot is taken + // by the underlying storage system. + // If not specified, it indicates the creation time is unknown. + // If not specified, it means the readiness of a group snapshot is unknown. + // The format of this field is a Unix nanoseconds time encoded as an int64. + // On Unix, the command date +%s%N returns the current time in nanoseconds + // since 1970-01-01 00:00:00 UTC. + // This field is the source for the CreationTime field in VolumeGroupSnapshotStatus + // +optional + CreationTime *metav1.Time `json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"` + + // ReadyToUse indicates if all the individual snapshots in the group are ready to be + // used to restore a group of volumes. + // ReadyToUse becomes true when ReadyToUse of all individual snapshots become true. + // +optional + ReadyToUse *bool `json:"readyToUse,omitempty" protobuf:"varint,3,opt,name=readyToUse"` + + // Error is the last observed error during group snapshot creation, if any. + // Upon success after retry, this error field will be cleared. + // +optional + Error *snapshotv1.VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,4,opt,name=error,casttype=VolumeSnapshotError"` + + // VolumeSnapshotHandlePairList is a list of CSI "volume_id" and "snapshot_id" + // pair returned by the CSI driver to identify snapshots and their source volumes + // on the storage system. + // +optional + VolumeSnapshotHandlePairList []VolumeSnapshotHandlePair `json:"volumeSnapshotHandlePairList,omitempty" protobuf:"bytes,6,opt,name=volumeSnapshotHandlePairList"` +} + +// VolumeGroupSnapshotContentSource represents the CSI source of a group snapshot. +// Exactly one of its members must be set. +// Members in VolumeGroupSnapshotContentSource are immutable. +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.volumeHandles) || has(self.volumeHandles)", message="volumeHandles is required once set" +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.groupSnapshotHandles) || has(self.groupSnapshotHandles)", message="groupSnapshotHandles is required once set" +// +kubebuilder:validation:XValidation:rule="(has(self.volumeHandles) && !has(self.groupSnapshotHandles)) || (!has(self.volumeHandles) && has(self.groupSnapshotHandles))", message="exactly one of volumeHandles and groupSnapshotHandles must be set" +type VolumeGroupSnapshotContentSource struct { + // VolumeHandles is a list of volume handles on the backend to be snapshotted + // together. It is specified for dynamic provisioning of the VolumeGroupSnapshot. + // This field is immutable. + // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeHandles is immutable" + VolumeHandles []string `json:"volumeHandles,omitempty" protobuf:"bytes,1,opt,name=volumeHandles"` + + // GroupSnapshotHandles specifies the CSI "group_snapshot_id" of a pre-existing + // group snapshot and a list of CSI "snapshot_id" of pre-existing snapshots + // on the underlying storage system for which a Kubernetes object + // representation was (or should be) created. + // This field is immutable. + // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="groupSnapshotHandles is immutable" + GroupSnapshotHandles *GroupSnapshotHandles `json:"groupSnapshotHandles,omitempty" protobuf:"bytes,2,opt,name=groupSnapshotHandles"` +} + +type GroupSnapshotHandles struct { + // VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id" of a pre-existing + // group snapshot on the underlying storage system for which a Kubernetes object + // representation was (or should be) created. + // This field is immutable. + // Required. + VolumeGroupSnapshotHandle string `json:"volumeGroupSnapshotHandle" protobuf:"bytes,1,opt,name=volumeGroupSnapshotHandle"` + + // VolumeSnapshotHandles is a list of CSI "snapshot_id" of pre-existing + // snapshots on the underlying storage system for which Kubernetes objects + // representation were (or should be) created. + // This field is immutable. + // Required. + VolumeSnapshotHandles []string `json:"volumeSnapshotHandles" protobuf:"bytes,2,opt,name=volumeSnapshotHandles"` +} + +// VolumeSnapshotHandlePair defines a pair of a source volume handle and a snapshot handle +type VolumeSnapshotHandlePair struct { + // VolumeHandle is a unique id returned by the CSI driver to identify a volume + // on the storage system + // Required. + VolumeHandle string `json:"volumeHandle" protobuf:"bytes,1,opt,name=volumeHandle"` + + // SnapshotHandle is a unique id returned by the CSI driver to identify a volume + // snapshot on the storage system + // Required. + SnapshotHandle string `json:"snapshotHandle" protobuf:"bytes,2,opt,name=snapshotHandle"` +} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 00000000..4c59130d --- /dev/null +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,433 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +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. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GroupSnapshotHandles) DeepCopyInto(out *GroupSnapshotHandles) { + *out = *in + if in.VolumeSnapshotHandles != nil { + in, out := &in.VolumeSnapshotHandles, &out.VolumeSnapshotHandles + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupSnapshotHandles. +func (in *GroupSnapshotHandles) DeepCopy() *GroupSnapshotHandles { + if in == nil { + return nil + } + out := new(GroupSnapshotHandles) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshot) DeepCopyInto(out *VolumeGroupSnapshot) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(VolumeGroupSnapshotStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshot. +func (in *VolumeGroupSnapshot) DeepCopy() *VolumeGroupSnapshot { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshot) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VolumeGroupSnapshot) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotClass) DeepCopyInto(out *VolumeGroupSnapshotClass) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Parameters != nil { + in, out := &in.Parameters, &out.Parameters + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotClass. +func (in *VolumeGroupSnapshotClass) DeepCopy() *VolumeGroupSnapshotClass { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotClass) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VolumeGroupSnapshotClass) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotClassList) DeepCopyInto(out *VolumeGroupSnapshotClassList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VolumeGroupSnapshotClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotClassList. +func (in *VolumeGroupSnapshotClassList) DeepCopy() *VolumeGroupSnapshotClassList { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotClassList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VolumeGroupSnapshotClassList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotContent) DeepCopyInto(out *VolumeGroupSnapshotContent) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(VolumeGroupSnapshotContentStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotContent. +func (in *VolumeGroupSnapshotContent) DeepCopy() *VolumeGroupSnapshotContent { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotContent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VolumeGroupSnapshotContent) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotContentList) DeepCopyInto(out *VolumeGroupSnapshotContentList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VolumeGroupSnapshotContent, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotContentList. +func (in *VolumeGroupSnapshotContentList) DeepCopy() *VolumeGroupSnapshotContentList { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotContentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VolumeGroupSnapshotContentList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotContentSource) DeepCopyInto(out *VolumeGroupSnapshotContentSource) { + *out = *in + if in.VolumeHandles != nil { + in, out := &in.VolumeHandles, &out.VolumeHandles + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.GroupSnapshotHandles != nil { + in, out := &in.GroupSnapshotHandles, &out.GroupSnapshotHandles + *out = new(GroupSnapshotHandles) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotContentSource. +func (in *VolumeGroupSnapshotContentSource) DeepCopy() *VolumeGroupSnapshotContentSource { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotContentSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotContentSpec) DeepCopyInto(out *VolumeGroupSnapshotContentSpec) { + *out = *in + out.VolumeGroupSnapshotRef = in.VolumeGroupSnapshotRef + if in.VolumeGroupSnapshotClassName != nil { + in, out := &in.VolumeGroupSnapshotClassName, &out.VolumeGroupSnapshotClassName + *out = new(string) + **out = **in + } + in.Source.DeepCopyInto(&out.Source) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotContentSpec. +func (in *VolumeGroupSnapshotContentSpec) DeepCopy() *VolumeGroupSnapshotContentSpec { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotContentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotContentStatus) DeepCopyInto(out *VolumeGroupSnapshotContentStatus) { + *out = *in + if in.VolumeGroupSnapshotHandle != nil { + in, out := &in.VolumeGroupSnapshotHandle, &out.VolumeGroupSnapshotHandle + *out = new(string) + **out = **in + } + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } + if in.ReadyToUse != nil { + in, out := &in.ReadyToUse, &out.ReadyToUse + *out = new(bool) + **out = **in + } + if in.Error != nil { + in, out := &in.Error, &out.Error + *out = new(v1.VolumeSnapshotError) + (*in).DeepCopyInto(*out) + } + if in.VolumeSnapshotHandlePairList != nil { + in, out := &in.VolumeSnapshotHandlePairList, &out.VolumeSnapshotHandlePairList + *out = make([]VolumeSnapshotHandlePair, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotContentStatus. +func (in *VolumeGroupSnapshotContentStatus) DeepCopy() *VolumeGroupSnapshotContentStatus { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotContentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotList) DeepCopyInto(out *VolumeGroupSnapshotList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VolumeGroupSnapshot, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotList. +func (in *VolumeGroupSnapshotList) DeepCopy() *VolumeGroupSnapshotList { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VolumeGroupSnapshotList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotSource) DeepCopyInto(out *VolumeGroupSnapshotSource) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.VolumeGroupSnapshotContentName != nil { + in, out := &in.VolumeGroupSnapshotContentName, &out.VolumeGroupSnapshotContentName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotSource. +func (in *VolumeGroupSnapshotSource) DeepCopy() *VolumeGroupSnapshotSource { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotSpec) DeepCopyInto(out *VolumeGroupSnapshotSpec) { + *out = *in + in.Source.DeepCopyInto(&out.Source) + if in.VolumeGroupSnapshotClassName != nil { + in, out := &in.VolumeGroupSnapshotClassName, &out.VolumeGroupSnapshotClassName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotSpec. +func (in *VolumeGroupSnapshotSpec) DeepCopy() *VolumeGroupSnapshotSpec { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeGroupSnapshotStatus) DeepCopyInto(out *VolumeGroupSnapshotStatus) { + *out = *in + if in.BoundVolumeGroupSnapshotContentName != nil { + in, out := &in.BoundVolumeGroupSnapshotContentName, &out.BoundVolumeGroupSnapshotContentName + *out = new(string) + **out = **in + } + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } + if in.ReadyToUse != nil { + in, out := &in.ReadyToUse, &out.ReadyToUse + *out = new(bool) + **out = **in + } + if in.Error != nil { + in, out := &in.Error, &out.Error + *out = new(v1.VolumeSnapshotError) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotStatus. +func (in *VolumeGroupSnapshotStatus) DeepCopy() *VolumeGroupSnapshotStatus { + if in == nil { + return nil + } + out := new(VolumeGroupSnapshotStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeSnapshotHandlePair) DeepCopyInto(out *VolumeSnapshotHandlePair) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotHandlePair. +func (in *VolumeSnapshotHandlePair) DeepCopy() *VolumeSnapshotHandlePair { + if in == nil { + return nil + } + out := new(VolumeSnapshotHandlePair) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/ramendr/ramen/api/v1alpha1/drpolicy_types.go b/vendor/github.com/ramendr/ramen/api/v1alpha1/drpolicy_types.go index b53a0681..6ecac12e 100644 --- a/vendor/github.com/ramendr/ramen/api/v1alpha1/drpolicy_types.go +++ b/vendor/github.com/ramendr/ramen/api/v1alpha1/drpolicy_types.go @@ -54,6 +54,53 @@ type DRPolicySpec struct { // DRPolicyStatus defines the observed state of DRPolicy type DRPolicyStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty"` + + // DRPolicyStatus.Async contains the status of observed + // async replication details between the clusters in the policy + //+optional + Async Async `json:"async,omitempty"` + + // DRPolicyStatus.Sync contains the status of observed + // sync replication details between the clusters in the policy + //+optional + Sync Sync `json:"sync,omitempty"` +} + +// for RDR +type Async struct { + // PeerClasses is a list of common StorageClasses across the clusters in a policy + // that have related async relationships. (one per pair of peers in the policy) + //+optional + PeerClasses []PeerClass `json:"peerClasses,omitempty"` +} + +// for MetroDR +type Sync struct { + // PeerClasses is a list of common StorageClasses across the clusters in a policy + // that have related sync relationships. (one per pair of peers in the policy) + //+optional + PeerClasses []PeerClass `json:"peerClasses,omitempty"` +} + +type PeerClass struct { + // ReplicationID is the common value for the label "ramendr.openshift.io/replicationID" on the corresponding + // VolumeReplicationClass or VolumeGroupReplicationClass on each peer for the matched StorageClassName. + //+optional + ReplicationID string `json:"replicationID,omitempty"` + + // StorageID is the collection of values for the label "ramendr.openshift.io/storageID" on the corresponding + // StorageClassName across the peers. It is singleton if the storage instance is shared across the peers, + // and distict if storage instances are different. + //+optional + StorageID []string `json:"storageID,omitempty"` + + // StorageClassName is the name of a StorageClass that is available across the peers + //+optional + StorageClassName string `json:"storageClassName,omitempty"` + + // ClusterIDs is a list of two clusterIDs that represent this peer relationship for a common StorageClassName + // The IDs are based on the value of the metadata.uid of the kube-system namespace + ClusterIDs []string `json:"clusterIDs,omitempty"` } const ( diff --git a/vendor/github.com/ramendr/ramen/api/v1alpha1/volumereplicationgroup_types.go b/vendor/github.com/ramendr/ramen/api/v1alpha1/volumereplicationgroup_types.go index 96436268..868c2bd2 100644 --- a/vendor/github.com/ramendr/ramen/api/v1alpha1/volumereplicationgroup_types.go +++ b/vendor/github.com/ramendr/ramen/api/v1alpha1/volumereplicationgroup_types.go @@ -62,10 +62,22 @@ type VRGAsyncSpec struct { // +kubebuilder:validation:Required // +kubebuilder:validation:Pattern=`^\d+[mhd]$` SchedulingInterval string `json:"schedulingInterval"` + + // PeerClasses is a list of common StorageClasses across the clusters in a policy that have related + // sync relationships. This is ONLY modified post creation, if the workload that is protected + // creates a PVC using a newer StorageClass that is determined to be common across the peers. + //+optional + PeerClasses []PeerClass `json:"peerClasses,omitempty"` } -// VRGSyncSpec has the parameters associated with MetroDR -type VRGSyncSpec struct{} +// VRGSyncSpec has the parameters associated with VE +type VRGSyncSpec struct { + // PeerClasses is a list of common StorageClasses across the clusters in a policy that have related + // async relationships. This is ONLY modified post creation, if the workload that is protected + // creates a PVC using a newer StorageClass that is determined to be common across the peers. + //+optional + PeerClasses []PeerClass `json:"peerClasses,omitempty"` +} // VolSyncReplicationDestinationSpec defines the configuration for the VolSync // protected PVC to be used by the destination cluster (Secondary) diff --git a/vendor/github.com/ramendr/ramen/api/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/ramendr/ramen/api/v1alpha1/zz_generated.deepcopy.go index 59059ff6..687a5ccb 100644 --- a/vendor/github.com/ramendr/ramen/api/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/ramendr/ramen/api/v1alpha1/zz_generated.deepcopy.go @@ -14,6 +14,28 @@ import ( configv1alpha1 "k8s.io/component-base/config/v1alpha1" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Async) DeepCopyInto(out *Async) { + *out = *in + if in.PeerClasses != nil { + in, out := &in.PeerClasses, &out.PeerClasses + *out = make([]PeerClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Async. +func (in *Async) DeepCopy() *Async { + if in == nil { + return nil + } + out := new(Async) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterMaintenanceMode) DeepCopyInto(out *ClusterMaintenanceMode) { *out = *in @@ -506,6 +528,8 @@ func (in *DRPolicyStatus) DeepCopyInto(out *DRPolicyStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + in.Async.DeepCopyInto(&out.Async) + in.Sync.DeepCopyInto(&out.Sync) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DRPolicyStatus. @@ -722,6 +746,31 @@ func (in *MaintenanceModeStatus) DeepCopy() *MaintenanceModeStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PeerClass) DeepCopyInto(out *PeerClass) { + *out = *in + if in.StorageID != nil { + in, out := &in.StorageID, &out.StorageID + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ClusterIDs != nil { + in, out := &in.ClusterIDs, &out.ClusterIDs + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PeerClass. +func (in *PeerClass) DeepCopy() *PeerClass { + if in == nil { + return nil + } + out := new(PeerClass) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PlacementDecision) DeepCopyInto(out *PlacementDecision) { *out = *in @@ -1302,12 +1351,41 @@ func (in *StorageIdentifiers) DeepCopy() *StorageIdentifiers { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Sync) DeepCopyInto(out *Sync) { + *out = *in + if in.PeerClasses != nil { + in, out := &in.PeerClasses, &out.PeerClasses + *out = make([]PeerClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sync. +func (in *Sync) DeepCopy() *Sync { + if in == nil { + return nil + } + out := new(Sync) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VRGAsyncSpec) DeepCopyInto(out *VRGAsyncSpec) { *out = *in in.ReplicationClassSelector.DeepCopyInto(&out.ReplicationClassSelector) in.VolumeSnapshotClassSelector.DeepCopyInto(&out.VolumeSnapshotClassSelector) in.VolumeGroupSnapshotClassSelector.DeepCopyInto(&out.VolumeGroupSnapshotClassSelector) + if in.PeerClasses != nil { + in, out := &in.PeerClasses, &out.PeerClasses + *out = make([]PeerClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VRGAsyncSpec. @@ -1366,6 +1444,13 @@ func (in *VRGResourceMeta) DeepCopy() *VRGResourceMeta { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VRGSyncSpec) DeepCopyInto(out *VRGSyncSpec) { *out = *in + if in.PeerClasses != nil { + in, out := &in.PeerClasses, &out.PeerClasses + *out = make([]PeerClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VRGSyncSpec. @@ -1508,7 +1593,7 @@ func (in *VolumeReplicationGroupSpec) DeepCopyInto(out *VolumeReplicationGroupSp if in.Sync != nil { in, out := &in.Sync, &out.Sync *out = new(VRGSyncSpec) - **out = **in + (*in).DeepCopyInto(*out) } in.VolSync.DeepCopyInto(&out.VolSync) if in.KubeObjectProtection != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 99ef1708..2f34df0d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -4,7 +4,7 @@ github.com/beorn7/perks/quantile # github.com/blang/semver/v4 v4.0.0 ## explicit; go 1.14 github.com/blang/semver/v4 -# github.com/ceph/ceph-csi-operator/api v0.0.0-20241114115439-f325f74205d3 +# github.com/ceph/ceph-csi-operator/api v0.0.0-20241119082218-62dc94e55c32 ## explicit; go 1.22.0 github.com/ceph/ceph-csi-operator/api/v1alpha1 # github.com/cespare/xxhash/v2 v2.3.0 @@ -107,8 +107,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/v8 v8.0.0 +# github.com/kubernetes-csi/external-snapshotter/client/v8 v8.2.0 ## explicit; go 1.22.0 +github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta1 github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1 # github.com/mailru/easyjson v0.7.7 ## explicit; go 1.12 @@ -213,8 +214,8 @@ github.com/prometheus/common/model github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util -# github.com/ramendr/ramen/api v0.0.0-20241001141243-29d6f22ad237 -## explicit; go 1.22.0 +# github.com/ramendr/ramen/api v0.0.0-20241105140706-d8587766acb3 +## explicit; go 1.22.5 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 @@ -928,4 +929,5 @@ sigs.k8s.io/yaml sigs.k8s.io/yaml/goyaml.v2 # github.com/portworx/sched-ops => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 # github.com/red-hat-storage/ocs-client-operator/api => ./api +# k8s.io/client-go v12.0.0+incompatible => k8s.io/client-go v0.29.0 # vbom.ml/util => github.com/fvbommel/util v0.0.0-20180919145318-efcd4e0f9787