scheduler-plugins icon indicating copy to clipboard operation
scheduler-plugins copied to clipboard

nrt: api: add manual conversion

Open ffromani opened this issue 3 years ago • 9 comments

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

if we try to run hack/update-codegen.sh, for example to add new fields to the NodeTopologyMatchArgs, we get this message:

E0915 14:12:39.348208  143048 conversion.go:755] Warning: could not find nor generate a final Conversion function for sigs.k8s.io/scheduler-plugins/apis/config/v1beta2.NodeResourceTopologyMatchArgs -> sigs.k8s.io/scheduler-plugins/apis/config.NodeResourceTopologyMatchArgs
E0915 14:12:39.348248  143048 conversion.go:756]   the following fields need manual conversion:
E0915 14:12:39.348252  143048 conversion.go:758]       - ScoringStrategy

After closer inspection, the current conversion code for ScoringStrategy was added to the autogenerated code: https://github.com/kubernetes-sigs/scheduler-plugins/blob/v0.23.10/apis/config/v1beta3/zz_generated.conversion.go#L233

This works, but it's a bit fragile, because attempting to regenerate the conversion will fail - no conversion will be generated, and the manually added code will be lost.

In order to improve, and to avoid changing the existing API, we add manually generated conversion code, which is simple and repetitive enough, and can still leverage some autogenerated helpers.

Which issue(s) this PR fixes:

Fixes N/A

Special notes for your reviewer:

NONE

ffromani avatar Sep 15 '22 12:09 ffromani

Hi @fromanirh. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 avatar Sep 15 '22 12:09 k8s-ci-robot

/release-note none

ffromani avatar Sep 15 '22 12:09 ffromani

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fromanirh Once this PR has been reviewed and has the lgtm label, please assign ahg-g for approval by writing /assign @ahg-g in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 avatar Sep 15 '22 12:09 k8s-ci-robot

/release-note-none

ffromani avatar Sep 15 '22 12:09 ffromani

/cc @Tal-or @swatisehgal

ffromani avatar Sep 15 '22 12:09 ffromani

@fromanirh: GitHub didn't allow me to request PR reviews from the following users: Tal-or.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @Tal-or @swatisehgal

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 avatar Sep 15 '22 12:09 k8s-ci-robot

/lgtm Thanks for the PR!

/assign @Huang-Wei for approval

swatisehgal avatar Sep 19 '22 11:09 swatisehgal

/lgtm Thanks for the PR!

/assign @Huang-Wei for approval

can I also get ok-to-test please? :)

ffromani avatar Sep 19 '22 11:09 ffromani

/ok-to-test

swatisehgal avatar Sep 19 '22 11:09 swatisehgal

superceded by https://github.com/kubernetes-sigs/scheduler-plugins/pull/438

ffromani avatar Oct 20 '22 15:10 ffromani