Skip to content

Commit

Permalink
chart(test): test scenario on existing KEDA
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Aug 12, 2024
1 parent 27cd8d8 commit 312e4a5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 38 deletions.
13 changes: 2 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ workflows:
test-strategy: disabled
cluster: 'minikube'
helm-version: 'v3.10.3'
test-existing-keda: false
test-upgrade: true
- kubernetes-test:
name: "K8s test - Autoscaling Jobs"
Expand All @@ -21,7 +20,6 @@ workflows:
test-strategy: job
cluster: 'minikube'
helm-version: 'v3.11.3'
test-existing-keda: true
test-upgrade: true
- kubernetes-test:
name: "K8s test - Autoscaling Deployments"
Expand All @@ -31,7 +29,6 @@ workflows:
test-strategy: deployment
cluster: 'minikube'
helm-version: 'v3.12.3'
test-existing-keda: true
test-upgrade: true
- kubernetes-test:
name: "K8s test - Autoscaling Jobs - HTTPS"
Expand All @@ -41,7 +38,6 @@ workflows:
test-strategy: job_https
cluster: 'minikube'
helm-version: 'v3.13.3'
test-existing-keda: true
test-upgrade: true
- kubernetes-test:
name: "K8s test - Autoscaling Jobs - Ingress hostname"
Expand All @@ -51,7 +47,6 @@ workflows:
test-strategy: job_hostname
cluster: 'minikube'
helm-version: 'v3.14.4'
test-existing-keda: false
test-upgrade: true
- kubernetes-test:
name: "K8s test - Autoscaling Deployments - HTTPS"
Expand All @@ -61,7 +56,6 @@ workflows:
test-strategy: deployment_https
cluster: 'minikube'
helm-version: 'v3.15.3'
test-existing-keda: false
test-upgrade: true
- docker-test:
name: "Docker test - Use random user (true)"
Expand Down Expand Up @@ -194,8 +188,6 @@ jobs:
type: string
helm-version:
type: string
test-existing-keda:
type: boolean
test-upgrade:
type: boolean
executor: << parameters.machine-type >>
Expand All @@ -207,7 +199,6 @@ jobs:
CLUSTER: << parameters.cluster >>
KUBERNETES_VERSION: << parameters.k8s-version >>
HELM_VERSION: << parameters.helm-version >>
TEST_EXISTING_KEDA: << parameters.test-existing-keda >>
TEST_UPGRADE_CHART: << parameters.test-upgrade >>
steps:
- run:
Expand All @@ -228,7 +219,7 @@ jobs:
make chart_setup_env
make set_containerd_image_store
CLUSTER=${CLUSTER} KUBERNETES_VERSION=${KUBERNETES_VERSION} NAME=${NAMESPACE} VERSION=${BRANCH} \
BUILD_DATE=${BUILD_DATE} TEST_EXISTING_KEDA=${TEST_EXISTING_KEDA} make chart_cluster_setup
BUILD_DATE=${BUILD_DATE} make chart_cluster_setup
- run:
name: "Build Docker images"
no_output_timeout: 30m
Expand Down Expand Up @@ -260,7 +251,7 @@ jobs:
N=3
while [ $N -gt 0 ]; do
PLATFORMS=${PLATFORMS} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} \
TEST_EXISTING_KEDA=${TEST_EXISTING_KEDA} TEST_UPGRADE_CHART=false make chart_test_autoscaling_${TEST_STRATEGY} \
TEST_UPGRADE_CHART=false make chart_test_autoscaling_${TEST_STRATEGY} \
&& make test_video_integrity || true
if [ $? -eq 0 ]; then
echo "Tests passed"
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/helm-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,44 +38,37 @@ jobs:
test-strategy: disabled
cluster: 'minikube'
helm-version: 'v3.10.3'
test-existing-keda: false
test-upgrade: true
- k8s-version: 'v1.26.15'
test-strategy: job
cluster: 'minikube'
helm-version: 'v3.11.3'
test-existing-keda: true
test-upgrade: true
- k8s-version: 'v1.27.16'
test-strategy: deployment
cluster: 'minikube'
helm-version: 'v3.12.3'
test-existing-keda: true
test-upgrade: true
- k8s-version: 'v1.28.12'
test-strategy: job_https
cluster: 'minikube'
helm-version: 'v3.13.3'
test-existing-keda: true
test-upgrade: true
- k8s-version: 'v1.29.7'
test-strategy: job_hostname
cluster: 'minikube'
helm-version: 'v3.14.4'
test-existing-keda: false
test-upgrade: true
- k8s-version: 'v1.30.3'
test-strategy: deployment_https
cluster: 'minikube'
helm-version: 'v3.15.3'
test-existing-keda: false
test-upgrade: true
env:
CLUSTER: ${{ matrix.cluster }}
KUBERNETES_VERSION: ${{ matrix.k8s-version }}
ARTIFACT_NAME: "${{ matrix.k8s-version }}-${{ matrix.test-strategy }}"
HELM_VERSION: ${{ matrix.helm-version }}
TEST_EXISTING_KEDA: ${{ matrix.test-existing-keda }}
TEST_UPGRADE_CHART: ${{ matrix.test-upgrade }}
steps:
- name: Free Disk Space (Ubuntu)
Expand Down Expand Up @@ -141,7 +134,7 @@ jobs:
with:
timeout_minutes: 10
max_attempts: 3
command: CLUSTER=${CLUSTER} KUBERNETES_VERSION=${KUBERNETES_VERSION} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_EXISTING_KEDA=${TEST_EXISTING_KEDA} make chart_cluster_setup
command: CLUSTER=${CLUSTER} KUBERNETES_VERSION=${KUBERNETES_VERSION} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup
- name: Test chart template
run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_test_template
- name: Test set custom CA certificate
Expand All @@ -162,12 +155,12 @@ jobs:
timeout_minutes: 30
max_attempts: 3
command: |
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_EXISTING_KEDA=${TEST_EXISTING_KEDA} TEST_UPGRADE_CHART=false make chart_test_autoscaling_${{ matrix.test-strategy }} \
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_${{ matrix.test-strategy }} \
&& make test_video_integrity
- name: Test chart upgrade
if: (matrix.test-upgrade == true)
run: |
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_EXISTING_KEDA=${TEST_EXISTING_KEDA} SET_MAX_REPLICAS=10 TEST_UPGRADE_CHART=${TEST_UPGRADE_CHART} make chart_test_autoscaling_${{ matrix.test-strategy }}
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} SET_MAX_REPLICAS=10 TEST_UPGRADE_CHART=${TEST_UPGRADE_CHART} make chart_test_autoscaling_${{ matrix.test-strategy }}
- name: Cleanup Kubernetes cluster
if: always()
run: CLUSTER=${CLUSTER} make chart_cluster_cleanup
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -796,18 +796,18 @@ chart_test_autoscaling_deployment_https:
./tests/charts/make/chart_test.sh DeploymentAutoscaling

