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

Upgrade Kubernetes libraries to 1.18.4 #844

Merged
merged 4 commits into from
Jul 8, 2020

Conversation

adrienjt
Copy link
Contributor

@adrienjt adrienjt commented Jun 29, 2020

  • Thanks to new v0.x.y tags in Kubernetes 1.17+ for libraries (client-go, etc.), it is no longer necessary to replace their requirements by paths in the staging area of the Kubernetes repo at the said version's Git commit hash. Upgrade Kubernetes libraries to 1.17 #834 (comment)

  • client-go introduced a major breaking change in Kubernetes 1.18, which is to pass context.Context to most functions.

This PR simplifies virtual-kubelet's go.mod file and updates calls to client-go.

EDIT

  • apimachinery (and maybe others) from v1.18 require go1.13, so I upgraded the Go version as well.

  • I also tried to run e2e tests in CI on 1.18 but gave up for now. This is not blocking IMO. Tests still pass on 1.17. We should actually run tests on multiple Kubernetes versions following a policy like https://kubernetes.io/docs/setup/release/version-skew-policy/

@adrienjt adrienjt marked this pull request as ready for review June 30, 2020 00:25
go.mod Show resolved Hide resolved
@cpuguy83
Copy link
Contributor

This is a hard change as it requires a v1.18 client since older clients no longer implement the interface.

Copy link
Contributor

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM

@cpuguy83
Copy link
Contributor

cpuguy83 commented Jul 6, 2020

@sargun, @pires Any objection to bringing this in?

@sargun
Copy link
Contributor

sargun commented Jul 6, 2020

I would like us to have a plan for how we're going to test against a 1.18 cluster, but otherwise, unopposed.

@pires
Copy link
Member

pires commented Jul 6, 2020

Please, change this https://github.com/virtual-kubelet/virtual-kubelet/blob/master/.circleci/config.yml#L67 to test w/ 1.18. Eventually, we can add sequential runs that test the supported versions of Kubernetes, or 1.1{6,7,8} as we speak.

@pires
Copy link
Member

pires commented Jul 6, 2020

Actually, @sargun @cpuguy83 I think this is good to go as it passed tests against 1.17. I keep my suggestion of having checks against the Kubernetes versions supported upstream.

@pires pires self-requested a review July 6, 2020 19:43
@adrienjt
Copy link
Contributor Author

adrienjt commented Jul 6, 2020

I just noticed this TODO item in internal/lockdeps/lockdeps.go:

package lockdeps

import (
	// TODO(Sargun): Remove in Go1.13
	// This is a dep that `go mod tidy` keeps removing, because it's a transitive dep that's pulled in via a test
	// See: https://github.com/golang/go/issues/29702
	_ "github.com/prometheus/client_golang/prometheus"
	_ "golang.org/x/sys/unix"
)

I'm not familiar with this issue. @sargun, should I remove as indicated?

@sargun
Copy link
Contributor

sargun commented Jul 6, 2020

@adrienjt I can deal with cleanup after this is merged.

@pires
Copy link
Member

pires commented Jul 7, 2020

Sorry for asking this after approval, but can the commit history be redone, please? It's quite misleading to read commit messages that no longer hold, like the installation of conntrack and e2e running on Kubernetes 1.18.

@adrienjt adrienjt force-pushed the upgrade-k8s-1-18 branch 2 times, most recently from 7d1cf91 to 225c1bd Compare July 8, 2020 02:42
@pires
Copy link
Member

pires commented Jul 8, 2020

You're the best! Thank you very much.

@@ -64,14 +67,16 @@ func (ts *EndToEndTestSuite) TestGetPods(t *testing.T) {
// TestGetStatsSummary creates a pod having two containers and queries the /stats/summary endpoint of the virtual-kubelet.
// It expects this endpoint to return stats for the current node, as well as for the aforementioned pod and each of its two containers.
func (ts *EndToEndTestSuite) TestGetStatsSummary(t *testing.T) {
ctx := context.Background()
Copy link
Contributor

Choose a reason for hiding this comment

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

should this context be cancelled?

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 wrote this PR as a no-op upgrade of a dependency, so when no context was available, I simply created a background context (no-op context). Maybe this PR creates opportunities for improvements, but I believe they'd be out-of-scope.

In this particular case, what's the value of cancelling the context? This is a test function where the context is used consecutively in a series of client-go calls.

@cpuguy83 cpuguy83 merged commit 5455f29 into virtual-kubelet:master Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants