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

Scheduler: change config.Plugins from pointers to objects #98663

Merged
merged 1 commit into from Feb 10, 2021

Conversation

gavinfish
Copy link
Contributor

@gavinfish gavinfish commented Feb 1, 2021

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Replacement of #95287

Which issue(s) this PR fixes:

Fix #95190

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

none

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 1, 2021
@k8s-ci-robot
Copy link
Contributor

@gavinfish: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions 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.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 1, 2021
@gavinfish gavinfish force-pushed the sched-remove-plugin-pt branch 3 times, most recently from e07610b to a0628ac Compare February 2, 2021 04:56
@k8s-ci-robot k8s-ci-robot added area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Feb 2, 2021
@gavinfish gavinfish changed the title [WIP] Scheduler: change config.Plugins from pointers to objects Scheduler: change config.Plugins from pointers to objects Feb 7, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 7, 2021
@gavinfish
Copy link
Contributor Author

/retest

1 similar comment
@gavinfish
Copy link
Contributor Author

/retest

@gavinfish
Copy link
Contributor Author

/test pull-kubernetes-verify

@gavinfish
Copy link
Contributor Author

/test pull-kubernetes-bazel-test
/test pull-kubernetes-e2e-kind

@gavinfish
Copy link
Contributor Author

/assign @alculquicondor

Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

looking pretty good

Enabled: []Plugin{
{Name: "DefaultPlugin1"},
{Name: "DefaultPlugin2"},
{Name: "CustomPlugin"},
},
},
PostFilter: &PluginSet{},
Copy link
Member

Choose a reason for hiding this comment

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

🎉

@@ -108,17 +108,17 @@ type extensionPoint struct {

func (f *frameworkImpl) getExtensionPoints(plugins *config.Plugins) []extensionPoint {
Copy link
Member

Choose a reason for hiding this comment

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

can we change extensionPoint to not hold pointers? evaluate if it simplifies things, otherwise leave it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be fine, just wait for all test results.

@@ -1280,8 +1280,8 @@ func TestFilterPluginsWithNominatedPods(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
registry := Registry{}
cfgPls := &config.Plugins{
PreFilter: &config.PluginSet{},
Filter: &config.PluginSet{},
PreFilter: config.PluginSet{},
Copy link
Member

Choose a reason for hiding this comment

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

you can remove these lines, that is the point :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cleaned all the missed ones.

return nil
}

func convertToInternalPluginSet(in *v1beta1.PluginSet, out *config.PluginSet, s conversion.Scope) error {
Copy link
Member

Choose a reason for hiding this comment

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

Can you use Convert_v1beta1_PluginSet_To_config_PluginSet instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

return nil
}

func convertToExternalPluginSet(in config.PluginSet, out *v1beta1.PluginSet, s conversion.Scope) error {
Copy link
Member

Choose a reason for hiding this comment

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

Can you use Convert_config_PluginSet_To_v1beta1_PluginSet instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

return err
}
return nil
}

func convertToInternalPluginSet(in *v1beta1.PluginSet, out *config.PluginSet, s conversion.Scope) error {
Copy link
Member

Choose a reason for hiding this comment

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

I see that I wasn't clear. I meant that you should prefer the autogenerated functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@gavinfish
Copy link
Contributor Author

/test pull-kubernetes-bazel-test
/test pull-kubernetes-integration

@gavinfish
Copy link
Contributor Author

/test pull-kubernetes-bazel-test

}
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.Filter, &out.Filter, s); err != nil {
return err
if in.QueueSort != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Trick to avoid so much code repetition:

func Convert_v1beta1_PluginConfig_To_config_PluginConfig(in *v1beta1.PluginConfig, out *config.PluginConfig, s conversion.Scope) error {
	if in == nil {
		return nil
	}
	return autoConvert_v1beta1_PluginConfig_To_config_PluginConfig(in, out, s)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, sure.

@alculquicondor
Copy link
Member

/approve

good for squash

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 10, 2021
@gavinfish
Copy link
Contributor Author

squashed.

Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 10, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, gavinfish

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

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@Huang-Wei
Copy link
Member

LGTM.

@alculquicondor Given that having a concrete value in internal API is a good practice, do we plan to change the internal Pluginsto values as well? (so that we don't need to init the Plugins inside a scheduler CC)

@alculquicondor
Copy link
Member

It's a good suggestion, but I don't mind that one as much (I don't think changing it leads to significantly less lines of code).

@gavinfish feel free to submit a PR for it with the catch that if it doesn't simplify much we might discard the change.

@Huang-Wei
Copy link
Member

It's a good suggestion, but I don't mind that one as much (I don't think changing it leads to significantly less lines of code).

True, most of the tests instantiate Plugins directly, instead of scheduler CC.

@Huang-Wei
Copy link
Member

/retest

@k8s-ci-robot k8s-ci-robot merged commit 838bb6a into kubernetes:master Feb 10, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Feb 10, 2021
@gavinfish gavinfish deleted the sched-remove-plugin-pt branch February 11, 2021 12:52
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

config.Plugins should not be composed of pointers
5 participants