Skip to content

Commit da24073

Browse files
authored
fix: do not allow spec update on mtpnc, pn and pni
Signed-off-by: GitHub <[email protected]>
1 parent 3e86bca commit da24073

File tree

6 files changed

+12
-0
lines changed

6 files changed

+12
-0
lines changed

crd/multitenancy/api/v1alpha1/multitenantpodnetworkconfig.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type MultitenantPodNetworkConfigList struct {
3737
}
3838

3939
// MultitenantPodNetworkConfigSpec defines the desired state of PodNetworkConfig
40+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="spec is immutable after creation"
4041
type MultitenantPodNetworkConfigSpec struct {
4142
// name of PNI object from requesting cx pod
4243
// +kubebuilder:validation:Optional

crd/multitenancy/api/v1alpha1/podnetwork.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const (
4646
)
4747

4848
// PodNetworkSpec defines the desired state of PodNetwork
49+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="spec is immutable after creation"
4950
type PodNetworkSpec struct {
5051
// NetworkID is the identifier for the network, e.g. vnet guid or IB network ID
5152
// +kubebuilder:validation:Optional

crd/multitenancy/api/v1alpha1/podnetworkinstance.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type PodNetworkConfig struct {
4545
}
4646

4747
// PodNetworkInstanceSpec defines the desired state of PodNetworkInstance
48+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="spec is immutable after creation"
4849
type PodNetworkInstanceSpec struct {
4950
// Deprecated - use PodNetworks
5051
// +kubebuilder:validation:Optional

crd/multitenancy/manifests/multitenancy.acn.azure.com_multitenantpodnetworkconfigs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ spec:
6868
required:
6969
- podNetwork
7070
type: object
71+
x-kubernetes-validations:
72+
- message: spec is immutable after creation
73+
rule: self == oldSelf
7174
status:
7275
description: MultitenantPodNetworkConfigStatus defines the observed state
7376
of PodNetworkConfig

crd/multitenancy/manifests/multitenancy.acn.azure.com_podnetworkinstances.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ spec:
8686
description: Deprecated - use PodNetworks
8787
type: string
8888
type: object
89+
x-kubernetes-validations:
90+
- message: spec is immutable after creation
91+
rule: self == oldSelf
8992
status:
9093
description: PodNetworkInstanceStatus defines the observed state of PodNetworkInstance
9194
properties:

crd/multitenancy/manifests/multitenancy.acn.azure.com_podnetworks.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ spec:
8787
description: Deprecated - Use NetworkID
8888
type: string
8989
type: object
90+
x-kubernetes-validations:
91+
- message: spec is immutable after creation
92+
rule: self == oldSelf
9093
status:
9194
description: PodNetworkStatus defines the observed state of PodNetwork
9295
properties:

0 commit comments

Comments
 (0)