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

Use the right image for the right platform in the e2e tests #49457

Merged
merged 4 commits into from
Sep 2, 2017

Conversation

mkumatag
Copy link
Member

@mkumatag mkumatag commented Jul 23, 2017

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 #38067

Special notes for your reviewer:
This will enable conformance tests for all the supported architectures.
Release note:

Make all e2e tests lookup image to use from a centralized place. In that centralized place, add support for multiple platforms.

x-ref #38067

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

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 23, 2017
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. labels Jul 23, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2017
@mkumatag
Copy link
Member Author

/assign
/cc @luxas

@k8s-ci-robot k8s-ci-robot requested a review from luxas July 23, 2017 18:25
@deads2k deads2k removed their assignment Jul 24, 2017
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2017
Copy link
Member

@luxas luxas left a 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?

  1. Adding the imagemanifest or imageutils package (net-new)
  2. Redirecting all references in Go code to imageutils.GetE2EImage() (replace)
  3. Remove all unnecessary constants that were used before
  4. Replace everything templated in YAML to use {{ .Field }} instead of hard-coding
  5. Updating bazel and other required and automated things

I'm actually fine with doing this in three PRs

  • 1 -- only adding the new thing
  • 2, 3 and 5 -- main piece of work
  • 4 and 5 -- 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"
Copy link
Member

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?

Copy link
Member Author

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}}
Copy link
Member

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

redisslaveImageVersion = "1.0"
resourceConsumerImageName = "resource-consumer"
resourceConsumerImageVersion = "1.0"
resourceControllerImageName = "resource-consumer/controller"
Copy link
Member

Choose a reason for hiding this comment

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

is this actually right?

)

const (
testRegistry = "gcr.io/kubernetes-e2e-test-images"
Copy link
Member

Choose a reason for hiding this comment

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

suggest: e2eImagesRegistry

}

// GetclusterTesterImage returns multi-arch cluster-image docker image
func GetclusterTesterImage() string {
Copy link
Member

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])
}

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
Copy link
Member

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}}
Copy link
Member

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

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

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

sure

limitations under the License.
*/

package imagemanifest
Copy link
Member

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?

busyboxImage = imagemanifest.GetBusyboxImage()
)

var funcMap = template.FuncMap{
Copy link
Member

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?

Copy link
Member Author

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,
Copy link
Member

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)

Copy link
Member Author

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

@luxas
Copy link
Member

luxas commented Jul 24, 2017

Also, this already needs a rebase as things are moving from test/e2e to test/e2e/$SIG

/release-note
/ok-to-test

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note-none Denotes a PR that doesn't merit a release note. labels Jul 24, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 26, 2017
@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 26, 2017
@mkumatag
Copy link
Member Author

Addressed most of the comments, PTAL at latest set of commits.

@@ -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))
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member Author

@mkumatag mkumatag Aug 3, 2017

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 @@
/*
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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


const (
e2eImagesRegistry = "gcr.io/kubernetes-e2e-test-images"
BusyBox = "busybox"
Copy link
Member

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.

Copy link
Member

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. :)

Copy link
Member Author

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?

Copy link
Member Author

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.!

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

@mkumatag mkumatag Jul 27, 2017

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.!

Copy link
Member

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.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 1, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 1, 2017
@mkumatag
Copy link
Member Author

mkumatag commented Sep 1, 2017

This cronjob pr created a lot of chaos today! btw : rebased the PR again.

@mkumatag looks like you need to rebase again. :( (the change to test/e2e/apps/types.go got reverted.)

@mkumatag
Copy link
Member Author

mkumatag commented Sep 1, 2017

/test pull-kubernetes-e2e-gce-etcd3

@mkumatag
Copy link
Member Author

mkumatag commented Sep 1, 2017

@ixdy @luxas because of rebase lgtm got removed, can you please gimme lgtm again to merge this PR.

@luxas
Copy link
Member

luxas commented Sep 1, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 1, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@mkumatag
Copy link
Member Author

mkumatag commented Sep 1, 2017

/retest

@mkumatag
Copy link
Member Author

mkumatag commented Sep 1, 2017

/test pull-kubernetes-kubemark-e2e-gce

@luxas luxas added this to the v1.8 milestone Sep 1, 2017
@luxas
Copy link
Member

luxas commented Sep 1, 2017

/retest

8 similar comments
@mkumatag
Copy link
Member Author

mkumatag commented Sep 1, 2017

/retest

@mkumatag
Copy link
Member Author

mkumatag commented Sep 1, 2017

/retest

@mkumatag
Copy link
Member Author

mkumatag commented Sep 2, 2017

/retest

@mkumatag
Copy link
Member Author

mkumatag commented Sep 2, 2017

/retest

@mkumatag
Copy link
Member Author

mkumatag commented Sep 2, 2017

/retest

@mkumatag
Copy link
Member Author

mkumatag commented Sep 2, 2017

/retest

@mkumatag
Copy link
Member Author

mkumatag commented Sep 2, 2017

/retest

@luxas
Copy link
Member

luxas commented Sep 2, 2017

/retest

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@mkumatag
Copy link
Member Author

mkumatag commented Sep 2, 2017

/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Sep 2, 2017

@mkumatag: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-kops-aws ee4d54c link /test pull-kubernetes-e2e-kops-aws

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.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit da7ee10 into kubernetes:master Sep 2, 2017
@mkumatag
Copy link
Member Author

mkumatag commented Sep 3, 2017

Finally got merged after so many retests... Thanks @ixdy @luxas

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. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-architecture plan for Kubernetes
7 participants