Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions operator/config/samples/csiscaleoperators.csi.ibm.com_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ spec:
- id: "<Primary Cluster ID>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s better to avoid using the term Primary Cluster ID at both the places; instead, use Local Scale ClusterID.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically given as such so that user should give the same primary cluster id in localScaleCluster as well

secrets: "secret1"
secureSslMode: false
# primary:
# primaryFs: "< Primary Filesystem >"
# primaryFset: "< Fileset in Primary Filesystem >" # Optional - default:spectrum-scale-csi-volume-store
# inodeLimit: "< inode limit for Primary Fileset >" # Optional
# remoteCluster: "< Remote ClusterID >" # Optional - This is only required if primaryFs is remote cluster's filesystem and this ID should have separate entry in Clusters map too.
# cacert: "< Name of CA cert configmap for GUI >" # Optional
restApi:
- guiHost: "< IP/Hostname of a GUI node of primary cluster >"
Expand Down
18 changes: 7 additions & 11 deletions operator/controllers/csiscaleoperator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,14 +662,15 @@ func (r *CSIScaleOperatorReconciler) isClusterStanzaModified(ctx context.Context
// which clusterID is present in current configmap data but not in new CR data.
func (r *CSIScaleOperatorReconciler) updateChangedClusters(ctx context.Context, instance *csiscaleoperator.CSIScaleOperator, currentCMcmString string, newCRClusters []csiv1.CSICluster) error {
logger := csiLog.FromContext(ctx).WithName("updateChangedClusters")
currentCMclusters := []csiv1.CSICluster{}
prefix := "{\"" + config.CSIConfigMap + ".json\":\"{\"clusters\":"
currentCMSpec := csiv1.CSIScaleOperatorSpec{}

prefix := "{\"" + config.CSIConfigMap + ".json\":\""
postfix := "}\"}"
currentCMcmString = strings.Replace(currentCMcmString, prefix, "", 1)
currentCMcmString = strings.Replace(currentCMcmString, postfix, "", 1)

currentCMcmString = currentCMcmString + "}"
configMapDataBytes := []byte(currentCMcmString)
err := json.Unmarshal(configMapDataBytes, &currentCMclusters)
err := json.Unmarshal(configMapDataBytes, &currentCMSpec)
if err != nil {
message := fmt.Sprintf("Failed to unmarshal data of ConfigMap: %v", config.CSIConfigMap)
err := fmt.Errorf("%s", message)
Expand All @@ -688,7 +689,7 @@ func (r *CSIScaleOperatorReconciler) updateChangedClusters(ctx context.Context,
for _, crCluster := range newCRClusters {
//For the cluster ID of each clusters of updated CR, get the clusters
//data of the current configmap and compare that with new CR data
oldCMCluster := r.getClusterByID(crCluster.Id, currentCMclusters)
oldCMCluster := r.getClusterByID(crCluster.Id, currentCMSpec.Clusters)
if reflect.DeepEqual(oldCMCluster, csiv1.CSICluster{}) {
//case 1: new cluster is added in CR
//no matching cluster is found, that means it is a new
Expand Down Expand Up @@ -731,7 +732,7 @@ func (r *CSIScaleOperatorReconciler) updateChangedClusters(ctx context.Context,
//case 3: clusters data in current configmap and new CR mataches, nothing to be done here.
//case 4: delete - current configmap has an entry, which is not there in new CR --> delete
//the connector for that cluster as we no longer need it.
for _, cluster := range currentCMclusters {
for _, cluster := range currentCMSpec.Clusters {
if _, processed := currentCMProcessedClusters[cluster.Id]; !processed {
delete(scaleConnMap, cluster.Id)
}
Expand Down Expand Up @@ -2168,11 +2169,6 @@ func ValidateCRParams(ctx context.Context, instance *csiscaleoperator.CSIScaleOp
issueFound = true
logger.Error(fmt.Errorf("no primary clusters specified"), "")
}
//_, nonPrimaryClusterExists := nonPrimaryClusters[remoteClusterID]
//if remoteClusterID != "" && !nonPrimaryClusterExists {
// issueFound = true
// logger.Error(fmt.Errorf("remote cluster specified for primary filesystem: %s, but no entry found for it in driver manifest", remoteClusterID), "")
//}

if issueFound {
message := "one or more issues found while validating driver manifest, check operator logs for details"
Expand Down