fix(kep-3633): redesign matchLabelSelectors as matchLabelKeys + mismatchLabelKeys#4069
Conversation
|
@ahg-g @msau42 What do you think about this idea? I'd like to have our decision on this first. |
8ed5cd7 to
33cc9ee
Compare
|
/lgtm |
|
@ahg-g Could you check this comment? #4069 (comment) |
| // The default value is empty. | ||
| // +optional | ||
| MatchLabelSelectors []strinMatchLabelSelectorg | ||
| MatchLabelSelectors []MatchLabelSelector |
There was a problem hiding this comment.
Continuing the discussion from:
#4001 (comment)
Ah, yes correct. This PR changes MatchLabelSelectors to be handled in kube-apiserver when Pod is created.
So, existing objects will continue to have the labelselector made by MatchLabelSelectors even after the feature gate is turned off.What is the ideal action here? OK to leave the existing objects when turning off the feature gate (as long as we state in KEP), or we somehow need to ignore the labelselector made by MatchLabelSelectors (gonna be tricky though..)?
Yes - I'm fine with leaving the existing objects as is [in fact we don't really have good mechanisms to do anything smarter].
Just please extend the Downgrade section with explanation about:
- leaving the existing objects as is
- scheduler ignoring this field when FG is disabled (even if set)
- IIUC, also scheduler depends on the FG, so please update the first question in PRR
Once all of the above is applied, this seems good to go for Alpha (IIUC we're only targeting Alpha now)
There was a problem hiding this comment.
OK, thanks for clarifying.
There was a problem hiding this comment.
scheduler ignoring this field when FG is disabled (even if set)
IIUC, also scheduler depends on the FG, so please update the first question in PRR
Regarding them, No.
The kube-apiserver generates LabelSelector from MatchLabelSelectors and kube-scheduler computes PodAffinity/PodAntiAffinity as it does now. So, kube-scheduler doesn't look at MatchLabelSelectors directly and it doesn't depend on the feature gate. (instead, it just looks at LabelSelector generated from kube-apiserver.)
|
/hold To address my comment. |
|
/hold This discussion is on-going in the original thread. If we don't find any good naming, then OK to unhold. |
wojtek-t
left a comment
There was a problem hiding this comment.
Few more clarifying comments.
| kube-apiserver will ignore `MatchLabelSelectors` in PodAffinity/PodAntiAffinity, | ||
| and thus, kube-scheduler will also do nothing with it. | ||
|
|
||
| But, we leave the existing `MatchLabelSelectors` and `LabelSelector` created from `MatchLabelSelectors` as it is. |
There was a problem hiding this comment.
Actually, I have an additional question: IIUC, PodAffinity/PodAntiAffinity is immutable, right? So once I create pod, I can no longer change that, right?
If the above is true, we should clarify that:
- if FG is disabled, MatchLabelSelectors will be dropped for newly created pods and for existing pods
- if FG is disabled, MatchLabelSelectors and changes to LabelSelector propagated from it will remain as they are for already existing pods
There was a problem hiding this comment.
Yes, right. Sure, let me clarify more on the KEP.
There was a problem hiding this comment.
If FG is disabled,
- for Pod creation, pods with MatchLabelSelectors will be rejected in validation.
- for Pod update (= for existing Pods), pods with MatchLabelSelectors will not be rejected, it'll remain as it is.
Does it sound good?
| ###### What happens if we reenable the feature if it was previously rolled back? | ||
|
|
||
| Scheduling of new Pods is affected. (Scheduled Pods aren't affected.) | ||
| Scheduling of new Pods created with `MatchLabelSelectors` is affected. |
There was a problem hiding this comment.
nit: Scheduling of newly created pods with MatchLabelSelector set is affected.
All already existing pods are unafected.
| // The default value is empty. | ||
| // +optional | ||
| MatchLabelSelectors []strinMatchLabelSelectorg | ||
| MatchLabelSelectors []MatchLabelSelector |
There was a problem hiding this comment.
I'm still keen on using two slice to represent the semantics, to avoid another "selector" field to confuse with existing labelSelector. How about:
type PodAffinityTerm struct {
matchLabelKeys []string
mismatchLabelKeys []string
where matchLabelKeys follows the same naming pattern and semantics with existing ones like:
and mismatchLabelKeys is simply an opposite semantics of matchLabelKeys.
cc @ahg-g per #4001 (comment)
There was a problem hiding this comment.
Having matchLabelKeys and mismatchLabelKeys sounds good to me to match what's in podTopologySpread. We can continue discussing if there's a better field name later.
There was a problem hiding this comment.
Sounds good to me; @sanposhiho can you please update the KEP? as @msau42 said, we can debate the names in the implementation PR.
There was a problem hiding this comment.
OK, I'll update the KEP soon.
e7782e1 to
c641305
Compare
|
/lgtm /hold cancel |
|
/retitle fix(kep-3633): redesign matchLabelSelectors as matchLabelKeys + mismatchLabelKeys |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahg-g, sanposhiho 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 |
|
/hold in case others have any final comments |
|
LGTM |
| title: Introduce MatchLabelKeys and MismatchLabelKeys to PodAffinity and PodAntiAffinity | ||
| kep-number: 3633 | ||
| authors: | ||
| - "@sanposhiho" |
There was a problem hiding this comment.
Can you update the kep.yaml with status: implementable here?
There was a problem hiding this comment.
OK, I'll follow up in another PR
|
LGTM still. |
|
/hold cancel |
It's continuous work from #4001. (#4001 is mistakenly merged.)
MatchLabelKeysto Pod Affinity and Pod Anti Affinity #3633