Skip to content

Add global cluster-aware validating admission webhook - #4288

Merged
kcp-ci-bot merged 5 commits into
kcp-dev:mainfrom
mjudeikis:global-validating-webhook
Oct 27, 2026
Merged

kcp-ci-bot merged 5 commits into
kcp-dev:mainfrom
mjudeikis:global-validating-webhook

Conversation

@mjudeikis

@mjudeikis mjudeikis commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Introduce a compiled-in admission plugin, apis.kcp.io/GlobalValidatingWebhook, that applies a single ValidatingWebhookConfiguration - supplied to the shard at startup via --admission-control-config-file - to requests in EVERY logical cluster, without a per-workspace WebhookConfiguration object.

This is to admission what --authorization-webhook-config-file is to authorization: one endpoint, wired at bootstrap, applied globally. Unlike the authorization webhook it is an admission webhook, so the callout carries the full object body + operation and can deny. The request's logical cluster is conveyed to the endpoint on the object's kcp.io/cluster annotation (create/update on the object, delete on the old object). Parsed config is run through API defaulting so nil namespace/object selectors do not silently match nothing.

This allows to start setting global policies on all instance.

What Type of PR Is This?

/kind feature

Related Issue(s)

Fixes #

Release Notes

Add the `apis.kcp.io/GlobalValidatingWebhook` admission plugin: a single `ValidatingWebhookConfiguration`, passed to the shard via the newly exposed `--admission-control-config-file` flag, is applied to requests in every logical cluster. The reviewed object carries the request's logical cluster name on the `kcp.io/cluster` annotation for the duration of the callout.

@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 24, 2026
Comment thread pkg/admission/globalwebhook/plugin.go
Comment thread pkg/admission/globalwebhook/plugin.go Outdated
@mjudeikis
mjudeikis marked this pull request as draft September 14, 2026 14:57
@kcp-ci-bot kcp-ci-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 14, 2026
Introduce a compiled-in admission plugin, apis.kcp.io/GlobalValidatingWebhook,
that applies a single ValidatingWebhookConfiguration - supplied to the shard at
startup via --admission-control-config-file - to requests in EVERY logical
cluster, without a per-workspace WebhookConfiguration object.

This is to admission what --authorization-webhook-config-file is to
authorization: one endpoint, wired at bootstrap, applied globally. Unlike the
authorization webhook it is an admission webhook, so the callout carries the full
object body + operation and can deny. The request's logical cluster is conveyed
to the endpoint on the object's kcp.io/cluster annotation (create/update on the
object, delete on the old object). Parsed config is run through API defaulting so
nil namespace/object selectors do not silently match nothing.

- pkg/admission/globalwebhook: the plugin (static webhook source) + unit tests
- pkg/admission/plugins.go: register, order, default-on (inert unless configured)
- pkg/server/options/flags.go: expose --admission-control-config-file
- config/examples/global-admission-webhook: example admission config + README
- test/e2e/admissionwebhook: dedicated-server e2e proving global reach,
  cluster-awareness and deny on a native ConfigMap across two workspaces
@mjudeikis
mjudeikis force-pushed the global-validating-webhook branch from 0607ee2 to db447a8 Compare October 27, 2026 06:49
@mjudeikis
mjudeikis marked this pull request as ready for review October 27, 2026 06:53
@kcp-ci-bot kcp-ci-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 27, 2026
@mjudeikis mjudeikis added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Oct 27, 2026

@neolit123 neolit123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, this is great!
likely worth mentioning the new flag in the release note?

Comment thread pkg/admission/globalwebhook/plugin.go Outdated
Comment thread pkg/admission/globalwebhook/plugin.go Outdated
Comment thread pkg/admission/clusterannotation/clusterannotation.go Outdated
@mjudeikis

Copy link
Copy Markdown
Contributor Author

Release note updated to mention the exposed --admission-control-config-file flag and the plugin name.

@mjudeikis

Copy link
Copy Markdown
Contributor Author

Added a big code comment explaining why the path is not there, so when (it's a question of time) we get the request we remember :D

@mjudeikis

Copy link
Copy Markdown
Contributor Author

/retest
quota flakes and few other known ones

@ntnn ntnn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm
/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 27, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 7cd4ca46d22b363cd3664cac208fd40403ce4ff0

@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ntnn

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

The pull request process is described here

Details 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

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 27, 2026
@mjudeikis

Copy link
Copy Markdown
Contributor Author

/retest
? strange flake

@mjudeikis

Copy link
Copy Markdown
Contributor Author

/retest

@kcp-ci-bot
kcp-ci-bot merged commit 037a899 into kcp-dev:main Oct 27, 2026
19 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. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants