diff --git a/.github/workflows/helm-chart-test.yml b/.github/workflows/helm-chart-test.yml index 92e4621d5..80d268eb6 100644 --- a/.github/workflows/helm-chart-test.yml +++ b/.github/workflows/helm-chart-test.yml @@ -165,13 +165,6 @@ jobs: command: | NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_${{ matrix.test-strategy }} \ && NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make test_video_integrity - - name: Test chart upgrade - if: (matrix.test-upgrade == true) - run: | - 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 - name: Upload Helm chart package if: always() uses: actions/upload-artifact@main @@ -191,6 +184,13 @@ jobs: with: name: ${{ env.ARTIFACT_NAME }}-videos path: ./tests/videos/ + - name: Test chart upgrade + if: (matrix.test-upgrade == true) + run: | + NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} SET_MAX_REPLICAS=10 TEST_NAME_OVERRIDE=true 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 - name: Clean up Docker if: always() run: docker system prune -af diff --git a/Makefile b/Makefile index 2468e0224..60495ac95 100644 --- a/Makefile +++ b/Makefile @@ -919,7 +919,7 @@ chart_test_autoscaling_deployment_https: ./tests/charts/make/chart_test.sh DeploymentAutoscaling chart_test_autoscaling_deployment: - PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true \ + PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=false \ 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) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) \ @@ -935,7 +935,7 @@ chart_test_autoscaling_job_https: ./tests/charts/make/chart_test.sh JobAutoscaling chart_test_autoscaling_job_hostname: - PLATFORMS=$(PLATFORMS) CHART_ENABLE_TRACING=true CHART_ENABLE_BASIC_AUTH=true \ + PLATFORMS=$(PLATFORMS) CHART_ENABLE_TRACING=true CHART_ENABLE_BASIC_AUTH=true BASIC_AUTH_EMBEDDED_URL=true TEST_PATCHED_KEDA=false \ SECURE_INGRESS_ONLY_DEFAULT=true SECURE_USE_EXTERNAL_CERT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -i) SELENIUM_GRID_PORT=443 \ VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) \ TEMPLATE_OUTPUT_FILENAME="k8s_enableTracing_basicAuth_secureIngress_externalCerts_ingressPublicIP_autoScaling_scaledJob_subPath.yaml" \ diff --git a/charts/selenium-grid/CONFIGURATION.md b/charts/selenium-grid/CONFIGURATION.md index ba6ba1203..326577712 100644 --- a/charts/selenium-grid/CONFIGURATION.md +++ b/charts/selenium-grid/CONFIGURATION.md @@ -1,6 +1,6 @@ # selenium-grid -![Version: 0.36.0](https://img.shields.io/badge/Version-0.36.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.25.0-20240922](https://img.shields.io/badge/AppVersion-4.25.0--20240922-informational?style=flat-square) +![Version: 0.36.1](https://img.shields.io/badge/Version-0.36.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.25.0-20240922](https://img.shields.io/badge/AppVersion-4.25.0--20240922-informational?style=flat-square) A Helm chart for creating a Selenium Grid Server in Kubernetes diff --git a/charts/selenium-grid/Chart.yaml b/charts/selenium-grid/Chart.yaml index 791c97103..a21896ceb 100644 --- a/charts/selenium-grid/Chart.yaml +++ b/charts/selenium-grid/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: selenium-grid description: A Helm chart for creating a Selenium Grid Server in Kubernetes type: application -version: 0.36.0 +version: 0.36.1 appVersion: 4.25.0-20240922 icon: https://github.com/SeleniumHQ/docker-selenium/raw/trunk/logo.png dependencies: diff --git a/charts/selenium-grid/templates/_helpers.tpl b/charts/selenium-grid/templates/_helpers.tpl index 866851c88..855fc0b85 100644 --- a/charts/selenium-grid/templates/_helpers.tpl +++ b/charts/selenium-grid/templates/_helpers.tpl @@ -638,9 +638,6 @@ Get the url of the grid. If the external url can be figured out from the ingress */}} {{- define "seleniumGrid.url" -}} {{- $url := printf "%s://%s%s%s" (include "seleniumGrid.url.schema" .) (include "seleniumGrid.url.host" .) (include "seleniumGrid.url.port" .) (include "seleniumGrid.url.subPath" .) -}} -{{- if $.Values.basicAuth.embeddedUrl -}} -{{- $url := printf "%s://%s%s%s%s" (include "seleniumGrid.url.schema" .) (include "seleniumGrid.url.basicAuth" .) (include "seleniumGrid.url.host" .) (include "seleniumGrid.url.port" .) (include "seleniumGrid.url.subPath" .) -}} -{{- end -}} {{- $url }} {{- end -}} @@ -649,6 +646,9 @@ Get the url of the grid server in the cluster */}} {{- define "seleniumGrid.server.url" -}} {{- $url := printf "%s://%s%s%s" (include "seleniumGrid.server.url.schema" .) (include "seleniumGrid.server.url.host" .) (include "seleniumGrid.server.url.port" .) (include "seleniumGrid.url.subPath" .) -}} +{{- if $.Values.basicAuth.embeddedUrl -}} + {{- $url = printf "%s://%s%s%s%s" (include "seleniumGrid.server.url.schema" .) (include "seleniumGrid.url.basicAuth" .) (include "seleniumGrid.server.url.host" .) (include "seleniumGrid.server.url.port" .) (include "seleniumGrid.url.subPath" .) -}} +{{- end -}} {{- $url }} {{- end -}} diff --git a/tests/charts/ci/local-pvc.yaml b/tests/charts/ci/local-pvc.yaml index 731fb9110..40b5826f1 100644 --- a/tests/charts/ci/local-pvc.yaml +++ b/tests/charts/ci/local-pvc.yaml @@ -74,6 +74,21 @@ spec: targetPort: 21005 --- apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: ${TEST_PV_CLAIM_NAME} + namespace: ${SELENIUM_NAMESPACE} + labels: + app: ftp-server +spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: "2Gi" + storageClassName: "standard" +--- +apiVersion: v1 kind: PersistentVolume metadata: name: pv-local @@ -92,18 +107,3 @@ spec: type: DirectoryOrCreate persistentVolumeReclaimPolicy: Retain storageClassName: "standard" ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: ${TEST_PV_CLAIM_NAME} - namespace: ${SELENIUM_NAMESPACE} - labels: - app: ftp-server -spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: "2Gi" - storageClassName: "standard" diff --git a/tests/charts/make/chart_test.sh b/tests/charts/make/chart_test.sh index 5724ed066..c12a56cf5 100755 --- a/tests/charts/make/chart_test.sh +++ b/tests/charts/make/chart_test.sh @@ -53,6 +53,8 @@ MAX_SESSIONS_CHROME=${MAX_SESSIONS_CHROME:-"1"} MAX_SESSIONS_FIREFOX=${MAX_SESSIONS_FIREFOX:-"1"} MAX_SESSIONS_EDGE=${MAX_SESSIONS_EDGE:-"1"} TEST_NAME_OVERRIDE=${TEST_NAME_OVERRIDE:-"false"} +TEST_PATCHED_KEDA=${TEST_PATCHED_KEDA:-"true"} +BASIC_AUTH_EMBEDDED_URL=${BASIC_AUTH_EMBEDDED_URL:-"false"} cleanup() { # Get the list of pods @@ -189,6 +191,7 @@ if [ "${CHART_ENABLE_BASIC_AUTH}" = "true" ]; then --set basicAuth.enabled=${CHART_ENABLE_BASIC_AUTH} \ --set basicAuth.username=${BASIC_AUTH_USERNAME} \ --set basicAuth.password=${BASIC_AUTH_PASSWORD} \ + --set basicAuth.embeddedUrl=${BASIC_AUTH_EMBEDDED_URL} \ " export SELENIUM_GRID_USERNAME=${BASIC_AUTH_USERNAME} export SELENIUM_GRID_PASSWORD=${BASIC_AUTH_PASSWORD} @@ -330,6 +333,34 @@ HELM_COMMAND_SET_BASE_VALUES="${HELM_COMMAND_SET_BASE_VALUES} \ --values ${MATRIX_BROWSER_VALUES_FILE} \ " +if [ "${TEST_EXISTING_KEDA}" = "true" ] && [ "${TEST_UPGRADE_CHART}" != "true" ]; then + if [ "${TEST_PATCHED_KEDA}" = "true" ]; then + KEDA_SET_IMAGES="--set image.keda.registry=${KEDA_BASED_NAME} --set image.keda.repository=keda --set image.keda.tag=${KEDA_BASED_TAG} \ + --set image.metricsApiServer.registry=${KEDA_BASED_NAME} --set image.metricsApiServer.repository=keda-metrics-apiserver --set image.metricsApiServer.tag=${KEDA_BASED_TAG} \ + --set image.webhooks.registry=${KEDA_BASED_NAME} --set image.webhooks.repository=keda-admission-webhooks --set image.webhooks.tag=${KEDA_BASED_TAG} \ + " + fi + helm repo add kedacore https://kedacore.github.io/charts + echo "Install KEDA core on Kubernetes cluster" + helm upgrade -i ${KEDA_NAMESPACE} -n ${KEDA_NAMESPACE} --create-namespace --set webhooks.enabled=true ${KEDA_SET_IMAGES} kedacore/keda + 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 +elif [ "${TEST_EXISTING_KEDA}" != "true" ]; then + if [ "${TEST_PATCHED_KEDA}" = "true" ]; then + HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \ + --set keda.image.keda.registry=${KEDA_BASED_NAME} --set keda.image.keda.repository=keda --set keda.image.keda.tag=${KEDA_BASED_TAG} \ + --set keda.image.metricsApiServer.registry=${KEDA_BASED_NAME} --set keda.image.metricsApiServer.repository=keda-metrics-apiserver --set keda.image.metricsApiServer.tag=${KEDA_BASED_TAG} \ + --set keda.image.webhooks.registry=${KEDA_BASED_NAME} --set keda.image.webhooks.repository=keda-admission-webhooks --set keda.image.webhooks.tag=${KEDA_BASED_TAG} \ + " + else + HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \ + --set keda.image.keda.registry=null --set keda.image.keda.repository=null --set keda.image.keda.tag=null \ + --set keda.image.metricsApiServer.registry=null --set keda.image.metricsApiServer.repository=null --set keda.image.metricsApiServer.tag=null \ + --set keda.image.webhooks.registry=null --set keda.image.webhooks.repository=null --set keda.image.webhooks.tag=null \ + " + fi +fi + HELM_COMMAND_ARGS="${RELEASE_NAME} \ ${HELM_COMMAND_SET_BASE_VALUES} \ ${HELM_COMMAND_SET_AUTOSCALING} \ @@ -343,27 +374,6 @@ 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 Kubernetes cluster" - helm upgrade -i ${KEDA_NAMESPACE} -n ${KEDA_NAMESPACE} --create-namespace --set webhooks.enabled=true \ - --set image.keda.registry=${KEDA_BASED_NAME} --set image.keda.repository=keda --set image.keda.tag=${KEDA_BASED_TAG} \ - --set image.metricsApiServer.registry=${KEDA_BASED_NAME} --set image.metricsApiServer.repository=keda-metrics-apiserver --set image.metricsApiServer.tag=${KEDA_BASED_TAG} \ - --set image.webhooks.registry=${KEDA_BASED_NAME} --set image.webhooks.repository=keda-admission-webhooks --set image.webhooks.tag=${KEDA_BASED_TAG} \ - kedacore/keda -elif [ "${TEST_EXISTING_KEDA}" != "true" ] && [ "${TEST_UPGRADE_CHART}" != "true" ]; then - HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \ - --set keda.image.keda.registry=${KEDA_BASED_NAME} --set keda.image.keda.repository=keda --set keda.image.keda.tag=${KEDA_BASED_TAG} \ - --set keda.image.metricsApiServer.registry=${KEDA_BASED_NAME} --set keda.image.metricsApiServer.repository=keda-metrics-apiserver --set keda.image.metricsApiServer.tag=${KEDA_BASED_TAG} \ - --set keda.image.webhooks.registry=${KEDA_BASED_NAME} --set keda.image.webhooks.repository=keda-admission-webhooks --set keda.image.webhooks.tag=${KEDA_BASED_TAG} \ - " -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} @@ -405,9 +415,6 @@ else ./tests/bootstrap.sh ${MATRIX_BROWSER} fi -echo "Get pods status" -kubectl get pods -n ${SELENIUM_NAMESPACE} - # Wait until no pods are in "Terminating" state while true; do terminating_pods=$(kubectl get pods -n ${SELENIUM_NAMESPACE} --no-headers | grep Terminating | wc -l) @@ -420,6 +427,9 @@ while true; do fi done +echo "Get pods status" +kubectl get pods -n ${SELENIUM_NAMESPACE} + echo "Get all resources in all namespaces" kubectl get all -A >> tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt