Skip to content

Conversation

@aranta-rokade
Copy link
Contributor

Reason for Change:
Make PNI CRD immutable using Kubernetes validations

Issue Fixed:
Making PNI CRD immutable, allows PNIs to retry reconcile after failure, for the cases when IP allocations become available.

Tested

k --kubeconfig=cluster.yaml apply -f ../pni.yaml
The PodNetworkInstance "pni-10" is invalid: <nil>: Invalid value: "object": Spec is immutable.

@aranta-rokade aranta-rokade requested a review from a team as a code owner November 24, 2025 18:33
Copilot finished reviewing on behalf of aranta-rokade November 24, 2025 18:36
Copy link
Contributor

Copilot AI left a comment

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 adds immutability validation to the PodNetworkInstance CRD's spec field using Kubernetes CEL validation rules. The goal is to prevent modifications to the PNI spec after creation, which allows PNIs to retry reconciliation after failures when IP allocations become available.

  • Adds kubebuilder XValidation annotation to enforce self.spec == oldSelf.spec
  • Updates generated CRD manifest with x-kubernetes-validations
  • Adds documentation comments explaining the validation rule and its requirements

Reviewed changes

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

File Description
crd/multitenancy/api/v1alpha1/podnetworkinstance.go Adds kubebuilder XValidation annotation to PodNetworkInstance type to enforce spec immutability
crd/multitenancy/manifests/multitenancy.acn.azure.com_podnetworkinstances.yaml Updates generated CRD manifest with x-kubernetes-validations rule to enforce spec immutability

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

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.

2 participants