Skip to content

Validation admission policy#328

Open
GunaKKIBM wants to merge 2 commits into
etcd-io:mainfrom
GunaKKIBM:Validation-admission-policy
Open

Validation admission policy#328
GunaKKIBM wants to merge 2 commits into
etcd-io:mainfrom
GunaKKIBM:Validation-admission-policy

Conversation

@GunaKKIBM

Copy link
Copy Markdown
Contributor

@k8s-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: GunaKKIBM
Once this PR has been reviewed and has the lgtm label, please assign ahrtr for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@k8s-ci-robot

Copy link
Copy Markdown

Hi @GunaKKIBM. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GunaKKIBM GunaKKIBM force-pushed the Validation-admission-policy branch 3 times, most recently from 7fde28a to 6dc6b74 Compare April 22, 2026 02:35
@GunaKKIBM GunaKKIBM marked this pull request as ready for review April 22, 2026 02:36
@ahrtr ahrtr requested review from ArkaSaha30, Copilot, hakman and ivanvc May 5, 2026 09:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a Kubernetes ValidatingAdmissionPolicy (VAP) and ValidatingAdmissionPolicyBinding to prevent end-users from updating or deleting operator-managed secondary resources (StatefulSets/Services/ConfigMaps) that are owned by an EtcdCluster, addressing issue #326.

Changes:

  • Add a ValidatingAdmissionPolicy that matches UPDATE/DELETE on StatefulSets/Services/ConfigMaps and restricts those operations to the etcd-operator controller manager identity.
  • Add a ValidatingAdmissionPolicyBinding to bind/enforce the policy (Deny).
  • Wire the policy into the config/default kustomize overlay via vars + a patch so the allowed service account username is derived from the deployed namespace/name.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
config/rbac/validating_admission_policy.yaml Adds the core ValidatingAdmissionPolicy targeting operator-owned secondary resources.
config/rbac/validating_admission_policy_binding.yaml Adds the binding intended to enforce the policy with Deny.
config/rbac/kustomization.yaml Includes the new VAP/VAPBinding resources in the RBAC kustomization.
config/default/validating_admission_policy_patch.yaml Patches the policy so the allowed username matches the installed service account identity.
config/default/kustomizeconfig.yaml Adds kustomize varReference configuration for substitutions inside the policy expression.
config/default/kustomization.yaml Adds vars/configurations/patch wiring to apply the policy patch in the default overlay.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

metadata:
name: secondary-resource-protection-binding
spec:
policyName: etcd-operator-resource-protection
Comment thread config/default/kustomization.yaml Outdated
Comment on lines +36 to +67
- path: validating_admission_policy_patch.yaml
target:
kind: ValidatingAdmissionPolicy
name: secondary-resource-protection
spec:
validations:
- expression: |
request.userInfo.username == "system:serviceaccount:$(NAMESPACE):$(SERVICE_ACCOUNT_NAME)"
@GunaKKIBM GunaKKIBM force-pushed the Validation-admission-policy branch from 6dc6b74 to 689c3b2 Compare May 8, 2026 03:22
Signed-off-by: Guna K Kambalimath <Guna.Kambalimath@ibm.com>
@GunaKKIBM GunaKKIBM force-pushed the Validation-admission-policy branch from 689c3b2 to dcf49a5 Compare May 8, 2026 14:33
@ahrtr

ahrtr commented Jun 9, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@ahrtr

ahrtr commented Jun 9, 2026

Copy link
Copy Markdown
Member

@GunaKKIBM pls discuss with @hakman offline, thx

@hakman

hakman commented Jun 9, 2026

Copy link
Copy Markdown
Member

I am reviewing this in the next few days, sorry for the delay.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants