Skip to content

Commit 8ba6e51

Browse files
committed
bump KUBERNETES_VERSION + refactor loading
1 parent 71f39ce commit 8ba6e51

File tree

3 files changed

+50
-5
lines changed

3 files changed

+50
-5
lines changed

hack/ensure-yq.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2025 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
YQ_VERSION="v4.45.4"
22+
23+
# Check if Go is installed
24+
if ! command -v go &> /dev/null; then
25+
echo "Error: go is not installed. Please install go first."
26+
exit 1
27+
fi
28+
29+
# Install yq only if not already installed
30+
if ! [ -x "$(command -v yq)" ]; then
31+
echo 'yq not found, installing'
32+
go install "github.com/mikefarah/yq/v4@${YQ_VERSION}"
33+
34+
# Check if installation was successful
35+
if ! [ -x "$(command -v yq)" ]; then
36+
echo "error: yq installation failed."
37+
exit 1
38+
fi
39+
40+
echo "yq ${YQ_VERSION} has been successfully installed."
41+
fi

scripts/ci-e2e.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ make --directory="${REPO_ROOT}" "${KUBECTL##*/}" "${KIND##*/}"
3232
source "${REPO_ROOT}/hack/ensure-go.sh"
3333
# shellcheck source=hack/ensure-kustomize.sh
3434
source "${REPO_ROOT}/hack/ensure-kustomize.sh"
35+
# shellcheck source=hack/ensure-yq.sh
36+
source "${REPO_ROOT}/hack/ensure-yq.sh"
3537

3638
# Configure e2e tests
3739
export GINKGO_NODES=3
@@ -47,10 +49,12 @@ export TEST_NAME=${CLUSTER_NAME:-"capg-${RANDOM}"}
4749
export GCP_NETWORK_NAME=${GCP_NETWORK_NAME:-"${TEST_NAME}-mynetwork"}
4850
GCP_B64ENCODED_CREDENTIALS=$(base64 "$GOOGLE_APPLICATION_CREDENTIALS" | tr -d '\n')
4951
export GCP_B64ENCODED_CREDENTIALS
50-
export KUBERNETES_MAJOR_VERSION="1"
51-
export KUBERNETES_MINOR_VERSION="27"
52-
export KUBERNETES_PATCH_VERSION="3"
53-
export KUBERNETES_VERSION="v${KUBERNETES_MAJOR_VERSION}.${KUBERNETES_MINOR_VERSION}.${KUBERNETES_PATCH_VERSION}"
52+
KUBERNETES_VERSION=$(yq '.variables.KUBERNETES_VERSION' test/e2e/config/gcp-ci.yaml)
53+
export KUBERNETES_VERSION
54+
read -ra VERSION_PARTS <<< "$(echo "${KUBERNETES_VERSION#v}" | tr '.' ' ')"
55+
export KUBERNETES_MAJOR_VERSION="${VERSION_PARTS[0]}"
56+
export KUBERNETES_MINOR_VERSION="${VERSION_PARTS[1]}"
57+
export KUBERNETES_PATCH_VERSION="${VERSION_PARTS[2]}"
5458
# using prebuilt image from image-builder project the image is built everyday and the job is available here https://prow.k8s.io/?job=periodic-image-builder-gcp-all-nightly
5559
export IMAGE_ID="projects/k8s-staging-cluster-api-gcp/global/images/cluster-api-ubuntu-2204-${KUBERNETES_VERSION//[.+]/-}-nightly"
5660

test/e2e/config/gcp-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ providers:
7575
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-ci-with-internal-lb.yaml"
7676

7777
variables:
78-
KUBERNETES_VERSION: "${KUBERNETES_VERSION:-v1.31.0}"
78+
KUBERNETES_VERSION: "v1.30.0"
7979
KUBERNETES_VERSION_MANAGEMENT: "v1.31.0"
8080
ETCD_VERSION_UPGRADE_TO: "3.5.14-0"
8181
COREDNS_VERSION_UPGRADE_TO: "v1.11.3"

0 commit comments

Comments
 (0)