diff --git a/bundle/manifests/ocs-client-operator.clusterserviceversion.yaml b/bundle/manifests/ocs-client-operator.clusterserviceversion.yaml index 2037463a..00088b41 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-11-14T15:13:37Z" + createdAt: "2024-11-18T12:48:54Z" description: OpenShift Data Foundation client operator enables consumption of storage services from a remote centralized OpenShift Data Foundation provider cluster. @@ -164,6 +164,17 @@ spec: - list - update - watch + - apiGroups: + - csi.ceph.io + resources: + - clientprofilemappings + verbs: + - create + - delete + - get + - list + - update + - watch - apiGroups: - csi.ceph.io resources: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index a1083288..0099a921 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -121,6 +121,17 @@ rules: - list - update - watch +- apiGroups: + - csi.ceph.io + resources: + - clientprofilemappings + verbs: + - create + - delete + - get + - list + - update + - watch - apiGroups: - csi.ceph.io resources: diff --git a/go.mod b/go.mod index c922468a..c301680a 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ exclude ( ) require ( - github.com/ceph/ceph-csi-operator/api v0.0.0-20240812072523-4d50cf3a32a0 + github.com/ceph/ceph-csi-operator/api v0.0.0-20241114115439-f325f74205d3 github.com/go-logr/logr v1.4.2 github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0 github.com/onsi/ginkgo v1.16.5 diff --git a/go.sum b/go.sum index f9204213..dc8ec0c7 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-20240812072523-4d50cf3a32a0 h1:LIAWGeOu1JzrhknCyD0JbuCUuCuhfiY/H+cBz4nsUcg= -github.com/ceph/ceph-csi-operator/api v0.0.0-20240812072523-4d50cf3a32a0/go.mod h1:odEUoarG26wXBCC2l4O4nMWhAz6VTKr2FRkv9yELgi8= +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/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= diff --git a/internal/controller/storageclient_controller.go b/internal/controller/storageclient_controller.go index b8740f19..35754e99 100644 --- a/internal/controller/storageclient_controller.go +++ b/internal/controller/storageclient_controller.go @@ -103,7 +103,8 @@ func (r *StorageClientReconciler) SetupWithManager(mgr ctrl.Manager) error { Owns("av1.ClusterResourceQuota{}, builder.WithPredicates(generationChangePredicate)). Owns(&nbv1.NooBaa{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})). Owns(&corev1.Secret{}). - Owns(&csiopv1a1.CephConnection{}, builder.WithPredicates(generationChangePredicate)) + Owns(&csiopv1a1.CephConnection{}, builder.WithPredicates(generationChangePredicate)). + Owns(&csiopv1a1.ClientProfileMapping{}, builder.WithPredicates(generationChangePredicate)) return bldr.Complete(r) } @@ -118,6 +119,7 @@ func (r *StorageClientReconciler) SetupWithManager(mgr ctrl.Manager) error { //+kubebuilder:rbac:groups=csi.ceph.io,resources=cephconnections,verbs=get;list;update;create;watch;delete //+kubebuilder:rbac:groups=noobaa.io,resources=noobaas,verbs=get;list;watch;create;update;delete //+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch;create;update;delete +//+kubebuilder:rbac:groups=csi.ceph.io,resources=clientprofilemappings,verbs=get;list;update;create;watch;delete func (r *StorageClientReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { var err error diff --git a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofilemapping_types.go b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofilemapping_types.go index 6242e256..ce927cb5 100644 --- a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofilemapping_types.go +++ b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofilemapping_types.go @@ -20,29 +20,26 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// BlockPoolRefSpec identify a blockpool - client profile pair -type BlockPoolRefSpec struct { - //+kubebuilder:validation:Required - ClientProfileName string `json:"clientProfileName,omitempty"` - - //+kubebuilder:validation:Required - //+kubebuilder:validation:Minimum:=0 - PoolId int `json:"poolId,omitempty"` -} - -// BlockPoolMappingSpec define a mapiing between a local and remote block pools -type BlockPoolMappingSpec struct { - //+kubebuilder:validation:Required - Local BlockPoolRefSpec `json:"local,omitempty"` - - //+kubebuilder:validation:Required - Remote BlockPoolRefSpec `json:"remote,omitempty"` +//+kubebuilder:validation:MinItems:=2 +//+kubebuilder:validation:MaxItems:=2 +type BlockPoolIdPair []string + +// MappingsSpec define a mapping between a local and remote profiles +type MappingsSpec struct { + //+kubebuilder:validation:Required + LocalClientProfile string `json:"localClientProfile,omitempty"` + + //+kubebuilder:validation:Required + RemoteClientProfile string `json:"remoteClientProfile,omitempty"` + + //+kubebuilder:validation:Optional + BlockPoolIdMapping []BlockPoolIdPair `json:"blockPoolIdMapping,omitempty"` } // ClientProfileMappingSpec defines the desired state of ClientProfileMapping type ClientProfileMappingSpec struct { - //+kubebuilder:validation:Optional - BlockPoolMapping []BlockPoolMappingSpec `json:"blockPoolMapping,omitempty"` + //+kubebuilder:validation:Required + Mappings []MappingsSpec `json:"mappings,omitempty"` } // ClientProfileMappingStatus defines the observed state of ClientProfileMapping @@ -69,3 +66,4 @@ type ClientProfileMappingList struct { metav1.ListMeta `json:"metadata,omitempty"` Items []ClientProfileMapping `json:"items"` } + diff --git a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/driver_types.go b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/driver_types.go index 1084c1d3..b562eeaa 100644 --- a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/driver_types.go +++ b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/driver_types.go @@ -33,8 +33,10 @@ const ( MonthlyPeriod PeriodicityType = "monthly" ) +// +kubebuilder:validation:XValidation:message="Either maxLogSize or periodicity must be set",rule="(has(self.maxLogSize)) || (has(self.periodicity))" type LogRotationSpec struct { // MaxFiles is the number of logrtoate files + // Default to 7 //+kubebuilder:validation:Optional MaxFiles int `json:"maxFiles,omitempty"` @@ -48,6 +50,7 @@ type LogRotationSpec struct { Periodicity PeriodicityType `json:"periodicity,omitempty"` // LogHostPath is the prefix directory path for the csi log files + // Default to /var/lib/cephcsi //+kubebuilder:validation:Optional LogHostPath string `json:"logHostPath,omitempty"` } @@ -210,6 +213,11 @@ type ControllerPluginSpec struct { // Embedded common pods spec PodCommonSpec `json:",inline"` + // DeploymentStrategy describes how to replace existing pods with new ones + // Default value is RollingUpdate with MaxUnavailable and MaxSurege as 25% (kubernetes default) + //+kubebuilder:validation:Optional + DeploymentStrategy *appsv1.DeploymentStrategy `json:"deploymentStrategy,omitempty"` + // Set replicas for controller plugin's deployment. Defaults to 2 //+kubebuilder:validation:Optional //+kubebuilder:validation:Minimum:=1 @@ -299,8 +307,8 @@ type DriverSpec struct { // OMAP generator will generate the omap mapping between the PV name and the RBD image. // Need to be enabled when we are using rbd mirroring feature. - // By default OMAP generator sidecar is deployed with Csi controller plugin pod, to disable - // it set it to false. + // By default OMAP generator sidecar is not deployed with Csi controller plugin pod, to enable + // it set it to true. //+kubebuilder:validation:Optional GenerateOMapInfo *bool `json:"generateOMapInfo,omitempty"` diff --git a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/zz_generated.deepcopy.go index 7b732846..a8542df9 100644 --- a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/zz_generated.deepcopy.go @@ -27,35 +27,22 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BlockPoolMappingSpec) DeepCopyInto(out *BlockPoolMappingSpec) { - *out = *in - out.Local = in.Local - out.Remote = in.Remote -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockPoolMappingSpec. -func (in *BlockPoolMappingSpec) DeepCopy() *BlockPoolMappingSpec { - if in == nil { - return nil +func (in BlockPoolIdPair) DeepCopyInto(out *BlockPoolIdPair) { + { + in := &in + *out = make(BlockPoolIdPair, len(*in)) + copy(*out, *in) } - out := new(BlockPoolMappingSpec) - in.DeepCopyInto(out) - return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BlockPoolRefSpec) DeepCopyInto(out *BlockPoolRefSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockPoolRefSpec. -func (in *BlockPoolRefSpec) DeepCopy() *BlockPoolRefSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockPoolIdPair. +func (in BlockPoolIdPair) DeepCopy() BlockPoolIdPair { if in == nil { return nil } - out := new(BlockPoolRefSpec) + out := new(BlockPoolIdPair) in.DeepCopyInto(out) - return out + return *out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -307,10 +294,12 @@ func (in *ClientProfileMappingList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientProfileMappingSpec) DeepCopyInto(out *ClientProfileMappingSpec) { *out = *in - if in.BlockPoolMapping != nil { - in, out := &in.BlockPoolMapping, &out.BlockPoolMapping - *out = make([]BlockPoolMappingSpec, len(*in)) - copy(*out, *in) + if in.Mappings != nil { + in, out := &in.Mappings, &out.Mappings + *out = make([]MappingsSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } @@ -449,6 +438,11 @@ func (in *ControllerPluginResourcesSpec) DeepCopy() *ControllerPluginResourcesSp func (in *ControllerPluginSpec) DeepCopyInto(out *ControllerPluginSpec) { *out = *in in.PodCommonSpec.DeepCopyInto(&out.PodCommonSpec) + if in.DeploymentStrategy != nil { + in, out := &in.DeploymentStrategy, &out.DeploymentStrategy + *out = new(appsv1.DeploymentStrategy) + (*in).DeepCopyInto(*out) + } if in.Replicas != nil { in, out := &in.Replicas, &out.Replicas *out = new(int32) @@ -717,6 +711,32 @@ func (in *LogSpec) DeepCopy() *LogSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MappingsSpec) DeepCopyInto(out *MappingsSpec) { + *out = *in + if in.BlockPoolIdMapping != nil { + in, out := &in.BlockPoolIdMapping, &out.BlockPoolIdMapping + *out = make([]BlockPoolIdPair, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = make(BlockPoolIdPair, len(*in)) + copy(*out, *in) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MappingsSpec. +func (in *MappingsSpec) DeepCopy() *MappingsSpec { + if in == nil { + return nil + } + out := new(MappingsSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NfsConfigSpec) DeepCopyInto(out *NfsConfigSpec) { *out = *in diff --git a/vendor/modules.txt b/vendor/modules.txt index a0861f01..58f75341 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-20240812072523-4d50cf3a32a0 +# github.com/ceph/ceph-csi-operator/api v0.0.0-20241114115439-f325f74205d3 ## explicit; go 1.22.0 github.com/ceph/ceph-csi-operator/api/v1alpha1 # github.com/cespare/xxhash/v2 v2.3.0