red-hat-storage / ocs-operator

Operator for RHOCS
Apache License 2.0
85 stars 184 forks source link

update the cephblockpool reonciler to disable mirroring #2795

Closed rewantsoni closed 2 months ago

rewantsoni commented 2 months ago

When mirroring on storageCluster was disabled, the cephblockpool mirroring was not disabled, this could break the DR as MCO enables/disables the mirroring on the cephblockpool via storageCluster.

Hence, with this PR we are making the mirroring spec on the storageCluster as a pointer and enabling/disabling mirroring on cephblockpool only if the value is set. If mirroring is set to nil other controller will be able to make changes on the mirroring field on the cephblockpool.

rewantsoni commented 2 months ago

Testing:

[rewantsoni odf] k get storagecluster ocs-storagecluster -oyaml | yq '.spec.mirroring' && k get cephblockpool ocs-storagecluster-cephblockpool -oyaml | yq '.spec.mirroring'
null
{}

Enabled from storageCluster:
[rewantsoni odf] k get storagecluster ocs-storagecluster -oyaml | yq '.spec.mirroring' && echo "" && k get cephblockpool ocs-storagecluster-cephblockpool -oyaml | yq '.spec.mirroring'
enabled: true
peerSecretNames:
  - ux-cert-secret

enabled: true
mode: image
peers:
  secretNames:
    - ux-cert-secret

Disable from storageCluster:
[rewantsoni odf] k get storagecluster ocs-storagecluster -oyaml | yq '.spec.mirroring' && echo "" && k get cephblockpool ocs-storagecluster-cephblockpool -oyaml | yq '.spec.mirroring'
enabled: false

{}

Not set on storageCluster:
[rewantsoni odf] k get storagecluster ocs-storagecluster -oyaml | yq '.spec.mirroring' && echo "" && k get cephblockpool ocs-storagecluster-cephblockpool -oyaml | yq '.spec.mirroring'
null

enabled: true
mode: image
openshift-ci[bot] commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: iamniting, rewantsoni

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: - ~~[OWNERS](https://github.com/red-hat-storage/ocs-operator/blob/main/OWNERS)~~ [iamniting] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
rewantsoni commented 2 months ago

/cherry-pick release-4.17

openshift-cherrypick-robot commented 2 months ago

@rewantsoni: new pull request created: #2796

In response to [this](https://github.com/red-hat-storage/ocs-operator/pull/2795#issuecomment-2348862594): >/cherry-pick release-4.17 Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.