Skip to content

Commit f1b077f

Browse files
authored
Merge pull request #713 from tam7t/tam7t/kubectl-version
chore: update kubectl to 1.22.1 for integration tests
2 parents 9af45b7 + 74e5871 commit f1b077f

File tree

5 files changed

+24
-41
lines changed

5 files changed

+24
-41
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ YQ := yq
9393
# Test variables
9494
KIND_VERSION ?= 0.11.0
9595
KUBERNETES_VERSION ?= 1.21.1
96+
# Use a different kubectl version to pickup https://github.com/kubernetes/kubernetes/pull/96702 which resolves an issue
97+
# with kubectl wait needed for integration testing. When KUBERNETES_VERSION is updated to >= 1.22.1 this can likely be
98+
# removed.
99+
KUBECTL_VERSION ?= 1.22.1
96100
BATS_VERSION ?= 1.2.1
97101
TRIVY_VERSION ?= 0.14.0
98102
PROTOC_VERSION ?= 3.15.2
@@ -190,7 +194,7 @@ $(EKSCTL): ## Download and install eksctl
190194
curl -sSLO https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_Linux_amd64.tar.gz && tar -zxvf eksctl_Linux_amd64.tar.gz && chmod +x eksctl && mv eksctl /usr/local/bin/
191195

192196
$(KUBECTL): ## Install kubectl
193-
curl -LO https://storage.googleapis.com/kubernetes-release/release/v$(KUBERNETES_VERSION)/bin/linux/amd64/kubectl && chmod +x ./kubectl && mv kubectl /usr/local/bin/
197+
curl -LO https://storage.googleapis.com/kubernetes-release/release/v$(KUBECTL_VERSION)/bin/linux/amd64/kubectl && chmod +x ./kubectl && mv kubectl /usr/local/bin/
194198

195199
$(TRIVY): ## Install trivy for image vulnerability scan
196200
trivy -v | grep -q $(TRIVY_VERSION) || (curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v$(TRIVY_VERSION))

test/bats/aws.bats

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,23 +148,17 @@ teardown_file() {
148148
}
149149

150150
@test "CSI inline volume test with pod portability - unmount succeeds" {
151-
# https://github.com/kubernetes/kubernetes/pull/96702
152-
# kubectl wait --for=delete does not work on already deleted pods.
153-
# Instead we will start the wait before initiating the delete.
154-
kubectl wait --for=delete --timeout=${WAIT_TIME}s --namespace $NAMESPACE pod/$POD_NAME &
155-
WAIT_PID=$!
156-
157-
sleep 1
151+
# On Linux a failure to unmount the tmpfs will block the pod from being
152+
# deleted.
158153
run kubectl --namespace $NAMESPACE delete -f $BATS_TEST_DIR/BasicTestMount.yaml
159154
assert_success
160155

161-
# On Linux a failure to unmount the tmpfs will block the pod from being
162-
# deleted.
163-
run wait $WAIT_PID
156+
run kubectl wait --for=delete --timeout=${WAIT_TIME}s --namespace $NAMESPACE pod/$POD_NAME
164157
assert_success
165158

166159
# Sleep to allow time for logs to propagate.
167160
sleep 10
161+
168162
# save debug information to archive in case of failure
169163
archive_info
170164

test/bats/azure.bats

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,17 @@ setup() {
126126
}
127127

128128
@test "CSI inline volume test with pod portability - unmount succeeds" {
129-
# https://github.com/kubernetes/kubernetes/pull/96702
130-
# kubectl wait --for=delete does not work on already deleted pods.
131-
# Instead we will start the wait before initiating the delete.
132-
kubectl wait --for=delete --timeout=${WAIT_TIME}s pod/secrets-store-inline-crd &
133-
WAIT_PID=$!
134-
135-
sleep 1
136-
run kubectl delete pod secrets-store-inline-crd
137-
138129
# On Linux a failure to unmount the tmpfs will block the pod from being
139130
# deleted.
140-
run wait $WAIT_PID
131+
run kubectl delete pod secrets-store-inline-crd
132+
assert_success
133+
134+
run kubectl wait --for=delete --timeout=${WAIT_TIME}s pod/secrets-store-inline-crd
141135
assert_success
142136

143137
# Sleep to allow time for logs to propagate.
144138
sleep 10
139+
145140
# save debug information to archive in case of failure
146141
archive_info
147142

test/bats/gcp.bats

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,17 @@ export SECRET_VALUE=${SECRET_VALUE:-"aHVudGVyMg=="}
7575
}
7676

7777
@test "CSI inline volume test with pod portability - unmount succeeds" {
78-
# https://github.com/kubernetes/kubernetes/pull/96702
79-
# kubectl wait --for=delete does not work on already deleted pods.
80-
# Instead we will start the wait before initiating the delete.
81-
kubectl wait --for=delete --timeout=${WAIT_TIME}s --namespace=$NAMESPACE pod/secrets-store-inline-crd &
82-
WAIT_PID=$!
83-
84-
sleep 1
85-
run kubectl delete pod secrets-store-inline-crd --namespace=$NAMESPACE
86-
8778
# On Linux a failure to unmount the tmpfs will block the pod from being
8879
# deleted.
89-
run wait $WAIT_PID
80+
run kubectl delete pod secrets-store-inline-crd --namespace=$NAMESPACE
81+
assert_success
82+
83+
run kubectl wait --for=delete --timeout=${WAIT_TIME}s --namespace=$NAMESPACE pod/secrets-store-inline-crd
9084
assert_success
9185

9286
# Sleep to allow time for logs to propagate.
9387
sleep 10
88+
9489
# save debug information to archive in case of failure
9590
archive_info
9691

test/bats/vault.bats

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,17 @@ EOF
114114
}
115115

116116
@test "CSI inline volume test with pod portability - unmount succeeds" {
117-
# https://github.com/kubernetes/kubernetes/pull/96702
118-
# kubectl wait --for=delete does not work on already deleted pods.
119-
# Instead we will start the wait before initiating the delete.
120-
kubectl wait --for=delete --timeout=${WAIT_TIME}s pod/secrets-store-inline &
121-
WAIT_PID=$!
122-
123-
sleep 1
124-
run kubectl delete pod secrets-store-inline
125-
126117
# On Linux a failure to unmount the tmpfs will block the pod from being
127118
# deleted.
128-
run wait $WAIT_PID
119+
run kubectl delete pod secrets-store-inline
120+
assert_success
121+
122+
run kubectl wait --for=delete --timeout=${WAIT_TIME}s pod/secrets-store-inline
129123
assert_success
130124

131125
# Sleep to allow time for logs to propagate.
132126
sleep 10
127+
133128
# save debug information to archive in case of failure
134129
archive_info
135130

0 commit comments

Comments
 (0)