Validate labelSelector in topologySpreadConstraints#111802
Validate labelSelector in topologySpreadConstraints#111802k8s-ci-robot merged 1 commit intokubernetes:masterfrom maaoBit:fix-labelSelectorValidate-missing
Conversation
|
Please note that we're already in Test Freeze for the Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Thu Aug 11 07:32:13 UTC 2022. |
|
@maaoBit: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Hi @maaoBit. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/cc |
There was a problem hiding this comment.
We need to consider what happens to existing persisted data that doesn't pass this validation
This means we need to only apply this stricter validation when validating a create request or an update request of an object that already passes the strict validation.
The pattern we use for this is:
- plumbing the PodValidationOptions struct down to this function
- add an
AllowInvalidTopologySpreadConstraintLabelSelector boolfield to that struct - populate that field in
GetValidationOptionsFromPodSpecAndMeta:
- set it to false when creating a new pod
- set it to true when updating a pod where the old pod has invalid topology spread constraint label selectors
- set it to false otherwise
- Make this new validation line conditional on that boolean field
- Add unit tests:
- validate a new pod (should not allow invalid selectors)
- validate an updated pod where the old pod has invalid selectors (should allow the new pod to have an invalid selector)
- validate an updated pod where the old pod has valid selectors (should not allow the new pod to have an invalid selector)
There was a problem hiding this comment.
thanks for review. PR has been updated. PTAL
There was a problem hiding this comment.
wonder if we need another test for invalid matchlables but with AllowInvalidTopologySpreadConstraintLabelSelector set to true to account for an update with invalid pod
|
@alaypatel07 Done |
alculquicondor
left a comment
There was a problem hiding this comment.
It looks generally good, but there is something else that we need to make sure:
When tightening validation, a Pod that used to work should continue to work. For this PR, this means that if a Pod had an invalid labelSelector, it should have failed to schedule.
Can you verify that this is the case?
There was a problem hiding this comment.
rename to metavalidation
|
/test pull-kubernetes-verify |
|
this lgtm, just a couple comments /milestone v1.27 |
alculquicondor
left a comment
There was a problem hiding this comment.
/approve
/lgtm
/hold for optional nit
Signed-off-by: maao <maao420691301@gmail.com>
|
/lgtm This needs a release note btw. |
|
/hold |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alculquicondor, liggitt, maaoBit The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
If you still need this PR then please rebase, if not, please close the PR |
|
release note has been added, remove hold label |
|
i can see it in the merge queue - https://prow.k8s.io/tide |
|
/milestone v1.27 The milestone_applier plugin was not configured to add 1.27 milestone |
Signed-off-by: maao maao420691301@gmail.com
What type of PR is this?
/kind bug
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #111791
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: