Skip to content

Commit a43e8cd

Browse files
authored
K8s: Remove triggerMetadata with empty value to prevent Unmatched input property from KEDA checks (#3005)
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
1 parent adbca66 commit a43e8cd

File tree

9 files changed

+18
-13
lines changed

9 files changed

+18
-13
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ chart_test_template:
10811081
./tests/charts/bootstrap.sh
10821082

10831083
chart_render_template:
1084-
RENDER_HELM_TEMPLATE_ONLY=true NAMESPACE=$(NAME) KEDA_TAG_VERSION=$(KEDA_TAG_VERSION) BUILD_DATE=$(BUILD_DATE) make chart_test_autoscaling_disabled chart_test_autoscaling_deployment_https chart_test_autoscaling_deployment chart_test_autoscaling_job_https chart_test_autoscaling_job_hostname chart_test_autoscaling_job chart_test_autoscaling_playwright_connect_grid
1084+
RENDER_HELM_TEMPLATE_ONLY=true NAMESPACE=$(NAME) KEDA_TAG_VERSION=$(KEDA_TAG_VERSION) BUILD_DATE=$(BUILD_DATE) make chart_test_autoscaling_disabled chart_test_autoscaling_deployment_https chart_test_autoscaling_deployment chart_test_autoscaling_job_https chart_test_autoscaling_job_hostname chart_test_autoscaling_job chart_test_autoscaling_playwright_connect_grid chart_test_autoscaling_job_relay
10851085

10861086
chart_test_autoscaling_disabled:
10871087
PLATFORMS=$(PLATFORMS) TEST_CHROMIUM=true RELEASE_NAME=selenium SELENIUM_GRID_AUTOSCALING=false CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) TEST_CUSTOM_SPECIFIC_NAME=true SELENIUM_GRID_MONITORING=false \

charts/selenium-grid/CONFIGURATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
5252
| global.seleniumGrid.nodeMaxSessions | int | `1` | Specify number of max sessions per node. Can be overridden by individual component (this is also set to scaler trigger parameter `nodeMaxSessions` if `autoscaling` is enabled) |
5353
| global.seleniumGrid.nodeDrainAfterSessionCount | int | `0` | Set number of sessions will be executed in a Node before detaching it from Hub and shutting it down |
5454
| global.seleniumGrid.nodeEnableManagedDownloads | bool | `true` | This causes the Node to auto manage files downloaded for a given session on the Node (https://www.selenium.dev/documentation/webdriver/drivers/remote_webdriver/#enable-downloads-in-the-grid) |
55-
| global.seleniumGrid.nodeCustomCapabilities | string | `""` | Setting custom capabilities for matching specific Nodes (https://www.selenium.dev/documentation/grid/configuration/toml_options/#setting-custom-capabilities-for-matching-specific-nodes) |
55+
| global.seleniumGrid.nodeCustomCapabilities | string | `""` | Setting custom capabilities for matching specific Nodes (https://www.selenium.dev/documentation/grid/configuration/toml_options/#setting-custom-capabilities-for-matching-specific-nodes). If set via Helm CLI, consider use `--set-literal` to prevent Helm from interpreting the JSON string |
5656
| global.seleniumGrid.nodeRegisterPeriod | int | `120` | How long, in seconds, will the Node try to register to the Distributor for the first time. After this period is completed, the Node will not attempt to register again. |
5757
| global.seleniumGrid.nodeRegisterCycle | int | `5` | How often, in seconds, the Node will try to register itself for the first time to the Distributor. |
5858
| tls.create | bool | `true` | Create a Secret resource for TLS certificate and key. If using an external secret set to false and provide its name in `nameOverride` below |

charts/selenium-grid/templates/_helpers.tpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,17 @@ triggers:
278278
metadata:
279279
{{- with .node.hpa }}
280280
{{- range $key, $value := . }}
281+
{{- if not (empty $value) }}
281282
{{ $key }}: {{ tpl ($value | toString) $ | quote }}
282283
{{- end }}
284+
{{- end }}
283285
{{- if not .nodeMaxSessions }}
284286
nodeMaxSessions: {{ $nodeMaxSessions | quote }}
285287
{{- end }}
286288
{{- if not .enableManagedDownloads }}
287289
enableManagedDownloads: {{ $nodeEnableManagedDownloads | quote }}
288290
{{- end }}
289-
{{- if not .capabilities }}
291+
{{- if and (not .capabilities) (not (empty $nodeCustomCapabilities)) }}
290292
capabilities: {{ $nodeCustomCapabilities | quote }}
291293
{{- end }}
292294
{{- end }}

charts/selenium-grid/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ global:
5959
nodeDrainAfterSessionCount: 0
6060
# -- This causes the Node to auto manage files downloaded for a given session on the Node (https://www.selenium.dev/documentation/webdriver/drivers/remote_webdriver/#enable-downloads-in-the-grid)
6161
nodeEnableManagedDownloads: true
62-
# -- Setting custom capabilities for matching specific Nodes (https://www.selenium.dev/documentation/grid/configuration/toml_options/#setting-custom-capabilities-for-matching-specific-nodes)
62+
# -- Setting custom capabilities for matching specific Nodes (https://www.selenium.dev/documentation/grid/configuration/toml_options/#setting-custom-capabilities-for-matching-specific-nodes). If set via Helm CLI, consider use `--set-literal` to prevent Helm from interpreting the JSON string
6363
nodeCustomCapabilities: ""
6464
# -- How long, in seconds, will the Node try to register to the Distributor for the first time. After this period is completed, the Node will not attempt to register again.
6565
nodeRegisterPeriod: 120

tests/SeleniumTests/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
LIST_FIREFOX_VERSIONS = ['142.0', '141.0', '140.0', '139.0', '138.0', '137.0', '136.0']
4141
LIST_PLATFORMS = ['Linux', None, 'Windows 11']
4242
TEST_SITE = os.environ.get('TEST_SITE', 'the-internet.herokuapp.com')
43+
RELAY_SELENIUM_VERSION = "4.35.0"
4344

4445
if not TEST_MULTIPLE_VERSIONS_EXPLICIT:
4546
LIST_CHROMIUM_VERSIONS.append(None)
@@ -186,7 +187,7 @@ def setUp(self):
186187
'username': os.environ.get('SAUCE_USERNAME'),
187188
'accessKey': os.environ.get('SAUCE_ACCESS_KEY'),
188189
'name': f"{self._testMethodName} ({self.__class__.__name__})",
189-
'seleniumVersion': '4.29.0',
190+
'seleniumVersion': RELAY_SELENIUM_VERSION,
190191
},
191192
)
192193
start_time = time.time()
@@ -235,7 +236,7 @@ def setUp(self):
235236
'username': os.environ.get('SAUCE_USERNAME'),
236237
'accessKey': os.environ.get('SAUCE_ACCESS_KEY'),
237238
'name': f"{self._testMethodName} ({self.__class__.__name__})",
238-
'seleniumVersion': '4.29.0',
239+
'seleniumVersion': RELAY_SELENIUM_VERSION,
239240
},
240241
)
241242
start_time = time.time()
@@ -289,7 +290,7 @@ def setUp(self):
289290
'username': os.environ.get('SAUCE_USERNAME'),
290291
'accessKey': os.environ.get('SAUCE_ACCESS_KEY'),
291292
'name': f"{self._testMethodName} ({self.__class__.__name__})",
292-
'seleniumVersion': '4.29.0',
293+
'seleniumVersion': RELAY_SELENIUM_VERSION,
293294
},
294295
)
295296
start_time = time.time()

