Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
test(chart): autoscaling as job
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Feb 29, 2024
1 parent cd49f19 commit c323bed
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 13 deletions.
2 changes: 1 addition & 1 deletion NodeChrome/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ USER ${SEL_UID}
# Dumping Browser information for config
#============================================
RUN echo "chrome" > /opt/selenium/browser_name
RUN google-chrome --version | awk '{print $3}' > /opt/selenium/browser_version
RUN google-chrome --version | awk '{print $3}' | cut -d'.' -f1,2 > /opt/selenium/browser_version
RUN echo "\"goog:chromeOptions\": {\"binary\": \"/usr/bin/google-chrome\"}" > /opt/selenium/browser_binary_location

ENV SE_OTEL_SERVICE_NAME "selenium-node-chrome"
2 changes: 1 addition & 1 deletion NodeEdge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ USER ${SEL_UID}
# Dumping Browser information for config
#============================================
RUN echo "MicrosoftEdge" > /opt/selenium/browser_name
RUN microsoft-edge --version | awk '{print $3}' > /opt/selenium/browser_version
RUN microsoft-edge --version | awk '{print $3}' | cut -d'.' -f1,2 > /opt/selenium/browser_version
RUN echo "\"ms:edgeOptions\": {\"binary\": \"/usr/bin/microsoft-edge\"}" > /opt/selenium/browser_binary_location

ENV SE_OTEL_SERVICE_NAME "selenium-node-edge"
3 changes: 1 addition & 2 deletions Video/video.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ UPLOAD_PIPE_FILE_NAME=${UPLOAD_PIPE_FILE_NAME:-"uploadpipe"}
SE_VIDEO_INTERNAL_UPLOAD=${SE_VIDEO_INTERNAL_UPLOAD:-"false"}
SE_SERVER_PROTOCOL=${SE_SERVER_PROTOCOL:-"http"}
SE_NODE_PORT=${SE_NODE_PORT:-"5555"}
max_attempts=${SE_VIDEO_WAIT_ATTEMPTS:-50}

if [ "${SE_VIDEO_INTERNAL_UPLOAD}" = "true" ];
then
Expand Down Expand Up @@ -109,7 +110,6 @@ function graceful_exit() {

if [[ "${VIDEO_UPLOAD_ENABLED}" != "true" ]] && [[ "${VIDEO_FILE_NAME}" != "auto" ]] && [[ -n "${VIDEO_FILE_NAME}" ]]; then
return_code=1
max_attempts=50
attempts=0
echo 'Checking if the display is open...'
until [[ $return_code -eq 0 ]] || [[ $attempts -eq $max_attempts ]]; do
Expand All @@ -130,7 +130,6 @@ else
trap graceful_exit SIGTERM SIGINT EXIT
export DISPLAY=${DISPLAY_CONTAINER_NAME}:${DISPLAY_NUM}.0

max_attempts=600
attempts=0

echo Checking if the display is open
Expand Down
5 changes: 5 additions & 0 deletions charts/selenium-grid/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ dependencies:
version: 1.0.0
name: jaeger
condition: tracing.enabled
- repository: https://prometheus-community.github.io/helm-charts
version: 56.15.0
name: kube-prometheus-stack
condition: monitoring.enabled
alias: prometheus-stack
maintainers:
- name: SeleniumHQ
email: selenium-developers@googlegroups.com
Expand Down
57 changes: 52 additions & 5 deletions charts/selenium-grid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ autoscaling:
# Number of Completed jobs should be kept
successfulJobsHistoryLimit: 0
# Number of Failed jobs should be kept (for troubleshooting purposes)
failedJobsHistoryLimit: 100
failedJobsHistoryLimit: 0
jobTargetRef:
parallelism: 1
completions: 1
Expand Down Expand Up @@ -709,7 +709,7 @@ chromeNode:
# scaledObjectOptions:
hpa:
url: '{{ template "seleniumGrid.graphqlURL" . }}'
browserName: chrome
browserName: 'chrome'
sessionBrowserName: 'chrome'
# browserVersion: '91.0' # Optional. Only required when supporting multiple versions of browser in your Selenium Grid.
unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional
Expand Down Expand Up @@ -869,7 +869,7 @@ firefoxNode:
# scaledObjectOptions:
hpa:
url: '{{ template "seleniumGrid.graphqlURL" . }}'
browserName: firefox
browserName: 'firefox'
sessionBrowserName: 'firefox'
unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional

Expand Down Expand Up @@ -1027,8 +1027,8 @@ edgeNode:
# scaledObjectOptions:
hpa:
url: '{{ template "seleniumGrid.graphqlURL" . }}'
browserName: MicrosoftEdge
sessionBrowserName: 'msedge'
browserName: 'MicrosoftEdge'
sessionBrowserName: 'MicrosoftEdge'
unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional

# It is used to add initContainers in the same pod of the browser node.
Expand Down Expand Up @@ -1191,3 +1191,50 @@ jaeger:
enabled: false
query:
enabled: false

prometheus-stack:
defaultRules:
annotations:
"helm.sh/hook": post-install,post-upgrade,post-rollback
alertmanager:
annotations:
"helm.sh/hook": post-install,post-upgrade,post-rollback
enabled: true
ingress:
enabled: true
ingressClassName: nginx
hosts:
- alertmanager.selenium-grid.prod
grafana:
enabled: true
adminPassword: admin
forceDeployDatasources: true
forceDeployDashboards: true
annotations:
"helm.sh/hook": post-install,post-upgrade,post-rollback
ingress:
enabled: true
ingressClassName: nginx
hosts:
- grafana.selenium-grid.prod
prometheus:
annotations:
"helm.sh/hook": post-install,post-upgrade,post-rollback
enabled: true
ingress:
enabled: true
ingressClassName: nginx
hosts:
- pts.selenium-grid.prod
prometheusSpec:
storageSpec:
volumeClaimTemplate:
spec:
storageClassName: "standard"
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi
selector:
matchLabels:
app.kubernetes.io/name: "prometheus"
7 changes: 4 additions & 3 deletions tests/charts/ci/JobAutoscaling-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ autoscaling:
enableWithExistingKEDA: true
scalingType: job
scaledJobOptions:
successfulJobsHistoryLimit: 100
successfulJobsHistoryLimit: 0
failedJobsHistoryLimit: 0
scalingStrategy:
strategy: default
strategy: accurate
scaledOptions:
minReplicaCount: 0
maxReplicaCount: 6
maxReplicaCount: 30
pollingInterval: 20
# Configuration for chrome nodes
chromeNode:
Expand Down
3 changes: 3 additions & 0 deletions tests/charts/ci/base-auth-ingress-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ global:
seleniumGrid:
logLevel: INFO

monitoring:
enabled: true

ingress:
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
Expand Down
1 change: 1 addition & 0 deletions tests/charts/config/ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ chart-repos:
- kedacore=https://kedacore.github.io/charts
- ingressNginx=https://kubernetes.github.io/ingress-nginx
- jaegertracing=https://jaegertracing.github.io/helm-charts
- prometheusCommunity=https://prometheus-community.github.io/helm-charts
upgrade: false
helm-extra-args: --timeout 600s
check-version-increment: false
14 changes: 13 additions & 1 deletion tests/charts/make/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SSL_CERT_DIR=${SSL_CERT_DIR:-"/etc/ssl/certs"}
VIDEO_TAG=${VIDEO_TAG:-"latest"}
CHART_ENABLE_TRACING=${CHART_ENABLE_TRACING:-"false"}
CHART_FULL_DISTRIBUTED_MODE=${CHART_FULL_DISTRIBUTED_MODE:-"false"}
HOSTNAME_ADDRESS=${HOSTNAME_ADDRESS:-"selenium-grid.local"}
HOSTNAME_ADDRESS=${HOSTNAME_ADDRESS:-"selenium-grid.prod"}
CHART_ENABLE_INGRESS_HOSTNAME=${CHART_ENABLE_INGRESS_HOSTNAME:-"false"}
CHART_ENABLE_BASIC_AUTH=${CHART_ENABLE_BASIC_AUTH:-"false"}
BASIC_AUTH_USERNAME=${BASIC_AUTH_USERNAME:-"sysAdminUser"}
Expand Down Expand Up @@ -115,6 +115,18 @@ else
"
fi

if [[ ! $(cat /etc/hosts) == *"alertmanager.selenium-grid.prod"* ]]; then
sudo -- sh -c -e "echo \"$(hostname -i) alertmanager.selenium-grid.prod\" >> /etc/hosts"
fi

if [[ ! $(cat /etc/hosts) == *"grafana.selenium-grid.prod"* ]]; then
sudo -- sh -c -e "echo \"$(hostname -i) grafana.selenium-grid.prod\" >> /etc/hosts"
fi

if [[ ! $(cat /etc/hosts) == *"pts.selenium-grid.prod"* ]]; then
sudo -- sh -c -e "echo \"$(hostname -i) pts.selenium-grid.prod\" >> /etc/hosts"
fi

if [ "${CHART_ENABLE_BASIC_AUTH}" = "true" ]; then
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
--set basicAuth.enabled=${CHART_ENABLE_BASIC_AUTH} \
Expand Down

0 comments on commit c323bed

Please sign in to comment.