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

Allow specifying flyte pod webhook deployment resources #4988

Merged
merged 5 commits into from
Mar 5, 2024

Conversation

katrogan
Copy link
Contributor

@katrogan katrogan commented Mar 1, 2024

Why are the changes needed?

Various resources recommend setting resources and limits for k8s deployments, e.g: https://www.cncf.io/blog/2022/10/20/kubernetes-best-practice-how-to-correctly-set-resource-requests-and-limits/

What changes were proposed in this pull request?

Optionally allows specifying flyte pod deployment resource requests and limits.

How was this patch tested?

In values.yaml

webhook:
...
  resources:
    limits:
      cpu: 200m
      ephemeral-storage: 100Mi
      memory: 200Mi
    requests:
      cpu: 10m
      ephemeral-storage: 50Mi
      memory: 100Mi

verified the rendered webhook deployment included

          ...
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop: ["ALL"]
          resources:
            limits:
              cpu: 200m
              ephemeral-storage: 100Mi
              memory: 200Mi
            requests:
              cpu: 10m
              ephemeral-storage: 50Mi
              memory: 100Mi
          volumeMounts:
            - name: config-volume
              mountPath: /etc/flyte/config
              readOnly: true
            - name: webhook-certs
              mountPath: /etc/webhook/certs
              readOnly: true
          ...

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request labels Mar 1, 2024
@katrogan katrogan changed the title Webhook resources Allow specifying flyte pod webhook deployment resources Mar 1, 2024
Copy link
Contributor

@mhotan mhotan left a comment

Choose a reason for hiding this comment

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

LGTM, we could add reasonable resources.requests but omit resources.limits. Requests defaults but are not immediately necessary. It may make more sense to have a single issue/PR set reasonable defaults missing for all workloads so folks can track what's changed more easily.

@@ -103,6 +103,9 @@ spec:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
{{- if .Values.webhook.resources -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Not important in this case but we could also do the following.

{{- with .Values.webhook.resources }}
resources: {{- toYaml . | nindent 12 }}
{{- end }}

This is not really that important as it's just syntactic difference, only really benefits for more complex config. We can always update later.

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 @mhotan updated to address both your comments, although having a hard time reasoning about what sensible defaults would be here esp given the recent ephemeral storage incident. figure it might be safer to err on overprovisioning for now

Signed-off-by: Katrina Rogan <[email protected]>
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Mar 1, 2024
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.97%. Comparing base (4a95abf) to head (3279ad5).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4988   +/-   ##
=======================================
  Coverage   58.97%   58.97%           
=======================================
  Files         645      645           
  Lines       55562    55562           
=======================================
  Hits        32767    32767           
  Misses      20200    20200           
  Partials     2595     2595           
Flag Coverage Δ
unittests 58.97% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Katrina Rogan <[email protected]>
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 4, 2024
@katrogan katrogan enabled auto-merge (squash) March 4, 2024 17:19
@katrogan katrogan merged commit caed584 into master Mar 5, 2024
51 checks passed
@katrogan katrogan deleted the webhook-resources branch March 5, 2024 01:50
yubofredwang pushed a commit to yubofredwang/flyte that referenced this pull request Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants