Skip to content

Commit

Permalink
fix!: make .spec.selector immutable (#4084)
Browse files Browse the repository at this point in the history
* fix: make selector immutable

Signed-off-by: Zach Aller <[email protected]>

* fix: make selector immutable

Signed-off-by: Zach Aller <[email protected]>

* fix: make selector optional for workloadRef

Signed-off-by: Zach Aller <[email protected]>

---------

Signed-off-by: Zach Aller <[email protected]>
  • Loading branch information
zachaller authored Jan 30, 2025
1 parent 723e81c commit 4f5d93b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions manifests/crds/rollout-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ spec:
type: object
type: object
x-kubernetes-map-type: atomic
x-kubernetes-validations:
- message: .spec.selector is immutable
rule: self == oldSelf
strategy:
properties:
blueGreen:
Expand Down
3 changes: 3 additions & 0 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12671,6 +12671,9 @@ spec:
type: object
type: object
x-kubernetes-map-type: atomic
x-kubernetes-validations:
- message: .spec.selector is immutable
rule: self == oldSelf
strategy:
properties:
blueGreen:
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiclient/rollout/rollout.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,7 @@
},
"selector": {
"$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector",
"title": "Label selector for pods. Existing ReplicaSets whose pods are\nselected by this will be the ones affected by this rollout.\nIt must match the pod template's labels.\n+optional"
"title": "Label selector for pods. Existing ReplicaSets whose pods are\nselected by this will be the ones affected by this rollout.\nIt must match the pod template's labels.\n+optional\n+kubebuilder:validation:XValidation:rule=\"self == oldSelf\",message=\".spec.selector is immutable\""
},
"template": {
"$ref": "#/definitions/k8s.io.api.core.v1.PodTemplateSpec",
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/rollouts/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/apis/rollouts/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type RolloutSpec struct {
// selected by this will be the ones affected by this rollout.
// It must match the pod template's labels.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message=".spec.selector is immutable"
Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"`
// Template describes the pods that will be created.
// +optional
Expand Down

0 comments on commit 4f5d93b

Please sign in to comment.