Skip to content

Commit

Permalink
[YUNIKORN-2815] Run e2e tests against Kubernetes 1.31
Browse files Browse the repository at this point in the history
Update the ee2e test matrix to include Kubernetes 1.31. Also, set the
InPlacePodVerticalScaling feature flag when running on Kind v1.27.x or
later to facilitate easier testing of pod resizing.
  • Loading branch information
craigcondit committed Aug 16, 2024
1 parent 2278b32 commit 31ae008
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 10 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,18 @@ jobs:
strategy:
fail-fast: false
matrix:
k8s: [v1.30.0, v1.29.4, v1.28.9, v1.27.13, v1.26.15, v1.25.16, v1.24.17]
plugin: ['', '--plugin']
k8s:
[
v1.31.0,
v1.30.4,
v1.29.8,
v1.28.13,
v1.27.16,
v1.26.15,
v1.25.16,
v1.24.17,
]
plugin: ["", "--plugin"]
steps:
- name: Checkout source code
uses: actions/checkout@v4
Expand Down Expand Up @@ -76,5 +86,5 @@ jobs:
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ${{ github.job }} stdout (${{ matrix.k8s }}${{ matrix.plugin == '--plugin' && format(', {0}', matrix.plugin) || matrix.plugin }})
name: ${{ github.job }} stdout (${{ matrix.k8s }}${{ matrix.plugin == '--plugin' && format(', {0}', matrix.plugin) || matrix.plugin }})
path: build/e2e
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ KUBECTL_BIN=$(KUBECTL_PATH)/kubectl
export PATH := $(BASE_DIR)/$(KUBECTL_PATH):$(PATH)

# kind
KIND_VERSION=v0.23.0
KIND_VERSION=v0.24.0
KIND_PATH=$(TOOLS_DIR)/kind-$(KIND_VERSION)
KIND_BIN=$(KIND_PATH)/kind
export PATH := $(BASE_DIR)/$(KIND_PATH):$(PATH)
Expand Down
25 changes: 25 additions & 0 deletions scripts/kind-pod-resize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
featureGates:
"InPlacePodVerticalScaling": true
nodes:
- role: control-plane
- role: worker
- role: worker
44 changes: 38 additions & 6 deletions scripts/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,39 @@ KUBECTL_VERSION=$(make -s print_kubectl_version)
HELM=$TOOLS_DIRECTORY/helm-$HELM_VERSION/helm
KIND=$TOOLS_DIRECTORY/kind-$KIND_VERSION/kind
KUBECTL=$TOOLS_DIRECTORY/kubectl-$KUBECTL_VERSION/kubectl
KIND_CONFIG=./scripts/kind.yaml
GO="${GO:-go}"
export GO

# return 0 if arg1 <= arg2
function verlte() {
if [ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]; then
return 0
else
return 1
fi
}

# return 0 if arg1 < arg2
function verlt() {
if [ "$1" = "$2" ]; then
return 1
fi
verlte "$1" "$2"
}

function update_kind_config() {
# use a different kind config for different cluster versions
version=$(echo "$1" | sed 's/.*://' | sed 's/^v//')
if verlt "${version}" "1.27"; then
# 1.26 or earlier
KIND_CONFIG=./scripts/kind.yaml
else
# 1.27 or later; enable InPlacePodVerticalScaling feature flag
KIND_CONFIG=./scripts/kind-pod-resize.yaml
fi
}

function check_cmd() {
CMD=$1
if ! command -v "${CMD}" &> /dev/null
Expand Down Expand Up @@ -164,13 +194,14 @@ Examples:
${NAME} -a test -n yk8s -v kindest/node:v1.24.17
${NAME} -a test -n yk8s -v kindest/node:v1.25.16
${NAME} -a test -n yk8s -v kindest/node:v1.26.15
${NAME} -a test -n yk8s -v kindest/node:v1.27.13
${NAME} -a test -n yk8s -v kindest/node:v1.28.9
${NAME} -a test -n yk8s -v kindest/node:v1.29.4
${NAME} -a test -n yk8s -v kindest/node:v1.30.0
${NAME} -a test -n yk8s -v kindest/node:v1.27.16
${NAME} -a test -n yk8s -v kindest/node:v1.28.13
${NAME} -a test -n yk8s -v kindest/node:v1.29.8
${NAME} -a test -n yk8s -v kindest/node:v1.30.4
${NAME} -a test -n yk8s -v kindest/node:v1.31.0
Use a local helm chart path:
${NAME} -a test -n yk8s -v kindest/node:v1.30.0 -p ../yunikorn-release/helm-charts/yunikorn
${NAME} -a test -n yk8s -v kindest/node:v1.31.0 -p ../yunikorn-release/helm-charts/yunikorn
EOF
}

Expand All @@ -181,7 +212,6 @@ eval "$(make arch)"
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
check_os

KIND_CONFIG=./scripts/kind.yaml
CHART_PATH="./build/yunikorn-release/helm-charts/yunikorn"
GIT_CLONE=true
SCHEDULER_IMAGE="scheduler-${DOCKER_ARCH}-latest"
Expand Down Expand Up @@ -228,6 +258,8 @@ case ${key} in
esac
done

update_kind_config "${CLUSTER_VERSION}"

echo "e2e test run details"
echo " action : ${ACTION}"
echo " kind cluster name : ${CLUSTER_NAME}"
Expand Down

0 comments on commit 31ae008

Please sign in to comment.