Skip to content

Commit 255bc70

Browse files
committed
Install dependencies for e2e singlecluster only when needed
This commit adds the support to only install the dependencies of tests cases from singlecluster e2e, when the version is defined and test scenario is being filtered or when there is no filter in place.
1 parent e37a5d0 commit 255bc70

File tree

2 files changed

+32
-23
lines changed

2 files changed

+32
-23
lines changed

hack/e2e-common.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ export KUEUE_NAMESPACE="${KUEUE_NAMESPACE:-kueue-system}"
2323

2424
export KIND_VERSION="${E2E_KIND_VERSION/"kindest/node:v"/}"
2525

26-
if [[ -n ${APPWRAPPER_VERSION:-} ]]; then
26+
if [[ -n ${APPWRAPPER_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:appwrapper" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
2727
export APPWRAPPER_MANIFEST=${ROOT_DIR}/dep-crds/appwrapper/config/default
28-
APPWRAPPER_IMAGE=quay.io/ibm/appwrapper:${APPWRAPPER_VERSION}
28+
export APPWRAPPER_IMAGE=quay.io/ibm/appwrapper:${APPWRAPPER_VERSION}
2929
fi
3030

31-
if [[ -n ${JOBSET_VERSION:-} ]]; then
31+
if [[ -n ${JOBSET_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:jobset" || "$GINKGO_ARGS" =~ "feature:tas" || "$GINKGO_ARGS" =~ "feature:trainjob" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
3232
export JOBSET_MANIFEST="https://github.com/kubernetes-sigs/jobset/releases/download/${JOBSET_VERSION}/manifests.yaml"
3333
export JOBSET_IMAGE=registry.k8s.io/jobset/jobset:${JOBSET_VERSION}
3434
export JOBSET_CRDS=${ROOT_DIR}/dep-crds/jobset-operator/
3535
fi
3636

37-
if [[ -n ${KUBEFLOW_VERSION:-} ]]; then
37+
if [[ -n ${KUBEFLOW_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:jaxjob" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
3838
export KUBEFLOW_MANIFEST_ORIG=${ROOT_DIR}/dep-crds/training-operator/manifests/overlays/standalone/kustomization.yaml
3939
export KUBEFLOW_MANIFEST_PATCHED=${ROOT_DIR}/test/e2e/config/multikueue
4040
# Extract the Kubeflow Training Operator image version tag (newTag) from the manifest.
@@ -44,7 +44,7 @@ if [[ -n ${KUBEFLOW_VERSION:-} ]]; then
4444
export KUBEFLOW_IMAGE=kubeflow/training-operator:${KUBEFLOW_IMAGE_VERSION}
4545
fi
4646

47-
if [[ -n ${KUBEFLOW_TRAINER_VERSION:-} ]]; then
47+
if [[ -n ${KUBEFLOW_TRAINER_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:tas" || "$GINKGO_ARGS" =~ "feature:trainjob" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
4848
export KUBEFLOW_TRAINER_MANIFEST=${ROOT_DIR}/dep-crds/kf-trainer/manifests
4949
# Extract the Kubeflow Trainer controller manager image version tag (newTag) from the manifest.
5050
# This is necessary because the image version tag does not follow the usual package versioning convention.
@@ -58,12 +58,12 @@ if [[ -n ${KUBEFLOW_MPI_VERSION:-} ]]; then
5858
export KUBEFLOW_MPI_IMAGE=mpioperator/mpi-operator:${KUBEFLOW_MPI_VERSION/#v}
5959
fi
6060

61-
if [[ -n ${KUBERAY_VERSION:-} ]]; then
61+
if [[ -n ${KUBERAY_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:kuberay" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
6262
export KUBERAY_MANIFEST="${ROOT_DIR}/dep-crds/ray-operator/default/"
6363
export KUBERAY_IMAGE=quay.io/kuberay/operator:${KUBERAY_VERSION}
6464
fi
6565

66-
if [[ -n ${LEADERWORKERSET_VERSION:-} ]]; then
66+
if [[ -n ${LEADERWORKERSET_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:leaderworkerset" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
6767
export LEADERWORKERSET_MANIFEST="https://github.com/kubernetes-sigs/lws/releases/download/${LEADERWORKERSET_VERSION}/manifests.yaml"
6868
export LEADERWORKERSET_IMAGE=registry.k8s.io/lws/lws:${LEADERWORKERSET_VERSION}
6969
fi
@@ -122,31 +122,31 @@ function prepare_docker_images {
122122
docker tag "$E2E_TEST_AGNHOST_IMAGE_OLD_WITH_SHA" "$E2E_TEST_AGNHOST_IMAGE_OLD"
123123
docker tag "$E2E_TEST_AGNHOST_IMAGE_WITH_SHA" "$E2E_TEST_AGNHOST_IMAGE"
124124

125-
if [[ -n ${APPWRAPPER_VERSION:-} ]]; then
125+
if [[ -n ${APPWRAPPER_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:appwrapper" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
126126
docker pull "${APPWRAPPER_IMAGE}"
127127
fi
128-
if [[ -n ${JOBSET_VERSION:-} ]]; then
128+
if [[ -n ${JOBSET_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:jobset" || "$GINKGO_ARGS" =~ "feature:tas" || "$GINKGO_ARGS" =~ "feature:trainjob" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
129129
docker pull "${JOBSET_IMAGE}"
130130
fi
131-
if [[ -n ${KUBEFLOW_VERSION:-} ]]; then
131+
if [[ -n ${KUBEFLOW_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:jaxjob" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
132132
docker pull "${KUBEFLOW_IMAGE}"
133133
fi
134134

135-
if [[ -n ${KUBEFLOW_TRAINER_VERSION:-} ]]; then
135+
if [[ -n ${KUBEFLOW_TRAINER_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:tas" || "$GINKGO_ARGS" =~ "feature:trainjob" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
136136
docker pull "${KF_TRAINER_IMAGE}"
137137
fi
138138

139139
if [[ -n ${KUBEFLOW_MPI_VERSION:-} ]]; then
140140
docker pull "${KUBEFLOW_MPI_IMAGE}"
141141
fi
142-
if [[ -n ${KUBERAY_VERSION:-} ]]; then
142+
if [[ -n ${KUBERAY_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:kuberay" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
143143
docker pull "${KUBERAY_IMAGE}"
144144
determine_kuberay_ray_image
145145
if [[ ${USE_RAY_FOR_TESTS:-} == "ray" ]]; then
146146
docker pull "${KUBERAY_RAY_IMAGE}"
147147
fi
148148
fi
149-
if [[ -n ${LEADERWORKERSET_VERSION:-} ]]; then
149+
if [[ -n ${LEADERWORKERSET_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:leaderworkerset" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
150150
docker pull "${LEADERWORKERSET_IMAGE}"
151151
fi
152152
if [[ -n ${KUEUE_UPGRADE_FROM_VERSION:-} ]]; then
@@ -174,30 +174,30 @@ function kind_load {
174174
if [ "$CREATE_KIND_CLUSTER" == 'true' ]; then
175175
cluster_kind_load "$1"
176176
fi
177-
if [[ -n ${APPWRAPPER_VERSION:-} ]]; then
177+
if [[ -n ${APPWRAPPER_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:appwrapper" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
178178
install_appwrapper "$1" "$2"
179179
fi
180-
if [[ -n ${JOBSET_VERSION:-} ]]; then
180+
if [[ -n ${JOBSET_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:jobset" || "$GINKGO_ARGS" =~ "feature:tas" || "$GINKGO_ARGS" =~ "feature:trainjob" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
181181
install_jobset "$1" "$2"
182182
fi
183-
if [[ -n ${KUBEFLOW_VERSION:-} ]]; then
183+
if [[ -n ${KUBEFLOW_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:jaxjob" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
184184
# In order for MPI-operator and Training-operator to work on the same cluster it is required that:
185185
# 1. 'kubeflow.org_mpijobs.yaml' is removed from base/crds/kustomization.yaml - https://github.com/kubeflow/training-operator/issues/1930
186186
# 2. Training-operator deployment is modified to enable all kubeflow jobs except for mpi - https://github.com/kubeflow/training-operator/issues/1777
187187
install_kubeflow "$1" "$2"
188188
fi
189189

190-
if [[ -n ${KUBEFLOW_TRAINER_VERSION:-} ]]; then
190+
if [[ -n ${KUBEFLOW_TRAINER_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:tas" || "$GINKGO_ARGS" =~ "feature:trainjob" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
191191
install_kubeflow_trainer "$1" "$2"
192192
fi
193193

194194
if [[ -n ${KUBEFLOW_MPI_VERSION:-} ]]; then
195195
install_mpi "$1" "$2"
196196
fi
197-
if [[ -n ${LEADERWORKERSET_VERSION:-} ]]; then
197+
if [[ -n ${LEADERWORKERSET_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:leaderworkerset" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
198198
install_lws "$1" "$2"
199199
fi
200-
if [[ -n ${KUBERAY_VERSION:-} ]]; then
200+
if [[ -n ${KUBERAY_VERSION:-} && ("$GINKGO_ARGS" =~ "feature:kuberay" || ! "$GINKGO_ARGS" =~ "--label-filter") ]]; then
201201
install_kuberay "$1" "$2"
202202
fi
203203
if [[ -n ${CERTMANAGER_VERSION:-} ]]; then

test/e2e/singlecluster/suite_test.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"os"
2323
"path/filepath"
24+
"strings"
2425
"testing"
2526
"time"
2627

@@ -71,10 +72,18 @@ var _ = ginkgo.BeforeSuite(func() {
7172

7273
waitForAvailableStart := time.Now()
7374
util.WaitForKueueAvailability(ctx, k8sClient)
74-
util.WaitForJobSetAvailability(ctx, k8sClient)
75-
util.WaitForLeaderWorkerSetAvailability(ctx, k8sClient)
76-
util.WaitForAppWrapperAvailability(ctx, k8sClient)
77-
util.WaitForKubeFlowTrainingOperatorAvailability(ctx, k8sClient)
75+
if !strings.Contains(ginkgo.GinkgoLabelFilter(), "feature") || strings.Contains(ginkgo.GinkgoLabelFilter(), "feature:jobset") {
76+
util.WaitForJobSetAvailability(ctx, k8sClient)
77+
}
78+
if !strings.Contains(ginkgo.GinkgoLabelFilter(), "feature") || strings.Contains(ginkgo.GinkgoLabelFilter(), "feature:leaderworkerset") {
79+
util.WaitForLeaderWorkerSetAvailability(ctx, k8sClient)
80+
}
81+
if !strings.Contains(ginkgo.GinkgoLabelFilter(), "feature") || strings.Contains(ginkgo.GinkgoLabelFilter(), "feature:appwrapper") {
82+
util.WaitForAppWrapperAvailability(ctx, k8sClient)
83+
}
84+
if !strings.Contains(ginkgo.GinkgoLabelFilter(), "feature") || strings.Contains(ginkgo.GinkgoLabelFilter(), "feature:jaxjob") {
85+
util.WaitForKubeFlowTrainingOperatorAvailability(ctx, k8sClient)
86+
}
7887
ginkgo.GinkgoLogr.Info(
7988
"Kueue and all required operators are available in the cluster",
8089
"waitingTime", time.Since(waitForAvailableStart),

0 commit comments

Comments
 (0)