Skip to content

Commit

Permalink
chore(deps): use equivalent tools version for cluster version
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Stroczynski <[email protected]>
  • Loading branch information
estroz committed Oct 15, 2021
1 parent 9dbdbd2 commit 0b6fb61
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ builds:
- linux_ppc64le
- darwin_amd64
env:
- KUBERNETES_VERSION=1.21.1
- KUBERNETES_VERSION=1.22.1
- CGO_ENABLED=0

# Only binaries of the form "kubebuilder_${goos}_${goarch}" will be released.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.21
ENVTEST_K8S_VERSION = 1.22

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/cronjob-tutorial/testdata/project/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.21
ENVTEST_K8S_VERSION = 1.22

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/migration/manually_migration_guide_v2_v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ test: manifests generate fmt vet ## Run tests.
<aside class="note">
<h1>Envtest binaries</h1>

The Kubernetes binaries that are required for the Envtest were upgraded from `1.16.4` to `1.21.1`.
The Kubernetes binaries that are required for the Envtest were upgraded from `1.16.4` to `1.22.1`.
You can still install them globally by following [these installation instructions][doc-envtest].

</aside>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.21
ENVTEST_K8S_VERSION = 1.22

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down
25 changes: 23 additions & 2 deletions test/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Not every exact cluster version has an equal tools version, and visa versa.
# This function returns the exact tools version for a k8s version based on its minor.
function convert_to_tools_ver {
local k8s_ver=${1:?"k8s version must be set to arg 1"}
local maj_min=$(echo $k8s_ver | grep -oE '^[0-9]+\.[0-9]+')
case $maj_min in
"1.14"|"1.15"|"1.16"|"1.17"|"1.18"|"1.19") echo "1.19.2";;
# "1.15") echo "1.15.5";;
# "1.16") echo "1.16.4";;
# "1.17") echo "1.17.9";;
# "1.18") echo "1.19.2";;
# "1.19") echo "1.19.2";;
"1.20") echo "1.20.2";;
"1.21") echo "1.21.4";;
"1.22") echo "1.22.1";;
*)
echo "k8s version $k8s_ver not supported"
exit 1
esac
}

set -o errexit
set -o nounset
set -o pipefail
Expand All @@ -27,7 +48,8 @@ if [ -n "$TRACE" ]; then
set -x
fi

tools_k8s_version=1.19.2
export KIND_K8S_VERSION="${KIND_K8S_VERSION:-"v1.22.1"}"
tools_k8s_version=$(convert_to_tools_ver "${KIND_K8S_VERSION#v*}")
kind_version=0.11.1
goarch=amd64

Expand Down Expand Up @@ -121,4 +143,3 @@ function is_installed {
fi
return 1
}

2 changes: 1 addition & 1 deletion test/e2e/local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ source "$(dirname "$0")/../common.sh"
source "$(dirname "$0")/setup.sh"

export KIND_CLUSTER="local-kubebuilder-e2e"
create_cluster ${KIND_K8S_VERSION:-v1.22.1}
create_cluster ${KIND_K8S_VERSION}
if [ -z "${SKIP_KIND_CLEANUP:-}" ]; then
trap delete_cluster EXIT
fi
Expand Down
1 change: 1 addition & 0 deletions test/e2e/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ install_kind
# create_cluster <k8s version>
function create_cluster {
: ${KIND_CLUSTER:?"KIND_CLUSTER must be set"}
: ${1:?"k8s version must be set as arg 1"}
if ! kind get clusters | grep -q $KIND_CLUSTER ; then
kind create cluster -v 4 --name $KIND_CLUSTER --retain --wait=1m --config $(dirname "$0")/kind-config.yaml --image=kindest/node:$1
fi
Expand Down

0 comments on commit 0b6fb61

Please sign in to comment.