Skip to content

Commit e7ca1dc

Browse files
authored
chart(update): Node deployment replicas use minReplicaCount in autoscaling (#2430)
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 94da26e commit e7ca1dc

File tree

11 files changed

+52
-24
lines changed

11 files changed

+52
-24
lines changed

Diff for: .circleci/config.yml

+27-1
Original file line numberDiff line numberDiff line change
@@ -79,54 +79,72 @@ workflows:
7979
use-random-user: true
8080
platforms: linux/arm64
8181
machine-type: ubuntu2204arm64
82+
firefox-install-lang-package: false
83+
enable-managed-downloads: false
8284
- docker-test:
8385
name: "Docker test - Use random user (false)"
8486
test-strategy: test
8587
use-random-user: false
8688
platforms: linux/arm64
8789
machine-type: ubuntu2204arm64
90+
firefox-install-lang-package: false
91+
enable-managed-downloads: false
8892
- docker-test:
8993
name: "Docker test - Video recording"
9094
test-strategy: test_video
9195
use-random-user: false
9296
platforms: linux/arm64
9397
machine-type: ubuntu2204arm64
98+
firefox-install-lang-package: true
99+
enable-managed-downloads: true
94100
- docker-test:
95101
name: "Docker test - Video recording dynamic file name"
96102
test-strategy: test_video_dynamic_name
97103
use-random-user: false
98104
platforms: linux/arm64
99105
machine-type: ubuntu2204arm64
106+
firefox-install-lang-package: true
107+
enable-managed-downloads: true
100108
- docker-test:
101109
name: "Docker test - Video recording standalone"
102110
test-strategy: test_video_standalone
103111
use-random-user: false
104112
platforms: linux/arm64
105113
machine-type: ubuntu2204arm64
114+
firefox-install-lang-package: true
115+
enable-managed-downloads: true
106116
- docker-test:
107117
name: "Docker test - Dynamic Grid"
108118
test-strategy: test_node_docker
109119
use-random-user: false
110120
platforms: linux/arm64
111121
machine-type: ubuntu2204arm64
122+
firefox-install-lang-package: true
123+
enable-managed-downloads: false
112124
- docker-test:
113125
name: "Docker test - Dynamic Grid Standalone"
114126
test-strategy: test_standalone_docker
115127
use-random-user: false
116128
platforms: linux/arm64
117129
machine-type: ubuntu2204arm64
130+
firefox-install-lang-package: true
131+
enable-managed-downloads: true
118132
- docker-test:
119133
name: "Docker test - Parallel execution"
120134
test-strategy: test_parallel
121135
use-random-user: false
122136
platforms: linux/arm64
123137
machine-type: ubuntu2204arm64
138+
firefox-install-lang-package: true
139+
enable-managed-downloads: true
124140
- docker-test:
125141
name: "Docker test - Node relay commands"
126142
test-strategy: test_node_relay
127143
use-random-user: false
128144
platforms: linux/arm64
129145
machine-type: ubuntu2204arm64
146+
firefox-install-lang-package: true
147+
enable-managed-downloads: true
130148

131149
executors:
132150
ubuntu2204arm64:
@@ -149,13 +167,19 @@ jobs:
149167
type: string
150168
use-random-user:
151169
type: boolean
170+
firefox-install-lang-package:
171+
type: boolean
172+
enable-managed-downloads:
173+
type: boolean
152174
executor: << parameters.machine-type >>
153175
environment:
154176
NAMESPACE: selenium
155177
BUILD_DATE: today
156178
PLATFORMS: << parameters.platforms >>
157179
TEST_STRATEGY: << parameters.test-strategy >>
158180
USE_RANDOM_USER: << parameters.use-random-user >>
181+
TEST_FIREFOX_INSTALL_LANG_PACKAGE: << parameters.firefox-install-lang-package >>
182+
SELENIUM_ENABLE_MANAGED_DOWNLOADS: << parameters.enable-managed-downloads >>
159183
steps:
160184
- run:
161185
name: "Prepare workflow environment variables"
@@ -195,7 +219,9 @@ jobs:
195219
command: |
196220
N=3
197221
while [ $N -gt 0 ]; do
198-
output=$(eval "USE_RANDOM_USER_ID=${USE_RANDOM_USER} PLATFORMS=${PLATFORMS} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make ${TEST_STRATEGY}")
222+
output=$(eval "USE_RANDOM_USER_ID=${USE_RANDOM_USER} PLATFORMS=${PLATFORMS} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} \
223+
TEST_FIREFOX_INSTALL_LANG_PACKAGE=${TEST_FIREFOX_INSTALL_LANG_PACKAGE} SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS} \
224+
make ${TEST_STRATEGY}")
199225
status=$?
200226
if [ $status -eq 0 ]; then
201227
echo "Tests passed"

Diff for: Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ test_firefox_download_lang_packs:
629629

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

634634
test_firefox_standalone:
635635
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
@@ -848,7 +848,7 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta
848848
envsubst < $${config_file} > ./videos/config.toml ; \
849849
DOCKER_DEFAULT_PLATFORM=$(PLATFORMS) docker compose -f $${docker_compose_file} up --remove-orphans --no-log-prefix --build --exit-code-from tests ; \
850850
if [ $$? -ne 0 ]; then exit 1; fi ; \
851-
if [ "$$SKIP_CHECK_DOWNLOADS_VOLUME" != "true" ] && [ -d "$$DOWNLOADS_DIR" ] && [ $$(ls -1q $$DOWNLOADS_DIR | wc -l) -eq 0 ]; then \
851+
if [ "$$SKIP_CHECK_DOWNLOADS_VOLUME" != "true" ] && [ "$$SELENIUM_ENABLE_MANAGED_DOWNLOADS" != "true" ] && [ -d "$$DOWNLOADS_DIR" ] && [ $$(ls -1q $$DOWNLOADS_DIR | wc -l) -eq 0 ]; then \
852852
echo "Mounted downloads directory is empty. Downloaded files could not be retrieved!" ; \
853853
exit 1 ; \
854854
fi ; \
@@ -922,7 +922,7 @@ chart_test_autoscaling_deployment_https:
922922
chart_test_autoscaling_deployment:
923923
PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=false \
924924
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 \
925-
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=1 \
925+
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=0 SET_MAX_REPLICAS=3 TEST_DELAY_AFTER_TEST=2 SELENIUM_GRID_MONITORING=false \
926926
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) \
927927
TEMPLATE_OUTPUT_FILENAME="k8s_prefixSelenium_enableTracing_secureServer_externalCerts_nodePort_autoScaling_scaledObject_existingKEDA_subPath.yaml" \
928928
./tests/charts/make/chart_test.sh DeploymentAutoscaling

Diff for: charts/selenium-grid/CONFIGURATION.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# selenium-grid
22

3-
![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)
3+
![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)
44

55
A Helm chart for creating a Selenium Grid Server in Kubernetes
66

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

2626
## Values
2727

@@ -42,7 +42,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
4242
| 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. |
4343
| global.seleniumGrid.structuredLogs | bool | `false` | Whether to enable structured logging |
4444
| global.seleniumGrid.httpLogs | bool | `false` | Enable http logging. Tracing should be enabled to log http logs. |
45-
| global.seleniumGrid.updateStrategy.type | string | `"Recreate"` | Specify update strategy for all components, can be overridden individually |
45+
| global.seleniumGrid.updateStrategy.type | string | `"RollingUpdate"` | Specify update strategy for all components, can be overridden individually |
4646
| global.seleniumGrid.updateStrategy.rollingUpdate | object | `{"maxSurge":1,"maxUnavailable":0}` | Specify for strategy RollingUpdate |
4747
| global.seleniumGrid.affinity | object | `{}` | Specify affinity for all components, can be overridden individually |
4848
| global.seleniumGrid.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for all components, can be overridden individually |

Diff for: charts/selenium-grid/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: selenium-grid
33
description: A Helm chart for creating a Selenium Grid Server in Kubernetes
44
type: application
5-
version: 0.36.2
5+
version: 0.36.3
66
appVersion: 4.25.0-20241010
77
icon: https://github.com/SeleniumHQ/docker-selenium/raw/trunk/logo.png
88
dependencies:
@@ -19,7 +19,7 @@ dependencies:
1919
name: jaeger
2020
condition: tracing.enabled, jaeger.enabled
2121
- repository: https://prometheus-community.github.io/helm-charts
22-
version: 65.1.1
22+
version: 65.2.0
2323
name: kube-prometheus-stack
2424
condition: monitoring.enabled, prometheus-stack.enabled
2525
maintainers:

Diff for: charts/selenium-grid/templates/chrome-node-deployment.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ metadata:
1717
spec:
1818
strategy:
1919
{{- template "seleniumGrid.updateStrategy" (list $.Values.chromeNode $.Values.global.seleniumGrid) }}
20-
{{- if and (not .Values.autoscaling.enabled) (not .Values.autoscaling.enableWithExistingKEDA) }}
20+
{{- if not (eq (include "seleniumGrid.useKEDA" $) "true") }}
2121
replicas: {{ .Values.chromeNode.replicas }}
22-
{{end}}
22+
{{- else }}
23+
replicas: {{ default $.Values.autoscaling.scaledOptions.minReplicaCount ($.Values.chromeNode.scaledOptions).minReplicaCount }}
24+
{{ end }}
2325
revisionHistoryLimit: {{ .Values.global.seleniumGrid.revisionHistoryLimit }}
2426
selector:
2527
matchLabels:

Diff for: charts/selenium-grid/templates/edge-node-deployment.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ metadata:
1717
spec:
1818
strategy:
1919
{{- template "seleniumGrid.updateStrategy" (list $.Values.edgeNode $.Values.global.seleniumGrid) }}
20-
{{- if and (not .Values.autoscaling.enabled) (not .Values.autoscaling.enableWithExistingKEDA) }}
20+
{{- if not (eq (include "seleniumGrid.useKEDA" $) "true") }}
2121
replicas: {{ .Values.edgeNode.replicas }}
22-
{{end}}
22+
{{- else }}
23+
replicas: {{ default $.Values.autoscaling.scaledOptions.minReplicaCount ($.Values.edgeNode.scaledOptions).minReplicaCount }}
24+
{{ end }}
2325
revisionHistoryLimit: {{ .Values.global.seleniumGrid.revisionHistoryLimit }}
2426
selector:
2527
matchLabels:

Diff for: charts/selenium-grid/templates/firefox-node-deployment.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ metadata:
1717
spec:
1818
strategy:
1919
{{- template "seleniumGrid.updateStrategy" (list $.Values.firefoxNode $.Values.global.seleniumGrid) }}
20-
{{- if and (not .Values.autoscaling.enabled) (not .Values.autoscaling.enableWithExistingKEDA) }}
20+
{{- if not (eq (include "seleniumGrid.useKEDA" $) "true") }}
2121
replicas: {{ .Values.firefoxNode.replicas }}
22-
{{end}}
22+
{{- else }}
23+
replicas: {{ default $.Values.autoscaling.scaledOptions.minReplicaCount ($.Values.firefoxNode.scaledOptions).minReplicaCount }}
24+
{{ end }}
2325
revisionHistoryLimit: {{ .Values.global.seleniumGrid.revisionHistoryLimit }}
2426
selector:
2527
matchLabels:

Diff for: charts/selenium-grid/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ global:
3434
httpLogs: false
3535
updateStrategy:
3636
# -- Specify update strategy for all components, can be overridden individually
37-
type: Recreate
37+
type: RollingUpdate
3838
# type: RollingUpdate
3939
# -- Specify for strategy RollingUpdate
4040
rollingUpdate:

Diff for: tests/SeleniumTests/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def test_download_file(self):
9999
driver = self.driver
100100
driver.get('https://the-internet.herokuapp.com/download')
101101
file_name = 'some-file.txt'
102-
is_continue = True
103102
wait = WebDriverWait(driver, 30)
104103
file_link = wait.until(
105104
EC.element_to_be_clickable((By.LINK_TEXT, file_name))

Diff for: tests/charts/make/chart_test.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ on_failure() {
8080
if [ ${RENDER_HELM_TEMPLATE_ONLY} = "true" ]; then
8181
exit $exit_status
8282
fi
83+
kubectl get pods -A
84+
echo "Get all resources in all namespaces"
85+
kubectl get all -A >> tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt
8386
echo "Describe all resources in the ${SELENIUM_NAMESPACE} namespace for debugging purposes"
8487
kubectl describe all -n ${SELENIUM_NAMESPACE} >> tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt
8588
kubectl describe pod -n ${SELENIUM_NAMESPACE} >> tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt
@@ -450,10 +453,4 @@ while true; do
450453
fi
451454
done
452455

453-
echo "Get pods status"
454-
kubectl get pods -n ${SELENIUM_NAMESPACE}
455-
456-
echo "Get all resources in all namespaces"
457-
kubectl get all -A >> tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt
458-
459456
cleanup

Diff for: tests/charts/templates/test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def test_update_strategy_in_all_components(self):
278278
count_rolling += 1
279279
if doc['metadata']['name'] in recreate and doc['kind'] == 'Deployment':
280280
logger.info(f"Assert updateStrategy is set in resource {doc['metadata']['name']}")
281-
self.assertTrue(doc['spec']['strategy']['type'] == 'Recreate', f"Resource {doc['metadata']['name']} doesn't have strategy Recreate")
281+
self.assertTrue(doc['spec']['strategy']['type'] == 'RollingUpdate', f"Resource {doc['metadata']['name']} doesn't have strategy RollingUpdate")
282282
count_recreate += 1
283283
self.assertEqual(count_rolling, len(rolling), "No deployment resources found with strategy RollingUpdate")
284284
self.assertEqual(count_recreate, len(recreate), "No deployment resources found with strategy Recreate")

0 commit comments

Comments
 (0)