-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Rebuild gvisor image for integration tests #4717
Conversation
We should rebuild the gvisor image for integration tests, so that if changes are made to the gvisor image they are tested. I added an environment variable that, when set, will change the expected gvisor image repo.
@minikube-bot OK to test |
pkg/minikube/constants/constants.go
Outdated
@@ -430,6 +430,9 @@ const ( | |||
GvisorContainerdShimURL = "https://github.com/google/gvisor-containerd-shim/releases/download/v0.0.1-rc.0/gvisor-containerd-shim-v0.0.1-rc.0.linux-amd64" | |||
// GvisorURL is the url to download gvisor | |||
GvisorURL = "https://storage.googleapis.com/gvisor/releases/nightly/2018-12-07/runsc" | |||
|
|||
// MinikubeGvisorAddonImageRepo is the environment variable set by integration tests to change the gvisor image repo. | |||
MinikubeGvisorAddonImageRepo = "MINIKUBE_GVISOR_ADDON_IMAGE_REPO" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to add set this evn to hack/jenkins/ bash files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so since I set the environment variable programatically & only for the gvisor tests.
pkg/minikube/assets/addons.go
Outdated
}{ | ||
Arch: a, | ||
ExoticArch: ea, | ||
ImageRepository: cfg.ImageRepository, | ||
GvisorImageRepo: os.Getenv(constants.MinikubeGvisorAddonImageRepo), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this not require normal addon users to set this environment variable? Seems like that would require an update to the docs. I'd prefer if it defaulted to cfg.ImageRepository
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the default value is gcr.io/k8s-skaffold
, users should never have to set the environment variable, since it should be empty. This way, they should always be using the latest version of the gvisor image.
I opted out of using cfg.ImageRepository because that repo would be applied to other images minikube pulls as well (storage provisioner, etc), which wouldn't exist.
This way, if the env variable is set (which should only happen in integration tests), then only in that case will a non-default gvisor image will be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking some folks would want to override the image repo globally. My thought was to use GvisorImageRepo if it is set, but use ImageRepository if it's not set (i.e. go back to current behavior)
pkg/minikube/assets/addons.go
Outdated
}{ | ||
Arch: a, | ||
ExoticArch: ea, | ||
ImageRepository: cfg.ImageRepository, | ||
GvisorImageRepo: os.Getenv(constants.MinikubeGvisorAddonImageRepo), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking some folks would want to override the image repo globally. My thought was to use GvisorImageRepo if it is set, but use ImageRepository if it's not set (i.e. go back to current behavior)
…to make sure that image is used
aa9b344
to
1a49eec
Compare
pkg/gvisor/enable.go
Outdated
@@ -44,6 +44,7 @@ const ( | |||
// 3. copies necessary containerd config files | |||
// 4. restarts containerd | |||
func Enable() error { | |||
return fmt.Errorf("local image used correctly") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this was for debugging? I would have thought that Go would complain about unreachable code when compiling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I want to make sure minikube actually pulls the locally built gvisor image, so tests should fail with this error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently it fails with compile error so you may want to remove the code after this line if you are intentionally returning an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are you seeing the compile error? If I run make out/gvisor-addon
locally the binary does compile, and running the docker image from make gvisor-addon-image
gives me:
minikube$ docker run gcr.io/k8s-minikube/gvisor-addon:latest
2019/07/10 23:20:28 local image used correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm seeing the error in Travis. Go's compiler complains if code is unreachable.
https://travis-ci.org/kubernetes/minikube/builds/557049237#L541
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. It was go vet the provides the error. In any case, the code afterwards isn't used.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: priyawadhwa The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
which can be picked up during integration testing. I opted to do it this way because the locally built gvisor image wasn't being picked up by minikube, because the docker daemon wasn't configured, since minikube isn't up and running yet. Even if the docker daemon was configured to point to minikube, we wouldn't be able to build the gvisor-image from the test itself.
01ba8aa
to
3ffe2af
Compare
500cdf4
to
23d2739
Compare
… which doesn't load the image into the runtime
46c1163
to
ee4cbbb
Compare
11b51cc
to
6cd9b58
Compare
6cd9b58
to
94638de
Compare
@priyawadhwa Thanks for the update! Sounds like we open a can of worms! |
d8da8a7
to
c611cf8
Compare
PR looks good, only one test fails, but it might be a flake fail.
I am gonna restart the KVM test
|
@priyawadhwa the PR looks good to me, are you okay with merging this PR ? |
@medyagh yah I think this should be ok! |
awesome thank you for fixing this ! |
We should rebuild the gvisor image for integration tests, so that if
changes are made to the gvisor image they are tested. I added an
environment variable that, when set, will change the expected gvisor
image repo.
should unblock #4494