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

move to go.mod #47

Merged
merged 3 commits into from
Mar 20, 2020
Merged

move to go.mod #47

merged 3 commits into from
Mar 20, 2020

Conversation

sanchezl
Copy link
Contributor

@sanchezl sanchezl commented Nov 4, 2019

  • go mod init
  • go mod vendor

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 4, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @sanchezl. 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 k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 4, 2019
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 4, 2019
@caesarxuchao
Copy link
Member

Why are there changes in the vendor/ folder? I expect with #41 already merged, this PR will not change the vendor/ folder.

@sanchezl
Copy link
Contributor Author

sanchezl commented Nov 5, 2019

Why are there changes in the vendor/ folder? I expect with #41 already merged, this PR will not change the vendor/ folder.

go mod vendor has different algorithms for deciding what to actually vendor (copies source in packages, not entire modules) and 2) might resolve dependencies differently (but I pinned the dependencies explicitly pinned before).

@deads2k
Copy link

deads2k commented Nov 6, 2019

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 6, 2019
go.mod Outdated
k8s.io/kube-aggregator v0.0.0-kubernetes-1.16.2
)

replace (
Copy link
Member

Choose a reason for hiding this comment

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

Is the "replace" section manually edited? Why are the specific revisions used here, instead of v0.0.0-kubernetes-1.16.2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the replace section is manually edited.

go.mod does not allow you to specify a branch or non-semver tag. If you are not using a semver tag (e.g. v1.0.0), which kubernetes does not at the moment, you must use a revision, and that is converted to a pseudo-version. Unfortunately, when you run certain go commands (such as go build), there is a chance that the pseudo version will be replaced with the latest from master. So...

  1. I set the k8s.io/* dependencies to a pseudo version of v0.0.0-kubernetes-1.16.2. The format accomplishes two things: 1. go sees it as a pseudo-version and 2. the kubernetes-1.16.2 part is a reminder of what I really want to require.
  2. Adding replace entries for k8s.io/* entries accomplishes the following: 1. the psedu-version in the require section is ignored, and 2. The revision of the k8s.io/* module is effectively pinned and won't change unless explicitly updated.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation.

If making "v0.0.0-kubernetes-1.16.2" a pseudo version isn't a common practice, can you document the purpose in comments?

In the future, when we need to bump the version of k8s.io/*, I think we need to manually edit the "require" section and the "replace" section, right?

Unfortunately, when you run certain go commands (such as go build), there is a chance that the pseudo version will be replaced with the latest from master

Can you say what commands exactly?
Anyhow, if we just use the revision based pseudo-version generated by go, it's not obvious what tag the revision matches to.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's do the 1.17 port soon. It has proper semver tags.

@@ -0,0 +1,34 @@
module github.com/kubernetes-sigs/kube-storage-version-migrator
Copy link
Member

Choose a reason for hiding this comment

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

switch to "sig.k8s.io"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will do that in a separate PR.

Copy link

Choose a reason for hiding this comment

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

@sanchezl it's a small thing and it's been two months.

Copy link

Choose a reason for hiding this comment

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

@sanchezl it's a small thing and it's been two months.

there's a PR open #46 .

@sanchezl
Copy link
Contributor Author

/test pull-kube-storage-version-migrator-disruptive

@sanchezl sanchezl force-pushed the sigs-go.mod branch 5 times, most recently from 1063503 to 42d6edb Compare December 21, 2019 05:50
@sanchezl sanchezl force-pushed the sigs-go.mod branch 3 times, most recently from 3956ca8 to c3307cd Compare January 10, 2020 21:27
@sanchezl
Copy link
Contributor Author

/retest

1 similar comment
@caesarxuchao
Copy link
Member

/retest

@sanchezl sanchezl force-pushed the sigs-go.mod branch 3 times, most recently from ae4e310 to 657a724 Compare January 21, 2020 19:43
@sanchezl
Copy link
Contributor Author

/test pull-kube-storage-version-migrator-disruptive

@sanchezl
Copy link
Contributor Author

/test pull-kube-storage-version-migrator-disruptive

@caesarxuchao
Copy link
Member

when listing resources, if a Not Found (404) error happens here (e.g. bad gvr), migrator will loop here forever (I added an IsNotFound check here to fail the migration).

@sanchezl thanks for the investigation. Can you say more about this bug? Is it stuck at this line? Is the storage migrator handling a k8s native resource or a CRD?

@sanchezl
Copy link
Contributor Author

when listing resources, if a Not Found (404) error happens here (e.g. bad gvr), migrator will loop here forever (I added an IsNotFound check here to fail the migration).

@sanchezl thanks for the investigation. Can you say more about this bug? Is it stuck at this line? Is the storage migrator handling a k8s native resource or a CRD?

This particular bug does not happen in any of the tests in this repo. I found it when testing on my own clusters and accidentally providing invalid GVRs.

@sanchezl
Copy link
Contributor Author

/retest

1 similar comment
@sanchezl
Copy link
Contributor Author

/retest

@sanchezl
Copy link
Contributor Author

sanchezl commented Feb 17, 2020

@caesarxuchao , @deads2k PTAL, I've finally gotten the tests to run consistently.
https://prow.k8s.io/pr-history/?org=kubernetes-sigs&repo=kube-storage-version-migrator&pr=47

@sanchezl
Copy link
Contributor Author

/retest

metrics.Metrics.ObserveFailedMigration(resource(m).String())
return err
klog.Errorf("%v: migration failed: %v", m.Name, err)
return updateErr
Copy link

Choose a reason for hiding this comment

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

thi sis a change in behavior. Why shouldn't we return the failure when we failed. This allows us to return nil after having an error. If this is correct, add comment explaining why.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did not intend to change behavior. Any recommendations for handling the updateErr ?
Please comment at #58 instead.

@sttts
Copy link
Contributor

sttts commented Mar 12, 2020

We import sigs.k8s.io/structured-merge-diff via versioned imports. This breaks the use of dep. We need this now.

@caesarxuchao
Copy link
Member

/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 Mar 20, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: caesarxuchao, deads2k, sanchezl, sttts

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:
  • OWNERS [caesarxuchao,deads2k]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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