Skip to content

Commit d34cc0d

Browse files
authored
K8s: Update strategy as Recreate by default (#2755)
Grid components still not support well for RollingUpdate Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 15eb64a commit d34cc0d

File tree

9 files changed

+102
-38
lines changed

9 files changed

+102
-38
lines changed

Diff for: .github/workflows/helm-chart-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ jobs:
263263
- name: Test chart upgrade
264264
if: (matrix.test-upgrade == true)
265265
run: |
266-
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 }}
266+
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} SET_MAX_REPLICAS=10 TEST_NAME_OVERRIDE=true TEST_UPGRADE_CHART=${TEST_UPGRADE_CHART} SET_UPDATE_STRATEGY=Recreate make chart_test_autoscaling_${{ matrix.test-strategy }}
267267
- name: Cleanup Kubernetes cluster
268268
if: always()
269269
run: CLUSTER=${CLUSTER} make chart_cluster_cleanup

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
4444
| 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. |
4545
| global.seleniumGrid.structuredLogs | bool | `false` | Whether to enable structured logging |
4646
| global.seleniumGrid.httpLogs | bool | `false` | Enable http logging. Tracing should be enabled to log http logs. |
47-
| global.seleniumGrid.updateStrategy.type | string | `"RollingUpdate"` | Specify update strategy for all components, can be overridden individually |
47+
| global.seleniumGrid.updateStrategy.type | string | `"Recreate"` | Specify update strategy for all components, can be overridden individually |
4848
| global.seleniumGrid.updateStrategy.rollingUpdate | object | `{"maxSurge":1,"maxUnavailable":0}` | Specify for strategy RollingUpdate |
4949
| global.seleniumGrid.affinity | object | `{}` | Specify affinity for all components, can be overridden individually |
5050
| global.seleniumGrid.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for all components, can be overridden individually |
@@ -420,7 +420,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
420420
| crossBrowsers.relayNode | list | `[{"nameOverride":null}]` | Additional release nodes, array of objects with the same structure as `relayNode` |
421421
| chromeNode.enabled | bool | `true` | Enable chrome nodes |
422422
| chromeNode.deploymentEnabled | bool | `true` | NOTE: Only used when autoscaling.enabled is false Enable creation of Deployment true (default) - if you want long-living pods false - for provisioning your own custom type such as Jobs |
423-
| chromeNode.updateStrategy | object | `{"type":"RollingUpdate"}` | Global update strategy will be overwritten by individual component |
423+
| chromeNode.updateStrategy | object | `{"type":null}` | Global update strategy will be overwritten by individual component |
424424
| chromeNode.replicas | int | `1` | Number of chrome nodes |
425425
| chromeNode.imageRegistry | string | `nil` | Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter) |
426426
| chromeNode.imageName | string | `"node-chrome"` | Image of chrome nodes |
@@ -478,7 +478,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
478478
| chromeNode.videoRecorder | object | `{}` | Override specific video recording settings for chrome node |
479479
| firefoxNode.enabled | bool | `true` | Enable firefox nodes |
480480
| firefoxNode.deploymentEnabled | bool | `true` | NOTE: Only used when autoscaling.enabled is false Enable creation of Deployment true (default) - if you want long living pods false - for provisioning your own custom type such as Jobs |
481-
| firefoxNode.updateStrategy | object | `{"type":"RollingUpdate"}` | Global update strategy will be overwritten by individual component |
481+
| firefoxNode.updateStrategy | object | `{"type":null}` | Global update strategy will be overwritten by individual component |
482482
| firefoxNode.replicas | int | `1` | Number of firefox nodes |
483483
| firefoxNode.imageRegistry | string | `nil` | Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter) |
484484
| firefoxNode.imageName | string | `"node-firefox"` | Image of firefox nodes |
@@ -536,7 +536,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
536536
| firefoxNode.videoRecorder | object | `{}` | Override specific video recording settings for firefox node |
537537
| edgeNode.enabled | bool | `true` | Enable edge nodes |
538538
| edgeNode.deploymentEnabled | bool | `true` | NOTE: Only used when autoscaling.enabled is false Enable creation of Deployment true (default) - if you want long living pods false - for provisioning your own custom type such as Jobs |
539-
| edgeNode.updateStrategy | object | `{"type":"RollingUpdate"}` | Global update strategy will be overwritten by individual component |
539+
| edgeNode.updateStrategy | object | `{"type":null}` | Global update strategy will be overwritten by individual component |
540540
| edgeNode.replicas | int | `1` | Number of edge nodes |
541541
| edgeNode.imageRegistry | string | `nil` | Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter) |
542542
| edgeNode.imageName | string | `"node-edge"` | Image of edge nodes |
@@ -595,7 +595,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
595595
| relayNode.enabled | bool | `false` | Enable relay nodes |
596596
| relayNode.relayUrl | string | `""` | Specify another Grid, another network, or a cloud vendor that you wish to connect to (e.g. https://ondemand.us-west-1.saucelabs.com/wd/hub) |
597597
| relayNode.deploymentEnabled | bool | `true` | NOTE: Only used when autoscaling.enabled is false Enable creation of Deployment true (default) - if you want long-living pods false - for provisioning your own custom type such as Jobs |
598-
| relayNode.updateStrategy | object | `{"type":"RollingUpdate"}` | Global update strategy will be overwritten by individual component |
598+
| relayNode.updateStrategy | object | `{"type":null}` | Global update strategy will be overwritten by individual component |
599599
| relayNode.replicas | int | `1` | Number of relay nodes |
600600
| relayNode.imageRegistry | string | `nil` | Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter) |
601601
| relayNode.imageName | string | `"node-base"` | Image of relay nodes |

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

