Skip to content

Commit 33471fe

Browse files
authored
K8s: Deployment scale metricType should be Value instead of AverageValue (#2465)
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent bf73ae9 commit 33471fe

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

Diff for: NodeChromium/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ USER root
99
# Install Chromium
1010
ARG CHROMIUM_VERSION="latest"
1111
ARG CHROMIUM_DEB_SITE="http://deb.debian.org/debian"
12-
RUN echo "deb ${CHROMIUM_DEB_SITE}/ sid main" >> /etc/apt/sources.list \
12+
RUN echo "deb ${CHROMIUM_DEB_SITE}/ stable main" >> /etc/apt/sources.list \
1313
&& wget -qO- https://ftp-master.debian.org/keys/archive-key-12.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/debian-archive-keyring.gpg \
1414
&& wget -qO- https://ftp-master.debian.org/keys/archive-key-12-security.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/debian-archive-security-keyring.gpg \
1515
&& apt-get update -qqy \

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

+2
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
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 |
329329
| 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 |
330+
| autoscaling.useCachedMetrics | bool | `true` | 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 |

Diff for: charts/selenium-grid/templates/_helpers.tpl

+7-5
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,16 @@ 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" $ }}
250-
{{- end }}
251+
useCachedMetrics: {{ $.Values.autoscaling.useCachedMetrics }}
252+
metricType: {{ $.Values.autoscaling.metricType }}
251253
{{- end }}
252254
{{- end -}}
253255

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

+5
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,11 @@ autoscaling:
836836
annotations:
837837
"helm.sh/hook": post-install,post-upgrade,post-rollback
838838
"helm.sh/hook-weight": "-2"
839+
# Configuration for ScaledObject triggers https://keda.sh/docs/latest/reference/scaledobject-spec/#triggers
840+
# -- Enables caching of metric values during polling interval (as specified in .spec.pollingInterval).
841+
useCachedMetrics: true
842+
# -- The type of metric that should be used (Override the default: AverageValue in KEDA)
843+
metricType: Value
839844
# -- Annotations for KEDA resources: ScaledObject and ScaledJob
840845
annotations:
841846
"helm.sh/hook": post-install,post-upgrade,post-rollback

Diff for: tests/SmokeTests/__init__.py

+5-1
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)