Skip to content

Commit 72eda40

Browse files
authored
Update k8s binaries used in CI (#6257) (#6297)
Backport #6257 in `2.6` needed to fix integration tests on buildkite by setting the kubebuilder assets path since last agent image was updated to work with controller-runtime 2.4.0 in `main` and then changed the etcd binary path. --- New versions of kubebuilder doesn't provide etcd and kube-apiserver binaries, so we have to download them directly now. I chose kube-apiserver `1.21.14` because it's the minimum k8s version supported today by ECK. I also aligned the kubectl version.
1 parent cfe54de commit 72eda40

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

.ci/Dockerfile

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ FROM docker.io/library/golang:1.19.3
33

44
ENV GOLANGCILINT_VERSION=1.48.0
55
ENV SHELLCHECK_VERSION=0.8.0
6-
ENV KUBEBUILDER_VERSION=2.3.1
76
ENV GCLOUD_VERSION=381.0.0
8-
ENV KUBECTL_VERSION=1.19.16
7+
ENV KUBECTL_VERSION=1.21.14
98
ENV DOCKER_VERSION=19.03.14
109
ENV DOCKER_BUILDX_VERSION=0.8.2
1110
ENV GOTESTSUM_VERSION=1.8.0
@@ -17,12 +16,14 @@ ENV HELM_VERSION=3.9.1
1716
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
1817
| sh -s -- -b $(go env GOPATH)/bin v${GOLANGCILINT_VERSION}
1918

20-
# kubebuilder to get required tools (etcd, apiserver, etc.)
21-
ENV PATH=${PATH}:/usr/local/kubebuilder/bin
22-
RUN curl -fsSLO https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBEBUILDER_VERSION}/kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64.tar.gz && \
23-
tar -zxf kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64.tar.gz && \
24-
mv kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64 /usr/local/kubebuilder && \
25-
rm kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64.tar.gz
19+
# etcd and apiserver for integration tests
20+
ENV KUBEAPISERVER_VERSION=1.21.14
21+
RUN curl -fsSL https://dl.k8s.io/v${KUBEAPISERVER_VERSION}/bin/linux/amd64/kube-apiserver -o /usr/local/bin/kube-apiserver && \
22+
chmod +x /usr/local/bin/kube-apiserver
23+
ENV ETCD_VER=3.4.23
24+
RUN curl -fsSLO https://storage.googleapis.com/etcd/v${ETCD_VER}/etcd-v${ETCD_VER}-linux-amd64.tar.gz && \
25+
tar zxf etcd-v${ETCD_VER}-linux-amd64.tar.gz -C /usr/local/bin --strip-components=1 && \
26+
rm -f etcd-v${ETCD_VER}-linux-amd64.tar.gz
2627

2728
# gcloud to provision GKE clusters
2829
ENV PATH=${PATH}:/usr/local/google-cloud-sdk/bin
@@ -36,7 +37,7 @@ RUN curl -fsSLO https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/googl
3637
rm google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz
3738

3839
# kubectl for deploying the operator and running e2e tests
39-
RUN curl -fsSLO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
40+
RUN curl -fsSLO https://dl.k8s.io/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
4041
mv kubectl /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl
4142

4243
# Docker client to build and push images

Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,13 @@ helm-test:
172172

173173
integration: GO_TAGS += integration
174174
integration: clean generate-crds-v1
175-
ECK_TEST_LOG_LEVEL=$(LOG_VERBOSITY) go test -tags='$(GO_TAGS)' ./pkg/... ./cmd/... -cover $(TEST_OPTS)
175+
KUBEBUILDER_ASSETS=/usr/local/bin ECK_TEST_LOG_LEVEL=$(LOG_VERBOSITY) \
176+
go test -tags='$(GO_TAGS)' ./pkg/... ./cmd/... -cover $(TEST_OPTS)
176177

177178
integration-xml: GO_TAGS += integration
178179
integration-xml: clean generate-crds-v1
179-
ECK_TEST_LOG_LEVEL=$(LOG_VERBOSITY) gotestsum --junitfile integration-tests.xml -- -tags='$(GO_TAGS)' -cover ./pkg/... ./cmd/... $(TEST_OPTS)
180+
KUBEBUILDER_ASSETS=/usr/local/bin ECK_TEST_LOG_LEVEL=$(LOG_VERBOSITY) \
181+
gotestsum --junitfile integration-tests.xml -- -tags='$(GO_TAGS)' -cover ./pkg/... ./cmd/... $(TEST_OPTS)
180182

181183
lint:
182184
GOGC=50 golangci-lint run --verbose

0 commit comments

Comments
 (0)