Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chart(update): Node deployment replicas use minReplicaCount in autoscaling #2430

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,54 +79,72 @@ workflows:
use-random-user: true
platforms: linux/arm64
machine-type: ubuntu2204arm64
firefox-install-lang-package: false
enable-managed-downloads: false
- docker-test:
name: "Docker test - Use random user (false)"
test-strategy: test
use-random-user: false
platforms: linux/arm64
machine-type: ubuntu2204arm64
firefox-install-lang-package: false
enable-managed-downloads: false
- docker-test:
name: "Docker test - Video recording"
test-strategy: test_video
use-random-user: false
platforms: linux/arm64
machine-type: ubuntu2204arm64
firefox-install-lang-package: true
enable-managed-downloads: true
- docker-test:
name: "Docker test - Video recording dynamic file name"
test-strategy: test_video_dynamic_name
use-random-user: false
platforms: linux/arm64
machine-type: ubuntu2204arm64
firefox-install-lang-package: true
enable-managed-downloads: true
- docker-test:
name: "Docker test - Video recording standalone"
test-strategy: test_video_standalone
use-random-user: false
platforms: linux/arm64
machine-type: ubuntu2204arm64
firefox-install-lang-package: true
enable-managed-downloads: true
- docker-test:
name: "Docker test - Dynamic Grid"
test-strategy: test_node_docker
use-random-user: false
platforms: linux/arm64
machine-type: ubuntu2204arm64
firefox-install-lang-package: true
enable-managed-downloads: false
- docker-test:
name: "Docker test - Dynamic Grid Standalone"
test-strategy: test_standalone_docker
use-random-user: false
platforms: linux/arm64
machine-type: ubuntu2204arm64
firefox-install-lang-package: true
enable-managed-downloads: true
- docker-test:
name: "Docker test - Parallel execution"
test-strategy: test_parallel
use-random-user: false
platforms: linux/arm64
machine-type: ubuntu2204arm64
firefox-install-lang-package: true
enable-managed-downloads: true
- docker-test:
name: "Docker test - Node relay commands"
test-strategy: test_node_relay
use-random-user: false
platforms: linux/arm64
machine-type: ubuntu2204arm64
firefox-install-lang-package: true
enable-managed-downloads: true

executors:
ubuntu2204arm64:
Expand All @@ -149,13 +167,19 @@ jobs:
type: string
use-random-user:
type: boolean
firefox-install-lang-package:
type: boolean
enable-managed-downloads:
type: boolean
executor: << parameters.machine-type >>
environment:
NAMESPACE: selenium
BUILD_DATE: today
PLATFORMS: << parameters.platforms >>
TEST_STRATEGY: << parameters.test-strategy >>
USE_RANDOM_USER: << parameters.use-random-user >>
TEST_FIREFOX_INSTALL_LANG_PACKAGE: << parameters.firefox-install-lang-package >>
SELENIUM_ENABLE_MANAGED_DOWNLOADS: << parameters.enable-managed-downloads >>
steps:
- run:
name: "Prepare workflow environment variables"
Expand Down Expand Up @@ -195,7 +219,9 @@ jobs:
command: |
N=3
while [ $N -gt 0 ]; do
output=$(eval "USE_RANDOM_USER_ID=${USE_RANDOM_USER} PLATFORMS=${PLATFORMS} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make ${TEST_STRATEGY}")
output=$(eval "USE_RANDOM_USER_ID=${USE_RANDOM_USER} PLATFORMS=${PLATFORMS} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} \
TEST_FIREFOX_INSTALL_LANG_PACKAGE=${TEST_FIREFOX_INSTALL_LANG_PACKAGE} SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS} \
make ${TEST_STRATEGY}")
status=$?
if [ $status -eq 0 ]; then
echo "Tests passed"
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ test_firefox_download_lang_packs:

test_firefox: test_firefox_download_lang_packs
PLATFORMS=$(PLATFORMS) VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) BASE_RELEASE=$(BASE_RELEASE) BASE_VERSION=$(BASE_VERSION) BINDING_VERSION=$(BINDING_VERSION) SKIP_BUILD=true \
TEST_FIREFOX_INSTALL_LANG_PACKAGE=true ./tests/bootstrap.sh NodeFirefox
TEST_FIREFOX_INSTALL_LANG_PACKAGE=$(or $(TEST_FIREFOX_INSTALL_LANG_PACKAGE), "true") ./tests/bootstrap.sh NodeFirefox

