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

Update a few dependencies #69976

Merged
merged 1 commit into from
Nov 2, 2018

Conversation

ash2k
Copy link
Member

@ash2k ash2k commented Oct 18, 2018

What type of PR is this?
/kind cleanup
/sig api-machinery

What this PR does / why we need it:
I'm trying to use the exact same versions of libraries that Kubernetes uses and it turned out that a few of the dependencies are significantly older than the versions I use atm. I discovered that because a few of my tests started to fail because of "regression" - bugs were fixed in newer versions but not in the versions kubernetes uses. So I decided to update the kubernetes versions.

These are the dependencies with the issues that are resolved for me in newer versions:
github.com/go-openapi/* <- new fields in some structs were added which I need
github.com/asaskevich/govalidator <- supports stricter validation of URLs
github.com/ghodss/yaml <- bug with pointer struct unmarshalling

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/apiserver area/code-generation labels Oct 18, 2018
@fedebongio
Copy link
Contributor

/assign @lavalamp

@ash2k
Copy link
Member Author

ash2k commented Oct 18, 2018

/retest

@ash2k
Copy link
Member Author

ash2k commented Oct 18, 2018

/assign sttts

@lavalamp
Copy link
Member

I thought the yaml package got updated recently? Maybe that's still in flight?

I'm not convinced by this justification for the other two updates. And why is mgo getting pulled in now?

@ash2k
Copy link
Member Author

ash2k commented Oct 19, 2018

I thought the yaml package got updated recently? Maybe that's still in flight?

#67594 This PR is not updating godeps.json though. And that is probably the reason builds are failing there. I was not aware it is there.

I'm not convinced by this justification for the other two updates.

What is the usual justification to get a dependency updated? (frankly, I was not expecting this PR to face any "resistance"...). Is that process documented somewhere?

Looks like github.com/go-openapi versions are from the middle of 2016. I could imagine there've been some bugfixes since then. If it was perfect, no changes would have been made.

github.com/asaskevich/govalidator - Jul 2016 version. There've been 170 commits since then.

And why is mgo getting pulled in now?

It is a dependency of github.com/go-openapi/strfmt. I was following the instructions to get to this state.

What worries you re. this PR? Potential regressions or something else too?

@ash2k
Copy link
Member Author

ash2k commented Oct 23, 2018

fyi @dims

@dims
Copy link
Member

dims commented Oct 23, 2018

@ash2k is the list of the packages in the commit message correct? here's what i see in the patch and i don't see ghodss/yaml

10 +++ b/vendor/github.com/asaskevich
22 +++ b/vendor/github.com/globalsign
133 +++ b/vendor/github.com/go-openapi

@dims
Copy link
Member

dims commented Oct 23, 2018

related to #69776

@dims
Copy link
Member

dims commented Oct 23, 2018

@ash2k the main concern would be "what was working before but will not work anymore", just identifying the possible scenarios, so we can figure out if we can tolerate it or need to document it or work around it.

@nikhita
Copy link
Member

nikhita commented Oct 23, 2018

the main concern would be "what was working before but will not work anymore",

I think go-openapi added some changes that could be concerning for custom resource validation, but I'll double-check to be sure.

Having said that, there are a few problems with the current vendored go-openapi that I know of. I'll be sending a fix upstream for those problems, and maybe we could update the vendored go-openapi then (or I'll do a bump again later if it takes time merging the upstream PR).

@ash2k
Copy link
Member Author

ash2k commented Oct 23, 2018

@dims

is the list of the packages in the commit message correct? here's what i see in the patch and i don't see ghodss/yaml

Turns out #69627 updated ghodss/yaml to the latest commit. I missed this fact because I was using release-1.12 branch as the latest released one and assumed that master has the same old version too. I'll amend the commit message and the issue description to avoid confusion.

the main concern would be "what was working before but will not work anymore", just identifying the possible scenarios, so we can figure out if we can tolerate it or need to document it or work around it.

I'm not sure how to proceed with this PR 🤷‍♂️ If all tests pass then... how else can we ensure it is all good?

@dims
Copy link
Member

dims commented Oct 23, 2018

@ash2k great question :)

How about enumerating what you saw? few of my tests started to fail because of "regression" - bugs were fixed in newer versions but not in the versions kubernetes uses any details on the test and/or the PR(s) that "probably" fixed the problem

Thanks,
Dims

@@ -1,6 +1,6 @@
{
"ImportPath": "k8s.io/kubernetes",
"GoVersion": "go1.10",
"GoVersion": "go1.11",
Copy link
Member

Choose a reason for hiding this comment

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

I think it's ok to bump this version now, but maybe @ixdy can confirm.

Copy link
Member

Choose a reason for hiding this comment

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

I think this field is automatically filled in by godep based on what version of the runtime it's using. it's pretty meaningless.

@@ -1351,132 +1351,132 @@
},
{
"ImportPath": "github.com/docker/docker/api",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9510-ga9fbbdc8d",
"Comment": "docs-v1.12.0-rc4-2016-07-15-9510-ga9fbbdc8dd",
Copy link
Member

Choose a reason for hiding this comment

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

Also @ixdy do you know why the extra d is getting appended here? I have a vendor change that is doing the same thing and I don't know why.

Copy link
Member

Choose a reason for hiding this comment

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

I have no idea how godep decides how to truncate the git commit. it might be a git setting, it might be something else. godep is terrible.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's just using git describe --tags.

The manpage for git describe notes

Note that the suffix you get if you type these commands today may be longer than what Linus saw above when he ran these commands, as your Git repository may have new commits whose object names begin with 975b that did not exist back then, and "-g975b" suffix alone may not be sufficient to disambiguate these commits.

so I guess this is WAI? 🤷‍♂️

Copy link
Member

Choose a reason for hiding this comment

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

I remember discussing about this with @cblecker somewhere but can't find the issue now... 🤷‍♀️

Copy link
Member

Choose a reason for hiding this comment

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

it has to do with the git version you're running locally. at a certain point, the default changed for git describe

see tools/godep#560 for more details. This PR to fix it was opened, but that happened after godep stopped active development.

Copy link
Member

Choose a reason for hiding this comment

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

+1 to not include the changes that update the comment with just one more character or one less character for the SHA

Copy link
Member

Choose a reason for hiding this comment

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

We could also just scrub all comments from the file. That's what we do with the staging-godeps script

Copy link
Member

Choose a reason for hiding this comment

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

We probably should. This is getting stupid.

Copy link
Member

Choose a reason for hiding this comment

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

+1 to scrub all comments from the file

Copy link
Member

Choose a reason for hiding this comment

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

submit a PR to address this: #70687

@lavalamp
Copy link
Member

To be clear, my concern is just that we don't unnecessarily expand the dependency list. I'm not super happy that we're importing mgo/bson after this change. I'm not sure there's anything to be done about it :( But every new dependency makes things a tiny bit worse for every consumer of kubernetes.

Regressions should be caught by tests, I'm not worried about that.

@ash2k
Copy link
Member Author

ash2k commented Oct 23, 2018

@dims

How about enumerating what you saw?

We use go-swagger to generate a client for one of our services. It generates code that uses github.com/go-openapi/runtime. Here is the diff of one of the files the generated code depends on. It needs the fields that are not present in the older version kubernetes uses. Here is the diff kube version vs wanted version:

diff --git a/vendor/github.com/go-openapi/runtime/client_operation.go b/vendor/github.com/go-openapi/runtime/client_operation.go
index fa21eacf3..421f726c5 100644
--- a/vendor/github.com/go-openapi/runtime/client_operation.go
+++ b/vendor/github.com/go-openapi/runtime/client_operation.go
@@ -14,11 +14,6 @@
 
 package runtime
 
-import (
-	"context"
-	"net/http"
-)
-
 // ClientOperation represents the context for a swagger operation to be submitted to the transport
 type ClientOperation struct {
 	ID                 string
@@ -30,8 +25,6 @@ type ClientOperation struct {
 	AuthInfo           ClientAuthInfoWriter
 	Params             ClientRequestWriter
 	Reader             ClientResponseReader
-	Context            context.Context
-	Client             *http.Client
 }
 
 // A ClientTransport implementor knows how to submit Request objects to some destination

Regarding github.com/asaskevich/govalidator - my tests with current kube version of this dependency are failing with:

--- FAIL: TestHTTPSAddressValid (0.02s)
    --- FAIL: TestHTTPSAddressValid/enusre_aws_sns_topic_endpoint_url_succeeds_on_'https://a.b-c.de' (0.00s)
        <autogenerated>:1: 
                Error Trace:    validation_test.go:172
                Error:          Received unexpected error:
                                Key: 'WubbaLubbaDubDub.Endpoint' Error:Field validation for 'Endpoint' failed on the 'aws_sns_topic_endpoint_url' tag
                Test:           TestHTTPSAddressValid/enusre_aws_sns_topic_endpoint_url_succeeds_on_'https://a.b-c.de'
    --- FAIL: TestHTTPSAddressValid/enusre_aws_sns_topic_endpoint_url_succeeds_on_'https://a.b--c.de/' (0.00s)
        <autogenerated>:1: 
                Error Trace:    validation_test.go:172
                Error:          Received unexpected error:
                                Key: 'WubbaLubbaDubDub.Endpoint' Error:Field validation for 'Endpoint' failed on the 'aws_sns_topic_endpoint_url' tag
                Test:           TestHTTPSAddressValid/enusre_aws_sns_topic_endpoint_url_succeeds_on_'https://a.b--c.de/'
    --- FAIL: TestHTTPSAddressValid/enusre_aws_sns_topic_endpoint_url_succeeds_on_'https://a.ba--c.de/' (0.00s)
        <autogenerated>:1: 
                Error Trace:    validation_test.go:172
                Error:          Received unexpected error:
                                Key: 'WubbaLubbaDubDub.Endpoint' Error:Field validation for 'Endpoint' failed on the 'aws_sns_topic_endpoint_url' tag
                Test:           TestHTTPSAddressValid/enusre_aws_sns_topic_endpoint_url_succeeds_on_'https://a.ba--c.de/'
    --- FAIL: TestHTTPSAddressValid/enusre_aws_sns_topic_endpoint_url_succeeds_on_'https://a.xn--c.de/' (0.00s)
        <autogenerated>:1: 
                Error Trace:    validation_test.go:172
                Error:          Received unexpected error:
                                Key: 'WubbaLubbaDubDub.Endpoint' Error:Field validation for 'Endpoint' failed on the 'aws_sns_topic_endpoint_url' tag
                Test:           TestHTTPSAddressValid/enusre_aws_sns_topic_endpoint_url_succeeds_on_'https://a.xn--c.de/'
    --- FAIL: TestHTTPSAddressValid/enusre_aws_sns_topic_endpoint_url_succeeds_on_'http://www.atlassian.com./' (0.00s)
        <autogenerated>:1: 
                Error Trace:    validation_test.go:172
                Error:          Received unexpected error:
                                Key: 'WubbaLubbaDubDub.Endpoint' Error:Field validation for 'Endpoint' failed on the 'aws_sns_topic_endpoint_url' tag
                Test:           TestHTTPSAddressValid/enusre_aws_sns_topic_endpoint_url_succeeds_on_'http://www.atlassian.com./'
FAIL

Everything is fine if I use new version. There is a whole bunch of url validation issues that have been fixed (probably not an exhaustive list) that I found: asaskevich/govalidator#193 asaskevich/govalidator#150 asaskevich/govalidator#151 asaskevich/govalidator#194 asaskevich/govalidator#269
One of them is probably the one that is causing the regression.

I've been thinking about this issue in general. Basically, here is a user story that kubernetes community probably needs to have an answer for:
As a developer, I'd like to use client-go/apimachinery/etc libraries to work with kubernetes. The recommended approach is to use dependency versions from Godeps.json so that I get a tested and verified set of dependencies that are guaranteed to work together. That makes sense. I also use one of the dependencies directly and I need a newer version to pick up a bugfix for an issue that is affecting me. What am I supposed to do in this situation?

@dims
Copy link
Member

dims commented Oct 24, 2018

  1. go-swagger update is for supporting code generated using latest version of the tool
  2. govalidator update is tightening the validation for urls
  3. mgo is pulled in because of go-openapi/strfmt indirectly

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 24, 2018
@cblecker
Copy link
Member

/hold
Needs license review for new dependency in the tree. Looks like 2-clause BSD (https://opensource.org/licenses/BSD-2-Clause)

/assign @thockin

@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 Oct 24, 2018
@ash2k
Copy link
Member Author

ash2k commented Oct 24, 2018

(citing myself)

The recommended approach is to use dependency versions from Godeps.json so that I get a tested and verified set of dependencies that are guaranteed to work together. That makes sense.

BTW, forgot to mention - I've built a tool to generate Gopkg.toml for dep from Godeps.json that some people may find useful https://github.com/ash2k/kubegodep2dep

@nikhita
Copy link
Member

nikhita commented Oct 24, 2018

Needs license review for new dependency in the tree. Looks like 2-clause BSD

fyi @justaugustus @swinslow

@dims
Copy link
Member

dims commented Oct 24, 2018

@thockin @justaugustus @nikhita @cblecker - fwiw, we do have 2 packages with the same license already. So at least it's not a new license.

  • vendor/github.com/pkg/sftp/LICENSE
  • vendor/github.com/PuerkitoBio/purell/LICENSE

@nikhita
Copy link
Member

nikhita commented Oct 26, 2018

I think go-openapi added some changes that could be concerning for custom resource validation, but I'll double-check to be sure.

Ok from the go-openapi side. 👍

@lavalamp
Copy link
Member

I think I'm satisfied that this is useful. I'll approve if it is rebased. Sorry for taking a while. I think it's not adding new license types.

github.com/go-openapi/*
github.com/asaskevich/govalidator
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 31, 2018
@ash2k
Copy link
Member Author

ash2k commented Nov 1, 2018

@lavalamp @dims rebased and ready for review. Thanks.

@dims
Copy link
Member

dims commented Nov 1, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 1, 2018
@lavalamp
Copy link
Member

lavalamp commented Nov 1, 2018

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 1, 2018
@thockin
Copy link
Member

thockin commented Nov 1, 2018

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ash2k, lavalamp, thockin

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

@ash2k
Copy link
Member Author

ash2k commented Nov 1, 2018

@cblecker mind canceling the hold?

@cblecker
Copy link
Member

cblecker commented Nov 1, 2018

/hold cancel
👍

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 1, 2018
@k8s-ci-robot k8s-ci-robot merged commit a831ea2 into kubernetes:master Nov 2, 2018
@ash2k ash2k deleted the update-few-dependencies branch November 2, 2018 07:32
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/apiserver area/code-generation cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. 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.

None yet