+5-5
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: RollingUpdate
37+
type: Recreate
3838
# type: RollingUpdate
3939
# -- Specify for strategy RollingUpdate
4040
rollingUpdate:
@@ -1124,7 +1124,7 @@ chromeNode:
11241124
deploymentEnabled: true
11251125
# -- Global update strategy will be overwritten by individual component
11261126
updateStrategy:
1127-
type: RollingUpdate
1127+
type:
11281128
# -- Number of chrome nodes
11291129
replicas: 1
11301130
# -- Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter)
@@ -1320,7 +1320,7 @@ firefoxNode:
13201320
deploymentEnabled: true
13211321
# -- Global update strategy will be overwritten by individual component
13221322
updateStrategy:
1323-
type: RollingUpdate
1323+
type:
13241324
# -- Number of firefox nodes
13251325
replicas: 1
13261326
# -- Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter)
@@ -1516,7 +1516,7 @@ edgeNode:
15161516
deploymentEnabled: true
15171517
# -- Global update strategy will be overwritten by individual component
15181518
updateStrategy:
1519-
type: RollingUpdate
1519+
type:
15201520
# -- Number of edge nodes
15211521
replicas: 1
15221522
# -- Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter)
@@ -1713,7 +1713,7 @@ relayNode:
17131713
deploymentEnabled: true
17141714
# -- Global update strategy will be overwritten by individual component
17151715
updateStrategy:
1716-
type: RollingUpdate
1716+
type:
17171717
# -- Number of relay nodes
17181718
replicas: 1
17191719
# -- Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter)

Diff for: tests/charts/ci/base-auth-ingress-values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ ingress-nginx:
5555
enabled: true
5656
kind: DaemonSet
5757
service:
58-
type: ClusterIP
58+
type: LoadBalancer

Diff for: tests/charts/ci/base-subPath-values.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ ingress:
1111
name: '{{ ternary (include "seleniumGrid.router.fullname" $ ) (include "seleniumGrid.hub.fullname" $ ) $.Values.isolateComponents }}'
1212
port:
1313
number: 4444
14-
- path: /(/?)(session/.*/element)
15-
pathType: ImplementationSpecific
16-
backend:
17-
service:
18-
name: '{{ ternary (include "seleniumGrid.router.fullname" $ ) (include "seleniumGrid.hub.fullname" $ ) $.Values.isolateComponents }}'
19-
port:
20-
number: 4444
2114

2215
hub:
2316
subPath: *gridAppRoot

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

+6
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ HELM_COMMAND_SET_IMAGES=" \
185185
--set edgeNode.nodeMaxSessions=${MAX_SESSIONS_EDGE} \
186186
"
187187

188+
if [ -n "${SET_UPDATE_STRATEGY}" ]; then
189+
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
190+
--set global.seleniumGrid.updateStrategy.type=${SET_UPDATE_STRATEGY} \
191+
"
192+
fi
193+
188194
if [ -n "${TRACING_EXPORTER_ENDPOINT}" ]; then
189195
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
190196
--set tracing.exporterEndpoint=\\"${TRACING_EXPORTER_ENDPOINT}\\" \

Diff for: tests/charts/refValues/simplex-docker-desktop.yaml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# README: This is a sample values for chart deployment in K8s cluster started by Docker Desktop
2+
# Chart dependency ingress-nginx is installed together by enabling `ingress.enableWithController`
3+
# Chart dependency keda is installed together by enabling `autoscaling.enable`
4+
# Enabled ingress without hostname, set the subPath `/selenium`. NGINX type LoadBalancer to expose access from `http://localhost/selenium`
5+
global:
6+
seleniumGrid:
7+
logLevel: INFO
8+
9+
tls:
10+
ingress:
11+
enabled: true
12+
13+
ingress:
14+
enableWithController: true
15+
annotations:
16+
nginx.ingress.kubernetes.io/use-regex: "true"
17+
nginx.ingress.kubernetes.io/rewrite-target: /$2
18+
nginx.ingress.kubernetes.io/app-root: &gridAppRoot "/selenium"
19+
className: nginx
20+
hostname: ""
21+
paths:
22+
- path: /selenium(/|$)(.*)
23+
pathType: ImplementationSpecific
24+
backend:
25+
service:
26+
name: '{{ ternary (include "seleniumGrid.router.fullname" $ ) (include "seleniumGrid.hub.fullname" $ ) $.Values.isolateComponents }}'
27+
port:
28+
number: 4444
29+
30+
basicAuth:
31+
enabled: false
32+
33+
isolateComponents: true
34+
35+
autoscaling:
36+
enabled: true
37+
scalingType: job
38+
scaledOptions:
39+
minReplicaCount: 0
40+
maxReplicaCount: 8
41+
pollingInterval: 15
42+
scaledJobOptions:
43+
successfulJobsHistoryLimit: 0
44+
failedJobsHistoryLimit: 5
45+
scalingStrategy:
46+
strategy: default
47+
48+
hub:
49+
subPath: *gridAppRoot
50+
serviceType: NodePort
51+
52+
components:
53+
router:
54+
subPath: *gridAppRoot
55+
serviceType: NodePort
56+
57+
chromeNode:
58+
extraEnvironmentVariables: &extraEnvironmentVariablesNodes
59+
- name: SE_VNC_NO_PASSWORD
60+
value: "true"
61+
62+
firefoxNode:
63+
extraEnvironmentVariables: *extraEnvironmentVariablesNodes
64+
65+
edgeNode:
66+
extraEnvironmentVariables: *extraEnvironmentVariablesNodes
67+
68+
videoRecorder:
69+
enabled: true
70+
71+
ingress-nginx:
72+
controller:
73+
hostPort:
74+
enabled: true
75+
kind: DaemonSet
76+
service:
77+
type: LoadBalancer

