From 0de1fca119c0fa2d742f9c0e6b8fc301a56d5383 Mon Sep 17 00:00:00 2001 From: phuhung273 Date: Sat, 25 Jan 2025 07:24:41 +0000 Subject: [PATCH 1/3] add recommender vpa-object-namespace quick integration test --- .../ignored-vpa-object-namespaces.sh | 81 +++++++++++ .../ignored-vpa-object-namespaces.yaml | 73 ++++++++++ .../recommender/vpa-object-namespace.sh | 80 +++++++++++ .../recommender/vpa-object-namespace.yaml | 73 ++++++++++ vertical-pod-autoscaler/hack/local-cluster.md | 4 + .../hack/run-integration-locally.sh | 135 ++++++++++++++++++ 6 files changed, 446 insertions(+) create mode 100755 vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.sh create mode 100644 vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.yaml create mode 100755 vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.sh create mode 100644 vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.yaml create mode 100755 vertical-pod-autoscaler/hack/run-integration-locally.sh diff --git a/vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.sh b/vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.sh new file mode 100755 index 000000000000..453c53f0f66b --- /dev/null +++ b/vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +# Copyright 2025 The Kubernetes Authors. +# +# Licensed 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. + +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../../../.. + +export REGISTRY=${REGISTRY:-localhost:5001} +export TAG=${TAG:-latest} + + +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.yaml | kubectl apply -f - + +CHECK_CYCLES=15 +CHECK_SLEEP=15 + +DEPLOYED=0 + +for i in $(seq 1 $CHECK_CYCLES); do + if [[ $(kubectl get deployments vpa-recommender -n kube-system -o jsonpath='{.status.unavailableReplicas}') -eq 0 ]]; then + echo "Verified vpa-recommender pod was scheduled and started!" + DEPLOYED=1 + break + fi + echo "Assertion Loop $i/$CHECK_CYCLES, sleeping for $CHECK_SLEEP seconds" + sleep $CHECK_SLEEP +done + +if [[ $DEPLOYED -eq 0 ]]; then + exit 1 +fi + +EXIT_STATUS=2 +for i in $(seq 1 $CHECK_CYCLES); do + if kubectl describe vpa -n included-namespace included-vpa | grep Status; then + echo "Verified included namespaces are being tracked!" + EXIT_STATUS=0 + break + fi + echo "Assertion Loop $i/$CHECK_CYCLES, sleeping for $CHECK_SLEEP seconds" + sleep $CHECK_SLEEP +done + +if [[ $EXIT_STATUS -ne 0 ]];then + exit $EXIT_STATUS +fi + +CHECK_CYCLES=5 + +for i in $(seq 1 $CHECK_CYCLES); do + if kubectl describe vpa -n ignored-namespace ignored-vpa | grep Status; then + echo "Failed! ignored namespaces should not be tracked!" + EXIT_STATUS=3 + break + fi + echo "Assertion Loop $i/$CHECK_CYCLES, sleeping for $CHECK_SLEEP seconds" + sleep $CHECK_SLEEP +done + +if [[ $EXIT_STATUS -ne 0 ]];then + exit $EXIT_STATUS +fi + +echo "Verified ignored namespaces are still not tracked after wait time!" + +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.yaml | kubectl delete -f - diff --git a/vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.yaml b/vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.yaml new file mode 100644 index 000000000000..065e19526978 --- /dev/null +++ b/vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.yaml @@ -0,0 +1,73 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vpa-recommender + namespace: kube-system +spec: + replicas: 1 + selector: + matchLabels: + app: vpa-recommender + template: + metadata: + labels: + app: vpa-recommender + spec: + serviceAccountName: vpa-recommender + securityContext: + runAsNonRoot: true + runAsUser: 65534 # nobody + containers: + - name: recommender + image: registry.k8s.io/autoscaling/vpa-recommender:1.2.2 + imagePullPolicy: IfNotPresent + args: + - /recommender + - --ignored-vpa-object-namespaces=ignored-namespace + resources: + limits: + cpu: 200m + memory: 1000Mi + requests: + cpu: 50m + memory: 500Mi + ports: + - name: prometheus + containerPort: 8942 +--- +apiVersion: v1 +kind: Namespace +metadata: + name: included-namespace +--- +apiVersion: autoscaling.k8s.io/v1 +kind: VerticalPodAutoscaler +metadata: + name: included-vpa + namespace: included-namespace +spec: + targetRef: + apiVersion: "apps/v1" + kind: Deployment + name: included-app + updatePolicy: + updateMode: "Auto" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: ignored-namespace +--- +apiVersion: autoscaling.k8s.io/v1 +kind: VerticalPodAutoscaler +metadata: + name: ignored-vpa + namespace: ignored-namespace +spec: + targetRef: + apiVersion: "apps/v1" + kind: Deployment + name: ignored-app + updatePolicy: + updateMode: "Auto" diff --git a/vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.sh b/vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.sh new file mode 100755 index 000000000000..417159e58466 --- /dev/null +++ b/vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +# Copyright 2025 The Kubernetes Authors. +# +# Licensed 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. + +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../../../.. + +export REGISTRY=${REGISTRY:-localhost:5001} +export TAG=${TAG:-latest} + + +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/e2e/deploy/recommender/vpa-object-namespace.yaml | kubectl apply -f - + +CHECK_CYCLES=15 +CHECK_SLEEP=15 + +DEPLOYED=0 + +for i in $(seq 1 $CHECK_CYCLES); do + if [[ $(kubectl get deployments vpa-recommender -n kube-system -o jsonpath='{.status.unavailableReplicas}') -eq 0 ]]; then + echo "Verified vpa-recommender pod was scheduled and started!" + DEPLOYED=1 + break + fi + sleep $CHECK_SLEEP +done + +if [[ $DEPLOYED -eq 0 ]]; then + exit 1 +fi + +EXIT_STATUS=2 +for i in $(seq 1 $CHECK_CYCLES); do + if kubectl describe vpa -n included-namespace included-vpa | grep Status; then + echo "Verified included namespaces are being tracked!" + EXIT_STATUS=0 + break + fi + echo "Assertion Loop $i/$CHECK_CYCLES, sleeping for $CHECK_SLEEP seconds" + sleep $CHECK_SLEEP +done + +if [[ $EXIT_STATUS -ne 0 ]];then + exit $EXIT_STATUS +fi + +CHECK_CYCLES=5 + +for i in $(seq 1 $CHECK_CYCLES); do + if kubectl describe vpa -n ignored-namespace ignored-vpa | grep Status; then + echo "Failed! ignored namespaces should not be tracked!" + EXIT_STATUS=3 + break + fi + echo "Assertion Loop $i/$CHECK_CYCLES, sleeping for $CHECK_SLEEP seconds" + sleep $CHECK_SLEEP +done + +if [[ $EXIT_STATUS -ne 0 ]];then + exit $EXIT_STATUS +fi + +echo "Verified ignored namespaces are still not tracked after wait time!" + +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/e2e/deploy/recommender/vpa-object-namespace.yaml | kubectl delete -f - diff --git a/vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.yaml b/vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.yaml new file mode 100644 index 000000000000..acd94b3fab89 --- /dev/null +++ b/vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.yaml @@ -0,0 +1,73 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vpa-recommender + namespace: kube-system +spec: + replicas: 1 + selector: + matchLabels: + app: vpa-recommender + template: + metadata: + labels: + app: vpa-recommender + spec: + serviceAccountName: vpa-recommender + securityContext: + runAsNonRoot: true + runAsUser: 65534 # nobody + containers: + - name: recommender + image: registry.k8s.io/autoscaling/vpa-recommender:1.2.2 + imagePullPolicy: IfNotPresent + args: + - /recommender + - --vpa-object-namespace=included-namespace + resources: + limits: + cpu: 200m + memory: 1000Mi + requests: + cpu: 50m + memory: 500Mi + ports: + - name: prometheus + containerPort: 8942 +--- +apiVersion: v1 +kind: Namespace +metadata: + name: included-namespace +--- +apiVersion: autoscaling.k8s.io/v1 +kind: VerticalPodAutoscaler +metadata: + name: included-vpa + namespace: included-namespace +spec: + targetRef: + apiVersion: "apps/v1" + kind: Deployment + name: included-app + updatePolicy: + updateMode: "Auto" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: ignored-namespace +--- +apiVersion: autoscaling.k8s.io/v1 +kind: VerticalPodAutoscaler +metadata: + name: ignored-vpa + namespace: ignored-namespace +spec: + targetRef: + apiVersion: "apps/v1" + kind: Deployment + name: ignored-app + updatePolicy: + updateMode: "Auto" diff --git a/vertical-pod-autoscaler/hack/local-cluster.md b/vertical-pod-autoscaler/hack/local-cluster.md index 5d03c38f61a1..6264e68c410a 100644 --- a/vertical-pod-autoscaler/hack/local-cluster.md +++ b/vertical-pod-autoscaler/hack/local-cluster.md @@ -34,3 +34,7 @@ The local test cases support running the `recommender` with external metrics. T additional permissions we don't want to automatically enable for all customers via the configuration given in `deploy/vpa-rbac.yaml`. The scripts use a context diff `hack/e2e/vpa-rbac.diff` to enable those permission when running locally. + +# Quick Integration Tests + +`run-integration-locally.sh` is a quicker way to integration test compared to `run-e2e-locally.sh`. Only used for simple tests. diff --git a/vertical-pod-autoscaler/hack/run-integration-locally.sh b/vertical-pod-autoscaler/hack/run-integration-locally.sh new file mode 100755 index 000000000000..310b41e1c2e3 --- /dev/null +++ b/vertical-pod-autoscaler/hack/run-integration-locally.sh @@ -0,0 +1,135 @@ +#!/bin/bash + +# Copyright 2025 The Kubernetes Authors. +# +# Licensed 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. + +set -o errexit +set -o nounset +set -o pipefail + +BASE_NAME=$(basename $0) +SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. +source "${SCRIPT_ROOT}/hack/lib/util.sh" + +ARCH=$(kube::util::host_arch) + +function print_help { + echo "ERROR! Usage: $BASE_NAME " + echo " should be one of:" + echo " - recommender" +} + +if [ $# -eq 0 ]; then + print_help + exit 1 +fi + +if [ $# -gt 1 ]; then + print_help + exit 1 +fi + +SUITE=$1 +REQUIRED_COMMANDS=" +docker +go +kind +kubectl +make +" + +for i in $REQUIRED_COMMANDS; do + if ! command -v $i > /dev/null 2>&1 + then + echo "$i could not be found, please ensure it is installed" + echo + echo "The following commands are required to run these tests:" + echo $REQUIRED_COMMANDS + exit 1; + fi +done + +if ! docker ps >/dev/null 2>&1 +then + echo "docker isn't running" + echo + echo "Please ensure that docker is running" + exit 1 +fi + +case ${SUITE} in + recommender) + COMPONENTS="${SUITE}" + ;; + *) + print_help + exit 1 + ;; +esac + +echo "Deleting KIND cluster 'kind'." +kind delete cluster -n kind -q + +echo "Creating KIND cluster 'kind'" +KIND_VERSION="kindest/node:v1.32.0" +if ! kind create cluster --image=${KIND_VERSION}; then + echo "Failed to create KIND cluster. Exiting. Make sure kind version is updated." + echo "Available versions: https://github.com/kubernetes-sigs/kind/releases" + exit 1 +fi + +# Local KIND images +export REGISTRY=${REGISTRY:-localhost:5001} +export TAG=${TAG:-latest} + +# Deploy common resources +rm -f ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.yaml +patch -c ${SCRIPT_ROOT}/deploy/vpa-rbac.yaml -i ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.diff -o ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.yaml +kubectl apply -f ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.yaml +# Other-versioned CRDs are irrelevant as we're running a modern-ish cluster. +kubectl apply -f ${SCRIPT_ROOT}/deploy/vpa-v1-crd-gen.yaml +kubectl apply -f ${SCRIPT_ROOT}/hack/e2e/k8s-metrics-server.yaml + +for i in ${COMPONENTS}; do + ALL_ARCHITECTURES=${ARCH} make --directory ${SCRIPT_ROOT}/pkg/${i} docker-build REGISTRY=${REGISTRY} TAG=${TAG} + docker tag ${REGISTRY}/vpa-${i}-${ARCH}:${TAG} ${REGISTRY}/vpa-${i}:${TAG} + kind load docker-image ${REGISTRY}/vpa-${i}:${TAG} +done + + +case ${SUITE} in + recommender) + + echo " ** Running suite ${SUITE}" + + ASSERTION_SCRIPTS=$(find "${SCRIPT_ROOT}/hack/e2e/deploy/${SUITE}" -name "*.sh" -type f | sort) + for assert_script in $ASSERTION_SCRIPTS; do + echo "======================================================================================================" + echo "Running assertion script $(basename "$assert_script")" + echo "======================================================================================================" + assert_start=$(date +%s) + $assert_script + # TODO: Cleanup on failure + # TODO: Add option to skip cleanup for debugging + assert_end=$(date +%s) + echo "Took $((assert_end - assert_start))sec" + echo "Assertion test $assert_script PASSED!" + # TODO: Define a way to cleanup resources between tests + done + ;; + *) + print_help + exit 1 + ;; +esac From 9652ffc9293459390dca6f5b3296d2cd759b220a Mon Sep 17 00:00:00 2001 From: phuhung273 Date: Sun, 26 Jan 2025 04:24:37 +0000 Subject: [PATCH 2/3] integration-tests directory, kubectl wait --- .../ignored-vpa-object-namespaces.sh | 21 ++++++------------- .../ignored-vpa-object-namespaces.yaml | 0 .../recommender/vpa-object-namespace.sh | 20 ++++++------------ .../recommender/vpa-object-namespace.yaml | 0 .../run-integration-locally.sh | 4 ++-- 5 files changed, 14 insertions(+), 31 deletions(-) rename vertical-pod-autoscaler/hack/{e2e => integration-tests}/deploy/recommender/ignored-vpa-object-namespaces.sh (74%) rename vertical-pod-autoscaler/hack/{e2e => integration-tests}/deploy/recommender/ignored-vpa-object-namespaces.yaml (100%) rename vertical-pod-autoscaler/hack/{e2e => integration-tests}/deploy/recommender/vpa-object-namespace.sh (77%) rename vertical-pod-autoscaler/hack/{e2e => integration-tests}/deploy/recommender/vpa-object-namespace.yaml (100%) rename vertical-pod-autoscaler/hack/{ => integration-tests}/run-integration-locally.sh (95%) diff --git a/vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.sh b/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.sh similarity index 74% rename from vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.sh rename to vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.sh index 453c53f0f66b..eb18fa86e2f8 100755 --- a/vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.sh +++ b/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.sh @@ -24,24 +24,15 @@ export REGISTRY=${REGISTRY:-localhost:5001} export TAG=${TAG:-latest} -REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.yaml | kubectl apply -f - +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.yaml | kubectl apply -f - CHECK_CYCLES=15 CHECK_SLEEP=15 -DEPLOYED=0 - -for i in $(seq 1 $CHECK_CYCLES); do - if [[ $(kubectl get deployments vpa-recommender -n kube-system -o jsonpath='{.status.unavailableReplicas}') -eq 0 ]]; then - echo "Verified vpa-recommender pod was scheduled and started!" - DEPLOYED=1 - break - fi - echo "Assertion Loop $i/$CHECK_CYCLES, sleeping for $CHECK_SLEEP seconds" - sleep $CHECK_SLEEP -done - -if [[ $DEPLOYED -eq 0 ]]; then +if kubectl wait --for=condition=Available --timeout=120s deployment/vpa-recommender -n kube-system; then + echo "Verified vpa-recommender pod was scheduled and started!" +else + echo "vpa-recommender pod did not start within the expected time." exit 1 fi @@ -78,4 +69,4 @@ fi echo "Verified ignored namespaces are still not tracked after wait time!" -REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.yaml | kubectl delete -f - +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.yaml | kubectl delete -f - diff --git a/vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.yaml b/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.yaml similarity index 100% rename from vertical-pod-autoscaler/hack/e2e/deploy/recommender/ignored-vpa-object-namespaces.yaml rename to vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.yaml diff --git a/vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.sh b/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/vpa-object-namespace.sh similarity index 77% rename from vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.sh rename to vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/vpa-object-namespace.sh index 417159e58466..26e54df0ee7b 100755 --- a/vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.sh +++ b/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/vpa-object-namespace.sh @@ -24,23 +24,15 @@ export REGISTRY=${REGISTRY:-localhost:5001} export TAG=${TAG:-latest} -REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/e2e/deploy/recommender/vpa-object-namespace.yaml | kubectl apply -f - +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/deploy/recommender/vpa-object-namespace.yaml | kubectl apply -f - CHECK_CYCLES=15 CHECK_SLEEP=15 -DEPLOYED=0 - -for i in $(seq 1 $CHECK_CYCLES); do - if [[ $(kubectl get deployments vpa-recommender -n kube-system -o jsonpath='{.status.unavailableReplicas}') -eq 0 ]]; then - echo "Verified vpa-recommender pod was scheduled and started!" - DEPLOYED=1 - break - fi - sleep $CHECK_SLEEP -done - -if [[ $DEPLOYED -eq 0 ]]; then +if kubectl wait --for=condition=Available --timeout=120s deployment/vpa-recommender -n kube-system; then + echo "Verified vpa-recommender pod was scheduled and started!" +else + echo "vpa-recommender pod did not start within the expected time." exit 1 fi @@ -77,4 +69,4 @@ fi echo "Verified ignored namespaces are still not tracked after wait time!" -REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/e2e/deploy/recommender/vpa-object-namespace.yaml | kubectl delete -f - +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/deploy/recommender/vpa-object-namespace.yaml | kubectl delete -f - diff --git a/vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.yaml b/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/vpa-object-namespace.yaml similarity index 100% rename from vertical-pod-autoscaler/hack/e2e/deploy/recommender/vpa-object-namespace.yaml rename to vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/vpa-object-namespace.yaml diff --git a/vertical-pod-autoscaler/hack/run-integration-locally.sh b/vertical-pod-autoscaler/hack/integration-tests/run-integration-locally.sh similarity index 95% rename from vertical-pod-autoscaler/hack/run-integration-locally.sh rename to vertical-pod-autoscaler/hack/integration-tests/run-integration-locally.sh index 310b41e1c2e3..f363ad689403 100755 --- a/vertical-pod-autoscaler/hack/run-integration-locally.sh +++ b/vertical-pod-autoscaler/hack/integration-tests/run-integration-locally.sh @@ -19,7 +19,7 @@ set -o nounset set -o pipefail BASE_NAME=$(basename $0) -SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. +SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../.. source "${SCRIPT_ROOT}/hack/lib/util.sh" ARCH=$(kube::util::host_arch) @@ -113,7 +113,7 @@ case ${SUITE} in echo " ** Running suite ${SUITE}" - ASSERTION_SCRIPTS=$(find "${SCRIPT_ROOT}/hack/e2e/deploy/${SUITE}" -name "*.sh" -type f | sort) + ASSERTION_SCRIPTS=$(find "${SCRIPT_ROOT}/hack/integration-tests/deploy/${SUITE}" -name "*.sh" -type f | sort) for assert_script in $ASSERTION_SCRIPTS; do echo "======================================================================================================" echo "Running assertion script $(basename "$assert_script")" From de66b56a84af24cbea5846dee633b58b88a36d23 Mon Sep 17 00:00:00 2001 From: phuhung273 Date: Sun, 26 Jan 2025 10:09:34 +0000 Subject: [PATCH 3/3] directory structure --- .../deploy}/ignored-vpa-object-namespaces.yaml | 0 .../deploy}/vpa-object-namespace.yaml | 0 .../recommender/ignored-vpa-object-namespaces.sh | 6 +++--- .../{deploy => }/recommender/vpa-object-namespace.sh | 6 +++--- .../hack/integration-tests/run-integration-locally.sh | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename vertical-pod-autoscaler/hack/integration-tests/{deploy/recommender => recommender/deploy}/ignored-vpa-object-namespaces.yaml (100%) rename vertical-pod-autoscaler/hack/integration-tests/{deploy/recommender => recommender/deploy}/vpa-object-namespace.yaml (100%) rename vertical-pod-autoscaler/hack/integration-tests/{deploy => }/recommender/ignored-vpa-object-namespaces.sh (92%) rename vertical-pod-autoscaler/hack/integration-tests/{deploy => }/recommender/vpa-object-namespace.sh (92%) diff --git a/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.yaml b/vertical-pod-autoscaler/hack/integration-tests/recommender/deploy/ignored-vpa-object-namespaces.yaml similarity index 100% rename from vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.yaml rename to vertical-pod-autoscaler/hack/integration-tests/recommender/deploy/ignored-vpa-object-namespaces.yaml diff --git a/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/vpa-object-namespace.yaml b/vertical-pod-autoscaler/hack/integration-tests/recommender/deploy/vpa-object-namespace.yaml similarity index 100% rename from vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/vpa-object-namespace.yaml rename to vertical-pod-autoscaler/hack/integration-tests/recommender/deploy/vpa-object-namespace.yaml diff --git a/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.sh b/vertical-pod-autoscaler/hack/integration-tests/recommender/ignored-vpa-object-namespaces.sh similarity index 92% rename from vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.sh rename to vertical-pod-autoscaler/hack/integration-tests/recommender/ignored-vpa-object-namespaces.sh index eb18fa86e2f8..c5324e67d59d 100755 --- a/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.sh +++ b/vertical-pod-autoscaler/hack/integration-tests/recommender/ignored-vpa-object-namespaces.sh @@ -18,13 +18,13 @@ set -o errexit set -o nounset set -o pipefail -SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../../../.. +SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../../.. export REGISTRY=${REGISTRY:-localhost:5001} export TAG=${TAG:-latest} -REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.yaml | kubectl apply -f - +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/recommender/deploy/ignored-vpa-object-namespaces.yaml | kubectl apply -f - CHECK_CYCLES=15 CHECK_SLEEP=15 @@ -69,4 +69,4 @@ fi echo "Verified ignored namespaces are still not tracked after wait time!" -REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/deploy/recommender/ignored-vpa-object-namespaces.yaml | kubectl delete -f - +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/recommender/deploy/ignored-vpa-object-namespaces.yaml | kubectl delete -f - diff --git a/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/vpa-object-namespace.sh b/vertical-pod-autoscaler/hack/integration-tests/recommender/vpa-object-namespace.sh similarity index 92% rename from vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/vpa-object-namespace.sh rename to vertical-pod-autoscaler/hack/integration-tests/recommender/vpa-object-namespace.sh index 26e54df0ee7b..b47cc77f6b62 100755 --- a/vertical-pod-autoscaler/hack/integration-tests/deploy/recommender/vpa-object-namespace.sh +++ b/vertical-pod-autoscaler/hack/integration-tests/recommender/vpa-object-namespace.sh @@ -18,13 +18,13 @@ set -o errexit set -o nounset set -o pipefail -SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../../../.. +SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../../.. export REGISTRY=${REGISTRY:-localhost:5001} export TAG=${TAG:-latest} -REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/deploy/recommender/vpa-object-namespace.yaml | kubectl apply -f - +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/recommender/deploy/vpa-object-namespace.yaml | kubectl apply -f - CHECK_CYCLES=15 CHECK_SLEEP=15 @@ -69,4 +69,4 @@ fi echo "Verified ignored namespaces are still not tracked after wait time!" -REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/deploy/recommender/vpa-object-namespace.yaml | kubectl delete -f - +REGISTRY=${REGISTRY} TAG=${TAG} ${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/hack/integration-tests/recommender/deploy/vpa-object-namespace.yaml | kubectl delete -f - diff --git a/vertical-pod-autoscaler/hack/integration-tests/run-integration-locally.sh b/vertical-pod-autoscaler/hack/integration-tests/run-integration-locally.sh index f363ad689403..59459be96c70 100755 --- a/vertical-pod-autoscaler/hack/integration-tests/run-integration-locally.sh +++ b/vertical-pod-autoscaler/hack/integration-tests/run-integration-locally.sh @@ -113,7 +113,7 @@ case ${SUITE} in echo " ** Running suite ${SUITE}" - ASSERTION_SCRIPTS=$(find "${SCRIPT_ROOT}/hack/integration-tests/deploy/${SUITE}" -name "*.sh" -type f | sort) + ASSERTION_SCRIPTS=$(find "${SCRIPT_ROOT}/hack/integration-tests/${SUITE}" -name "*.sh" -type f | sort) for assert_script in $ASSERTION_SCRIPTS; do echo "======================================================================================================" echo "Running assertion script $(basename "$assert_script")"