Skip to content

Commit 8865ae0

Browse files
committed
controllers: Generates VGSClass
Signed-off-by: raaizik <[email protected]>
1 parent e23afd3 commit 8865ae0

File tree

18 files changed

+1167
-132
lines changed

18 files changed

+1167
-132
lines changed

bundle/manifests/ocs-client-operator.clusterserviceversion.yaml

+19-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
categories: Storage
88
console.openshift.io/plugins: '["odf-client-console"]'
99
containerImage: quay.io/ocs-dev/ocs-client-operator:latest
10-
createdAt: "2024-10-29T07:06:57Z"
10+
createdAt: "2024-10-30T11:43:15Z"
1111
description: OpenShift Data Foundation client operator enables consumption of
1212
storage services from a remote centralized OpenShift Data Foundation provider
1313
cluster.
@@ -197,6 +197,24 @@ spec:
197197
- list
198198
- update
199199
- watch
200+
- apiGroups:
201+
- groupsnapshot.storage.k8s.io
202+
resources:
203+
- volumegroupsnapshotclasses
204+
verbs:
205+
- create
206+
- delete
207+
- get
208+
- list
209+
- watch
210+
- apiGroups:
211+
- groupsnapshot.storage.k8s.io
212+
resources:
213+
- volumegroupsnapshotcontents
214+
verbs:
215+
- get
216+
- list
217+
- watch
200218
- apiGroups:
201219
- monitoring.coreos.com
202220
resources:

cmd/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
3232
// to ensure that exec-entrypoint and run can make use of them.
3333
csiopv1a1 "github.com/ceph/ceph-csi-operator/api/v1alpha1"
34-
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
34+
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1"
3535
nbapis "github.com/noobaa/noobaa-operator/v5/pkg/apis"
3636
configv1 "github.com/openshift/api/config/v1"
3737
consolev1 "github.com/openshift/api/console/v1"
@@ -203,6 +203,7 @@ func main() {
203203
Scheme: mgr.GetScheme(),
204204
OperatorNamespace: utils.GetOperatorNamespace(),
205205
ConsolePort: int32(consolePort),
206+
AvailCrds: availCrds,
206207
}).SetupWithManager(mgr); err != nil {
207208
setupLog.Error(err, "unable to create controller", "controller", "OperatorConfigMapReconciler")
208209
os.Exit(1)

config/rbac/role.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,24 @@ rules:
154154
- list
155155
- update
156156
- watch
157+
- apiGroups:
158+
- groupsnapshot.storage.k8s.io
159+
resources:
160+
- volumegroupsnapshotclasses
161+
verbs:
162+
- create
163+
- delete
164+
- get
165+
- list
166+
- watch
167+
- apiGroups:
168+
- groupsnapshot.storage.k8s.io
169+
resources:
170+
- volumegroupsnapshotcontents
171+
verbs:
172+
- get
173+
- list
174+
- watch
157175
- apiGroups:
158176
- monitoring.coreos.com
159177
resources:

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ exclude (
2020
require (
2121
github.com/ceph/ceph-csi-operator/api v0.0.0-20240812072523-4d50cf3a32a0
2222
github.com/go-logr/logr v1.4.2
23-
github.com/kubernetes-csi/external-snapshotter/client/v6 v6.3.0
23+
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0
2424
github.com/onsi/ginkgo v1.16.5
2525
github.com/onsi/gomega v1.34.1
2626
github.com/openshift/api v0.0.0-20240828125535-01b3675ba7b3

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
254254
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
255255
github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1 h1:dQEHhTfi+bSIOSViQrKY9PqJvZenD6tFz+3lPzux58o=
256256
github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1/go.mod h1:my+EVjOJLeQ9lUR9uVkxRvNNkhO2saSGIgzV8GZT9HY=
257-
github.com/kubernetes-csi/external-snapshotter/client/v6 v6.3.0 h1:qS4r4ljINLWKJ9m9Ge3Q3sGZ/eIoDVDT2RhAdQFHb1k=
258-
github.com/kubernetes-csi/external-snapshotter/client/v6 v6.3.0/go.mod h1:oGXx2XTEzs9ikW2V6IC1dD8trgjRsS/Mvc2JRiC618Y=
257+
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0 h1:mjQG0Vakr2h246kEDR85U8y8ZhPgT3bguTCajRa/jaw=
258+
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0/go.mod h1:E3vdYxHj2C2q6qo8/Da4g7P+IcwqRZyy3gJBzYybV9Y=
259259
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
260260
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
261261
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=

internal/controller/operatorconfigmap_controller.go

+5
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ type OperatorConfigMapReconciler struct {
7979
OperatorNamespace string
8080
ConsolePort int32
8181
Scheme *runtime.Scheme
82+
AvailCrds map[string]bool
8283

8384
log logr.Logger
8485
ctx context.Context
@@ -327,6 +328,10 @@ func (c *OperatorConfigMapReconciler) reconcileDelegatedCSI() error {
327328
templates.CSIOperatorConfigSpec.DeepCopyInto(&csiOperatorConfig.Spec)
328329
csiOperatorConfig.Spec.DriverSpecDefaults.ImageSet = &corev1.LocalObjectReference{Name: cmName}
329330
csiOperatorConfig.Spec.DriverSpecDefaults.ClusterName = ptr.To(string(clusterVersion.Spec.ClusterID))
331+
if c.AvailCrds[volumeGroupSnapshotClassCrd] {
332+
csiOperatorConfig.Spec.DriverSpecDefaults.SnapshotPolicy = csiopv1a1.VolumeGroupSnapshotPolicy
333+
}
334+
330335
return nil
331336
}); err != nil {
332337
return fmt.Errorf("failed to reconcile csi operator config: %v", err)

0 commit comments

Comments
 (0)