Diff for: tests/charts/refValues/simplex-minikube.yaml

+3-16
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,12 @@
66
# Components serviceType is set to NodePort to allow access from outside the cluster via K8S_PUBLIC_IP and NodePort http://<K8S_PUBLIC_IP>:30444/selenium
77
# Use this reference values to deploy e.g. `helm upgrade --install test --values tests/charts/refValues/simplex-minikube.yaml docker-selenium/selenium-grid --version <0.26.3_onwards>`
88
global:
9-
K8S_PUBLIC_IP: "10.10.10.10" # Replace with your public IP
109
seleniumGrid:
1110
logLevel: INFO
12-
# imageRegistry: selenium
13-
# imageTag: latest
14-
# nodesImageTag: latest
15-
# videoImageTag: latest
1611

1712
tls:
18-
# enabled: true
1913
ingress:
20-
generateTLS: true
14+
enabled: true
2115

2216
ingress:
2317
enableWithController: true
@@ -42,11 +36,8 @@ basicAuth:
4236
isolateComponents: true
4337

4438
autoscaling:
45-
# enabled: true
46-
enableWithExistingKEDA: true
39+
enabled: true
4740
scalingType: job
48-
annotations:
49-
helm.sh/hook: post-install,post-upgrade,post-rollback
5041
scaledOptions:
5142
minReplicaCount: 0
5243
maxReplicaCount: 8
@@ -68,12 +59,8 @@ components:
6859

6960
chromeNode:
7061
extraEnvironmentVariables: &extraEnvironmentVariablesNodes
71-
- name: SE_NODE_SESSION_TIMEOUT
72-
value: "300"
7362
- name: SE_VNC_NO_PASSWORD
7463
value: "true"
75-
- name: SE_NODE_ENABLE_MANAGED_DOWNLOADS
76-
value: "true"
7764

7865
firefoxNode:
7966
extraEnvironmentVariables: *extraEnvironmentVariablesNodes
@@ -90,4 +77,4 @@ ingress-nginx:
9077
enabled: true
9178
kind: DaemonSet
9279
service:
93-
type: ClusterIP
80+
type: LoadBalancer

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,11 @@ def test_update_strategy_in_all_components(self):
269269
f'{RELEASE_NAME}selenium-event-bus',
270270
f'{RELEASE_NAME}selenium-router',
271271
f'{RELEASE_NAME}selenium-session-map',
272-
f'{RELEASE_NAME}selenium-session-queue',]
273-
rolling = [f'{RELEASE_NAME}selenium-node-chrome',
272+
f'{RELEASE_NAME}selenium-session-queue',
273+
f'{RELEASE_NAME}selenium-node-chrome',
274274
f'{RELEASE_NAME}selenium-node-edge',
275275
f'{RELEASE_NAME}selenium-node-firefox',]
276+
rolling = []
276277
count_recreate = 0
277278
count_rolling = 0
278279
for doc in LIST_OF_DOCUMENTS:
@@ -282,7 +283,7 @@ def test_update_strategy_in_all_components(self):
282283
count_rolling += 1
283284
if doc['metadata']['name'] in recreate and doc['kind'] == 'Deployment':
284285
logger.info(f"Assert updateStrategy is set in resource {doc['metadata']['name']}")
285-
self.assertTrue(doc['spec']['strategy']['type'] == 'RollingUpdate', f"Resource {doc['metadata']['name']} doesn't have strategy RollingUpdate")
286+
self.assertTrue(doc['spec']['strategy']['type'] == 'Recreate', f"Resource {doc['metadata']['name']} doesn't have strategy Recreate")
286287
count_recreate += 1
287288
self.assertEqual(count_rolling, len(rolling), "No deployment resources found with strategy RollingUpdate")
288289
self.assertEqual(count_recreate, len(recreate), "No deployment resources found with strategy Recreate")

0 commit comments

Comments
 (0)