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

Fix --base-image caching for images specified by name:tag #11603

Merged
merged 5 commits into from
Jun 25, 2021

Conversation

ilya-zuyev
Copy link
Contributor

This PR fixes an issue when the image set by --base-image is downloaded on start even if it's already present in minikube cache.

Before:

➜  minikube git:(master) ✗ time m start  --base-image=docker.io/ilyazuyev/kicbase:jun4_0 
😄  minikube v1.21.0-beta.0 on Darwin 11.3.1
✨  Automatically selected the docker driver. Other choices: virtualbox, ssh
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
    > index.docker.io/ilyazuyev/k...: 359.08 MiB / 359.08 MiB  100.00% 5.63 MiB
🔥  Creating docker container (CPUs=2, Memory=4000MB) ...
🐳  Preparing Kubernetes v1.20.7 on Docker 20.10.7 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
out/minikube start --base-image=docker.io/ilyazuyev/kicbase:jun4_0  11.13s user 7.60s system 13% cpu 2:23.21 total

➜  minikube git:(master) ✗ m delete --all
🔥  Deleting "minikube" in docker ...
🔥  Removing /Users/izuyev/.minikube/machines/minikube ...
💀  Removed all traces of the "minikube" cluster.
🔥  Successfully deleted all profiles

➜  minikube git:(master) ✗ time m start  --base-image=docker.io/ilyazuyev/kicbase:jun4_0 
😄  minikube v1.21.0-beta.0 on Darwin 11.3.1
✨  Automatically selected the docker driver. Other choices: virtualbox, ssh
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
    > index.docker.io/ilyazuyev/k...: 359.08 MiB / 359.08 MiB  100.00% 5.73 MiB
🔥  Creating docker container (CPUs=2, Memory=4000MB) ...
🐳  Preparing Kubernetes v1.20.7 on Docker 20.10.7 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
out/minikube start --base-image=docker.io/ilyazuyev/kicbase:jun4_0  13.43s user 10.21s system 15% cpu 2:36.20 total

After:

➜  minikube git:(ilyaz/fix_no_digest_caching) ✗ time m start  --base-image=docker.io/ilyazuyev/kicbase:jun4_0                              
😄  minikube v1.21.0-beta.0 on Darwin 11.3.1
✨  Automatically selected the docker driver. Other choices: virtualbox, ssh
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
💾  Downloading Kubernetes v1.20.7 preload ...
    > preloaded-images-k8s-v11-v1...: 492.20 MiB / 492.20 MiB  100.00% 6.57 MiB
    > index.docker.io/ilyazuyev/k...: 359.08 MiB / 359.08 MiB  100.00% 2.91 MiB
🔥  Creating docker container (CPUs=2, Memory=4000MB) ...
🐳  Preparing Kubernetes v1.20.7 on Docker 20.10.7 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
out/minikube start --base-image=docker.io/ilyazuyev/kicbase:jun4_0  16.40s user 13.19s system 13% cpu 3:41.00 total


➜  minikube git:(ilyaz/fix_no_digest_caching) ✗ m delete --all
🔥  Deleting "minikube" in docker ...
🔥  Removing /Users/izuyev/.minikube/machines/minikube ...
💀  Removed all traces of the "minikube" cluster.
🔥  Successfully deleted all profiles


➜  minikube git:(ilyaz/fix_no_digest_caching) ✗ time m start  --base-image=docker.io/ilyazuyev/kicbase:jun4_0 
😄  minikube v1.21.0-beta.0 on Darwin 11.3.1
✨  Automatically selected the docker driver. Other choices: virtualbox, ssh
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
🔥  Creating docker container (CPUs=2, Memory=4000MB) ...
🐳  Preparing Kubernetes v1.20.7 on Docker 20.10.7 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
out/minikube start --base-image=docker.io/ilyazuyev/kicbase:jun4_0  9.32s user 5.43s system 15% cpu 1:36.86 total

Note, after the fix, the base image is not downloaded.

There is an exception for latest, when --base-image=<img>:latest format is used the image is always pulled

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 8, 2021
@k8s-ci-robot k8s-ci-robot requested review from medyagh and RA489 June 8, 2021 00:48
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 8, 2021
@ilya-zuyev
Copy link
Contributor Author

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jun 8, 2021
@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11603) |
+----------------+----------+---------------------+
| minikube start | 48.6s    | 46.8s               |
| enable ingress | 34.1s    | 35.0s               |
+----------------+----------+---------------------+

Times for minikube start: 47.7s 50.7s 47.3s 46.2s 51.1s
Times for minikube (PR 11603) start: 46.7s 45.8s 47.6s 47.5s 46.6s

Times for minikube ingress: 34.7s 33.8s 33.9s 35.7s 32.3s
Times for minikube (PR 11603) ingress: 37.1s 34.2s 34.4s 34.8s 34.7s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11603) |
+----------------+----------+---------------------+
| minikube start | 22.0s    | 21.6s               |
| enable ingress | 29.8s    | 32.3s               |
+----------------+----------+---------------------+

