Skip to content

Commit 4b632a0

Browse files
committed
Merge remote-tracking branch 'origin/trunk' into optimize-recorder
2 parents ee99c61 + 3dddb7d commit 4b632a0

File tree

5 files changed

+33
-15
lines changed

5 files changed

+33
-15
lines changed

charts/selenium-grid/CONFIGURATION.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
7979
| serviceAccount.create | bool | `true` | Create a service account for all components. If using an external service account, set to false and provide its name in `nameOverride` below |
8080
| serviceAccount.nameOverride | string | `nil` | Override to use an external service account |
8181
| serviceAccount.annotations | object | `{}` | Annotations for the service account |
82-
| rbacRole | object | `{"annotations":{},"create":true,"nameOverride":null,"rules":[{"apiGroups":["keda.sh"],"resources":["scaledjobs"],"verbs":["get","list","patch","update","delete"]},{"apiGroups":["keda.sh"],"resources":["scaledobjects"],"verbs":["get","list","patch","update","delete"]},{"apiGroups":["keda.sh"],"resources":["triggerauthentication"],"verbs":["get","list","patch","update","delete"]},{"apiGroups":["autoscaling"],"resources":["horizontalpodautoscalers"],"verbs":["get","list","patch","update","delete"]}]}` | RBAC settings for patching finalizers KEDA scaled resources |
82+
| rbacRole | object | `{"annotations":{},"create":true,"nameOverride":null,"rules":[{"apiGroups":["keda.sh"],"resources":["scaledjobs"],"verbs":["get","list","patch","update","delete"]},{"apiGroups":["keda.sh"],"resources":["scaledobjects"],"verbs":["get","list","patch","update","delete"]},{"apiGroups":["keda.sh"],"resources":["triggerauthentications"],"verbs":["get","list","patch","update","delete"]},{"apiGroups":["autoscaling"],"resources":["horizontalpodautoscalers"],"verbs":["get","list","patch","update","delete"]}]}` | RBAC settings for patching finalizers KEDA scaled resources |
8383
| rbacRole.create | bool | `true` | Enable to create RBAC role to access few KEDA resources. If using an external role, set to false and provide its name in `nameOverride` below |
8484
| rbacRole.nameOverride | string | `nil` | Override resource name or provide an external role name |
8585
| rbacRoleBinding | object | `{"annotations":{},"create":true,"nameOverride":null,"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role"},"subjects":[{"kind":"ServiceAccount"}]}` | RBAC role binding settings for patching finalizers KEDA scaled resources |
@@ -326,7 +326,9 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
326326
| autoscaling.enabled | bool | `false` | Enable autoscaling. Implies installing KEDA |
327327
| autoscaling.enableWithExistingKEDA | bool | `false` | Enable autoscaling without automatically installing KEDA |
328328
| autoscaling.scalingType | string | `"job"` | Which type of KEDA scaling to use: job or deployment |
329-
| autoscaling.authenticationRef | object | `{"annotations":{"helm.sh/hook":"post-install,post-upgrade,post-rollback","helm.sh/hook-weight":"-2"},"name":""}` | Specify an external KEDA TriggerAuthentication resource is used for scaler triggers config. Apply for all browser nodes |
329+
| autoscaling.authenticationRef | object | `{"annotations":{"helm.sh/hook":"post-install,post-upgrade,post-rollback","helm.sh/hook-weight":"0"},"name":""}` | Specify an external KEDA TriggerAuthentication resource is used for scaler triggers config. Apply for all browser nodes |
330+
| autoscaling.useCachedMetrics | bool | `false` | Enables caching of metric values during polling interval (as specified in .spec.pollingInterval). |
331+
| autoscaling.metricType | string | `"Value"` | The type of metric that should be used (Override the default: AverageValue in KEDA) |
330332
| autoscaling.annotations | object | `{"helm.sh/hook":"post-install,post-upgrade,post-rollback","helm.sh/hook-weight":"1"}` | Annotations for KEDA resources: ScaledObject and ScaledJob |
331333
| autoscaling.patchObjectFinalizers.nameOverride | string | `nil` | Override the name of the patch job |
332334
| autoscaling.patchObjectFinalizers.enabled | bool | `true` | Enable patching finalizers for KEDA scaled resources. Workaround for Hook post-upgrade selenium-grid/templates/x-node-hpa.yaml failed: object is being deleted: scaledobjects.keda.sh "x" already exists |
@@ -339,7 +341,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
339341
| autoscaling.scaledOptions.minReplicaCount | int | `0` | Minimum number of replicas |
340342
| autoscaling.scaledOptions.maxReplicaCount | int | `8` | Maximum number of replicas |
341343
| autoscaling.scaledOptions.pollingInterval | int | `10` | Polling interval in seconds |
342-
| autoscaling.scaledJobOptions.scalingStrategy.strategy | string | `"accurate"` | Scaling strategy for KEDA ScaledJob |
344+
| autoscaling.scaledJobOptions.scalingStrategy.strategy | string | `"eager"` | Scaling strategy for KEDA ScaledJob - https://keda.sh/docs/latest/reference/scaledjob-spec/#scalingstrategy |
343345
| autoscaling.scaledJobOptions.successfulJobsHistoryLimit | int | `0` | Number of Completed jobs should be kept |
344346
| autoscaling.scaledJobOptions.failedJobsHistoryLimit | int | `0` | Number of Failed jobs should be kept (for troubleshooting purposes) |
345347
| autoscaling.scaledJobOptions.jobTargetRef | object | `{"backoffLimit":0,"completions":1,"parallelism":1}` | Specify job target ref for KEDA ScaledJob |

