Skip to content

Commit 944fec0

Browse files
committed
K8s: Update strategy as Recreate by default
Grid components still not support well for RollingUpdate Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
1 parent 15eb64a commit 944fec0

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

.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

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 |

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)

tests/charts/make/chart_test.sh

+5
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ 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+
fi
192+
188193
if [ -n "${TRACING_EXPORTER_ENDPOINT}" ]; then
189194
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
190195
--set tracing.exporterEndpoint=\\"${TRACING_EXPORTER_ENDPOINT}\\" \

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)