test_firefox_standalone:
PLATFORMS=$(PLATFORMS) VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) BASE_RELEASE=$(BASE_RELEASE) BASE_VERSION=$(BASE_VERSION) BINDING_VERSION=$(BINDING_VERSION) SKIP_BUILD=true ./tests/bootstrap.sh StandaloneFirefox
Expand Down Expand Up @@ -848,7 +848,7 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta
envsubst < $${config_file} > ./videos/config.toml ; \
DOCKER_DEFAULT_PLATFORM=$(PLATFORMS) docker compose -f $${docker_compose_file} up --remove-orphans --no-log-prefix --build --exit-code-from tests ; \
if [ $$? -ne 0 ]; then exit 1; fi ; \
if [ "$$SKIP_CHECK_DOWNLOADS_VOLUME" != "true" ] && [ -d "$$DOWNLOADS_DIR" ] && [ $$(ls -1q $$DOWNLOADS_DIR | wc -l) -eq 0 ]; then \
if [ "$$SKIP_CHECK_DOWNLOADS_VOLUME" != "true" ] && [ "$$SELENIUM_ENABLE_MANAGED_DOWNLOADS" != "true" ] && [ -d "$$DOWNLOADS_DIR" ] && [ $$(ls -1q $$DOWNLOADS_DIR | wc -l) -eq 0 ]; then \
echo "Mounted downloads directory is empty. Downloaded files could not be retrieved!" ; \
exit 1 ; \
fi ; \
Expand Down Expand Up @@ -922,7 +922,7 @@ chart_test_autoscaling_deployment_https:
chart_test_autoscaling_deployment:
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 \
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=0 SET_MAX_REPLICAS=3 TEST_DELAY_AFTER_TEST=2 SELENIUM_GRID_MONITORING=false \
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_prefixSelenium_enableTracing_secureServer_externalCerts_nodePort_autoScaling_scaledObject_existingKEDA_subPath.yaml" \
./tests/charts/make/chart_test.sh DeploymentAutoscaling
Expand Down
6 changes: 3 additions & 3 deletions charts/selenium-grid/CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# selenium-grid

![Version: 0.36.2](https://img.shields.io/badge/Version-0.36.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.25.0-20241010](https://img.shields.io/badge/AppVersion-4.25.0--20241010-informational?style=flat-square)
![Version: 0.36.3](https://img.shields.io/badge/Version-0.36.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.25.0-20241010](https://img.shields.io/badge/AppVersion-4.25.0--20241010-informational?style=flat-square)

A Helm chart for creating a Selenium Grid Server in Kubernetes

Expand All @@ -21,7 +21,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| https://jaegertracing.github.io/helm-charts | jaeger | 3.3.1 |
| https://kedacore.github.io/charts | keda | 2.15.1 |
| https://kubernetes.github.io/ingress-nginx | ingress-nginx | 4.11.3 |
| https://prometheus-community.github.io/helm-charts | kube-prometheus-stack | 65.1.1 |
| https://prometheus-community.github.io/helm-charts | kube-prometheus-stack | 65.2.0 |

## Values

Expand All @@ -42,7 +42,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| global.seleniumGrid.revisionHistoryLimit | int | `10` | Specify how many old ReplicaSets for this Deployment you want to retain. The rest will be garbage-collected in the background. |
| global.seleniumGrid.structuredLogs | bool | `false` | Whether to enable structured logging |
| global.seleniumGrid.httpLogs | bool | `false` | Enable http logging. Tracing should be enabled to log http logs. |
| global.seleniumGrid.updateStrategy.type | string | `"Recreate"` | Specify update strategy for all components, can be overridden individually |
| global.seleniumGrid.updateStrategy.type | string | `"RollingUpdate"` | Specify update strategy for all components, can be overridden individually |
| global.seleniumGrid.updateStrategy.rollingUpdate | object | `{"maxSurge":1,"maxUnavailable":0}` | Specify for strategy RollingUpdate |
| global.seleniumGrid.affinity | object | `{}` | Specify affinity for all components, can be overridden individually |
| global.seleniumGrid.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for all components, can be overridden individually |
Expand Down
4 changes: 2 additions & 2 deletions 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.2
version: 0.36.3
appVersion: 4.25.0-20241010
icon: https://github.com/SeleniumHQ/docker-selenium/raw/trunk/logo.png
dependencies:
Expand All @@ -19,7 +19,7 @@ dependencies:
name: jaeger
condition: tracing.enabled, jaeger.enabled
- repository: https://prometheus-community.github.io/helm-charts
version: 65.1.1
version: 65.2.0
name: kube-prometheus-stack
condition: monitoring.enabled, prometheus-stack.enabled
maintainers:
Expand Down
6 changes: 4 additions & 2 deletions charts/selenium-grid/templates/chrome-node-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ metadata:
spec:
strategy:
{{- template "seleniumGrid.updateStrategy" (list $.Values.chromeNode $.Values.global.seleniumGrid) }}
{{- if and (not .Values.autoscaling.enabled) (not .Values.autoscaling.enableWithExistingKEDA) }}
{{- if not (eq (include "seleniumGrid.useKEDA" $) "true") }}
replicas: {{ .Values.chromeNode.replicas }}
{{end}}
{{- else }}
replicas: {{ default $.Values.autoscaling.scaledOptions.minReplicaCount ($.Values.chromeNode.scaledOptions).minReplicaCount }}
{{ end }}
revisionHistoryLimit: {{ .Values.global.seleniumGrid.revisionHistoryLimit }}
selector:
matchLabels:
Expand Down
6 changes: 4 additions & 2 deletions charts/selenium-grid/templates/edge-node-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ metadata:
spec:
strategy:
{{- template "seleniumGrid.updateStrategy" (list $.Values.edgeNode $.Values.global.seleniumGrid) }}
{{- if and (not .Values.autoscaling.enabled) (not .Values.autoscaling.enableWithExistingKEDA) }}
{{- if not (eq (include "seleniumGrid.useKEDA" $) "true") }}
replicas: {{ .Values.edgeNode.replicas }}
{{end}}
{{- else }}
replicas: {{ default $.Values.autoscaling.scaledOptions.minReplicaCount ($.Values.edgeNode.scaledOptions).minReplicaCount }}
{{ end }}
revisionHistoryLimit: {{ .Values.global.seleniumGrid.revisionHistoryLimit }}
selector:
matchLabels:
Expand Down
6 changes: 4 additions & 2 deletions charts/selenium-grid/templates/firefox-node-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ metadata:
spec:
strategy:
{{- template "seleniumGrid.updateStrategy" (list $.Values.firefoxNode $.Values.global.seleniumGrid) }}
{{- if and (not .Values.autoscaling.enabled) (not .Values.autoscaling.enableWithExistingKEDA) }}
{{- if not (eq (include "seleniumGrid.useKEDA" $) "true") }}
replicas: {{ .Values.firefoxNode.replicas }}
{{end}}
{{- else }}
replicas: {{ default $.Values.autoscaling.scaledOptions.minReplicaCount ($.Values.firefoxNode.scaledOptions).minReplicaCount }}
{{ end }}
revisionHistoryLimit: {{ .Values.global.seleniumGrid.revisionHistoryLimit }}
selector:
matchLabels:
Expand Down
2 changes: 1 addition & 1 deletion charts/selenium-grid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ global:
httpLogs: false
updateStrategy:
# -- Specify update strategy for all components, can be overridden individually
type: Recreate
type: RollingUpdate
# type: RollingUpdate
# -- Specify for strategy RollingUpdate
rollingUpdate:
Expand Down
1 change: 0 additions & 1 deletion tests/SeleniumTests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def test_download_file(self):
driver = self.driver
driver.get('https://the-internet.herokuapp.com/download')
file_name = 'some-file.txt'
is_continue = True
wait = WebDriverWait(driver, 30)
file_link = wait.until(
EC.element_to_be_clickable((By.LINK_TEXT, file_name))
Expand Down
9 changes: 3 additions & 6 deletions tests/charts/make/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ on_failure() {
if [ ${RENDER_HELM_TEMPLATE_ONLY} = "true" ]; then
exit $exit_status
fi
kubectl get pods -A
echo "Get all resources in all namespaces"
kubectl get all -A >> tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt
echo "Describe all resources in the ${SELENIUM_NAMESPACE} namespace for debugging purposes"
kubectl describe all -n ${SELENIUM_NAMESPACE} >> tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt
kubectl describe pod -n ${SELENIUM_NAMESPACE} >> tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt
Expand Down Expand Up @@ -450,10 +453,4 @@ 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

cleanup
2 changes: 1 addition & 1 deletion tests/charts/templates/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def test_update_strategy_in_all_components(self):
count_rolling += 1
if doc['metadata']['name'] in recreate and doc['kind'] == 'Deployment':
logger.info(f"Assert updateStrategy is set in resource {doc['metadata']['name']}")
self.assertTrue(doc['spec']['strategy']['type'] == 'Recreate', f"Resource {doc['metadata']['name']} doesn't have strategy Recreate")
self.assertTrue(doc['spec']['strategy']['type'] == 'RollingUpdate', f"Resource {doc['metadata']['name']} doesn't have strategy RollingUpdate")
count_recreate += 1
self.assertEqual(count_rolling, len(rolling), "No deployment resources found with strategy RollingUpdate")
self.assertEqual(count_recreate, len(recreate), "No deployment resources found with strategy Recreate")
Expand Down
Loading