Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Rollout's selector field should be immutable #3626

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions docs/features/kustomize/rollout_cr_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -22183,6 +22183,9 @@
"type": "object"
}
},
"required": [
"selector"
],
"type": "object"
}
},
Expand Down
5 changes: 5 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: field is immutable
rule: self == oldSelf
strategy:
properties:
blueGreen:
Expand Down Expand Up @@ -3556,6 +3559,8 @@ spec:
scaleDown:
type: string
type: object
required:
- selector
type: object
status:
properties:
Expand Down
5 changes: 5 additions & 0 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12599,6 +12599,9 @@ spec:
type: object
type: object
x-kubernetes-map-type: atomic
x-kubernetes-validations:
- message: field is immutable
rule: self == oldSelf
strategy:
properties:
blueGreen:
Expand Down Expand Up @@ -16046,6 +16049,8 @@ spec:
scaleDown:
type: string
type: object
required:
- selector
type: object
status:
properties:
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 @@ -2062,7 +2062,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+kubebuilder:validation:Required\n+kubebuilder:validation:XValidation:rule=\"self == oldSelf\",message=\"field is immutable\""
},
"template": {
"$ref": "#/definitions/k8s.io.api.core.v1.PodTemplateSpec",
Expand Down
3 changes: 2 additions & 1 deletion 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/openapi_generated.go

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

3 changes: 2 additions & 1 deletion pkg/apis/rollouts/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ type RolloutSpec struct {
// Label selector for pods. Existing ReplicaSets whose pods are
// selected by this will be the ones affected by this rollout.
// It must match the pod template's labels.
// +optional
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="field is immutable"
Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"`
// Template describes the pods that will be created.
// +optional
Expand Down
Loading