Skip to content

Commit

Permalink
chart(fix): basicAuth.embeddedUrl in GraphQL endpoint for old scale…
Browse files Browse the repository at this point in the history
…r compatible

Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Sep 23, 2024
1 parent c6a781b commit 486d075
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand All @@ -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" \
Expand Down
2 changes: 1 addition & 1 deletion charts/selenium-grid/CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion charts/selenium-grid/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions charts/selenium-grid/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}

Expand All @@ -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 -}}

Expand Down
45 changes: 29 additions & 16 deletions tests/charts/make/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -330,6 +333,32 @@ 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
elif [ "${TEST_EXISTING_KEDA}" != "true" ] && [ "${TEST_UPGRADE_CHART}" != "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=ghcr.io --set keda.image.keda.repository=kedacore/keda --set keda.image.keda.tag=2.15.1 \
--set keda.image.metricsApiServer.registry=ghcr.io --set keda.image.metricsApiServer.repository=kedacore/keda-metrics-apiserver --set keda.image.metricsApiServer.tag=2.15.1 \
--set keda.image.webhooks.registry=ghcr.io --set keda.image.webhooks.repository=kedacore/keda-admission-webhooks --set keda.image.webhooks.tag=2.15.1 \
"
fi
fi

HELM_COMMAND_ARGS="${RELEASE_NAME} \
${HELM_COMMAND_SET_BASE_VALUES} \
${HELM_COMMAND_SET_AUTOSCALING} \
Expand All @@ -343,22 +372,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
Expand Down

0 comments on commit 486d075

Please sign in to comment.