Merge pull request #99178 from wilsonehusin/distroless-conformance

Use distroless to build Conformance image
This commit is contained in:
Kubernetes Prow Robot 2021-05-21 13:32:11 -07:00 committed by GitHub
commit fb3273774a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 7 deletions

View File

@ -13,16 +13,24 @@
# limitations under the License.
ARG BASEIMAGE
ARG RUNNERIMAGE
FROM ${BASEIMAGE}
FROM ${BASEIMAGE} as debbase
FROM ${RUNNERIMAGE}
# This is a dependency for `kubectl diff` tests
COPY --from=debbase /usr/bin/diff /usr/local/bin/
COPY cluster /kubernetes/cluster
COPY ginkgo /usr/local/bin/
COPY e2e.test /usr/local/bin/
COPY kubectl /usr/local/bin/
COPY run_e2e.sh /run_e2e.sh
COPY gorunner /usr/local/bin/kubeconformance
# Legacy executables -- deprecated
COPY gorunner /run_e2e.sh
COPY gorunner /gorunner
COPY cluster /kubernetes/cluster
WORKDIR /usr/local/bin
ENV E2E_FOCUS="\[Conformance\]"
ENV E2E_SKIP=""
@ -32,4 +40,4 @@ ENV E2E_VERBOSITY="4"
ENV RESULTS_DIR="/tmp/results"
ENV KUBECONFIG=""
CMD [ "/bin/bash", "-c", "/run_e2e.sh" ]
ENTRYPOINT [ "kubeconformance" ]

View File

@ -31,8 +31,18 @@ E2E_GO_RUNNER_BIN?=$(shell test -f $(LOCAL_OUTPUT_PATH)/go-runner && echo $(LOCA
CLUSTER_DIR?=$(shell pwd)/../../../cluster/
BASEIMAGE=debian:stable-slim
TEMP_DIR:=$(shell mktemp -d -t conformanceXXXXXX)
# This is defined in root Makefile, but some build contexts do not refer to them
KUBE_BASE_IMAGE_REGISTRY?=k8s.gcr.io
ifeq ($(ARCH),amd64)
BASEIMAGE?=${KUBE_BASE_IMAGE_REGISTRY}/build-image/debian-base:v2.1.3
else
BASEIMAGE?=${KUBE_BASE_IMAGE_REGISTRY}/build-image/debian-base-${ARCH}:v2.1.3
endif
RUNNERIMAGE?=gcr.io/distroless/base:latest
TEMP_DIR:=$(shell mktemp -d -t conformance-XXXXXX)
all: build
@ -60,6 +70,7 @@ endif
--pull \
-t ${REGISTRY}/conformance-${ARCH}:${VERSION} \
--build-arg BASEIMAGE=$(BASEIMAGE) \
--build-arg RUNNERIMAGE=$(RUNNERIMAGE) \
${TEMP_DIR}
rm -rf "${TEMP_DIR}"

View File

@ -23,11 +23,15 @@ import (
"os"
"os/signal"
"path/filepath"
"strings"
"github.com/pkg/errors"
)
func main() {
if strings.Contains(os.Args[0], "run_e2e.sh") || strings.Contains(os.Args[0], "gorunner") {
log.Print("warn: calling test with e2e.test is deprecated and will be removed in 1.25, please rely on container manifest to invoke executable")
}
env := envWithDefaults(map[string]string{
resultsDirEnvKey: defaultResultsDir,
skipEnvKey: defaultSkip,