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

chore: Add pods/resize subresource to mutating and validating webhooks #3778

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/build/helmify/replacements.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ var replacements = map[string]string{
- pods/proxy
- pods/attach
- pods/binding
- pods/resize
- deployments/scale
- replicasets/scale
- statefulsets/scale
Expand Down Expand Up @@ -256,6 +257,7 @@ var replacements = map[string]string{
- 'pods/proxy'
- 'pods/attach'
- 'pods/binding'
- 'pods/resize'
- 'deployments/scale'
- 'replicasets/scale'
- 'statefulsets/scale'
Expand Down
17 changes: 17 additions & 0 deletions config/webhook/manifests.yaml
Copy link
Contributor

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

Copy link
Author

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

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ webhooks:
- UPDATE
resources:
- '*'
- 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
sideEffects: None
---
apiVersion: admissionregistration.k8s.io/v1
Expand Down Expand Up @@ -83,6 +99,7 @@ webhooks:
- pods/proxy
- pods/attach
- pods/binding
- pods/resize
- deployments/scale
- replicasets/scale
- statefulsets/scale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ webhooks:
- pods/proxy
- pods/attach
- pods/binding
- pods/resize
- deployments/scale
- replicasets/scale
- statefulsets/scale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ webhooks:
- 'pods/proxy'
- 'pods/attach'
- 'pods/binding'
- 'pods/resize'
- 'deployments/scale'
- 'replicasets/scale'
- 'statefulsets/scale'
Expand Down
17 changes: 17 additions & 0 deletions manifest_staging/deploy/gatekeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5332,6 +5332,22 @@ webhooks:
- UPDATE
resources:
- '*'
- 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
sideEffects: None
timeoutSeconds: 1
---
Expand Down Expand Up @@ -5379,6 +5395,7 @@ webhooks:
- pods/proxy
- pods/attach
- pods/binding
- pods/resize
- deployments/scale
- replicasets/scale
- statefulsets/scale
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/mutation.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func init() {
}
}

// +kubebuilder:webhook:verbs=create;update,path=/v1/mutate,mutating=true,failurePolicy=ignore,groups=*,resources=*,versions=*,name=mutation.gatekeeper.sh,sideEffects=None,admissionReviewVersions=v1;v1beta1,matchPolicy=Exact
// +kubebuilder:webhook:verbs=create;update,path=/v1/mutate,mutating=true,failurePolicy=ignore,groups=*,resources=*;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,versions=*,name=mutation.gatekeeper.sh,sideEffects=None,admissionReviewVersions=v1;v1beta1,matchPolicy=Exact
// +kubebuilder:rbac:resourceNames=gatekeeper-mutating-webhook-configuration,groups=admissionregistration.k8s.io,resources=mutatingwebhookconfigurations,verbs=get;list;watch;update;patch

// AddMutatingWebhook registers the mutating webhook server with the manager.
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func init() {

// Explicitly list all known subresources except "status" (to avoid destabilizing the cluster and increasing load on gatekeeper). But include "services/status" for constraints that mitigate CVE-2020-8554.
// You can find a rough list of subresources by doing a case-sensitive search in the Kubernetes codebase for 'Subresource("'
// +kubebuilder:webhook:verbs=create;update,path=/v1/admit,mutating=false,failurePolicy=ignore,groups=*,resources=*;pods/ephemeralcontainers;pods/exec;pods/log;pods/eviction;pods/portforward;pods/proxy;pods/attach;pods/binding;deployments/scale;replicasets/scale;statefulsets/scale;replicationcontrollers/scale;services/proxy;nodes/proxy;services/status,versions=*,name=validation.gatekeeper.sh,sideEffects=None,admissionReviewVersions=v1;v1beta1,matchPolicy=Exact
// +kubebuilder:webhook:verbs=create;update,path=/v1/admit,mutating=false,failurePolicy=ignore,groups=*,resources=*;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,versions=*,name=validation.gatekeeper.sh,sideEffects=None,admissionReviewVersions=v1;v1beta1,matchPolicy=Exact
// +kubebuilder:rbac:groups=*,resources=*,verbs=get;list;watch

// AddPolicyWebhook registers the policy webhook server with the manager.
Expand Down