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 vpa webhook reinvocationPolicy: IfNeeded #9191

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

voelzmo
Copy link
Member

@voelzmo voelzmo commented Feb 21, 2024

How to categorize this PR?

/area auto-scaling
/kind enhancement

What this PR does / why we need it:
Under normal circumstances, VPA is ignoring injected sidecar Containers. This is achieved by ensuring that the VPA admission-controller MutatingWebhook is called before all other webhooks which inject containers. The VPA admission-controller will add an annotation vpaObservedContainers with a list of all Containers found in a Pod and later on only apply recommendations to the Containers found in this annotation. This feature was introduced specifically to avoid endless eviction loops in the case where controllers injecting sidecar Containers are overwriting resources set by the VPA admission-controller.

In gardener, however, we need the VPA admission-controller to be called after other webhooks inject containers, as we're e.g. putting containers injected by the provider extensions under control of VPA.

In this scenario, problems can arise if the injecting webhook specifies reinvocationPolicy: IfNeeded and unconditionally reconciles the resources section of the injected container. This way, it will overwrite the resources set by VPA, resulting in an endless eviction loop. This became visible after we introduced the app-oidc-controller, which injects additional sidecar Containers and also adjusts their resources.

By setting vpa webhook reinvocationPolicy: IfNeeded for the VPA admission-controller webhook, we ensure that the VPA admission-controller is invoked last, making sure that the requests are set correctly also for injected Containers.

Release note:

Set `reinvocationPolicy: IfNeeded` for VPA admission-controller webhook to ensure that webhooks injecting sidecar containers will not trigger and endless eviction loop.

@gardener-prow gardener-prow bot added area/auto-scaling Auto-scaling (CA/HPA/VPA/HVPA, predominantly control plane, but also otherwise) related kind/enhancement Enhancement, improvement, extension cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. labels Feb 21, 2024
@gardener-prow gardener-prow bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 21, 2024
Copy link
Contributor

@ScheererJ ScheererJ 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 the pull request. Could you please share more details concerning which scenario/webhook required this change?

pkg/component/vpa/vpa.go Outdated Show resolved Hide resolved
@gardener-prow gardener-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 21, 2024
@voelzmo
Copy link
Member Author

voelzmo commented Feb 21, 2024

Thanks for the pull request. Could you please share more details concerning which scenario/webhook required this change?

adjusted the PR description to contain this additional sentence

This became visible after we introduced the app-oidc-controller, which injects additional sidecar Containers and also adjusts their resources.

@voelzmo
Copy link
Member Author

voelzmo commented Feb 21, 2024

/retest

@voelzmo
Copy link
Member Author

voelzmo commented Feb 22, 2024

/retest

Copy link
Contributor

@ScheererJ ScheererJ left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Feb 22, 2024
Copy link
Contributor

gardener-prow bot commented Feb 22, 2024

LGTM label has been added.

Git tree hash: a517e99d8a7a8ec45fcb362a8431cd1409a6e7a8

@gardener-prow gardener-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2024
@gardener-prow gardener-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 26, 2024
Copy link
Member

@rfranzke rfranzke left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2024
Copy link
Contributor

gardener-prow bot commented Feb 26, 2024

LGTM label has been added.

Git tree hash: 5d9d9a1c51f7fb7260a7ad4142f2d4f5beff55ac

Copy link
Contributor

gardener-prow bot commented Feb 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rfranzke

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow gardener-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 26, 2024
@gardener-prow gardener-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2024
@rfranzke
Copy link
Member

/lgtm

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2024
Copy link
Contributor

gardener-prow bot commented Feb 26, 2024

LGTM label has been added.

Git tree hash: b61caf2b8f721f7ae2130fcf880c49804231686c

@gardener-prow gardener-prow bot merged commit a902bd7 into gardener:master Feb 26, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/auto-scaling Auto-scaling (CA/HPA/VPA/HVPA, predominantly control plane, but also otherwise) related cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/enhancement Enhancement, improvement, extension lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants