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

Bug 1801357: Migrate from glide to go modules #102

Merged

Conversation

juanluisvaladas
Copy link
Contributor

@juanluisvaladas juanluisvaladas commented Feb 4, 2020

Migrate from glide to go modules

It was mandatory to migrate to go modules due to syntax incompatibility
on the sigs.k8s.io-structured-merge-diff module definition. Besides
this incompatibility, it was a matter of time until we found more
problems and glide is abandoned at this stage.

There are a few non obvious things going on:

  • go.mod: Unnecessary large, however, to avoid changing dependencies
    some stuff it was necessary to add some stuff that normally
    wouldn't make sense. After the 1.17 rebase it'll be cleaner.
    There is a require and replace discrepancy on
    github.com/miekg/dns. This is because go mod tidy modifies
    the require because one dependency asks for a newer version.
    The k8s.io/ packages are replaced beacuse this issue:
    cmd/go: go mod -vendor prunes non-package directories golang/go#26366

  • pkg/dependencymagnet: go mod vendor won't actually pull a module
    unless it's required by some go code. We need to explictly
    add dependencies on a fake moduleso that we can actually
    build.

  • Removed files: go mod vendor removes unnecessary files, lots of
    files have been removed, but those shouldn't be required at
    all.

  • Updated github.com/openshift/library-go: The version we were using
    was incompatible with go mod. So I updated to the latest.

  • Makefile: export GO111MODULE=on library go runs some stuff with
    -mod=vendor. Prior to go 1.13 this environment variable
    is mandatory for it to work.
    Additionally we need to explictly define
    GO_BUILD_PACKAGES_EXPANDED for the same reason.
    we need to add unxeport GOPATH and export GOPROXY are
    necessary due to some odd behavior with go get modernc.org/.
    The queries to this domain ultimately get converted to
    https://gitlab.com/cznic/
    and go tries to run
    git clone https://gitlab.com/cznic/*
    instead of
    git clone https://gitlab.com/cznic/*.git.
    For some reason adding these two variables fixes it.

  • patch directory: We needed to patch a single file in the netlink
    library. This is the most similar solution to glide.diff I
    could find. It's not elegant and doesn't scale well, but
    since we are only patching one file in one library it's
    not so terrible.

  • HACKING.md: This document is now outdated, it wil be updated after
    the 1.17 rebase.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 4, 2020
@juanluisvaladas
Copy link
Contributor Author

/hold

This is missing the glide.diff fix, I want to see if it passess the tests first and I'll deal with that later.

@openshift-ci-robot openshift-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 4, 2020
@juanluisvaladas juanluisvaladas force-pushed the migrate-go-mod branch 3 times, most recently from 0b493e2 to 2d52f90 Compare February 4, 2020 15:31
@juanluisvaladas
Copy link
Contributor Author

/test verify-deps

Doesn't look like a legit failure

@juanluisvaladas
Copy link
Contributor Author

/retest

@juanluisvaladas juanluisvaladas changed the title [wip] Migrate from glide to go modules Migrate from glide to go modules Feb 4, 2020
@openshift-ci-robot openshift-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 4, 2020
@juanluisvaladas
Copy link
Contributor Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 4, 2020
@juanluisvaladas
Copy link
Contributor Author

I'm particularly concerned about the patch, directory, I'm quite unhappy about this solution...

@juanluisvaladas
Copy link
Contributor Author

/retest

@juanluisvaladas juanluisvaladas force-pushed the migrate-go-mod branch 4 times, most recently from 2f1d266 to c6d5616 Compare February 5, 2020 16:41
@juanluisvaladas
Copy link
Contributor Author

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 5, 2020
@juanluisvaladas
Copy link
Contributor Author

/retest

@juanluisvaladas juanluisvaladas force-pushed the migrate-go-mod branch 3 times, most recently from 9cf2090 to 02538b7 Compare February 5, 2020 20:00
@juanluisvaladas
Copy link
Contributor Author

/retest

1 similar comment
@juanluisvaladas
Copy link
Contributor Author

/retest

Copy link
Contributor

@pecameron pecameron left a comment

Choose a reason for hiding this comment

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

Do we need this file: netlink/.travis.yml?
generally looks good to me.

It was mandatory to migrate to go modules due to syntax incompatibility
on the sigs.k8s.io-structured-merge-diff module definition. Besides
this incompatibility, it was a matter of time until we found more
problems and glide is abandoned at this stage.

There are a few non obvious things going on:

* go.mod: Unnecessary large, however, to avoid changing dependencies
          some stuff it was necessary to add some stuff that normally
          wouldn't make sense. After the 1.17 rebase it'll be cleaner.
          There is a require and replace discrepancy on
          github.com/miekg/dns. This is because go mod tidy modifies
          the require because one dependency asks for a newer version.
          The k8s.io/ packages are replaced beacuse this issue:
          golang/go#26366

* pkg/dependencymagnet: go mod vendor won't actually pull a module
          unless it's required by some go code. We need to explictly
          add dependencies on a fake moduleso that we can actually
          build.

* Removed files: go mod vendor removes unnecessary files, lots of
          files have been removed, but those shouldn't be required at
          all.

* Updated github.com/openshift/library-go: The version we were using
          was incompatible with go mod. So I updated to the latest.

* Makefile: export GO111MODULE=on library go runs some stuff with
          -mod=vendor. Prior to go 1.13 this environment variable
          is mandatory for it to work.
          Additionally we need to explictly define
          GO_BUILD_PACKAGES_EXPANDED for the same reason.
          we need to add unxeport GOPATH and export GOPROXY are
          necessary due to some odd behavior with go get modernc.org/*.
          The queries to this domain ultimately get converted to
          https://gitlab.com/cznic/* and go tries to run
          git clone https://gitlab.com/cznic/*
          instead of
          git clone https://gitlab.com/cznic/*.git.
          For some reason adding these two variables fixes it.

* patch directory: We needed to patch a single file in the netlink
          library. This is the most similar solution to glide.diff I
          could find. It's not elegant and doesn't scale well, but
          since we are only patching one file in one library it's
          not so terrible.

* HACKING.md: This document is now outdated, it wil be updated after
          the 1.17 rebase.
@juanluisvaladas
Copy link
Contributor Author

I guess we can remove that, I removed all non go files and tests. Needs to pass tests again, particularly the make verify-deps, but it should be fine.

@danwinship
Copy link
Contributor

* patch directory: We needed to patch a single file in the netlink
  library.

You can just update the vishvananda/netlink dep to v1.1.0. At the time we first took the fix we didn't want to update to a random git master SHA because we might have ended up getting new bugs along with the bugfix, but now there's been an official release containing the fix we need, so we can just take that.

Other than that, I think this seems OK? Ugh, vendoring. Sigh.

@juanluisvaladas
Copy link
Contributor Author

Regarding upgrading the netlink library, kube-proxy has github.com/docker/libnetwork/ipvs as a dependency and this has this lines:
https://github.com/docker/libnetwork/blob/master/ipvs/netlink.go#L220
Which is incompatible with v1.1.0 because now this function signature has changed and returns 3 arguments.
https://github.com/vishvananda/netlink/blob/v1.1.0/nl/nl_linux.go#L625

I could try to upgrade github.com/docker/libnetwork upstream to v1.1.0 but even if they accepted it, that would take some time.

@juanluisvaladas
Copy link
Contributor Author

/retest

@danwinship
Copy link
Contributor

blah. ok

btw, as seen in the github status, this needs bugzilla/valid-bug, meaning you need to create a bug targeted at 4.4 to go with this

@juanluisvaladas
Copy link
Contributor Author

/retitle Bug 1801357: Migrate from glide to go modules
/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 10, 2020
@openshift-ci-robot openshift-ci-robot changed the title Migrate from glide to go modules Bug 1801357: Migrate from glide to go modules Feb 10, 2020
@openshift-ci-robot
Copy link
Contributor

@juanluisvaladas: This pull request references Bugzilla bug 1801357, which is invalid:

  • expected the bug to target the "4.4.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1801357: Migrate from glide to go modules

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.

@openshift-ci-robot openshift-ci-robot added the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Feb 10, 2020
@juanluisvaladas
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Feb 10, 2020
@openshift-ci-robot
Copy link
Contributor

@juanluisvaladas: This pull request references Bugzilla bug 1801357, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

/bugzilla refresh

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.

@juanluisvaladas
Copy link
Contributor Author

@danwinship can you approve it?

@danwinship
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 10, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danwinship, juanluisvaladas

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

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

/retest

@openshift-merge-robot openshift-merge-robot merged commit 6fde59e into openshift:master Feb 10, 2020
@openshift-ci-robot
Copy link
Contributor

@juanluisvaladas: All pull requests linked via external trackers have merged. Bugzilla bug 1801357 has been moved to the MODIFIED state.

In response to this:

Bug 1801357: Migrate from glide to go modules

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
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants