Skip to content
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
8 changes: 8 additions & 0 deletions crd/multitenancy/api/v1alpha1/podnetworkinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ import (
// +kubebuilder:metadata:labels=managed=
// +kubebuilder:metadata:labels=owner=
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.status`
//
// Enforce immutability of .spec.
// Rule semantics:
// - Do not allow UPDATE require self.spec == oldSelf.spec (no spec changes).
//
// This compiles to a CRD-level x-kubernetes-validations transition rule using oldSelf.
// Requires Kubernetes versions that support CEL transition rules.
// +kubebuilder:validation:XValidation:rule="self.spec == oldSelf.spec",message="Spec is immutable."
type PodNetworkInstance struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: PodNetworkInstance is the Schema for the PodNetworkInstances
API
description: |-
PodNetworkInstance is the Schema for the PodNetworkInstances API

Enforce immutability of .spec.
Rule semantics:
- Do not allow UPDATE require self.spec == oldSelf.spec (no spec changes).

This compiles to a CRD-level x-kubernetes-validations transition rule using oldSelf.
Requires Kubernetes versions that support CEL transition rules.
properties:
apiVersion:
description: |-
Expand Down Expand Up @@ -109,6 +116,9 @@ spec:
type: string
type: object
type: object
x-kubernetes-validations:
- message: Spec is immutable.
rule: self.spec == oldSelf.spec
served: true
storage: true
subresources:
Expand Down
Loading