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

upstream heptio/kube-conformance #69368

Merged

Conversation

dims
Copy link
Member

@dims dims commented Oct 3, 2018

Pick up some code from https://github.com/heptio/kube-conformance

Command line to build the container:
REGISTRY=staging-k8s.gcr.io VERSION=v1.12.1 hack/dev-push-conformance.sh

Change-Id: I22d2436ad2658bdc889af566beb21f3714d0b0b0

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Release note:

Added a new container based image for running e2e tests

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 3, 2018
@dims
Copy link
Member Author

dims commented Oct 3, 2018

In support of #69110

cc @timothysc @jbeda

@dims
Copy link
Member Author

dims commented Oct 3, 2018

cc @brahmaroutu @duglin @bradtopol

Copy link
Member

@timothysc timothysc left a comment

Choose a reason for hiding this comment

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

@dims thanks for doing this!

Minor comment about adding other .test artifacts and possibly changing the name.

@@ -217,6 +218,12 @@ function kube::release::build_server_images() {
if [[ "${KUBE_BUILD_HYPERKUBE}" =~ [yY] ]]; then
cp "${LOCAL_OUTPUT_BINPATH}/${platform}/hyperkube" "${release_stage}/server/bin"
fi
# if we are building conformance, we also need to copy the binaries needed
if [[ "${KUBE_BUILD_CONFORMANCE}" =~ [yY] ]]; then
cp "${LOCAL_OUTPUT_BINPATH}/${platform}/e2e.test" "${release_stage}/server/bin"
Copy link
Member

Choose a reason for hiding this comment

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

fwiw I think we should call it kube_tests and include the other suites. We had an issue open for a while to include the node tests to evaluate prior to running conformance.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack. i want to get the basic skeleton working and hand it off to @brahmaroutu or @duglin who promised to help.

Copy link
Member

Choose a reason for hiding this comment

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

cp "${LOCAL_OUTPUT_BINPATH}/${platform}/*.test" "${release_stage}/server/bin" should work.

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 @timothysc

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 this works. I'd think of this as part of building the test tarball rather than the server (=control plane) images ... Anyone building those will need to opt out of another image now or lose build time again.

Copy link
Member Author

Choose a reason for hiding this comment

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

switching back to cp "${LOCAL_OUTPUT_BINPATH}/${platform}/e2e.test" "${release_stage}/server/bin", will revisit later when we add node conformance test etc

Copy link
Member

Choose a reason for hiding this comment

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

Why do you need these test binaries in the server tarball? I don't see them used anywhere.

Copy link
Member

Choose a reason for hiding this comment

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

Ideally, we would want e2e.test and e2e_node.test - When a group is running conformance this gives them the ability to check to see it the node itself passes the local checks.

@spiffxp
Copy link
Member

spiffxp commented Oct 4, 2018

/area conformance
/sig testing
/cc @BenTheElder @Katharine

@k8s-ci-robot k8s-ci-robot added area/conformance Issues or PRs related to kubernetes conformance tests sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Oct 4, 2018
@spiffxp
Copy link
Member

spiffxp commented Oct 4, 2018

/kind feature

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Oct 4, 2018
@dims dims force-pushed the upstream-heptio-kube-conformance branch from 513d8bc to 066f512 Compare October 11, 2018 02:05
@dims dims changed the title [WIP] upstream heptio/kube-conformance upstream heptio/kube-conformance Oct 11, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 11, 2018
@dims dims force-pushed the upstream-heptio-kube-conformance branch from 066f512 to 8964386 Compare October 11, 2018 02:06
@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 do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Oct 11, 2018
@dims
Copy link
Member Author

dims commented Oct 11, 2018

/retest

@dims
Copy link
Member Author

dims commented Oct 11, 2018

/test pull-kubernetes-cross

@dims dims force-pushed the upstream-heptio-kube-conformance branch from 8964386 to c6b3985 Compare October 11, 2018 12:58
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 11, 2018
@dims dims force-pushed the upstream-heptio-kube-conformance branch from f44bf1d to 0cac408 Compare October 11, 2018 23:12
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 11, 2018
@@ -217,6 +218,12 @@ function kube::release::build_server_images() {
if [[ "${KUBE_BUILD_HYPERKUBE}" =~ [yY] ]]; then
cp "${LOCAL_OUTPUT_BINPATH}/${platform}/hyperkube" "${release_stage}/server/bin"
fi
# if we are building conformance, we also need to copy the binaries needed
if [[ "${KUBE_BUILD_CONFORMANCE}" =~ [yY] ]]; then
cp "${LOCAL_OUTPUT_BINPATH}/${platform}/e2e.test" "${release_stage}/server/bin"
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need these test binaries in the server tarball? I don't see them used anywhere.

if [[ -n "${save_dir}" ]]; then
"${DOCKER[@]}" save "${conformance_tag}" > "${save_dir}/conformance-${arch}.tar"
fi
if [[ -z "${KUBE_DOCKER_IMAGE_TAG-}" || -z "${KUBE_DOCKER_REGISTRY-}" ]]; then
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 pretty sure we can always call rmi here - we use the tarballs to push to gcr.io these days, rather than pushing images directly. (The conditionals are basically legacy stuff I forgot to clean up after #47939.)

Copy link
Member Author

Choose a reason for hiding this comment

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

  • ok removing the test binaries
  • cool, removing the if condition around rmi

E2E_TEST_BIN?=$(shell pwd)/../../../$(OUT_DIR)/dockerized/bin/linux/$(ARCH)/e2e.test
CLUSTER_DIR?=$(shell pwd)/../../../cluster/

BASEIMAGE=k8s.gcr.io/debian-hyperkube-base-$(ARCH):0.10.2
Copy link
Member

Choose a reason for hiding this comment

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

why hyperkube?

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 needed something that had ca-certificates and just reusing the existing 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.

Copy link
Member

Choose a reason for hiding this comment

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

you could also potentially clean-install ca-certificates in the Dockerfile for conformance. hyperkube-base has a lot of extra stuff you don't really need...

Copy link
Member

Choose a reason for hiding this comment

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

OTOH installing packages at build time is not great, so I'm OK with leaving this as-is for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

whew! thanks :)

REGISTRY?=staging-k8s.gcr.io
ARCH?=amd64
OUT_DIR?=_output
GINKGO_BIN?=$(shell pwd)/../../../$(OUT_DIR)/dockerized/bin/linux/$(ARCH)/ginkgo
Copy link
Member

Choose a reason for hiding this comment

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

maybe build/lib/release.sh could set these variables, since it really knows the path?

Copy link
Member Author

Choose a reason for hiding this comment

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

was just following the pattern from cluster/images/hyperkube/Makefile could we do this in a later PR? (clean up both)

@@ -29,6 +29,9 @@ CMD_TARGETS="${KUBE_SERVER_IMAGE_TARGETS[*]}"
if [[ "${KUBE_BUILD_HYPERKUBE}" =~ [yY] ]]; then
CMD_TARGETS="${CMD_TARGETS} cmd/hyperkube"
fi
if [[ "${KUBE_BUILD_CONFORMANCE}" =~ [yY] ]]; then
CMD_TARGETS="${CMD_TARGETS} vendor/github.com/onsi/ginkgo/ginkgo test/e2e/e2e.test cmd/kubectl"
Copy link
Member

Choose a reason for hiding this comment

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

would it make sense to list these targets in hack/lib/golang.sh rather than repeating them in multiple places?

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 was not sure KUBE_SERVER_IMAGE_TARGETS was appropriate to change (see line 28)

Copy link
Member

Choose a reason for hiding this comment

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

I meant to add another variable like KUBE_CONFORMANCE_TEST_TARGETS or something.

Copy link
Member Author

Choose a reason for hiding this comment

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

perfect. doing that now

@@ -0,0 +1,53 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

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

should this script have errexit, nounset, and pipefail per usual?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixing

exit -1
fi

IMAGE="${REGISTRY}/conformance-amd64:${VERSION}"
Copy link
Member

Choose a reason for hiding this comment

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

should we be using a manifest-list here instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

eventually, this is just a helper script. (make release/quick-release will spit out images for all platforms already)

@dims
Copy link
Member Author

dims commented Oct 12, 2018

/retest

@dims dims force-pushed the upstream-heptio-kube-conformance branch from 0cac408 to 2090bb8 Compare October 12, 2018 02:07
@dims
Copy link
Member Author

dims commented Oct 12, 2018

/retest

@dims
Copy link
Member Author

dims commented Oct 12, 2018

@ixdy there's more things to do here which we can tackle while we are getting a job up and go green. i'll open a follow up Issue for @brahmaroutu and myself.

@timothysc
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 12, 2018

ginkgo_args=(
"--focus=${E2E_FOCUS}"
"--skip=${E2E_SKIP}"
Copy link
Member

Choose a reason for hiding this comment

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

E2E_SKIP isn't defined by default - should it be?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixing

Copy link
Member

Choose a reason for hiding this comment

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

It doesn't need to be and it's defined in the dockerfile.

Copy link
Member Author

Choose a reason for hiding this comment

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

@timothysc i had removed it in one of the edits. yes, should be good with latest changes

[1-9]|[1-9][0-9]*) ginkgo_args+=("--nodes=${E2E_PARALLEL}") ;;
esac

echo "/usr/local/bin/ginkgo ${ginkgo_args[@]} /usr/local/bin/e2e.test -- --disable-log-dump --repo-root=/kubernetes --provider=\"${E2E_PROVIDER}\" --report-dir=\"${RESULTS_DIR}\" --kubeconfig=\"${KUBECONFIG}\""
Copy link
Member

Choose a reason for hiding this comment

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

similarly for KUBECONFIG

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

Copy link
Member

Choose a reason for hiding this comment

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

same answer.

Copy link
Member Author

Choose a reason for hiding this comment

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

y i added it after @ixdy's nudge

@dims
Copy link
Member Author

dims commented Oct 12, 2018

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 12, 2018
@ixdy
Copy link
Member

ixdy commented Oct 12, 2018

it'd be worth following up with the bazel rules to build this image, too. I believe this would do it (put in cluster/images/conformance/BUILD:

load("@io_bazel_rules_docker//container:container.bzl", "container_bundle", "container_image", "container_layer")

container_layer(
    name = "cluster-srcs",
    data_path = "/",
    directory = "/kubernetes",
    files = ["//cluster:all-srcs"],
)

container_layer(
    name = "bins",
    directory = "/usr/local/bin",
    files = [
        "//cmd/kubectl",
        "//test/e2e:e2e.test",
        "//vendor/github.com/onsi/ginkgo/ginkgo",
    ],
)

container_image(
    name = "conformance-internal",
    base = "@debian-hyperkube-base-amd64//image",
    cmd = [
        "/bin/bash",
        "-c",
        "/run_e2e.sh",
    ],
    env = {
        "E2E_FOCUS": "\[Conformance\]",
        "E2E_PARALLEL": "1",
        "E2E_PROVIDER": "local",
        "RESULTS_DIR": "/tmp/results",
    },
    files = [
        ":run_e2e.sh",
    ],
    layers = [
        ":cluster-srcs",
        ":bins",
    ],
    stamp = True,
    workdir = "/usr/local/bin",
)

container_bundle(
    name = "conformance",
    images = {"k8s.gcr.io/conformance-amd64:{STABLE_DOCKER_TAG}": "conformance-internal"},
    stamp = True,
    visibility = ["//visibility:public"],
)

@ixdy
Copy link
Member

ixdy commented Oct 12, 2018

(updated my bazel code to add visibility on the container_bundle rule; you'd also need to run hack/update-bazel.sh to update the various all-srcs rules)

@dims
Copy link
Member Author

dims commented Oct 12, 2018

Thanks @ixdy adding the cluster/images/conformance/BUILD

@dims dims force-pushed the upstream-heptio-kube-conformance branch from 2090bb8 to 6881049 Compare October 12, 2018 19:27
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 12, 2018
Pick up some code from https://github.com/heptio/kube-conformance
Fix up build scripts for the new conformance image
Fix Header template and Copyright to make verify job go green
update README and add execute permissions for script

Change-Id: Ib6509acd816cc2fb3a516bfb8e0ff9e32bff8f79
@dims dims force-pushed the upstream-heptio-kube-conformance branch from 6881049 to 6830bad Compare October 12, 2018 19:33
@@ -0,0 +1,66 @@
# Copyright 2016 The Kubernetes Authors.
Copy link
Member

Choose a reason for hiding this comment

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

technically this should be 2018 but I don't really care

@ixdy
Copy link
Member

ixdy commented Oct 12, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 12, 2018
@spiffxp
Copy link
Member

spiffxp commented Oct 12, 2018

/retest

@dims
Copy link
Member Author

dims commented Oct 12, 2018

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 12, 2018
@k8s-ci-robot k8s-ci-robot merged commit 8e4f781 into kubernetes:master Oct 13, 2018
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. area/conformance Issues or PRs related to kubernetes conformance tests cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. 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. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants