Skip to content

do not conversion-gen v1alpha3.OSDisk due to warning message non-determinism#1368

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
devigned:patch-conversion-gen
May 6, 2021
Merged

do not conversion-gen v1alpha3.OSDisk due to warning message non-determinism#1368
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
devigned:patch-conversion-gen

Conversation

@devigned
Copy link
Copy Markdown
Contributor

@devigned devigned commented May 5, 2021

What type of PR is this?

/kind bug

What this PR does / why we need it:

When conversion-gen runs outside of the GOPATH, it will generate some resources with ./api/v1alpha3.TypeName rather than the full import path of the resource sigs.k8s.io/cluster-api-provider-azure/api/v1alpha3.TypeName. This seems to work fine when running conversion-gen in the GOPATH.

#1300 and #1332 are running into this issue. It seems to have started with #1321, but I don't see any evidence that the issue should be caused by anything in that change set.

I do not see a clear cause for why this is happening, and after a messing around with each of the flags for conversion-gen, I've thrown up my hands and just used sed to manipulate the conversion-gen output. I'm not super proud, but it will fix the problem until we find a better solution.

Due to OSDisk and DataDisk needing *ManageDisk and ManagedDisk conversions which would require the same conversion func name with two different signatures, conversion-gen warns that manual conversion is needed, which #1321 properly handled. This PR tells conversion-gen not to generate conversions for OSDisk and handles the conversion in the custom converter func for OSDisk, which eliminates the warning message with the relative path.

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

manually convert `OSDisk.ManagedDisk` to eliminate a non-deterministic warning from conversion-gen due to generating code outside of the GOPATH.

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/provider/azure Issues or PRs related to azure provider sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. labels May 5, 2021
@k8s-ci-robot k8s-ci-robot requested review from cpanato and juan-lee May 5, 2021 19:26
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 5, 2021
@devigned devigned requested review from CecileRobertMichon and removed request for cpanato and juan-lee May 5, 2021 19:26
@CecileRobertMichon
Copy link
Copy Markdown
Contributor

/hold

we are looking into fixing this another way

@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 May 5, 2021
@devigned devigned force-pushed the patch-conversion-gen branch from 629f2ea to e3488e0 Compare May 5, 2021 21:18
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 5, 2021
@devigned devigned changed the title normalize conversion-gen relative dir output when outside of GOPATH do not conversion-gen v1alpha3.OSDisk due to warning message non-determinism May 5, 2021
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels May 5, 2021
Comment thread api/v1alpha3/types.go
@devigned devigned force-pushed the patch-conversion-gen branch from e3488e0 to d6a69a5 Compare May 5, 2021 21:51
Comment thread api/v1alpha3/types.go
// WARNING: this requires any updates to ManagedDisk to be manually converted. This is due to the odd issue with
// conversion-gen where the warning message generated uses a relative directory import rather than the fully
// qualified import when generating outside of the GOPATH.
// +k8s:conversion-gen=false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need // +k8s:conversion-gen=false so it doesn't generate autoConvert_v1alpha3_OSDisk_To_v1alpha4_OSDisk ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is precisely what +k8s:conversion-gen=false does.

@CecileRobertMichon
Copy link
Copy Markdown
Contributor

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon

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

The pull request process is described here

Details 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

@CecileRobertMichon
Copy link
Copy Markdown
Contributor

/hold cancel

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels May 5, 2021
@devigned
Copy link
Copy Markdown
Contributor Author

devigned commented May 5, 2021

/retest

@k8s-ci-robot k8s-ci-robot merged commit f4704bf into kubernetes-sigs:master May 6, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.5.0 milestone May 6, 2021
@devigned devigned deleted the patch-conversion-gen branch May 6, 2021 02:22
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/provider/azure Issues or PRs related to azure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. 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.

3 participants