charts/selenium-grid/templates/_helpers.tpl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,17 @@ Common autoscaling spec template
240240
triggers:
241241
- type: selenium-grid
242242
metadata:
243+
{{- with .node.hpa }}
244+
{{- tpl (toYaml .) $ | nindent 6 }}
245+
{{- if not .nodeMaxSessions }}
243246
nodeMaxSessions: {{ $nodeMaxSessions | quote }}
244-
{{- with .node.hpa }}
245-
{{- tpl (toYaml .) $ | nindent 6 }}
246-
{{- end }}
247-
{{- if not .node.hpa.authenticationRef }}
247+
{{- end }}
248+
{{- end }}
248249
authenticationRef:
249250
name: {{ template "seleniumGrid.autoscaling.authenticationRef.fullname" $ }}
251+
useCachedMetrics: {{ $.Values.autoscaling.useCachedMetrics }}
252+
{{- if eq $.Values.autoscaling.scalingType "deployment" }}
253+
metricType: {{ $.Values.autoscaling.metricType }}
250254
{{- end }}
251255
{{- end }}
252256
{{- end -}}

charts/selenium-grid/templates/patch-keda/patch-keda-objects-job.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ spec:
3535
- |
3636
echo "Cleaning up ScaledObjects, ScaledJobs and HPAs for {{ .Release.Name }} when upgrading or disabling autoscaling."
3737
kubectl get ScaledObjects,ScaledJobs,TriggerAuthentication -n {{ .Release.Namespace }} -l component.autoscaling={{ .Release.Name }} -o=json | jq '.metadata.finalizers = null' | kubectl apply -f - || true ;
38-
kubectl delete ScaledObjects,ScaledJobs,TriggerAuthentication -n {{ .Release.Namespace }} -l component.autoscaling={{ .Release.Name }} --wait || true ;
39-
kubectl delete hpa -n {{ .Release.Namespace }} -l component.autoscaling={{ .Release.Name }} --wait || true ;
38+
kubectl delete ScaledObjects,ScaledJobs,TriggerAuthentication -n {{ .Release.Namespace }} -l component.autoscaling={{ .Release.Name }} --wait false || true ;
39+
kubectl delete hpa -n {{ .Release.Namespace }} -l component.autoscaling={{ .Release.Name }} --wait false || true ;
4040
{{- with $.Values.autoscaling.patchObjectFinalizers.resources }}
4141
resources: {{ toYaml . | nindent 12 }}
4242
{{- end }}

charts/selenium-grid/values.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ rbacRole:
156156
- apiGroups:
157157
- keda.sh
158158
resources:
159-
- triggerauthentication
159+
- triggerauthentications
160160
verbs: [get, list, patch, update, delete]
161161
- apiGroups:
162162
- autoscaling
@@ -835,10 +835,17 @@ autoscaling:
835835
name: ""
836836
annotations:
837837
"helm.sh/hook": post-install,post-upgrade,post-rollback
838-
"helm.sh/hook-weight": "-2"
838+
# TriggerAuthentication is used by ScaledObject/ScaledJob, hence weight should be less than those hooks
839+
"helm.sh/hook-weight": "0"
840+
# Configuration for ScaledObject triggers https://keda.sh/docs/latest/reference/scaledobject-spec/#triggers
841+
# -- Enables caching of metric values during polling interval (as specified in .spec.pollingInterval).
842+
useCachedMetrics: false
843+
# -- The type of metric that should be used (Override the default: AverageValue in KEDA)
844+
metricType: Value
839845
# -- Annotations for KEDA resources: ScaledObject and ScaledJob
840846
annotations:
841847
"helm.sh/hook": post-install,post-upgrade,post-rollback
848+
# Ensure the weight should be higher than TriggerAuthentication hook
842849
"helm.sh/hook-weight": "1"
843850
patchObjectFinalizers:
844851
# -- Override the name of the patch job
@@ -851,6 +858,7 @@ autoscaling:
851858
annotations:
852859
"helm.sh/hook": post-install,post-upgrade,post-rollback,pre-delete
853860
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
861+
# This should be run before all other hooks (since delete action is called), so use a negative weight
854862
"helm.sh/hook-weight": "-1"
855863
# -- Define an external service account name contains permissions to patch KEDA scaled resources
856864
serviceAccount: ""
@@ -877,9 +885,9 @@ autoscaling:
877885
# Options for KEDA ScaledJobs (only used when scalingType is set to "job"). See https://keda.sh/docs/latest/concepts/scaling-jobs/#scaledjob-spec
878886
scaledJobOptions:
879887
scalingStrategy:
880-
# Offer the strategy default with scaler calculation updated in https://github.com/SeleniumHQ/docker-selenium/tree/trunk/.keda/README.md
881-
# -- Scaling strategy for KEDA ScaledJob
882-
strategy: accurate
888+
# Use `eager` strategy for utilizing all available slots up to the maxReplicaCount, ensuring that waiting request are processed as quickly as possible.
889+
# -- Scaling strategy for KEDA ScaledJob - https://keda.sh/docs/latest/reference/scaledjob-spec/#scalingstrategy
890+
strategy: eager
883891
# -- Number of Completed jobs should be kept
884892
successfulJobsHistoryLimit: 0
885893
# -- Number of Failed jobs should be kept (for troubleshooting purposes)

tests/SmokeTests/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111
SELENIUM_GRID_PORT = os.environ.get('SELENIUM_GRID_PORT', '4444')
1212
SELENIUM_GRID_USERNAME = os.environ.get('SELENIUM_GRID_USERNAME', '')
1313
SELENIUM_GRID_PASSWORD = os.environ.get('SELENIUM_GRID_PASSWORD', '')
14+
CHART_CERT_PATH = os.environ.get('CHART_CERT_PATH', None)
1415
SELENIUM_GRID_AUTOSCALING = os.environ.get('SELENIUM_GRID_AUTOSCALING', 'false')
1516
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA = os.environ.get('SELENIUM_GRID_AUTOSCALING_MIN_REPLICA', 0)
1617
HUB_CHECKS_MAX_ATTEMPTS = os.environ.get('HUB_CHECKS_MAX_ATTEMPTS', 3)
1718
HUB_CHECKS_INTERVAL = os.environ.get('HUB_CHECKS_INTERVAL', 10)
1819

20+
if CHART_CERT_PATH:
21+
os.environ['REQUESTS_CA_BUNDLE'] = CHART_CERT_PATH
22+
1923
class SmokeTests(unittest.TestCase):
2024
def smoke_test_container(self, port):
2125
current_attempts = 0
@@ -53,7 +57,7 @@ def smoke_test_container(self, port):
5357
def client_verify_cert(self, port):
5458
grid_url_status = '%s://%s:%s/status' % (SELENIUM_GRID_PROTOCOL, SELENIUM_GRID_HOST, port)
5559
cert_path = os.environ.get("REQUESTS_CA_BUNDLE")
56-
response = requests.get(grid_url_status, verify=cert_path)
60+
response = requests.get(grid_url_status, verify=cert_path, auth=HTTPBasicAuth(SELENIUM_GRID_USERNAME, SELENIUM_GRID_PASSWORD))
5761

5862
class GridTest(SmokeTests):
5963
def test_grid_is_up(self):

0 commit comments

Comments
 (0)