Skip to content

Commit

Permalink
K8s: Remove .svc.cluster.local from component host using service name (
Browse files Browse the repository at this point in the history
…#2591)

Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 authored Jan 17, 2025
1 parent 575723a commit 7cbd637
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions charts/selenium-grid/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ Graphql Url for internal monitoring exporter
{{- end -}}

{{- define "seleniumGrid.url.host" -}}
{{- $host := printf "%s.%s.svc.cluster.local" (include ($.Values.isolateComponents | ternary "seleniumGrid.router.fullname" "seleniumGrid.hub.fullname") $ ) (.Release.Namespace) -}}
{{- $host := printf "%s.%s" (include ($.Values.isolateComponents | ternary "seleniumGrid.router.fullname" "seleniumGrid.hub.fullname") $ ) (.Release.Namespace) -}}
{{- if eq (include "seleniumGrid.ingress.enabled" $) "true" -}}
{{- if and (not .Values.ingress.hostname) .Values.global.K8S_PUBLIC_IP -}}
{{- $host = .Values.global.K8S_PUBLIC_IP -}}
Expand All @@ -721,7 +721,7 @@ Graphql Url for internal monitoring exporter
{{- end -}}

{{- define "seleniumGrid.server.url.host" -}}
{{- $host := printf "%s.%s.svc.cluster.local" (include ($.Values.isolateComponents | ternary "seleniumGrid.router.fullname" "seleniumGrid.hub.fullname") $ ) (.Release.Namespace) -}}
{{- $host := printf "%s.%s" (include ($.Values.isolateComponents | ternary "seleniumGrid.router.fullname" "seleniumGrid.hub.fullname") $ ) (.Release.Namespace) -}}
{{- $host }}
{{- end -}}

Expand Down
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/event-bus-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- $eventBusHost := printf "%s.%s.svc.cluster.local" (ternary (include "seleniumGrid.eventBus.fullname" .) (include "seleniumGrid.hub.fullname" .) .Values.isolateComponents) (.Release.Namespace) -}}
{{- $eventBusHost := printf "%s.%s" (ternary (include "seleniumGrid.eventBus.fullname" .) (include "seleniumGrid.hub.fullname" .) .Values.isolateComponents) (.Release.Namespace) -}}
{{- $eventBusPublishPort := ternary .Values.components.eventBus.publishPort .Values.hub.publishPort .Values.isolateComponents -}}
{{- $eventBusSubscribePort := ternary .Values.components.eventBus.subscribePort .Values.hub.subscribePort .Values.isolateComponents -}}
apiVersion: v1
Expand Down
6 changes: 3 additions & 3 deletions charts/selenium-grid/templates/node-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- $distributorHost := printf "%s.%s.svc.cluster.local" (include "seleniumGrid.distributor.fullname" .) (.Release.Namespace) -}}
{{- $routerHost := printf "%s.%s.svc.cluster.local" (include "seleniumGrid.router.fullname" .) (.Release.Namespace) -}}
{{- $hubHost := printf "%s.%s.svc.cluster.local" (include "seleniumGrid.hub.fullname" .) (.Release.Namespace) -}}
{{- $distributorHost := printf "%s.%s" (include "seleniumGrid.distributor.fullname" .) (.Release.Namespace) -}}
{{- $routerHost := printf "%s.%s" (include "seleniumGrid.router.fullname" .) (.Release.Namespace) -}}
{{- $hubHost := printf "%s.%s" (include "seleniumGrid.hub.fullname" .) (.Release.Namespace) -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
2 changes: 1 addition & 1 deletion tests/charts/templates/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_graphql_url_for_autoscaling_constructed_without_basic_auth_in_url(self)
logger.info(f"Assert graphql url is constructed without basic auth in url")
base64_url = doc['data']['SE_NODE_GRID_GRAPHQL_URL']
decoded_url = base64.b64decode(base64_url).decode('utf-8')
self.assertTrue(decoded_url == f'https://{RELEASE_NAME}selenium-router.default.svc.cluster.local:4444/selenium/graphql', decoded_url)
self.assertTrue(decoded_url == f'https://{RELEASE_NAME}selenium-router.default:4444/selenium/graphql', decoded_url)

def test_distributor_new_session_thread_pool_size(self):
resources_name = [f'{RELEASE_NAME}selenium-distributor']
Expand Down

0 comments on commit 7cbd637

Please sign in to comment.