Skip to content

Commit

Permalink
WIP: Enhance RestoreCrd to Support OCS CRs Alongside Rook CRs
Browse files Browse the repository at this point in the history
Signed-off-by: Oded Viner <[email protected]>
  • Loading branch information
OdedViner committed Jan 30, 2025
1 parent e16f78b commit 295be46
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pkg/crds/crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ var CephResources = []string{
}

const (
CephRookIoGroup = "ceph.rook.io"
CephRookResourcesVersion = "v1"
CephRookIoGroup = "ceph.rook.io"
CephRookResourcesVersion = "v1"
OcsOpenshiftIoGroup = "ocs.openshift.io"
OcsOpenshiftResourcesVersion = "v1"
)

const (
Expand Down
11 changes: 10 additions & 1 deletion pkg/restore/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ func RestoreCrd(ctx context.Context, k8sclientset *k8sutil.Clientsets, operatorN
}

logging.Info("Detecting which resources to restore for crd %q", crd)
crdList, err := k8sclientset.ListResourcesDynamically(ctx, crds.CephRookIoGroup, crds.CephRookResourcesVersion, crd, clusterNamespace)
var groupName string
var versionResource string
if crd == "storageclusters" {
groupName = crds.OcsOpenshiftIoGroup
versionResource = crds.OcsOpenshiftResourcesVersion
} else {
groupName = crds.CephRookIoGroup
versionResource = crds.CephRookResourcesVersion
}
crdList, err := k8sclientset.ListResourcesDynamically(ctx, groupName, versionResource, crd, clusterNamespace)
if err != nil {
logging.Fatal(fmt.Errorf("Failed to list resources for crd %v", err))
}
Expand Down

0 comments on commit 295be46

Please sign in to comment.