File tree Expand file tree Collapse file tree 10 files changed +42
-14
lines changed
component-config-tutorial/testdata/project
cronjob-tutorial/testdata/project
multiversion-tutorial/testdata/project Expand file tree Collapse file tree 10 files changed +42
-14
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ builds:
43
43
- linux_ppc64le
44
44
- darwin_amd64
45
45
env :
46
- - KUBERNETES_VERSION=1.21 .1
46
+ - KUBERNETES_VERSION=1.22 .1
47
47
- CGO_ENABLED=0
48
48
49
49
# Only binaries of the form "kubebuilder_${goos}_${goarch}" will be released.
Original file line number Diff line number Diff line change 2
2
# Image URL to use all building/pushing image targets
3
3
IMG ?= controller:latest
4
4
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5
- ENVTEST_K8S_VERSION = 1.21
5
+ ENVTEST_K8S_VERSION = 1.22
6
6
7
7
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
8
8
ifeq (,$(shell go env GOBIN) )
Original file line number Diff line number Diff line change 2
2
# Image URL to use all building/pushing image targets
3
3
IMG ?= controller:latest
4
4
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5
- ENVTEST_K8S_VERSION = 1.21
5
+ ENVTEST_K8S_VERSION = 1.22
6
6
7
7
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
8
8
ifeq (,$(shell go env GOBIN) )
Original file line number Diff line number Diff line change @@ -425,7 +425,7 @@ test: manifests generate fmt vet ## Run tests.
425
425
<aside class="note">
426
426
<h1>Envtest binaries</h1>
427
427
428
- The Kubernetes binaries that are required for the Envtest were upgraded from `1.16.4` to `1.21 .1`.
428
+ The Kubernetes binaries that are required for the Envtest were upgraded from `1.16.4` to `1.22 .1`.
429
429
You can still install them globally by following [these installation instructions][doc-envtest].
430
430
431
431
</aside>
Original file line number Diff line number Diff line change 2
2
# Image URL to use all building/pushing image targets
3
3
IMG ?= controller:latest
4
4
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5
- ENVTEST_K8S_VERSION = 1.21
5
+ ENVTEST_K8S_VERSION = 1.22
6
6
7
7
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
8
8
ifeq (,$(shell go env GOBIN) )
Original file line number Diff line number Diff line change @@ -39,6 +39,15 @@ Or configure the existing target to skip the download and point to a [custom loc
39
39
make test SKIP_FETCH_TOOLS=1 KUBEBUILDER_ASSETS=/opt/kubebuilder/testbin
40
40
```
41
41
42
+ ### Kubernetes 1.20 and 1.21 binary issues
43
+
44
+ There have been many reports of the ` kube-apiserver ` or ` etcd ` binary [ hanging during cleanup] [ cr-1571 ]
45
+ or misbehaving in other ways. We recommend using the 1.19.2 tools version to circumvent such issues,
46
+ which do not seem to arise in 1.22+. This is likely NOT the cause of a ` fork/exec: permission denied `
47
+ or ` fork/exec: not found ` error, which is caused by improper tools installation.
48
+
49
+ [ cr-1571 ] :https://github.com/kubernetes-sigs/controller-runtime/issues/1571
50
+
42
51
## Writing tests
43
52
44
53
Using ` envtest ` in integration tests follows the general flow of:
Original file line number Diff line number Diff line change 14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
16
17
+ # Not every exact cluster version has an equal tools version, and visa versa.
18
+ # This function returns the exact tools version for a k8s version based on its minor.
19
+ function convert_to_tools_ver {
20
+ local k8s_ver=${1:? " k8s version must be set to arg 1" }
21
+ local maj_min=$( echo $k8s_ver | grep -oE ' ^[0-9]+\.[0-9]+' )
22
+ case $maj_min in
23
+ # 1.14-1.19 work with the 1.19 server bins and kubectl.
24
+ " 1.14" |" 1.15" |" 1.16" |" 1.17" |" 1.18" |" 1.19" ) echo " 1.19.2" ;;
25
+ # Tests in 1.20 and 1.21 with their counterpart version's apiserver.
26
+ " 1.20" |" 1.21" ) echo " 1.19.2" ;;
27
+ " 1.22" ) echo " 1.22.1" ;;
28
+ * )
29
+ echo " k8s version $k8s_ver not supported"
30
+ exit 1
31
+ esac
32
+ }
33
+
17
34
set -o errexit
18
35
set -o nounset
19
36
set -o pipefail
@@ -27,7 +44,8 @@ if [ -n "$TRACE" ]; then
27
44
set -x
28
45
fi
29
46
30
- tools_k8s_version=1.19.2
47
+ export KIND_K8S_VERSION=" ${KIND_K8S_VERSION:- " v1.22.1" } "
48
+ tools_k8s_version=$( convert_to_tools_ver " ${KIND_K8S_VERSION# v* } " )
31
49
kind_version=0.11.1
32
50
goarch=amd64
33
51
@@ -121,4 +139,3 @@ function is_installed {
121
139
fi
122
140
return 1
123
141
}
124
-
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ source "$(dirname "$0")/../common.sh"
18
18
source " $( dirname " $0 " ) /setup.sh"
19
19
20
20
export KIND_CLUSTER=" local-kubebuilder-e2e"
21
- create_cluster ${KIND_K8S_VERSION:- v1.22.1 }
21
+ create_cluster ${KIND_K8S_VERSION}
22
22
if [ -z " ${SKIP_KIND_CLEANUP:- } " ]; then
23
23
trap delete_cluster EXIT
24
24
fi
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ install_kind
28
28
# create_cluster <k8s version>
29
29
function create_cluster {
30
30
: ${KIND_CLUSTER:? " KIND_CLUSTER must be set" }
31
+ : ${1:? " k8s version must be set as arg 1" }
31
32
if ! kind get clusters | grep -q $KIND_CLUSTER ; then
32
33
kind create cluster -v 4 --name $KIND_CLUSTER --retain --wait=1m --config $( dirname " $0 " ) /kind-config.yaml --image=kindest/node:$1
33
34
fi
Original file line number Diff line number Diff line change @@ -29,15 +29,16 @@ function test_project {
29
29
}
30
30
31
31
build_kb
32
- fetch_tools
33
-
34
- # Test project v2
35
- test_project project-v2
36
- test_project project-v2-multigroup
37
- test_project project-v2-addon
38
32
39
33
# Test project v3
40
34
test_project project-v3
41
35
test_project project-v3-multigroup
42
36
test_project project-v3-addon
43
37
test_project project-v3-config
38
+
39
+ # Test project v2, which relies on pre-installed envtest tools to run 'make test'.
40
+ tools_k8s_version=" 1.19.2"
41
+ fetch_tools
42
+ test_project project-v2
43
+ test_project project-v2-multigroup
44
+ test_project project-v2-addon
You can’t perform that action at this time.
0 commit comments