From 069eeb541b4df1691007df68f09979aaf833e9fd Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 26 Feb 2019 09:18:05 -0500 Subject: [PATCH 1/4] Simpler make commands for ginkgo/kubectl/e2e.test Change-Id: I78cff10231eabd53b1fc7bdd1526c861179e135a --- cluster/images/conformance/Makefile | 10 +++++++--- cluster/images/conformance/README.md | 5 ++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cluster/images/conformance/Makefile b/cluster/images/conformance/Makefile index d6177aaac32..0a5e4cd532d 100644 --- a/cluster/images/conformance/Makefile +++ b/cluster/images/conformance/Makefile @@ -20,9 +20,13 @@ REGISTRY?=staging-k8s.gcr.io ARCH?=amd64 OUT_DIR?=_output -GINKGO_BIN?=$(shell pwd)/../../../$(OUT_DIR)/dockerized/bin/linux/$(ARCH)/ginkgo -KUBECTL_BIN?=$(shell pwd)/../../../$(OUT_DIR)/dockerized/bin/linux/$(ARCH)/kubectl -E2E_TEST_BIN?=$(shell pwd)/../../../$(OUT_DIR)/dockerized/bin/linux/$(ARCH)/e2e.test + +OUTPUT_PATH=$(shell pwd)/../../../$(OUT_DIR) +BINARY_PATH=$(shell test -d $(OUTPUT_PATH)/dockerized && echo $(OUTPUT_PATH)/dockerized || echo $(OUTPUT_PATH)/local) + +GINKGO_BIN?=$(BINARY_PATH)/bin/linux/$(ARCH)/ginkgo +KUBECTL_BIN?=$(BINARY_PATH)/bin/linux/$(ARCH)/kubectl +E2E_TEST_BIN?=$(BINARY_PATH)/bin/linux/$(ARCH)/e2e.test CLUSTER_DIR?=$(shell pwd)/../../../cluster/ BASEIMAGE=k8s.gcr.io/debian-hyperkube-base-$(ARCH):0.12.1 diff --git a/cluster/images/conformance/README.md b/cluster/images/conformance/README.md index 3f8d5954bc8..4e1d7dcff42 100644 --- a/cluster/images/conformance/README.md +++ b/cluster/images/conformance/README.md @@ -6,8 +6,8 @@ #### How to release by hand ```console -# First, build the binaries -$ build/run.sh make cross +# First, build the binaries by running make from the root directory +$ make WHAT="test/e2e/e2e.test vendor/github.com/onsi/ginkgo/ginkgo cmd/kubectl" # Build for linux/amd64 (default) # export REGISTRY=$HOST/$ORG to switch from staging-k8s.gcr.io @@ -48,7 +48,6 @@ metadata: spec: containers: - name: conformance-container - image: gcr.io/heptio-images/kube-conformance:latest image: staging-k8s.gcr.io/conformance-amd64:v1.12.1 imagePullPolicy: IfNotPresent env: From 94ad1dfb112c609815247d5b6fe0634f9a77b172 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 26 Feb 2019 10:29:12 -0500 Subject: [PATCH 2/4] Better manifest for running conformance image Change-Id: I137180ed781edd4a9877cabe039e40a72aa71366 --- cluster/images/conformance/README.md | 30 +------- .../images/conformance/conformance-e2e.yaml | 71 +++++++++++++++++++ 2 files changed, 73 insertions(+), 28 deletions(-) create mode 100644 cluster/images/conformance/conformance-e2e.yaml diff --git a/cluster/images/conformance/README.md b/cluster/images/conformance/README.md index 4e1d7dcff42..c32c84eb00e 100644 --- a/cluster/images/conformance/README.md +++ b/cluster/images/conformance/README.md @@ -32,36 +32,10 @@ $ make push VERSION={target_version} ARCH=s390x If you don't want to push the images, run `make` or `make build` instead -#### How to setup RBAC needed +#### How to run tests ``` -kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=default:default +kubectl create -f conformance-e2e.yaml ``` -#### How to run a single test - -``` -apiVersion: v1 -kind: Pod -metadata: - name: e2e-producer-consumer-test -spec: - containers: - - name: conformance-container - image: staging-k8s.gcr.io/conformance-amd64:v1.12.1 - imagePullPolicy: IfNotPresent - env: - - name: E2E_FOCUS - value: "Pods should be submitted and removed" - volumeMounts: - - name: output-volume - mountPath: /tmp/results - volumes: - - name: output-volume - hostPath: - path: /tmp/results - restartPolicy: Never -``` - - [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/cluster/images/conformance/README.md?pixel)]() diff --git a/cluster/images/conformance/conformance-e2e.yaml b/cluster/images/conformance/conformance-e2e.yaml new file mode 100644 index 00000000000..4070b71731c --- /dev/null +++ b/cluster/images/conformance/conformance-e2e.yaml @@ -0,0 +1,71 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: conformance +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + component: conformance + name: conformance-serviceaccount + namespace: conformance +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + component: conformance + name: conformance-serviceaccount-role +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: conformance-serviceaccount +subjects: +- kind: ServiceAccount + name: conformance-serviceaccount + namespace: conformance +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + component: conformance + name: conformance-serviceaccount +rules: +- apiGroups: + - '*' + resources: + - '*' + verbs: + - '*' +- nonResourceURLs: + - '/metrics' + - '/logs' + - '/logs/*' + verbs: + - 'get' +--- +apiVersion: v1 +kind: Pod +metadata: + name: e2e-conformance-test + namespace: conformance +spec: + containers: + - name: conformance-container + image: staging-k8s.gcr.io/conformance-amd64:v1.14-alpha4 + imagePullPolicy: IfNotPresent + env: + - name: E2E_FOCUS + value: "Pods should be submitted and removed" + volumeMounts: + - name: output-volume + mountPath: /tmp/results + volumes: + - name: output-volume + hostPath: + path: /tmp/results + restartPolicy: Never + serviceAccountName: conformance-serviceaccount From 87d9903aaf58189d2c3bc512b7890f53dda5f9d3 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 26 Feb 2019 11:29:57 -0500 Subject: [PATCH 3/4] Add a script to run the conformance image and pull results Change-Id: I1eb673fe37b5e8a719f9095473765c80fb7f2347 --- cluster/images/conformance/Makefile | 2 +- cluster/images/conformance/conformance-e2e.sh | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 cluster/images/conformance/conformance-e2e.sh diff --git a/cluster/images/conformance/Makefile b/cluster/images/conformance/Makefile index 0a5e4cd532d..00307960210 100644 --- a/cluster/images/conformance/Makefile +++ b/cluster/images/conformance/Makefile @@ -22,7 +22,7 @@ ARCH?=amd64 OUT_DIR?=_output OUTPUT_PATH=$(shell pwd)/../../../$(OUT_DIR) -BINARY_PATH=$(shell test -d $(OUTPUT_PATH)/dockerized && echo $(OUTPUT_PATH)/dockerized || echo $(OUTPUT_PATH)/local) +BINARY_PATH=$(shell test -d $(OUTPUT_PATH)/local && echo $(OUTPUT_PATH)/local || echo $(OUTPUT_PATH)/dockerized) GINKGO_BIN?=$(BINARY_PATH)/bin/linux/$(ARCH)/ginkgo KUBECTL_BIN?=$(BINARY_PATH)/bin/linux/$(ARCH)/kubectl diff --git a/cluster/images/conformance/conformance-e2e.sh b/cluster/images/conformance/conformance-e2e.sh new file mode 100755 index 00000000000..45d86a258ef --- /dev/null +++ b/cluster/images/conformance/conformance-e2e.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Copyright 2018 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o nounset +set -o pipefail + +kubectl create -f conformance-e2e.yaml +while true; do + STATUS=$(kubectl -n conformance get pods e2e-conformance-test -o jsonpath="{.status.phase}") + timestamp=$(date +"[%H:%M:%S]") + echo "$timestamp Pod status is: ${STATUS}" + if [[ "$STATUS" == "Succeeded" ]]; then + echo "$timestamp Done." + break + else + sleep 5 + fi +done +echo "Please use 'kubectl logs -n conformance e2e-conformance-test' to view the results" From 23b33f5c852beb60eabd4d0cbb92f5ef00cf647a Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Wed, 27 Feb 2019 08:54:45 -0500 Subject: [PATCH 4/4] Switch to k8s.gcr.io (from staging) Change-Id: Ib0d6f681be3537f0cbfcae1dc254f1c42a04be66 --- cluster/images/conformance/Makefile | 4 ++-- cluster/images/conformance/README.md | 14 +++++++------- cluster/images/conformance/conformance-e2e.yaml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cluster/images/conformance/Makefile b/cluster/images/conformance/Makefile index 00307960210..0a7673adca7 100644 --- a/cluster/images/conformance/Makefile +++ b/cluster/images/conformance/Makefile @@ -15,9 +15,9 @@ # Build the conformance image. # # Usage: -# [ARCH=amd64] [REGISTRY="staging-k8s.gcr.io"] make (build|push) VERSION={some_released_version_of_kubernetes} +# [ARCH=amd64] [REGISTRY="k8s.gcr.io"] make (build|push) VERSION={some_released_version_of_kubernetes} -REGISTRY?=staging-k8s.gcr.io +REGISTRY?=k8s.gcr.io ARCH?=amd64 OUT_DIR?=_output diff --git a/cluster/images/conformance/README.md b/cluster/images/conformance/README.md index c32c84eb00e..b5df5e8c1db 100644 --- a/cluster/images/conformance/README.md +++ b/cluster/images/conformance/README.md @@ -10,23 +10,23 @@ $ make WHAT="test/e2e/e2e.test vendor/github.com/onsi/ginkgo/ginkgo cmd/kubectl" # Build for linux/amd64 (default) -# export REGISTRY=$HOST/$ORG to switch from staging-k8s.gcr.io +# export REGISTRY=$HOST/$ORG to switch from k8s.gcr.io $ make push VERSION={target_version} ARCH=amd64 -# ---> staging-k8s.gcr.io/conformance-amd64:VERSION -# ---> staging-k8s.gcr.io/conformance:VERSION (image with backwards-compatible naming) +# ---> k8s.gcr.io/conformance-amd64:VERSION +# ---> k8s.gcr.io/conformance:VERSION (image with backwards-compatible naming) $ make push VERSION={target_version} ARCH=arm -# ---> staging-k8s.gcr.io/conformance-arm:VERSION +# ---> k8s.gcr.io/conformance-arm:VERSION $ make push VERSION={target_version} ARCH=arm64 -# ---> staging-k8s.gcr.io/conformance-arm64:VERSION +# ---> k8s.gcr.io/conformance-arm64:VERSION $ make push VERSION={target_version} ARCH=ppc64le -# ---> staging-k8s.gcr.io/conformance-ppc64le:VERSION +# ---> k8s.gcr.io/conformance-ppc64le:VERSION $ make push VERSION={target_version} ARCH=s390x -# ---> staging-k8s.gcr.io/conformance-s390x:VERSION +# ---> k8s.gcr.io/conformance-s390x:VERSION ``` If you don't want to push the images, run `make` or `make build` instead diff --git a/cluster/images/conformance/conformance-e2e.yaml b/cluster/images/conformance/conformance-e2e.yaml index 4070b71731c..b12c4858483 100644 --- a/cluster/images/conformance/conformance-e2e.yaml +++ b/cluster/images/conformance/conformance-e2e.yaml @@ -55,7 +55,7 @@ metadata: spec: containers: - name: conformance-container - image: staging-k8s.gcr.io/conformance-amd64:v1.14-alpha4 + image: k8s.gcr.io/conformance-amd64:v1.14 imagePullPolicy: IfNotPresent env: - name: E2E_FOCUS