From df0d9cf35601dce1a65d9adc3ed6a2d995e6c584 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Fri, 30 Jul 2021 12:26:16 +0200 Subject: [PATCH 01/14] Upgrade kube-builder --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 84a39e75..1d084a8d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,7 +7,7 @@ on: - '*' pull_request: env: - KUBE_BUILDER_VERSION: "2.3.2" + KUBE_BUILDER_VERSION: "3.1.0" OPERATOR_SDK_VERSION: "v1.10.0" jobs: build: From 4615bbe7b7ecbfcad1082b68981cd33b06c2710f Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Fri, 30 Jul 2021 12:41:47 +0200 Subject: [PATCH 02/14] fix config of kube builder --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1d084a8d..8d8ffabd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,8 +37,8 @@ jobs: - name: Setup env run: | - sudo curl -Lo- https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBE_BUILDER_VERSION}/kubebuilder_${KUBE_BUILDER_VERSION}_linux_amd64.tar.gz | tar xzv -C /tmp -f - - echo "KUBEBUILDER_ASSETS=/tmp/kubebuilder_${KUBE_BUILDER_VERSION}_linux_amd64/bin" >> $GITHUB_ENV + sudo curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBE_BUILDER_VERSION}/kubebuilder_linux_amd64 -o /usr/local/bin/kubebuilder + chmod a+x /usr/local/bin/kubebuilder - name: Test and build image run: | From 136b841f27b4b9ae9650681149cd188d1a0c0f72 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Fri, 30 Jul 2021 12:43:01 +0200 Subject: [PATCH 03/14] use sudo --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8d8ffabd..f5834782 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -38,7 +38,7 @@ jobs: - name: Setup env run: | sudo curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBE_BUILDER_VERSION}/kubebuilder_linux_amd64 -o /usr/local/bin/kubebuilder - chmod a+x /usr/local/bin/kubebuilder + sudo chmod a+x /usr/local/bin/kubebuilder - name: Test and build image run: | From c4b1b36705e1daeae02dffe74675c0dacc9db02e Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Mon, 30 Aug 2021 10:59:16 +0200 Subject: [PATCH 04/14] fix controller-runtime stuff --- Makefile | 5 +++++ api/v1alpha1/zz_generated.deepcopy.go | 1 + 2 files changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 1e0f23d8..619b1293 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,12 @@ endif all: manager # Run tests +ENVTEST_ASSETS_DIR=/tmp/envtest_assets.d +CONTROLLER_RUNTIME_VERSION=V0.9.6 test: generate fmt vet manifests + mkdir -p ${ENVTEST_ASSETS_DIR} + test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/${CONTROLLER_RUNTIME_VERSION}/hack/setup-envtest.sh + source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR) go test ./... -coverprofile cover.out # Build manager binary diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 125425e8..bc8b151a 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* From 2d2d8af0ce7cfc2b18035f8a0123db03c68e5ee6 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Mon, 30 Aug 2021 11:01:01 +0200 Subject: [PATCH 05/14] This should not be needed --- .github/workflows/build.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f5834782..bce2d917 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -35,11 +35,6 @@ jobs: with: go-version: '^1.17' - - name: Setup env - run: | - sudo curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBE_BUILDER_VERSION}/kubebuilder_linux_amd64 -o /usr/local/bin/kubebuilder - sudo chmod a+x /usr/local/bin/kubebuilder - - name: Test and build image run: | make test docker-build From bb5814244daf24ad569481cb65c21722c9b77b59 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Mon, 30 Aug 2021 11:01:21 +0200 Subject: [PATCH 06/14] Fix typo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 619b1293..ef6f35e8 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ all: manager # Run tests ENVTEST_ASSETS_DIR=/tmp/envtest_assets.d -CONTROLLER_RUNTIME_VERSION=V0.9.6 +CONTROLLER_RUNTIME_VERSION=v0.9.6 test: generate fmt vet manifests mkdir -p ${ENVTEST_ASSETS_DIR} test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/${CONTROLLER_RUNTIME_VERSION}/hack/setup-envtest.sh From 00d05da33f0d8218e4fa4dc1772aa664927554f1 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Mon, 30 Aug 2021 11:08:05 +0200 Subject: [PATCH 07/14] set bash as default shell --- .github/workflows/build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bce2d917..d151ad9c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -6,6 +6,9 @@ on: tags: - '*' pull_request: +defaults: + run: + shell: bash env: KUBE_BUILDER_VERSION: "3.1.0" OPERATOR_SDK_VERSION: "v1.10.0" From 68377364cb9ec3bf12ace01ae7bf118cbcd88d87 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Mon, 30 Aug 2021 11:14:39 +0200 Subject: [PATCH 08/14] downgrade to get script --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ef6f35e8..d870ccde 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ all: manager # Run tests ENVTEST_ASSETS_DIR=/tmp/envtest_assets.d -CONTROLLER_RUNTIME_VERSION=v0.9.6 +CONTROLLER_RUNTIME_VERSION=v0.8.3 test: generate fmt vet manifests mkdir -p ${ENVTEST_ASSETS_DIR} test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/${CONTROLLER_RUNTIME_VERSION}/hack/setup-envtest.sh From 9380c83b521eafc728554fa0f09ca9e32e4ff673 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Sat, 9 Oct 2021 17:44:53 +0200 Subject: [PATCH 09/14] Fix envtest --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f24f6525..d7e7c010 100644 --- a/Makefile +++ b/Makefile @@ -29,10 +29,13 @@ all: manager # Run tests ENVTEST_ASSETS_DIR=/tmp/envtest_assets.d CONTROLLER_RUNTIME_VERSION=v0.8.3 +K8S_VERSION=1.22.0 +GOOS=$(shell go env GOOS) +GOARCH=$(shell go env GOARCH) test: generate fmt vet manifests mkdir -p ${ENVTEST_ASSETS_DIR} - test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/${CONTROLLER_RUNTIME_VERSION}/hack/setup-envtest.sh - source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR) + curl -sSLo /tmp/envtest-bins.tar.gz "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-${K8S_VERSION}-${GOOS}-${GOARCH}.tar.gz" + tar -C ${ENVTEST_ASSETS_DIR} --strip-components=1 -zvxf /tmp/envtest-bins.tar.gz go test ./... -coverprofile cover.out # Build manager binary From bcf262cb312bd065b3051e721702bb7df3ea708e Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Sat, 9 Oct 2021 17:57:25 +0200 Subject: [PATCH 10/14] simplify --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d7e7c010..03f8605a 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,7 @@ GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) test: generate fmt vet manifests mkdir -p ${ENVTEST_ASSETS_DIR} - curl -sSLo /tmp/envtest-bins.tar.gz "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-${K8S_VERSION}-${GOOS}-${GOARCH}.tar.gz" - tar -C ${ENVTEST_ASSETS_DIR} --strip-components=1 -zvxf /tmp/envtest-bins.tar.gz + curl -sSL "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-${K8S_VERSION}-${GOOS}-${GOARCH}.tar.gz" | tar xvz -C ${ENVTEST_ASSETS_DIR} --strip-components=1 go test ./... -coverprofile cover.out # Build manager binary From 4ad248f1a7ac396afa41c487c2e48d290ac81dd1 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Sat, 9 Oct 2021 18:06:17 +0200 Subject: [PATCH 11/14] fix variable --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 03f8605a..041dba26 100644 --- a/Makefile +++ b/Makefile @@ -27,14 +27,14 @@ endif all: manager # Run tests -ENVTEST_ASSETS_DIR=/tmp/envtest_assets.d +KUBEBUILDER_ASSETS=/tmp/envtest_assets.d CONTROLLER_RUNTIME_VERSION=v0.8.3 K8S_VERSION=1.22.0 GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) test: generate fmt vet manifests - mkdir -p ${ENVTEST_ASSETS_DIR} - curl -sSL "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-${K8S_VERSION}-${GOOS}-${GOARCH}.tar.gz" | tar xvz -C ${ENVTEST_ASSETS_DIR} --strip-components=1 + mkdir -p ${KUBEBUILDER_ASSETS} + curl -sSL "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-${K8S_VERSION}-${GOOS}-${GOARCH}.tar.gz" | tar xvz -C ${KUBEBUILDER_ASSETS} --strip-components=1 go test ./... -coverprofile cover.out # Build manager binary From a18dbec33b1f7fa62ac88a7e1224232ca7d12992 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Sat, 9 Oct 2021 18:11:55 +0200 Subject: [PATCH 12/14] fix path --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 041dba26..1a622ec3 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) test: generate fmt vet manifests mkdir -p ${KUBEBUILDER_ASSETS} - curl -sSL "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-${K8S_VERSION}-${GOOS}-${GOARCH}.tar.gz" | tar xvz -C ${KUBEBUILDER_ASSETS} --strip-components=1 + curl -sSL "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-${K8S_VERSION}-${GOOS}-${GOARCH}.tar.gz" | tar xvz -C ${KUBEBUILDER_ASSETS} --strip-components=2 go test ./... -coverprofile cover.out # Build manager binary From e3ab3fda817390f689cc94167042e27fdf151dc8 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Sat, 9 Oct 2021 18:23:07 +0200 Subject: [PATCH 13/14] cleanup --- .github/workflows/build.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d151ad9c..4f5920c2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -6,11 +6,7 @@ on: tags: - '*' pull_request: -defaults: - run: - shell: bash env: - KUBE_BUILDER_VERSION: "3.1.0" OPERATOR_SDK_VERSION: "v1.10.0" jobs: build: From 7499bbc1177d9c87a09ea97b68699a0791ba9e35 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Sat, 9 Oct 2021 18:29:09 +0200 Subject: [PATCH 14/14] fix build --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1a622ec3..73572941 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ GOARCH=$(shell go env GOARCH) test: generate fmt vet manifests mkdir -p ${KUBEBUILDER_ASSETS} curl -sSL "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-${K8S_VERSION}-${GOOS}-${GOARCH}.tar.gz" | tar xvz -C ${KUBEBUILDER_ASSETS} --strip-components=2 - go test ./... -coverprofile cover.out + KUBEBUILDER_ASSETS=${KUBEBUILDER_ASSETS} go test ./... -coverprofile cover.out # Build manager binary manager: generate fmt vet