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: Cleanup mon canary pvc if the failover failed #6224

Merged
merged 2 commits into from
Sep 10, 2020

Conversation

travisn
Copy link
Member

@travisn travisn commented Sep 9, 2020

Description of your changes:
If the mon failover fails and the mon is backed by a pvc, the pvc could remain orphaned. This is likely to happen if there is not a node available for scheduling the mon. Therefore, the operator will ensure after a failover that any orphaned mon pvc is cleaned up.

On a related change, the pvc_name label was not being set as expected on canary deployments. Now the label will always be set on both the canary and the daemon pods.

This replaces #6199.

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.

When the mons are based on pvcs, the pvc_name label was not being set
as expected. Now the label will always be set on both the canary and
the daemon pods.

The mon pvcs were also never being deleted during canary cleanup. This
code is now removed since we must be very careful when the pvcs are
removed.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
@travisn travisn requested a review from leseb September 9, 2020 22:43
@travisn travisn mentioned this pull request Sep 9, 2020
10 tasks
@mergify mergify bot added the ceph main ceph tag label Sep 9, 2020
Copy link
Member

@leseb leseb left a comment

Choose a reason for hiding this comment

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

Nit

logger.Info("checking for orphaned mon resources")

if c.spec.Mon.VolumeClaimTemplate == nil {
logger.Info("skipping check for orphaned mon pvcs")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logger.Info("skipping check for orphaned mon pvcs")
logger.Info("skipping check for orphaned mon pvcs")

Did you mean non-pvc?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's skipping the check for mon pvcs, it looks correct to me.

Copy link
Member

Choose a reason for hiding this comment

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

But if the VolumeClaimTemplate is nil this means non-pvc right? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

That's right. There are no mon pvcs, so we skip checking for them. What about this?

logger.Info("skipping check for orphaned mon pvcs since using the host path")

assert.NoError(t, err)
assert.Equal(t, 4, len(pvcs.Items))

// pvc "b" should be removed and the others should remain
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean "c" instead?

If the mon failover fails, if the mon is on a pvc, the pvc could remain
orphaned. This is likely to happen if there is not a node available
for scheduling the mon. Therefore, the operator will ensure after a failover
that any orphaned mon pvc is cleaned up.

Signed-off-by: Travis Nielsen <tnielsen@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