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

feat(helm): optionally set pod disruption budgets #27163

Merged
merged 3 commits into from
Feb 20, 2024

Conversation

pradasouvanlasy
Copy link
Contributor

@pradasouvanlasy pradasouvanlasy commented Feb 19, 2024

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 as true and add either minAvailable or maxUnavailable variables and test whether the generated manifests look as expected.
PDB manifests are not generated when the relevant podDisruptionBudget.enabled is false and generation fails if any of the enabled PDB defines both minAvailable and maxUnavailable at the same time.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

Comment on lines +140 to +163
{{- 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 }}
Copy link
Member

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

Copy link
Contributor Author

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
Copy link
Member

@craig-rueda craig-rueda Feb 20, 2024

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

Copy link
Contributor Author

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.

Copy link
Member

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}}

Copy link
Contributor Author

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!

Copy link
Member

@craig-rueda craig-rueda left a 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

Copy link
Member

@craig-rueda craig-rueda left a comment

Choose a reason for hiding this comment

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

LGTM

@craig-rueda craig-rueda merged commit 3818da8 into apache:master Feb 20, 2024
29 checks passed
@pradasouvanlasy pradasouvanlasy deleted the add_pdb branch February 21, 2024 09:36
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 4.1.0 labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 4.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants