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 code to cache correct images for different k8s versions #2849

Merged
merged 3 commits into from
Jun 5, 2018
Merged

Update code to cache correct images for different k8s versions #2849

merged 3 commits into from
Jun 5, 2018

Conversation

mlgibbons
Copy link
Contributor

See #2827

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mlgibbons
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: aaron-prindle

Assign the PR to them by writing /assign @aaron-prindle in a comment when ready.

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

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 27, 2018
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@mlgibbons
Copy link
Contributor Author

/assign @aaron-prindle

Copy link
Contributor

@dlorenc dlorenc left a comment

Choose a reason for hiding this comment

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

Thanks for this!

"k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.8",
"k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.8",
"k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.8",
v1_10, _ := semver.ParseRange(">=1.10.0 <1.11.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use MustParse here instead of dropping the errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Will do.

"k8s.gcr.io/kube-scheduler-amd64:" + version,
"k8s.gcr.io/kube-controller-manager-amd64:" + version,
"k8s.gcr.io/kube-apiserver-amd64:" + version,
if v1_10(kubernetesVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I usually prefer a switch statement to a long list of if elses.

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 agree. With the multiple booleans though I'm not sure how I could structure this more cleanly so settled on that code structure as being clean and understandable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, SGTM then. I'll think on this a bit and see if I can come up with a way to make it more declarative longer term.

"k8s.gcr.io/kube-scheduler-amd64:" + version,
"k8s.gcr.io/kube-controller-manager-amd64:" + version,
"k8s.gcr.io/kube-apiserver-amd64:" + version,
if v1_10(kubernetesVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, SGTM then. I'll think on this a bit and see if I can come up with a way to make it more declarative longer term.

"k8s.gcr.io/kube-scheduler-amd64:" + version,
"k8s.gcr.io/kube-controller-manager-amd64:" + version,
"k8s.gcr.io/kube-apiserver-amd64:" + version,
if v1_10(kubernetesVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

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

One last nit, it might be a bit more clear if this first if statement is something like:

if v_10 || greater_than_v_10

that makes it clearer that versions outside the range (but higher) get the same images as the latest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Updated.

@mlgibbons
Copy link
Contributor Author

/cc dlorenc

@k8s-ci-robot k8s-ci-robot requested a review from dlorenc June 3, 2018 03:23
@dlorenc
Copy link
Contributor

dlorenc commented Jun 4, 2018

@minikube-bot OK to test

@mlgibbons
Copy link
Contributor Author

I'm not quite clear on the process for merging but I'm wondering why this is sitting and not merged yet?

@dlorenc dlorenc merged commit e37d615 into kubernetes:master Jun 5, 2018
@mlgibbons mlgibbons deleted the fixCachedImagesByKubeVersion branch June 5, 2018 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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.

5 participants