Skip to content

add cluster name label admission webhook#5

Open
jiazhiguang wants to merge 1 commit into
release-1.10-alaudafrom
feat/add-resource-webhook
Open

add cluster name label admission webhook#5
jiazhiguang wants to merge 1 commit into
release-1.10-alaudafrom
feat/add-resource-webhook

Conversation

@jiazhiguang
Copy link
Copy Markdown
Collaborator

No description provided.

Add a generic core admission handler that enforces the cluster.x-k8s.io/cluster-name label for explicitly configured resources. The initial generated webhook rule targets Cluster create/update requests, requiring Cluster objects to carry the label themselves while still allowing future provider resources to inherit the label from labeled owners.

Register the webhook in the core manager and envtest setup, expose it through the public webhook alias package, and generate the corresponding webhook/RBAC manifests. Add unit coverage for existing labels, owner-based mutation, missing owners, missing labels, multiple owners, and invalid owner references.

Tested:
- make GO_VERSION=1.25.9 generate-manifests-core
- go test ./internal/webhooks ./webhooks .
- git diff --check

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (3)
  • main
  • master
  • ^\d.x$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 88148bbc-e40d-4a21-a1ea-d85c8dd780ab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-resource-webhook

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant