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

feat: configurable arguments for the scheduler plugins #210

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

marwanad
Copy link
Contributor

This change adds configurable arguments for both the proxy and candidate plugins and changes the filterWait in the proxy plugin and preBindWait in the candidate plugin to be configurable.

I also updated the scheduler config api version to v1 as part of this change.

@@ -15,6 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# TODO: migrate to k8s.io/code-generator/kube_codegen.sh
Copy link
Contributor Author

Choose a reason for hiding this comment

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

both generate-groups and generate-internal-groups seems to be gone with v1.30.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please resolve this TODO? What does "gone" mean for this script?

Typically, I try to follow this: https://github.com/kubernetes/sample-controller/blob/master/hack/update-codegen.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

generate-internal-groups.sh and generate-groups.sh which this script depends have been deprecated since 1.29 and removed in 1.30.

https://github.com/kubernetes/code-generator/blob/3f91291add4375b42d0f8c4d6d041bb6ed440d97/generate-groups.sh#L52-L54

The recommendation is to switch to kube_codegen.sh instead.

Happy to include the change here, just wanted to keep the scope small.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so I ended up updating the k8s deps in the process including controller-runtime and the change is here (+boilerplate changes):

bf71f85

Thoughts on having this as a separate follow-up PR? I guess it doesn't matter much since I noticed PRs aren't merged squashed but it would be easier to review the diff separately. Happy to do either, let me know.

@@ -0,0 +1,44 @@
/*
* Copyright 2020 The Multicluster-Scheduler Authors.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

thoughts on dropping the year from the boilerplate header?

Copy link
Contributor

Choose a reason for hiding this comment

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

}

var _ framework.PreFilterPlugin = &Plugin{}
var _ framework.ReservePlugin = &Plugin{}
var _ framework.PreBindPlugin = &Plugin{}

// Name is the name of the plugin used in the plugin registry and configurations.
const Name = "candidate"
const Name = "Candidate"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The framework expects the args to be of the form pluginName + "Args" so I changed the casing here.

@marwanad marwanad force-pushed the plugin-args branch 2 times, most recently from 752ad80 to 538e75e Compare May 27, 2024 05:11
Copy link
Contributor

@adrienjt adrienjt left a comment

Choose a reason for hiding this comment

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

Thank you for this PR. Please see questions below.

@@ -15,6 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# TODO: migrate to k8s.io/code-generator/kube_codegen.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please resolve this TODO? What does "gone" mean for this script?

Typically, I try to follow this: https://github.com/kubernetes/sample-controller/blob/master/hack/update-codegen.sh

@@ -0,0 +1,44 @@
/*
* Copyright 2020 The Multicluster-Scheduler Authors.
Copy link
Contributor

Choose a reason for hiding this comment

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

*/

// +k8s:deepcopy-gen=package
// +groupName=kubescheduler.config.k8s.io
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this not config.admiralty.io?

Taking a step back, why don't you simply add the config types to pkg/apis/multicluster?

If you do need a separate group, declaring a v1 seems premature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it's my understanding that for out of tree scheduler plugins, it has to be registered to the same GVK as the scheduler configs since the loading of those hardcodes and expects to parse as the plugin name + "Args" when converting to Go types.

https://github.com/kubernetes/kubernetes/blob/4fa7ce6f3c0038ecec7c2ec3d6edb42315db3015/staging/src/k8s.io/kube-scheduler/config/v1/types.go#L287-L289

https://github.com/kubernetes/kubernetes/blob/4fa7ce6f3c0038ecec7c2ec3d6edb42315db3015/pkg/scheduler/apis/config/v1/defaults.go#L89-L91

Since 1.29, all alphas/betas are deprecated so only the v1 is supported. kubescheduler.config.k8s.io/v1 is supported since 1.25.

pkg/apis/config/v1/defaults_test.go Outdated Show resolved Hide resolved
pkg/apis/config/types.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants