diff --git a/Dockerfile.e2e-test b/Dockerfile.e2e-test index b56fba01ef..8faffefe26 100644 --- a/Dockerfile.e2e-test +++ b/Dockerfile.e2e-test @@ -14,5 +14,8 @@ FROM debian:9 +COPY cmd/e2e-test/run.sh /run.sh ADD bin/ARG_ARCH/ARG_BIN /ARG_BIN -ENTRYPOINT ["/ARG_BIN", "-inCluster"] +RUN apt-get update && apt-get update && apt-get install curl -y + +ENTRYPOINT ["/run.sh"] diff --git a/Makefile b/Makefile index b15d78e13d..1e2d27c7e2 100644 --- a/Makefile +++ b/Makefile @@ -53,4 +53,4 @@ include build/rules.mk # Additional rule to build an image of glbc for e2e testing. # TODO(rramkumar): Find a way not to use "latest" as the tag. push-e2e: - @$(MAKE) --no-print-directory CONTAINER_PREFIX=ingress-gce-e2e containers push + @$(MAKE) --no-print-directory containers push diff --git a/cmd/e2e-test/e2e-test.yaml b/cmd/e2e-test/e2e-test.yaml index 7585bf3abf..aa96151dec 100644 --- a/cmd/e2e-test/e2e-test.yaml +++ b/cmd/e2e-test/e2e-test.yaml @@ -13,10 +13,15 @@ # limitations under the License. # -# To enable creating RBAC rules on the GKE cluster: +# To run the containerized e2e test in your own cluster: +# +# $ kubectl apply -f e2e-test.yaml +# +# You will nee to first enable creating RBAC rules on the GKE cluster: +# # $ kubectl create clusterrolebinding cluster-admin-binding \ -# --clusterrole cluster-admin -# --user $(gcloud config get-value account) +# --clusterrole cluster-admin \ +# --user $(gcloud config get-value account) \ # clusterrolebinding "cluster-admin-binding" kind: ServiceAccount apiVersion: v1 @@ -24,36 +29,25 @@ metadata: name: ingress-e2e-test namespace: default --- -kind: Role +kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: - namespace: default name: ingress-e2e-test rules: - - apiGroups: [""] - resources: ["pods"] - verbs: ["list"] - - apiGroups: [""] - resources: ["nodes"] - verbs: ["list"] - - apiGroups: [""] - resources: ["services"] - verbs: ["list"] - - apiGroups: [""] - resources: ["configmaps"] - verbs: ["get", "create"] + - apiGroups: ["*"] + resources: ["*"] + verbs: ["*"] --- -kind: RoleBinding +kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: ingress-e2e-test - namespace: default subjects: - kind: ServiceAccount name: ingress-e2e-test namespace: default roleRef: - kind: Role + kind: ClusterRole name: ingress-e2e-test apiGroup: rbac.authorization.k8s.io --- @@ -65,7 +59,7 @@ metadata: spec: containers: - name: ingress-e2e - image: gcr.io/k8s-ingress-image-push/ingress-gce-e2e-test-amd64:v1.1.0-123-g7aaa9456 + image: gcr.io/k8s-ingress-image-push/ingress-gce-e2e-test-amd64:master imagePullPolicy: Always restartPolicy: Never serviceAccount: ingress-e2e-test diff --git a/cmd/e2e-test/run.sh b/cmd/e2e-test/run.sh new file mode 100755 index 0000000000..f99d04b4ce --- /dev/null +++ b/cmd/e2e-test/run.sh @@ -0,0 +1,27 @@ +#!/bin/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. + +# run.sh manages the settings required for running containerized in a +# Kubernetes cluster. + +echo '--- BEGIN ---' +PROJECT=$(curl -H'Metadata-Flavor:Google' metadata.google.internal/computeMetadata/v1/project/project-id 2>/dev/null) +echo "PROJECT: ${PROJECT}" +CMD="/e2e-test -test.v -test.parallel=10 -run -project ${PROJECT} -logtostderr -inCluster -v=2" +echo "CMD: ${CMD}" $@ +${CMD} "$@" 2>&1 +echo "RESULT: $?" +echo '--- END ---'