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

Set a dynamic MinAvailable value for the default PDB #1775

Merged
merged 19 commits into from
Sep 25, 2019

Conversation

sebgl
Copy link
Contributor

@sebgl sebgl commented Sep 23, 2019

Fixes #916.

Reconcile the default PDB to have its MinAvailable value consider the current number of Pods we expect to run, according to the StatefulSet specs.

This is done right after handling nodes upscale: we work with the returned (updated) StatefulSets. Summing their replicas give us the maximum number of nodes we should have running. Some of them may not be running yet, but that's OK since it will lead to a higher MinAvailable value (-> no disruption allowed).

By default, we want to set MinAvailable to NumberOfPods - 1, so only one Pod can be disrupted.
However, in cases such as:

  • cluster not green (best-effort based on out-of-date information)
  • only 1 master node
  • only 1 data node

we don't want any Pod to be disrupted.

Side-effects of this PR in the code:

  • return the updated StatefulSets at the end of the upscale phase
  • add a typed ElasticsearchUnknownHealth const

Follow-up issues:

@sebgl sebgl added >enhancement Enhancement of existing functionality >bug Something isn't working v1.0.0-beta1 and removed >bug Something isn't working labels Sep 23, 2019
Copy link
Contributor

@david-kow david-kow left a comment

Choose a reason for hiding this comment

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

Looks good overall, just few comments.

pkg/controller/elasticsearch/driver/upscale.go Outdated Show resolved Hide resolved
pkg/controller/elasticsearch/label/label.go Outdated Show resolved Hide resolved
pkg/controller/elasticsearch/sset/list.go Outdated Show resolved Hide resolved
pkg/controller/elasticsearch/pdb/reconcile.go Outdated Show resolved Hide resolved
pkg/controller/elasticsearch/pdb/reconcile.go Show resolved Hide resolved
pkg/controller/elasticsearch/pdb/reconcile.go Show resolved Hide resolved
pkg/controller/elasticsearch/pdb/reconcile.go Show resolved Hide resolved
pkg/controller/elasticsearch/driver/nodes.go Show resolved Hide resolved
@@ -127,6 +169,20 @@ func (l StatefulSetList) DeepCopy() StatefulSetList {
return result
}

// WithStatefulSet returns the StatefulSetList updated to contain the given StatefulSet.
// If one with the same namespace & name already exist, it will be replaced.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo/wording: If one already exists with the same namespace & name

Copy link
Contributor

@barkbay barkbay left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@david-kow david-kow left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v1.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ready checks are incompatible with Service usage and PDB usage
4 participants