Skip to content

Commit

Permalink
ODF info CM: reconciler
Browse files Browse the repository at this point in the history
Introduces new CM that replaces ClusterClaims + adjusts tests
Signed-off-by: raaizik <[email protected]>
  • Loading branch information
raaizik committed May 15, 2024
1 parent 5b94962 commit c808435
Show file tree
Hide file tree
Showing 71 changed files with 355 additions and 7,335 deletions.
11 changes: 0 additions & 11 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,6 @@ rules:
- list
- update
- watch
- apiGroups:
- cluster.open-cluster-management.io
resources:
- clusterclaims
verbs:
- create
- delete
- get
- list
- update
- watch
- apiGroups:
- config.openshift.io
resources:
Expand Down
296 changes: 0 additions & 296 deletions controllers/storagecluster/clusterclaims.go

This file was deleted.

3 changes: 2 additions & 1 deletion controllers/storagecluster/external_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ func createExternalClusterReconcilerFromCustomResources(
UninstallModeAnnotation: string(UninstallModeGraceful),
CleanupPolicyAnnotation: string(CleanupPolicyDelete),
},
Finalizers: []string{storageClusterFinalizer},
Finalizers: []string{storageClusterFinalizer},
OwnerReferences: []metav1.OwnerReference{{Name: "storage-test", Kind: "StorageSystem", APIVersion: "v1"}},
},
Spec: api.StorageClusterSpec{
ExternalStorage: api.ExternalStorageClusterSpec{
Expand Down
30 changes: 28 additions & 2 deletions controllers/storagecluster/initialization_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package storagecluster

import (
"context"
"fmt"
"github.com/blang/semver/v4"
oprverion "github.com/operator-framework/api/pkg/lib/version"
opv1a1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
ocsversion "github.com/red-hat-storage/ocs-operator/v4/version"
"os"
"testing"

Expand Down Expand Up @@ -39,7 +44,8 @@ func createStorageCluster(scName, failureDomainName string,
UninstallModeAnnotation: string(UninstallModeGraceful),
CleanupPolicyAnnotation: string(CleanupPolicyDelete),
},
Finalizers: []string{storageClusterFinalizer},
Finalizers: []string{storageClusterFinalizer},
OwnerReferences: []metav1.OwnerReference{{Name: "storage-test", Kind: "StorageSystem", APIVersion: "v1"}},
},
Spec: api.StorageClusterSpec{
Monitoring: &api.MonitoringSpec{
Expand Down Expand Up @@ -349,6 +355,26 @@ func createFakeInitializationStorageClusterReconciler(t *testing.T, obj ...runti
Phase: cephv1.ConditionType(util.PhaseReady),
},
}
verOcs, err := semver.Make(getSemVer(ocsversion.Version, 1, true))
if err != nil {
panic(err)
}
csv := &opv1a1.ClusterServiceVersion{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("ocs-operator-%s", sc.Name),
Namespace: sc.Namespace,
},
Spec: opv1a1.ClusterServiceVersionSpec{
Version: oprverion.OperatorVersion{Version: verOcs},
},
}

rookCephMonSecret := &v1.Secret{
ObjectMeta: metav1.ObjectMeta{Name: "rook-ceph-mon", Namespace: sc.Namespace},
Data: map[string][]byte{
"fsid": []byte("b88c2d78-9de9-4227-9313-a63f62f78743"),
},
}

statusSubresourceObjs := []client.Object{sc}
var runtimeObjects []runtime.Object
Expand All @@ -363,7 +389,7 @@ func createFakeInitializationStorageClusterReconciler(t *testing.T, obj ...runti
}
}

runtimeObjects = append(runtimeObjects, mockNodeList.DeepCopy(), cbp, cfs, cnfs, cnfsbp, cnfssvc, infrastructure, networkConfig)
runtimeObjects = append(runtimeObjects, mockNodeList.DeepCopy(), cbp, cfs, cnfs, cnfsbp, cnfssvc, infrastructure, networkConfig, rookCephMonSecret, csv)
client := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(runtimeObjects...).WithStatusSubresource(statusSubresourceObjs...).Build()

return StorageClusterReconciler{
Expand Down
Loading

0 comments on commit c808435

Please sign in to comment.