tests/charts/ci/NoAutoscaling-values.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
# Configuration for chrome nodes
33
chromeNode:
44
port: 6666
5+
nodeEnableManagedDownloads: &remoteDownload "${SELENIUM_ENABLE_MANAGED_DOWNLOADS}"
56
extraEnvironmentVariables: &extraEnvironmentVariables
6-
- name: SE_NODE_ENABLE_MANAGED_DOWNLOADS
7-
value: "${SELENIUM_ENABLE_MANAGED_DOWNLOADS}"
87
- name: SE_VNC_NO_PASSWORD
98
value: "true"
109
- name: SE_SCREEN_WIDTH
@@ -30,6 +29,7 @@ chromeNode:
3029
# Configuration for edge nodes
3130
edgeNode:
3231
port: 8888
32+
nodeEnableManagedDownloads: *remoteDownload
3333
extraEnvironmentVariables: *extraEnvironmentVariables
3434
readinessProbe:
3535
enabled: *readinessProbe
@@ -40,6 +40,7 @@ edgeNode:
4040
# Configuration for firefox nodes
4141
firefoxNode:
4242
port: 7777
43+
nodeEnableManagedDownloads: *remoteDownload
4344
extraEnvironmentVariables: *extraEnvironmentVariables
4445
readinessProbe:
4546
enabled: *readinessProbe

tests/charts/make/chart_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fi
207207

208208
if [ "${TEST_CUSTOM_SPECIFIC_NAME}" = "true" ]; then
209209
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
210-
--set global.seleniumGrid.nodeCustomCapabilities={'myApp:version':'beta','myApp:publish':'public'} \
210+
--set-literal global.seleniumGrid.nodeCustomCapabilities={'myApp:version':'beta','myApp:publish':'public'} \
211211
"
212212
fi
213213

tests/charts/refValues/sample-aws.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,19 @@ components:
5353
subPath: *gridAppRoot
5454

5555
chromeNode:
56+
nodeEnableManagedDownloads: &remoteDownload true
5657
extraEnvironmentVariables: &extraEnvironmentVariablesNodes
5758
- name: SE_NODE_SESSION_TIMEOUT
5859
value: "300"
5960
- name: SE_VNC_NO_PASSWORD
6061
value: "true"
61-
- name: SE_NODE_ENABLE_MANAGED_DOWNLOADS
62-
value: "true"
6362

6463
firefoxNode:
64+
nodeEnableManagedDownloads: *remoteDownload
6565
extraEnvironmentVariables: *extraEnvironmentVariablesNodes
6666

6767
edgeNode:
68+
nodeEnableManagedDownloads: *remoteDownload
6869
extraEnvironmentVariables: *extraEnvironmentVariablesNodes
6970

7071
videoRecorder:

tests/charts/templates/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def test_scaler_triggers_parameter_nodeMaxSessions_global_and_individual_value(s
427427
if doc['metadata']['name'] == resource_name and doc['kind'] == 'ScaledObject':
428428
logger.info(f"Assert nodeMaxSessions parameter is set in scaler triggers")
429429
self.assertTrue(
430-
doc['spec']['triggers'][0]['metadata']['nodeMaxSessions']
430+
str(doc['spec']['triggers'][0]['metadata']['nodeMaxSessions'])
431431
== str(resources_name[doc['metadata']['name']])
432432
)
433433
if doc['metadata']['name'] == resource_name and doc['kind'] == 'Deployment':

0 commit comments

Comments
 (0)