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
Scheduler: change config.Plugins from pointers to objects #98663
Conversation
@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 The 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. |
e07610b
to
a0628ac
Compare
a0628ac
to
82cad2e
Compare
/retest |
1 similar comment
/retest |
82cad2e
to
0a409e6
Compare
/test pull-kubernetes-verify |
0a409e6
to
264832a
Compare
/test pull-kubernetes-bazel-test |
/assign @alculquicondor |
There was a problem hiding this 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{}, |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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{}, |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
72c2a8e
to
5e979f5
Compare
/test pull-kubernetes-bazel-test |
/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 { |
There was a problem hiding this comment.
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)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, sure.
/approve good for squash |
fcd281d
to
74315f9
Compare
squashed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/lgtm
Thanks!
[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 |
/retest Review the full test history for this PR. Silence the bot with an |
LGTM. @alculquicondor Given that having a concrete value in internal API is a good practice, do we plan to change the internal kubernetes/pkg/scheduler/apis/config/types.go Line 123 in a1e310b
|
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. |
True, most of the tests instantiate Plugins directly, instead of scheduler CC. |
/retest |
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?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: