Skip to content

go modules adoption checklist #68577

Closed
Closed

Description

@sigma

/kind feature

Description:

This issue is to track the list of issues for a go modules (aka vgo) adoption. The list itself is a work in progress, and will be updated as issues popup or get resolved.

First class of issues: the current godep snapshot of packages is not a valid solution as far as go modules are concerned

This list needs to be empty to actually perform the migration. Post-migration, the burden will move to the dependency update workflow (similar issues will block the update).

Some more issues are to be expected, due to mainly 2 factors:

  • go modules reason about test dependencies in addition to "regular" dependencies, which we currently completely ignore
  • a large chunk of our dependencies are not versioned at all, meaning that no semver guarantees apply. It'll be easy to get incompatibilities once our dependencies start using go modules themselves.

Second class of issues: tooling needed

  • it takes a non-negligible amount of effort to convince go to vendor everything we need at the top-level in k/k, given that some of our dependencies are actually only used by our staging sub-projects.
  • since go modules don't track modifications at the sub-package level, we need to maintain Godeps.json files for a while, and there's no official tooling for that.
  • our go modules dependencies need to be kept in sync across k/k and all staging repos.

https://github.com/sigma/vgo-k8s-tools has some (ugly) code to address all these, but is very much a work in progress

Third class of issues: go modules usability

  • extremely opaque about what it does, and why. Took me some grepping the cache to understand why golang.org/x/exp was bumped in the first place in gonum.org/v1/gonum module conflicts with use of golang.org/x/exp/inotify #68478. With our kind of dependency graph complexity, lack of clarity is hard to handle.
  • we'll still need some scripting around go modules to maintain our dependency graph. Hopefully that should be after running regular module operations in the main or staging repos.

Activity

  1. added
    kind/featureCategorizes issue or PR as related to a new feature.
    needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.
    on Sep 12, 2018
  2. sigma commented on Sep 12, 2018

    @sigma
    ContributorAuthor

    @kubernetes/sig-testing-proposals

  3. added
    sig/testingCategorizes an issue or PR as relevant to SIG Testing.
    kind/designCategorizes issue or PR as related to design.
    and removed
    needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.
    on Sep 12, 2018
  4. k8s-ci-robot commented on Sep 12, 2018

    @k8s-ci-robot
    Contributor

    @sigma: Reiterating the mentions to trigger a notification:
    @kubernetes/sig-testing-proposals

    Details

    In response to this:

    @kubernetes/sig-testing-proposals

    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.

  5. BenTheElder commented on Sep 12, 2018

    @BenTheElder
    Member

    /cc

  6. spiffxp commented on Sep 12, 2018

    @spiffxp
    Contributor

    FYI @kubernetes/sig-architecture-proposals

  7. bgrant0607 commented on Sep 13, 2018

    @bgrant0607
    Member
  8. lavalamp commented on Sep 13, 2018

    @lavalamp
    Contributor

    Excited to have someone looking at this!

  9. sdboyer commented on Sep 28, 2018

    @sdboyer

    It's worth noting that the path of least resistance (to the module system) will ultimately be to treat each currently-discrete staging repo as its own go module, and abandon the separate staging repos entirely.

    ive also been thinking about how useful some kind of declaration would be to automatically treat all imports under a particular root as though there were a local replace declaration. As the number of Go modules within k8s increases, this will be increasingly useful, as it will obviate the need to litter replace statements everywhere.

  10. sigma commented on Sep 28, 2018

    @sigma
    ContributorAuthor

    a few thoughts:

    • I don't know that the organization of the repo is the main issue. I think the higher-level problem is that we need those modules to be kept in sync (in terms of dependency graph) regardless of whether they live in the same repo or not, short of changing our support model. And there's just very little tooling support for doing that right now
    • somehow the maintenance of the replace directives doesn't worry me so much, as it's one thing that we can pretty easily automate. But sure, a shortcut would be nicer.
  11. sdboyer commented on Sep 28, 2018

    @sdboyer

    I'd say keeping deps in sync is somewhat orthogonal to module nesting - given that everything is already developed in a single repo, you avoid a whole class of drift problems. My point was more that you have

    idk what assumptions tooling make about having those separate repos because idk the tooling. my naive view is that it should be a fairly simple removal: pick a new import path within k/k for staging contents, move the dirs, add go.mod files, and update import paths. the other repos can then just go away; there might also be some redirect magic possible.

    My concern with replace directives is having multiple PRs batches together for CI that both change replaces: an automated solution MAY be possible, but it would certainly require a fixup commit at the very least.

    Having it declared once makes that easier. It also may make release prep easier - certainly less to clean up, but it also might be feasible to keep require statements more up to date throughout development. (I haven't thought this latter point through fully)

  12. 5 remaining items

  13. ixdy commented on Feb 6, 2019

    @ixdy
    Contributor
  14. sigma commented on Feb 6, 2019

    @sigma
    ContributorAuthor

    As far as I'm concerned, I'm still waiting on heketi/heketi#1272 to be merged.

    I would add that the difficulty of getting those ducks in a row seems like a systemic problem in the go modules approach. I'm not quite sure the incentives are stacked the right way.

  15. andreykaipov commented on Feb 20, 2019

    @andreykaipov

    Sorry for my ignorance, but as someone fairly new to Go and Kubernetes, what's the problem with just running go mod init? I cloned this repo outside my GOPATH, ran go mod init, Go found what it needed from the Godeps, and boom - make worked with no issue and I didn't even cry once. I was shocked it worked so smoothly.

    Go modules are experimental in Go 1.11, but would having a go.mod and go.sum in the root directory of the project really affect anything dependent on just Godep? Why not just add support for it now?

  16. BenTheElder commented on Feb 20, 2019

    @BenTheElder
    Member

    Go modules are experimental in Go 1.11, but would having a go.mod and go.sum in the root directory of the project really affect anything dependent on just Godep? Why not just add support for it now?

    Yes it can affect them, adding a go.mod (previously on accident) broke some tooling that depends on Kubernetes being findable in GOPATH, it couldn't query the package location anymore. Many tools in & out of the repo depend on GOPATH pretty heavily unfortunately, we need to disentangle that.

    We also shouldn't check it in unless we're going to keep it up to date, so we need to update all the godeps scripts / presubmit(s) and the docs.

    We also need to consider the publishing robot for staging/, the cross build container, if we will retain vendor/ (and if not if we will run a module proxy to avoid CI flakiness).

    We've started using go modules for some other smaller sub-projects, and ran into bugs with the checksums (they should and to seem to be fixed in >= go 1.11.4 now) ... it's probably worth shaking out the issues in these smaller projects first and letting it become stable before we switch the main repo.

  17. BenTheElder commented on Feb 20, 2019

    @BenTheElder
    Member

    With go1.12 coming soon it has to be about time, but I don't think we have all of those things figured out just yet.

    cc @cblecker @dims

  18. sigma commented on Feb 20, 2019

    @sigma
    ContributorAuthor

    Sorry for my ignorance, but as someone fairly new to Go and Kubernetes, what's the problem with just running go mod init? I cloned this repo outside my GOPATH, ran go mod init, Go found what it needed from the Godeps, and boom - make worked with no issue and I didn't even cry once. I was shocked it worked so smoothly.

    This is a bit misleading. It seems to work, but builds the wrong thing because staging/ is then ignored as the source of many of the k8s.io packages. Basically this allows go mod to reason about a much looser dependency graph, and ultimately claim "victory". When you enforce actual alignment of the dependency graph is when problems above start showing up.

  19. danielqsj commented on Feb 21, 2019

    @danielqsj
    Contributor

    /cc

  20. munnerz commented on Mar 2, 2019

    @munnerz
    Member

    I've opened heketi/heketi#1542 against heketi/heketi that bumps Kubernetes dependencies to client-go 1.10 😄 hopefully that's sufficiently new to have compatibility with the HEAD of kubernetes/kubernetes at the moment, but at the very least it'll make it far easier to bump again in future.

    edit: this seems to build fine: https://github.com/kubernetes/kubernetes/compare/master...munnerz:bump-heketi?expand=1

  21. self-assigned this
    on Mar 19, 2019
  22. liggitt commented on Mar 20, 2019

    @liggitt
    Member

    I'm writing up a KEP for the 1.15 release for this here: kubernetes/enhancements#908

    I also have a WIP PR that uses go mod vendor to rebuild the vendor dir, populates go.mod files for each staging repo as a module.

    The biggest unresolved question is what versioning strategy to use for the modules. Options are described in the KEP

  23. liggitt commented on Mar 28, 2019

    @liggitt
    Member

    Accepted proposal for initial go module support is at https://github.com/kubernetes/enhancements/blob/master/keps/sig-architecture/2019-03-19-go-modules.md

    #74877 contains the changes needed to reproducibly generate the vendor dir using go modules

    kubernetes/publishing-bot#169 is a WIP PR to publish go.mod files for staging component

  24. liggitt commented on Apr 6, 2019

    @liggitt
    Member

    #74877 is merged and kubernetes/kubernetes vendoring is now managed using go modules

    /close

  25. k8s-ci-robot commented on Apr 6, 2019

    @k8s-ci-robot
    Contributor

    @liggitt: Closing this issue.

    Details

    In response to this:

    #74877 is merged and kubernetes/kubernetes vendoring is now managed using go modules

    /close

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/designCategorizes issue or PR as related to design.kind/featureCategorizes issue or PR as related to a new feature.sig/architectureCategorizes an issue or PR as relevant to SIG Architecture.sig/testingCategorizes an issue or PR as relevant to SIG Testing.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions