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 (#2408)

Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 authored Sep 23, 2024
1 parent c6a781b commit 8466588
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 53 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/helm-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
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
30 changes: 15 additions & 15 deletions tests/charts/ci/local-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
58 changes: 34 additions & 24 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,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} \
Expand All @@ -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}

Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit 8466588

Please sign in to comment.