-
Notifications
You must be signed in to change notification settings - Fork 788
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
chore: Add pods/resize
subresource to mutating and validating webhooks
#3778
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Ian Stanton <[email protected]>
Signed-off-by: Ian Stanton <[email protected]>
Signed-off-by: Ian Stanton <[email protected]>
Signed-off-by: Ian Stanton <[email protected]>
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 also add the list of subresources for mutating-webhook-configuration
as well?
- pods/ephemeralcontainers
- pods/exec
- pods/log
- pods/eviction
- pods/portforward
- pods/proxy
- pods/attach
- pods/binding
- pods/resize
- deployments/scale
- replicasets/scale
- statefulsets/scale
- replicationcontrollers/scale
- services/proxy
- nodes/proxy
- services/status
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.
✔️ Updated the kubebuilder annotation in pkg/webhook/mutation.go
with these values
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 the PR @ianstanton!
Adding these resources to the MutatingWebhookConfiguration can introduce security risks and, performance impacts. I recommend removing these from the default. Users can always add if needed for their specific use cases based on their own security and performance analysis.
Security Risks:
pods/exec: Allowing exec operations can be risky as it enables direct command execution within containers, which can be exploited if not properly controlled.
pods/log: Access to logs can expose sensitive information.
pods/proxy, services/proxy, nodes/proxy: Proxy operations can be exploited to redirect traffic, potentially exposing internal services.
pods/attach: Attaching to pods can provide direct access to the container's processes and data.
pods/ephemeralcontainers: These can be used to add ephemeral containers to running pods, which could be exploited if proper security measures are not in place.
pods/binding: This operation binds a Pod to a specific Node, which can be misused to affect workload scheduling and performance.
pods/resize: Resizing pods can impact resource allocation and disrupt services.
Performance Impact:
The webhook will intercept more requests, potentially increasing the latency and load on the API server.
Frequent mutations on high-traffic resources (like pods/exec or pods/log) can lead to performance bottlenecks.
We need to balance the need for mutation with the potential risks and performance overhead it introduces. Limiting the scope to only necessary resources and operations is a good practice.
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.
@ritazh Good call, thanks for pointing this out. I'll revert this piece soon.
deploy/gatekeeper.yaml
Outdated
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.
changes in deploy
dir are overwritten with each release, so please remove any changes in gatekeeper.yaml
file.
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.
👍 Removed these changes
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.
Any changes in charts
dir is overwritten in release, please remove any changes in this dir
.
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.
Got it! Looks like these changes are applied in the manifest_staging
dir when we run make generate
.
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.
Yip! that is fine. We want these changes to manifest_staging
. You can find out more on contributing to helm chart and overall here - https://open-policy-agent.github.io/gatekeeper/website/docs/help#contributing-to-helm-chart. Thanks again for the PR!
@ianstanton Thanks for the PR, few changes and we should be good. |
Signed-off-by: Ian Stanton <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3778 +/- ##
==========================================
- Coverage 54.49% 47.77% -6.73%
==========================================
Files 134 235 +101
Lines 12329 19861 +7532
==========================================
+ Hits 6719 9488 +2769
- Misses 5116 9485 +4369
- Partials 494 888 +394
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Ian Stanton <[email protected]>
@JaydipGabani @ritazh I've addressed the feedback here #3778 (comment). Please let me know if you'd like to see any other changes! |
What this PR does / why we need it:
Add
pod/resize
subresource to mutating and validating webhooks.Which issue(s) this PR fixes (optional, using
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when the PR gets merged):Fixes #3771
Special notes for your reviewer:
@JaydipGabani Please let me know if there's anything else we need for this one