Skip to content
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

ceph: fix mon pdb reconcile #6469

Merged
merged 1 commit into from Oct 21, 2020
Merged

ceph: fix mon pdb reconcile #6469

merged 1 commit into from Oct 21, 2020

Conversation

sp98
Copy link
Contributor

@sp98 sp98 commented Oct 21, 2020

updated mon pdb reconcile to delete mon pdb and create a new one when mon count changes in the cluster spec

Tests:

  • 3 Mons
Every 2.0s: oc get pdb                                                       localhost.localdomain: Wed Oct 21 13:45:00 2020

NAME                MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
rook-ceph-mon-pdb   2               N/A               1                     3m58s
  • Updated mon count from 3 to 5
Every 2.0s: oc get pdb                                                       localhost.localdomain: Wed Oct 21 13:48:37 2020

NAME                MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
rook-ceph-mon-pdb   3               N/A               2                     2m47s
  • updated mon count from 5 to 3
Every 2.0s: oc get pdb                                                       localhost.localdomain: Wed Oct 21 13:53:38 2020

NAME                MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
rook-ceph-mon-pdb   2               N/A               1                     3m38s

Signed-off-by: Santosh Pillai sapillai@redhat.com

Description of your changes:

Which issue is resolved by this Pull Request:
Resolves #

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the developer guide.
  • Skip Tests for Docs: Add the flag for skipping the build if this is only a documentation change. See here for the flag.
  • Skip Unrelated Tests: Add a flag to run tests for a specific storage provider. See test options.
  • Reviewed the developer guide on Submitting a Pull Request
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.
  • Pending release notes updated with breaking and/or notable changes, if necessary.
  • Upgrade from previous release is tested and upgrade user guide is updated, if necessary.
  • Code generation (make codegen) has been run to update object specifications, if necessary.

@mergify mergify bot added the ceph main ceph tag label Oct 21, 2020
@sp98 sp98 requested a review from rohantmp October 21, 2020 13:09

existingPDB := &policyv1beta1.PodDisruptionBudget{}
err := r.client.Get(context.TODO(), pdbRequest, existingPDB)
if apierrors.IsNotFound(err) {
Copy link
Member

Choose a reason for hiding this comment

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

How about this pattern?

if err != nil {
  if apierrors.IsNotFound(err) {
    // insert lines 71-75 to create the pdb
  }
  return errors.Wrap(err, "failed to get mon pdb")
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this looks like the common pattern used across rook. Changed code to use this format.

@@ -61,9 +64,29 @@ func (r *ReconcileClusterDisruption) reconcileMonPDB(cephCluster *cephv1.CephClu
MinAvailable: &intstr.IntOrString{IntVal: minAvailable},
},
}
err := r.reconcileStaticPDB(pdbRequest, pdb)
Copy link
Member

Choose a reason for hiding this comment

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

How about making these code changes inside reconcileStaticPDB()? Seems like we would want the update pattern other places as well, right? (or at least it would be a no-op if the minAvailable never changes)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved changes to reconcileStaticPDB() method.

updated mon pdb reconcile to delete mon pdb and create a new one when mon count changes in the cluster spec

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ceph main ceph tag
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants