Skip to content

Commit 22a0e5a

Browse files
authored
Merge pull request #118 from awslabs/immutable-fields
feat: make ResourceGroup `schema.kind` and `schema.apiVersion` immutable
2 parents 77d0157 + 74118be commit 22a0e5a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

api/v1alpha1/resource_group.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ type Schema struct {
5252
// and create the CRD for the resourcegroup.
5353
//
5454
// +kubebuilder:validation:Required
55+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="kind is immutable"
5556
Kind string `json:"kind,omitempty"`
5657
// The APIVersion of the resourcegroup. This is used to generate
5758
// and create the CRD for the resourcegroup.
5859
//
5960
// +kubebuilder:validation:Required
61+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="apiVersion is immutable"
6062
APIVersion string `json:"apiVersion,omitempty"`
6163
// The spec of the resourcegroup. Typically, this is the spec of
6264
// the CRD that the resourcegroup is managing. This is adhering

config/crd/bases/kro.run_resourcegroups.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,17 @@ spec:
100100
The APIVersion of the resourcegroup. This is used to generate
101101
and create the CRD for the resourcegroup.
102102
type: string
103+
x-kubernetes-validations:
104+
- message: apiVersion is immutable
105+
rule: self == oldSelf
103106
kind:
104107
description: |-
105108
The kind of the resourcegroup. This is used to generate
106109
and create the CRD for the resourcegroup.
107110
type: string
111+
x-kubernetes-validations:
112+
- message: kind is immutable
113+
rule: self == oldSelf
108114
spec:
109115
description: |-
110116
The spec of the resourcegroup. Typically, this is the spec of

0 commit comments

Comments
 (0)