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

Implement rolling upgrades with StatefulSets #1219

Merged
merged 6 commits into from
Jul 17, 2019

Conversation

sebgl
Copy link
Contributor

@sebgl sebgl commented Jul 9, 2019

Handle cluster rolling upgrades with StatefulSets.

Relies on manually updating the rollingUpdate.Partition index of a sset when we're ready to restart the ES node.
For now, it only handles 1 node restart at a time, mostly because we rely on cluster health green checks.
It also introduces 2 additional concepts:

  • StatefulSet updates expectations, based on UID + Generation: there are certain ES calls we don't want to make if our StatefulSet cache is out of date
  • "lazy" ES client calls: some ES calls we do to handle the upgrade cannot rely on out-of-date information from observers. We need fresh ES information on the state of the cluster before eg. re-enabling shard allocations. However we don't want to perform these calls at every single reconciliation. I see this as a "stop-gap" implementation before we go on with a larger refactoring of sync/async ES calls.

This is still WIP since many things are still missing:

  • changeBudget considerations.
  • zen1/zen2 handling.
  • Unit tests, everywhere. I still think a large portion of this code may be refactored in the short-term to account for change budget & zen1/zen2. Keeping unit tests for a later PR.
  • E2E tests, kept for a later PR.

@sebgl sebgl force-pushed the sset-rolling-upgrade branch 4 times, most recently from 1119bcd to 5c95c85 Compare July 12, 2019 18:34
@sebgl sebgl force-pushed the sset-rolling-upgrade branch from 5c95c85 to ee2974d Compare July 15, 2019 08:17
@sebgl sebgl changed the title WIP: StatefulSets rolling upgrades StatefulSets rolling upgrades Jul 15, 2019
Copy link
Contributor

@thbkrkr thbkrkr left a comment

Choose a reason for hiding this comment

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

The algorithm in operators/pkg/controller/elasticsearch/driver/upgrade.go looks good to me. Nice work!

@@ -0,0 +1,129 @@
package driver
Copy link
Collaborator

Choose a reason for hiding this comment

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

license header should be on top?

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! I'll merge that one and fix it in #1262.

Copy link
Collaborator

@pebrc pebrc left a comment

Choose a reason for hiding this comment

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

I wasn't able to go as deep as I wanted but I found the overall logic pretty easy to follow which is a good sign and an improvement over what we had previously

@sebgl sebgl merged commit b5e3a50 into elastic:statefulset-refactoring Jul 17, 2019
@sebgl sebgl mentioned this pull request Jul 19, 2019
18 tasks
@pebrc pebrc changed the title StatefulSets rolling upgrades Implement rolling upgrades with StatefulSets Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants