Skip to content

Commit bc3e9dd

Browse files
committed
fix: resolve test breakage related to using emulation-forward-compatible feature gate on all tests when it is not present until k8s 1.33
1 parent 37b82bb commit bc3e9dd

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

experiment/compatibility-versions/e2e-k8s-compatibility-versions.sh

+31-2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,29 @@ check_structured_log_support() {
8888
esac
8989
}
9090

91+
# Function to check if version is greater than or equal to the target
92+
version_gte() {
93+
local version=$1
94+
local target=$2
95+
96+
# Extract major and minor versions
97+
local version_major version_minor
98+
version_major=$(echo "$version" | cut -d. -f1)
99+
version_minor=$(echo "$version" | cut -d. -f2)
100+
101+
local target_major target_minor
102+
target_major=$(echo "$target" | cut -d. -f1)
103+
target_minor=$(echo "$target" | cut -d. -f2)
104+
105+
# Compare major version first, then minor
106+
if [ "$version_major" -gt "$target_major" ]; then
107+
return 0
108+
elif [ "$version_major" -eq "$target_major" ] && [ "$version_minor" -ge "$target_minor" ]; then
109+
return 0
110+
fi
111+
return 1
112+
}
113+
91114
# up a cluster with kind
92115
create_cluster() {
93116
# Default Log level for all components in test clusters
@@ -148,6 +171,12 @@ create_cluster() {
148171
;;
149172
esac
150173

174+
# Conditionally include the emulation-forward-compatible flag based on version
175+
emulation_forward_compatible=""
176+
if version_gte "${PREV_VERSION}" "1.33"; then
177+
emulation_forward_compatible=" \"emulation-forward-compatible\": \"true\""
178+
fi
179+
151180
# create the config file
152181
cat <<EOF > "${ARTIFACTS}/kind-config.yaml"
153182
# config for 1 control plane node and 2 workers (necessary for conformance)
@@ -173,8 +202,8 @@ kubeadmConfigPatches:
173202
apiServer:
174203
extraArgs:
175204
${apiServer_extra_args}
176-
"emulated-version": "${EMULATED_VERSION}"
177-
"emulation-forward-compatible": "true"
205+
"emulated-version": "${EMULATED_VERSION}"${emulation_forward_compatible:+
206+
$emulation_forward_compatible}
178207
controllerManager:
179208
extraArgs:
180209
${controllerManager_extra_args}

0 commit comments

Comments
 (0)