From 0a5c397160b1da70c61e313381ac3a62fa727b6c Mon Sep 17 00:00:00 2001 From: nom3ad <19239479+nom3ad@users.noreply.github.com> Date: Fri, 29 Apr 2022 13:59:43 +0530 Subject: [PATCH] fixes and improvements in helmchart NOTES.txt (#1554) Helm chart NOTES.txt was rendering `seleniumGrid.router` related output when `.Values.isolateComponents` is set to `false`. This PR fixes it and also added notes about accessing selenium withing Kubernetes cluster. [skip ci] --- chart/selenium-grid/templates/NOTES.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/chart/selenium-grid/templates/NOTES.txt b/chart/selenium-grid/templates/NOTES.txt index 57c57379d..55f3c0422 100644 --- a/chart/selenium-grid/templates/NOTES.txt +++ b/chart/selenium-grid/templates/NOTES.txt @@ -1,22 +1,27 @@ Selenium Grid Server deployed succesfully. -1. Get the URL FOR WebDriver tests by running these commands: +{{- $svcName := ternary (include "seleniumGrid.router.fullname" . ) (include "seleniumGrid.hub.fullname" . ) .Values.isolateComponents }} + +1. To access Selenium from outside of Kubernetes, run these commands: {{- $appName := ternary "selenium-router" "selenium-hub" .Values.isolateComponents }} {{- $serviceType := ternary .Values.components.router.serviceType .Values.hub.serviceType .Values.isolateComponents }} {{- $port := ternary .Values.components.router.port .Values.hub.port .Values.isolateComponents }} {{- $localUrl := ternary "http://localhost:PORT" "http://localhost:PORT/wd/hub" .Values.isolateComponents }} {{- if contains "NodePort" $serviceType }} - export NODE_PORT=$(kubectl get -n {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" svc {{ include "seleniumGrid.router.fullname" . }}) + export NODE_PORT=$(kubectl get -n {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" svc {{ $svcName }}) export NODE_IP=$(kubectl get nodes -n {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" $serviceType }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get -n {{ .Release.Namespace }} svc -w {{ include "seleniumGrid.router.fullname" . }}' - export SERVICE_IP=$(kubectl get svc -n {{ .Release.Namespace }} {{ include "seleniumGrid.router.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + You can watch the status of by running 'kubectl get -n {{ .Release.Namespace }} svc -w {{ $svcName }}' + export SERVICE_IP=$(kubectl get svc -n {{ .Release.Namespace }} {{ $svcName }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ $port }} {{- else if contains "ClusterIP" $serviceType }} export POD_NAME=$(kubectl get pods -n {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ $appName }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Point your WebDriver tests to {{ $localUrl | replace "PORT" (toString $port) }}" kubectl -n {{ .Release.Namespace }} port-forward $POD_NAME {{ $port }}:{{ $port }} {{- end }} + +2. Within Kubernetes cluster, you can use following Service endpoint: + http://{{ $svcName }}.{{ .Release.Namespace }}.svc:{{ $port }}