-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Use the right image for the right platform in the e2e tests #49457
Conversation
Hi @mkumatag. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
7355885
to
bf0a637
Compare
/assign |
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.
Thanks a LOT for this beast! 🎉
Some initial points to discuss... let's get feedback from @ixdy and @kubernetes/sig-testing-pr-reviews before making the rest of the changes so we have consensus on the direction.
Can you please structure your commits like this?
- Adding the
imagemanifest
orimageutils
package (net-new) - Redirecting all references in Go code to
imageutils.GetE2EImage()
(replace) - Remove all unnecessary constants that were used before
- Replace everything templated in YAML to use
{{ .Field }}
instead of hard-coding - Updating bazel and other required and automated things
I'm actually fine with doing this in three PRs
1
-- only adding the new thing2
,3
and5
-- main piece of work4
and5
-- takes care of YAML files used in tests.
What do others think about that?
@@ -61,7 +61,6 @@ const ( | |||
GlusterfsServerImage string = "gcr.io/google_containers/volume-gluster:0.2" | |||
CephServerImage string = "gcr.io/google_containers/volume-ceph:0.1" | |||
RbdServerImage string = "gcr.io/google_containers/volume-rbd:0.1" |
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 guess these images will be cross-built in the future as well?
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.
As these images are bit complex and need lot of effort porting them for other archs. Anyways those images are not used in conformance tests.
@@ -12,7 +12,7 @@ spec: | |||
spec: | |||
containers: | |||
- name: php-redis | |||
image: gcr.io/google-samples/gb-frontend:v4 | |||
image: {{frontendImage}} |
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.
Leave out all examples/
changes, they have been moved to a new repo
test/utils/imagemanifest/manifest.go
Outdated
redisslaveImageVersion = "1.0" | ||
resourceConsumerImageName = "resource-consumer" | ||
resourceConsumerImageVersion = "1.0" | ||
resourceControllerImageName = "resource-consumer/controller" |
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.
is this actually right?
test/utils/imagemanifest/manifest.go
Outdated
) | ||
|
||
const ( | ||
testRegistry = "gcr.io/kubernetes-e2e-test-images" |
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.
suggest: e2eImagesRegistry
test/utils/imagemanifest/manifest.go
Outdated
} | ||
|
||
// GetclusterTesterImage returns multi-arch cluster-image docker image | ||
func GetclusterTesterImage() string { |
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.
Could we just structure it like this?
const (
Foo = "foo"
Bar = "bar"
Busybox = "busybox"
)
var imageVersions = map[string]string{
Foo: "1.0",
Bar: "1.1",
}
var imageExceptions = map[string](func() string){
BusyBox: getBusyBoxImage,
}
func GetE2EImage(image string) string {
if nameFunc, ok := imageExceptions[image]; ok {
return nameFunc()
}
return fmt.Sprintf("%s/%s-%s:%s", e2eImagesRegistry, image, runtime.GOARCH, imageVersions[image])
}
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.
done
test/utils/imagemanifest/BUILD
Outdated
@@ -0,0 +1,27 @@ | |||
package(default_visibility = ["//visibility:public"]) |
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.
can you update bazel in your last commit please so its easier to review?
@@ -13,7 +13,7 @@ spec: | |||
version: kitten | |||
spec: | |||
containers: | |||
- image: gcr.io/google_containers/update-demo:kitten | |||
- image: {{kittenImage}} |
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.
Is this file actually used by e2e tests?
If it is a template, the filename must indicate that (may it be with .in
or whatever)
If it's used by the e2e tests and intended to be a template, please use the normal {{ .Field }}
syntax
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.
This goes for all gcr.io/google_containers/foo:bar
=> {{fooIimage}}
changes
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.
sure
test/utils/imagemanifest/manifest.go
Outdated
limitations under the License. | ||
*/ | ||
|
||
package imagemanifest |
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.
@ixdy preference on name here?
What about just image
and then import as imageutils
?
test/e2e/kubectl/kubectl.go
Outdated
busyboxImage = imagemanifest.GetBusyboxImage() | ||
) | ||
|
||
var funcMap = template.FuncMap{ |
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.
Can we use a normal map[string]string
instead so we can use the more common {{ .Field }}
format?
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.
sure
@@ -84,7 +84,7 @@ done`, testCmd) | |||
Spec: api.PodSpec{ | |||
Containers: []api.Container{{ | |||
Name: "test", | |||
Image: "gcr.io/google_containers/busybox:1.24", | |||
Image: busyboxImage, |
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.
What do we feel about referencing some custom busyboxImage
variable vs always calling imageutils
?
To me it seems like always calling the SSOT makes sense, regardless of if we there prefix things with -GOARCH
or not.
I don't think the busyboxImage
shorthands makes things much shorter actually, as there are duplicates everywhere (a new BusyboxImage var has to be created in every new package, instead of always referencing the canonical place)
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 also have a similar opinion, will update the tests to call GetE2EImage
function
Also, this already needs a rebase as things are moving from /release-note |
bf0a637
to
952698d
Compare
952698d
to
5fc0259
Compare
5fc0259
to
bcefdf8
Compare
Addressed most of the comments, PTAL at latest set of commits. |
test/e2e/apps/rc.go
Outdated
@@ -45,7 +46,7 @@ var _ = SIGDescribe("ReplicationController", func() { | |||
// requires private images | |||
framework.SkipUnlessProviderIs("gce", "gke") | |||
|
|||
TestReplicationControllerServeImageOrFail(f, "private", "gcr.io/k8s-authenticated-test/serve_hostname:v1.4") | |||
TestReplicationControllerServeImageOrFail(f, "private", imageutils.GetE2EImage(imageutils.ServeHostname)) |
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.
this one looks wrong. it is intentionally testing a private repo, which gcr.io/kubernetes-e2e-test-images
is not.
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.
then we may need to push serve_hostname
image to gcr.io/k8s-authenticated-test
repo as well for all the architectures or do you have any other way to tackle this?
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.
@ixdy as we already have a way to push these images to user defined repository, can you please run following command to push the images to gcr.io/k8s-authenticated-test
repository
make all-push WHAT=serve-hostname REGISTRY=gcr.io/k8s-authenticated-test
@@ -0,0 +1,141 @@ | |||
/* |
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 have a particularly strong opinion here, but should this live in test/images
instead of adding a new test/utils/image
directory?
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.
As we are maintaining only docker images in test/images
so IMO it will be more relevant in test/utils/images
directory.
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'm okay with this
test/utils/image/manifest.go
Outdated
|
||
const ( | ||
e2eImagesRegistry = "gcr.io/kubernetes-e2e-test-images" | ||
BusyBox = "busybox" |
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.
maybe sort these into groups by which registry they're in? i.e. most are in kubernetes-e2e-test-images
, but some are in google-containers
, and the way they're written right now doesn't make that super obvious.
same thought goes for imageVersions
.
I'm also worried about the vertical separation/disconnect between the image names, registry, and versions.
I'm starting to wonder if there should instead be more structure around the configs, literally using a struct or something, like so:
const (
e2eRegistry = "gcr.io/kubernetes-e2e-test-images"
gcRegistry = "gcr.io/kubernetes-e2e-test-images"
)
type ImageConfig struct {
registry string
name string
version string
}
var (
BusyBox = ImageConfig{gcRegistry, "busybox", "1.24"}
ClusterTester = ImageConfig{e2eRegistry, "clusterapi-tester", "1.0"}
...
)
func GetArchImage(config ImageConfig) string {
return fmt.Sprintf("%s/%s-%s:%s", config.registry, config.name, runtime.GOARCH, config.version)
}
thoughts? it's a bit more succinct.
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 guess really kubernetes should figure out how to use the right arch image itself, which is probably something @luxas has written about and I haven't caught up on. :)
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.
The above approach looks more cleaner and will reduce good amount of coding, @luxas what do you say about it?
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.
@ixdy How gcr.io/google-containers/busybox:1.24
different from docker hub busybox
? I'm wondering how to get busybox images for different architectures.!
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 think gcr.io/google-containers/busybox:1.24
is just the official docker busybox:1.24
that was downloaded at some point and pushed back to gcr.io/google-containers
, since gcr.io was/is more reliable than dockerhub (#13288).
as with many things, I'm not sure if this is still necessary.
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.
in particular, busybox
was #23248.
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'm fine with any option, what do you recommend?
Option 1 - Refer busybox from docker hub
Option 2 - Pull busybox images for all the architecture and keep it in gcr.
My vote is for option 1 to avoid any maintenance required for pushing same image to gcr for all the architecture.!
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 think we should use Busybox from Docker Hub, yes. That will get us security patches automatically. I think Docker Hub is more reliable now... or?
cc @fejta
@ixdy We'll ideally, we'd use manifest lists. Plan B might be to lookup the API server platform by hitting /version
on every image get, but that's kinda painful. Plan C (which this is, and is what I think we should stick with now) is to use runtime.GOARCH
from the e2e binary. If you have an arm cluster, you have to make sure you call e2e tests from an arm machine as well, etc.
418fb21
to
ee4d54c
Compare
This cronjob pr created a lot of chaos today! btw : rebased the PR again.
|
/test pull-kubernetes-e2e-gce-etcd3 |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ixdy, luxas, mkumatag Associated issue: 38067 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/retest |
/test pull-kubernetes-kubemark-e2e-gce |
/retest |
8 similar comments
/retest |
/retest |
/retest |
/retest |
/retest |
/retest |
/retest |
/retest |
/test all [submit-queue is verifying that this PR is safe to merge] |
/retest |
@mkumatag: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Automatic merge from submit-queue |
What this PR does / why we need it:
This PR is for enabling kubernetes tests for multi architecture platform
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #38067Special notes for your reviewer:
This will enable conformance tests for all the supported architectures.
Release note:
x-ref #38067