chart_test_autoscaling_deployment:
PLATFORMS=$(PLATFORMS) RELEASE_NAME=selenium CHART_ENABLE_TRACING=true \
PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true \
SECURE_CONNECTION_SERVER=true SECURE_USE_EXTERNAL_CERT=true SERVICE_TYPE_NODEPORT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -i) SELENIUM_GRID_PORT=31444 \
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=1 \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) \
TEMPLATE_OUTPUT_FILENAME="k8s_prefixSelenium_enableTracing_secureServer_externalCerts_nodePort_autoScaling_scaledObject_subPath.yaml" \
TEMPLATE_OUTPUT_FILENAME="k8s_prefixSelenium_enableTracing_secureServer_externalCerts_nodePort_autoScaling_scaledObject_existingKEDA_subPath.yaml" \
./tests/charts/make/chart_test.sh DeploymentAutoscaling

chart_test_autoscaling_job_https:
PLATFORMS=$(PLATFORMS) RELEASE_NAME=selenium CHART_ENABLE_BASIC_AUTH=true \
PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_BASIC_AUTH=true \
SECURE_CONNECTION_SERVER=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_PORT=443 SUB_PATH=/ \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) \
TEMPLATE_OUTPUT_FILENAME="k8s_prefixSelenium_basicAuth_secureServer_autoScaling_scaledJob.yaml" \
TEMPLATE_OUTPUT_FILENAME="k8s_prefixSelenium_basicAuth_secureServer_autoScaling_scaledJob_existingKEDA.yaml" \
./tests/charts/make/chart_test.sh JobAutoscaling

