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

GeneralPredicate as framework plugin config #84054

Merged
merged 1 commit into from
Oct 18, 2019

Conversation

ahg-g
Copy link
Member

@ahg-g ahg-g commented Oct 17, 2019

What type of PR is this?

/kind feature

What this PR does / why we need it:
GeneralPred as Filter configuration that combines PodFitsResources, PodFitsHost, PodFitsHostPorts and PodMatchNodeSelector.

Which issue(s) this PR fixes:

Fixes #84039

Does this PR introduce a user-facing change?:

NONE

/priority important-soon

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 17, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 17, 2019
@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. area/test and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 17, 2019
@ahg-g
Copy link
Member Author

ahg-g commented Oct 17, 2019

/assign @liu-cong

@ahg-g
Copy link
Member Author

ahg-g commented Oct 17, 2019

/cc @Huang-Wei

@@ -651,7 +651,7 @@ func (g *genericScheduler) podFitsOnNode(
if err != nil {
return false, []predicates.PredicateFailureReason{}, nil, err
}
} else if !podsAdded || len(failedPredicates) != 0 {
} else if !podsAdded || len(failedPredicates) != 0 || !status.IsSuccess() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand why we run predicates twice here. But looking at the code, when this branch is reached, the status can only be Success or Unschedulable. So this change is to break if status is Unschedulable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment at the top tries to explain this, do you have questions about that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I understand it. Discussed offline, we are going to keep it for now and I am gonna do a followup cleanup.

@@ -105,6 +105,15 @@ func NewDefaultConfigProducerRegistry() *ConfigProducerRegistry {
PredicateToConfigProducer: make(map[string]ConfigProducer),
PriorityToConfigProducer: make(map[string]ConfigProducer),
}
registry.RegisterPredicate(predicates.GeneralPred,
func(_ ConfigProducerArgs) (plugins config.Plugins, pluginConfig []config.PluginConfig) {
// GeneralPredicate is a combination of predicates.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it cleaner to call RegisterPredicate each time for each predicate instead of combining them in one "general predicate"? Or what's special about "GeneralPred" compared to others?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately "GeneralPredicate" is registered as a "composite" standalone predicate. By composite I mean that its implementation basically calls a group of other predicates. I think it was a mistake making it a predicate on of its own, but we are stuck with it since it is now a value that we deem valid in the schedule config file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @ahg-g said, we were not doing well in the "GeneralPredicate" thing - it shouldn't be considered as, or registered as a serious Predicate, instead, it should serve as a helper to invoke a series of real Predicate, and called by consumers like controller manager and kubelet.

To make our code readable and the semantics of Predicates/FilterPlugins clear, I hope we can get rid of the "GeneralPredicate" thing in 2 aspects:

  • Rename it to be not related with "Predicate" - just serve as a "composite" to invoke other Predicate/Plugin
  • Discard the support to expose it as a regular Predicate in Policy API.

WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy to rename/discard it, but it is part of the Policy v1 API. If someone has a custom policy configuration that included "GeneralPredicate" as one of the priorities, their scheduler will fail to start.

However, if we do remove it as a predicate in the policy API, it is easy for users to migrate, they just need to modify their policy file to include the corresponding predicates, and it is backward compatible (i.e., specifying the list of corresponding predicate will work for new and older versions of the scheduler). I am fine with this if we get an API review approval for it, but that should be in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we do remove it as a predicate in the policy API, it is easy for users to migrate, they just need to modify their policy file to include the corresponding predicates, and it is backward compatible

Yup, it sounds good to me.

@liu-cong
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 17, 2019
@ahg-g
Copy link
Member Author

ahg-g commented Oct 18, 2019

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 18, 2019
@ahg-g
Copy link
Member Author

ahg-g commented Oct 18, 2019

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 18, 2019
@k8s-ci-robot k8s-ci-robot merged commit d1a79f1 into kubernetes:master Oct 18, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.17 milestone Oct 18, 2019
@ahg-g ahg-g deleted the ahg-gp branch January 10, 2020 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[migration phase 1] GeneralPred as a plugin configuration
4 participants