-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set Mirroring field to false than setting it to nil #250
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vbnrh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: vbadrina <vbadrina@redhat.com>
/cherry-pick release-4.18 |
@vbnrh: once the present PR merges, I will cherry-pick it on top of In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/assign @umangachapagain |
if sc.Spec.Mirroring == nil { | ||
sc.Spec.Mirroring = &ocsv1.MirroringSpec{} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not want to initialize it everytime.
We only want to initialize it when MCO is the one controlling the enable/disable of mirroring. That was the reason we moved the initialization under the if enabled {
block.
@rewantsoni Since the mirroring spec is managed by 2 different controllers, I think we need to document how to work with this spec and the expected behavior.
sc.Spec.Mirroring = nil | ||
sc.Spec.Mirroring.Enabled = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should set it to nil as we will no longer be managing this spec once mirroring is disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we need to understand what the problem is, before making any changes. This could fix one problem but cause another.
Currently there are two fields in the MirroringSpec, which are both used solely for RDR purposes. Intializing an empty struct would only intialize with the default values which would be The issue is caused in OCS end which does not check the CephBlockPool's mirroring is enabled or not if the struct is set to nil. Hence if it is set to nil at a later point, the CBP's mirroring still remains enabled (which is the issue the script is facing). The script tries to So there are few ways to do this -
I opted to explicitly initialize and disable it as i did not see any side effects through initialized default values. This is only for internal mode, the uninstall end for provider RDR does not manage these fields as it is handled through the StorageClusterPeer API |
https://github.com/red-hat-storage/ocs-operator/blob/d62b2a2b1f5663b5a11ff88c9b7a830a298ca071/controllers/storagecluster/cephblockpools.go#L97
OCS operator does not check if cephblockpool's mirroring is enabled when mirroring field in the StorageCluster spec is set to nil.
Hence setting it nil from here, causes the cephblockpool to remain in true state.
This PR fixes that and explicitly sets the Mirroring spec to be
false
in StorageCluster