-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
feat(helm): optionally set pod disruption budgets #27163
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{- define "supersetCeleryBeat.selectorLabels" -}} | ||
app: {{ include "superset.name" . }}-celerybeat | ||
release: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{- define "supersetCeleryFlower.selectorLabels" -}} | ||
app: {{ include "superset.name" . }}-flower | ||
release: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{- define "supersetNode.selectorLabels" -}} | ||
app: {{ include "superset.name" . }} | ||
release: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{- define "supersetWebsockets.selectorLabels" -}} | ||
app: {{ include "superset.name" . }}-ws | ||
release: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{- define "supersetWorker.selectorLabels" -}} | ||
app: {{ include "superset.name" . }}-worker | ||
release: {{ .Release.Name }} | ||
{{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also mention this refactor in the description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I've updated the description. Please let me know if this looks clear enough
@@ -248,6 +248,8 @@ supersetNode: | |||
maxReplicas: 100 | |||
targetCPUUtilizationPercentage: 80 | |||
# targetMemoryUtilizationPercentage: 80 | |||
# -- Sets the [pod disruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) for supersetNode pods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an enabled
field here, along with a set of sensible defaults for each of these blocks? That way, we can add the various settings to the schema and can document them appropriately. Using an enabled
also makes the config a bit more explicit
e.g.
podDisruptionBudget:
enabled: false
minAvailable: 1
maxUnavailable: 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I will take this into account. However both variables are mutually exclusive so we would have to comment these in values.yaml
and document somehow that PDB only accepts either minAvailable
or maxUnavailable
at a time - https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that makes sense. For extra credit, you could fail if both are set:
{{- if .Values.podDisruptionBudget.minAvailable and .Values.podDisruptionBudget.maxAvailable }}
{{ required "Only one of minAvailable or maxAvailable should be set" .Values.podDisruptionBudget.minAvailable }}
{{- end}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made the changes and slightly refactored the PDB templates I'm contributing there to make better use of variable scoping - reducing a bit the boilerplate and avoiding to repeat .Values.supersetXXX.podDisruptionBudget
everywhere.
Please tell me if the updated documentation looks clear enough as well. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! Left a comment below, otherwise LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
SUMMARY
This PRs optionally adds pod disruption budgets against all Superset deployments. By default, they are not enabled to keep the current behavior but we're now able to set PDBs on any deployment if relevant.
This also comes with a slight refactoring on the selector labels for each deployment: they are now defined as named templates in
_helpers.tpl
to mitigate selectors duplication between deployments and their respective related pod disruption budgets.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
One can set any
supersetXxx.podDisruptionBudget.enabled
astrue
and add eitherminAvailable
ormaxUnavailable
variables and test whether the generated manifests look as expected.PDB manifests are not generated when the relevant
podDisruptionBudget.enabled
isfalse
and generation fails if any of the enabled PDB defines bothminAvailable
andmaxUnavailable
at the same time.ADDITIONAL INFORMATION