chart_test_autoscaling_job_hostname:
Expand All @@ -818,10 +818,10 @@ chart_test_autoscaling_job_hostname:
./tests/charts/make/chart_test.sh JobAutoscaling

chart_test_autoscaling_job:
PLATFORMS=$(PLATFORMS) TEST_CHROMIUM=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true CHART_FULL_DISTRIBUTED_MODE=true \
PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true TEST_CHROMIUM=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true CHART_FULL_DISTRIBUTED_MODE=true \
SECURE_INGRESS_ONLY_CONFIG_INLINE=true SECURE_USE_EXTERNAL_CERT=true CHART_ENABLE_INGRESS_HOSTNAME=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=selenium-grid.prod SUB_PATH=/ SELENIUM_GRID_PORT=443 \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) \
TEMPLATE_OUTPUT_FILENAME="k8s_prefixSelenium_nodeChromium_enableTracing_fullDistributed_secureIngress_externalCerts_ingressHostName_ingressTLSInline_autoScaling_scaledJob_.yaml" \
TEMPLATE_OUTPUT_FILENAME="k8s_fullDistributed_secureIngress_externalCerts_ingressHostName_ingressTLSInline_autoScaling_scaledJob_existingKEDA_prefixSelenium_nodeChromium_enableTracing.yaml" \
./tests/charts/make/chart_test.sh JobAutoscaling

chart_test_language_bindings:
Expand Down
11 changes: 0 additions & 11 deletions tests/charts/make/chart_cluster_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,10 @@ elif [ "${CLUSTER}" = "minikube" ]; then
sudo chown -R $USER $HOME/.kube $HOME/.minikube
fi

if [ "${TEST_EXISTING_KEDA}" = "true" ]; then
helm repo add kedacore https://kedacore.github.io/charts
echo "Install KEDA core on kind kubernetes cluster"
helm upgrade -i ${KEDA_NAMESPACE} -n ${KEDA_NAMESPACE} --create-namespace --set webhooks.enabled=false kedacore/keda
fi

if [ "${CLUSTER}" = "kind" ]; then
echo "Load built local Docker Images into Kind Cluster"
image_list=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep ${NAMESPACE} | grep ${BUILD_DATE:-$VERSION})
for image in $image_list; do
kind load docker-image --name ${CLUSTER_NAME} "$image"
done
fi

if [ "${TEST_EXISTING_KEDA}" = "true" ]; then
echo "Wait for KEDA core to be ready"
kubectl -n ${KEDA_NAMESPACE} wait --for=condition=ready pod -l app.kubernetes.io/instance=${KEDA_NAMESPACE} --timeout 180s
fi
11 changes: 11 additions & 0 deletions tests/charts/make/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,17 @@ if [ "${RENDER_HELM_TEMPLATE_ONLY}" = "true" ]; then
exit 0
fi

if [ "${TEST_EXISTING_KEDA}" = "true" ] && [ "${TEST_UPGRADE_CHART}" != "true" ]; then
helm repo add kedacore https://kedacore.github.io/charts
echo "Install KEDA core on kind kubernetes cluster"
helm upgrade -i ${KEDA_NAMESPACE} -n ${KEDA_NAMESPACE} --create-namespace --set webhooks.enabled=false kedacore/keda
fi

if [ "${TEST_EXISTING_KEDA}" = "true" ] && [ "${TEST_UPGRADE_CHART}" != "true" ]; then
echo "Wait for KEDA core to be ready"
kubectl -n ${KEDA_NAMESPACE} wait --for=condition=ready pod -l app.kubernetes.io/instance=${KEDA_NAMESPACE} --timeout 180s
fi

echo "Deploy Selenium Grid Chart"
helm upgrade --install ${HELM_COMMAND_ARGS}

Expand Down

0 comments on commit 312e4a5

Please sign in to comment.