Skip to content

Commit

Permalink
Add CSI_REMOVE_HOLDER_PODS key and its value in the ocs configmap
Browse files Browse the repository at this point in the history
set the CSI_REMOVE_HOLDER_PODS to true for new users on version 4.16
onwards and set it to false for older/upgraded user to give them time to
migrate manually.

with version 4.17 we will make the CSI_REMOVE_HOLDER_PODS to true for
all customers older and new both.

If the configmap is being created for the first time we are considering
it as a new install.

Signed-off-by: Nitin Goyal <[email protected]>
  • Loading branch information
iamniting committed Mar 19, 2024
1 parent 50bd4ef commit 66b74e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion controllers/ocsinitialization/ocsinitialization_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,23 @@ func (r *OCSInitializationReconciler) ensureOcsOperatorConfigExists(initialData
Name: util.OcsOperatorConfigName,
Namespace: initialData.Namespace,
},
Data: ocsOperatorConfigData,
}
opResult, err := ctrl.CreateOrUpdate(r.ctx, r.Client, ocsOperatorConfig, func() error {

// If the configmap is being created for the first time, set the entry for
// CSI_REMOVE_HOLDER_PODS to "true". This configuration is applied for new clusters
// starting from ODF version 4.16 onwards. For old or upgraded clusters,
// it's initially set to "false", allowing users time to manually migrate from holder pods.
// In ODF version 4.17, we will universally set it to "true" for all users.

if ocsOperatorConfig.CreationTimestamp.IsZero() {
ocsOperatorConfigData[util.CsiRemoveHolderPodsKey] = "true"
} else if ocsOperatorConfig.Data[util.CsiRemoveHolderPodsKey] == "" {
ocsOperatorConfigData[util.CsiRemoveHolderPodsKey] = "false"
} else if ocsOperatorConfig.Data[util.CsiRemoveHolderPodsKey] != "" {
ocsOperatorConfigData[util.CsiRemoveHolderPodsKey] = ocsOperatorConfig.Data[util.CsiRemoveHolderPodsKey]
}

if !reflect.DeepEqual(ocsOperatorConfig.Data, ocsOperatorConfigData) {
r.Log.Info("Updating ocs-operator-config configmap")
ocsOperatorConfig.Data = ocsOperatorConfigData
Expand Down
1 change: 1 addition & 0 deletions controllers/util/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const (
EnableTopologyKey = "CSI_ENABLE_TOPOLOGY"
TopologyDomainLabelsKey = "CSI_TOPOLOGY_DOMAIN_LABELS"
EnableNFSKey = "ROOK_CSI_ENABLE_NFS"
CsiRemoveHolderPodsKey = "CSI_REMOVE_HOLDER_PODS"
)

// GetWatchNamespace returns the namespace the operator should be watching for changes
Expand Down

0 comments on commit 66b74e0

Please sign in to comment.