Times for minikube (PR 11603) start: 20.9s 22.4s 21.3s 21.1s 22.3s
Times for minikube start: 23.0s 21.5s 22.5s 21.8s 21.3s

Times for minikube ingress: 29.0s 37.0s 27.5s 26.5s 29.0s
Times for minikube (PR 11603) ingress: 36.5s 32.0s 30.0s 34.0s 29.0s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11603) |
+----------------+----------+---------------------+
| minikube start | 41.5s    | 45.7s               |
| enable ingress |          |                     |
+----------------+----------+---------------------+

Times for minikube start: 31.2s 43.3s 43.2s 46.2s 43.4s
Times for minikube (PR 11603) start: 47.1s 47.0s 42.7s 43.4s 48.0s

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

thank you for this PR this seems interesting !

pkg/minikube/download/image.go Show resolved Hide resolved
@medyagh
Copy link
Member

medyagh commented Jun 21, 2021

@ilya-zuyev please pull upstream on this PR, there was a another PR that touched same part of this code might need to test with that

@minikube-bot
Copy link
Collaborator

These are the flake rates of all failed tests on Docker_Linux.

Failed Tests Flake Rate (%)
TestScheduledStopUnix 4.00 (chart)

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11603) |
+----------------+----------+---------------------+
| minikube start | 47.5s    | 47.5s               |
| enable ingress | 35.3s    | 34.6s               |
+----------------+----------+---------------------+

Times for minikube ingress: 36.8s 33.8s 36.7s 34.3s 34.7s
Times for minikube (PR 11603) ingress: 34.2s 34.3s 35.2s 33.8s 35.8s

Times for minikube (PR 11603) start: 46.2s 48.0s 45.9s 46.8s 50.6s
Times for minikube start: 48.3s 47.3s 47.0s 47.9s 47.1s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11603) |
+----------------+----------+---------------------+
| minikube start | 21.6s    | 21.6s               |
| enable ingress | 29.5s    | 33.3s               |
+----------------+----------+---------------------+

Times for minikube start: 21.7s 20.8s 22.4s 21.4s 21.4s
Times for minikube (PR 11603) start: 20.4s 22.1s 21.6s 22.1s 21.6s

Times for minikube ingress: 29.0s 29.6s 33.0s 26.5s 29.5s
Times for minikube (PR 11603) ingress: 36.5s 27.5s 29.0s 37.0s 36.5s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11603) |
+----------------+----------+---------------------+
| minikube start | 45.9s    | 44.0s               |
| enable ingress |          |                     |
+----------------+----------+---------------------+

Times for minikube start: 48.3s 43.5s 47.4s 43.1s 47.3s
Times for minikube (PR 11603) start: 43.0s 43.0s 47.8s 43.3s 42.7s

@ilya-zuyev
Copy link
Contributor Author

@ilya-zuyev please pull upstream on this PR, there was a another PR that touched same part of this code might need to test with that

done!

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

lets fix the review comments and hopefully cloud shell test will pass this time too (seems like it didnt get started)

pkg/minikube/download/image.go Show resolved Hide resolved
pkg/minikube/download/image.go Show resolved Hide resolved
@minikube-bot
Copy link
Collaborator

These are the flake rates of all failed tests on Docker_Linux.

Failed Tests Flake Rate (%)
TestRunningBinaryUpgrade 0.92 (chart)
TestScheduledStopUnix 4.59 (chart)

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11603) |
+----------------+----------+---------------------+
| minikube start | 49.1s    | 47.3s               |
| enable ingress | 39.7s    | 38.3s               |
+----------------+----------+---------------------+

Times for minikube start: 51.0s 48.5s 47.1s 51.2s 47.4s
Times for minikube (PR 11603) start: 47.5s 47.1s 47.3s 46.7s 47.9s

Times for minikube (PR 11603) ingress: 43.2s 34.3s 43.2s 34.7s 36.3s
Times for minikube ingress: 42.3s 41.8s 36.7s 35.3s 42.2s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11603) |
+----------------+----------+---------------------+
| minikube start | 22.2s    | 22.1s               |
| enable ingress | 34.5s    | 33.8s               |
+----------------+----------+---------------------+

Times for minikube start: 22.0s 21.8s 22.1s 22.3s 22.7s
Times for minikube (PR 11603) start: 22.4s 21.4s 21.5s 22.2s 22.8s

Times for minikube ingress: 36.0s 31.5s 34.5s 35.0s 35.5s
Times for minikube (PR 11603) ingress: 35.0s 32.0s 33.0s 37.0s 32.0s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11603) |
+----------------+----------+---------------------+
| minikube start | 44.3s    | 43.4s               |
| enable ingress |          |                     |
+----------------+----------+---------------------+

Times for minikube start: 42.9s 43.8s 43.7s 43.8s 47.2s
Times for minikube (PR 11603) start: 44.0s 43.4s 43.8s 43.3s 42.7s

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ilya-zuyev, medyagh

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

@ilya-zuyev ilya-zuyev merged commit 6ac71f1 into kubernetes:master Jun 25, 2021
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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