From 99604441caeca32d67b02e7ccd9e2328620b849e Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Sat, 12 Oct 2024 09:29:54 +0000 Subject: [PATCH 1/2] chart(update): use podIP in all components server host Signed-off-by: Viet Nguyen Duc --- charts/selenium-grid/templates/_helpers.tpl | 4 ++++ charts/selenium-grid/templates/distributor-deployment.yaml | 4 +++- charts/selenium-grid/templates/event-bus-deployment.yaml | 4 +++- charts/selenium-grid/templates/hub-deployment.yaml | 4 +++- charts/selenium-grid/templates/router-deployment.yaml | 4 +++- charts/selenium-grid/templates/session-map-deployment.yaml | 4 +++- charts/selenium-grid/templates/session-queue-deployment.yaml | 4 +++- 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/charts/selenium-grid/templates/_helpers.tpl b/charts/selenium-grid/templates/_helpers.tpl index f5e2194971..74acebcb15 100644 --- a/charts/selenium-grid/templates/_helpers.tpl +++ b/charts/selenium-grid/templates/_helpers.tpl @@ -349,6 +349,10 @@ template: {{- end }} - name: SE_OTEL_SERVICE_NAME value: {{ .name | quote }} + - name: SE_NODE_HOST + valueFrom: + fieldRef: + fieldPath: status.podIP - name: SE_NODE_PORT value: {{ .node.port | quote }} {{- with .node.startupProbe.timeoutSeconds }} diff --git a/charts/selenium-grid/templates/distributor-deployment.yaml b/charts/selenium-grid/templates/distributor-deployment.yaml index 210f8ab194..5d6111a7d5 100644 --- a/charts/selenium-grid/templates/distributor-deployment.yaml +++ b/charts/selenium-grid/templates/distributor-deployment.yaml @@ -46,7 +46,9 @@ spec: - name: SE_OTEL_SERVICE_NAME value: '{{ template "seleniumGrid.distributor.fullname" . }}' - name: SE_DISTRIBUTOR_HOST - value: '{{ template "seleniumGrid.distributor.fullname" . }}.{{ .Release.Namespace }}' + valueFrom: + fieldRef: + fieldPath: status.podIP - name: SE_DISTRIBUTOR_PORT value: {{ .Values.components.distributor.port | quote }} - name: SE_ROUTER_HOST diff --git a/charts/selenium-grid/templates/event-bus-deployment.yaml b/charts/selenium-grid/templates/event-bus-deployment.yaml index 6ae4a6fba9..30bc6c4b19 100644 --- a/charts/selenium-grid/templates/event-bus-deployment.yaml +++ b/charts/selenium-grid/templates/event-bus-deployment.yaml @@ -50,7 +50,9 @@ spec: - name: SE_OTEL_SERVICE_NAME value: '{{ template "seleniumGrid.eventBus.fullname" . }}' - name: SE_EVENT_BUS_HOST - value: '{{ template "seleniumGrid.eventBus.fullname" . }}.{{ .Release.Namespace }}' + valueFrom: + fieldRef: + fieldPath: status.podIP - name: SE_EVENT_BUS_PORT value: {{ .Values.components.eventBus.port | quote }} {{- with .Values.components.extraEnvironmentVariables }} diff --git a/charts/selenium-grid/templates/hub-deployment.yaml b/charts/selenium-grid/templates/hub-deployment.yaml index 5e5981a4c2..20e3ddc668 100644 --- a/charts/selenium-grid/templates/hub-deployment.yaml +++ b/charts/selenium-grid/templates/hub-deployment.yaml @@ -107,7 +107,9 @@ spec: - name: SE_OTEL_SERVICE_NAME value: '{{ template "seleniumGrid.hub.fullname" . }}' - name: SE_HUB_HOST - value: '{{ template "seleniumGrid.hub.fullname" . }}.{{ .Release.Namespace }}' + valueFrom: + fieldRef: + fieldPath: status.podIP - name: SE_HUB_PORT value: {{ .Values.hub.port | quote }} {{- with .Values.hub.subPath }} diff --git a/charts/selenium-grid/templates/router-deployment.yaml b/charts/selenium-grid/templates/router-deployment.yaml index 5f479d641e..e9f771ce82 100644 --- a/charts/selenium-grid/templates/router-deployment.yaml +++ b/charts/selenium-grid/templates/router-deployment.yaml @@ -44,7 +44,9 @@ spec: - name: SE_OTEL_SERVICE_NAME value: '{{ template "seleniumGrid.router.fullname" . }}' - name: SE_ROUTER_HOST - value: '{{ template "seleniumGrid.router.fullname" . }}.{{ .Release.Namespace }}' + valueFrom: + fieldRef: + fieldPath: status.podIP - name: SE_ROUTER_PORT value: {{ .Values.components.router.port | quote }} - name: SE_DISTRIBUTOR_HOST diff --git a/charts/selenium-grid/templates/session-map-deployment.yaml b/charts/selenium-grid/templates/session-map-deployment.yaml index 043637928a..8e9a4a158f 100644 --- a/charts/selenium-grid/templates/session-map-deployment.yaml +++ b/charts/selenium-grid/templates/session-map-deployment.yaml @@ -44,7 +44,9 @@ spec: - name: SE_OTEL_SERVICE_NAME value: '{{ template "seleniumGrid.sessionMap.fullname" . }}' - name: SE_SESSIONS_HOST - value: '{{ template "seleniumGrid.sessionMap.fullname" . }}.{{ .Release.Namespace }}' + valueFrom: + fieldRef: + fieldPath: status.podIP - name: SE_SESSIONS_PORT value: {{ .Values.components.sessionMap.port | quote }} {{- with .Values.components.extraEnvironmentVariables }} diff --git a/charts/selenium-grid/templates/session-queue-deployment.yaml b/charts/selenium-grid/templates/session-queue-deployment.yaml index 2f454687fe..eba000ee02 100644 --- a/charts/selenium-grid/templates/session-queue-deployment.yaml +++ b/charts/selenium-grid/templates/session-queue-deployment.yaml @@ -43,7 +43,9 @@ spec: - name: SE_OTEL_SERVICE_NAME value: '{{ template "seleniumGrid.sessionQueue.fullname" . }}' - name: SE_SESSION_QUEUE_HOST - value: '{{ template "seleniumGrid.sessionQueue.fullname" . }}.{{ .Release.Namespace }}' + valueFrom: + fieldRef: + fieldPath: status.podIP - name: SE_SESSION_QUEUE_PORT value: {{ .Values.components.sessionQueue.port | quote }} {{- with .Values.components.extraEnvironmentVariables }} From cc2dd6547b2e775d26e5ae04cd662733abbcbc61 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Sat, 12 Oct 2024 09:32:59 +0000 Subject: [PATCH 2/2] chart(update): disable Node service resource creation by default Signed-off-by: Viet Nguyen Duc --- .github/workflows/helm-chart-test.yml | 10 +++++++++- charts/selenium-grid/CONFIGURATION.md | 6 +++--- charts/selenium-grid/values.yaml | 6 +++--- tests/charts/make/chart_cluster_setup.sh | 5 +++++ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/helm-chart-test.yml b/.github/workflows/helm-chart-test.yml index 603579f28b..b1657b1a75 100644 --- a/.github/workflows/helm-chart-test.yml +++ b/.github/workflows/helm-chart-test.yml @@ -40,42 +40,49 @@ jobs: helm-version: 'v3.10.3' docker-version: '24.0.9' test-upgrade: true + service-mesh: true - k8s-version: 'v1.26.15' test-strategy: disabled cluster: 'minikube' helm-version: 'v3.11.3' docker-version: '24.0.9' test-upgrade: true + service-mesh: false - k8s-version: 'v1.27.16' test-strategy: job cluster: 'minikube' helm-version: 'v3.12.3' docker-version: '24.0.9' test-upgrade: true + service-mesh: true - k8s-version: 'v1.28.14' test-strategy: deployment cluster: 'minikube' helm-version: 'v3.13.3' docker-version: '24.0.9' test-upgrade: true + service-mesh: true - k8s-version: 'v1.29.9' test-strategy: job_https cluster: 'minikube' helm-version: 'v3.14.3' docker-version: '25.0.5' test-upgrade: true + service-mesh: false - k8s-version: 'v1.30.5' test-strategy: job_hostname cluster: 'minikube' helm-version: 'v3.15.4' docker-version: '26.1.4' test-upgrade: true + service-mesh: false - k8s-version: 'v1.31.1' test-strategy: deployment_https cluster: 'minikube' helm-version: 'v3.16.1' docker-version: '27.2.0' test-upgrade: true + service-mesh: false env: CLUSTER: ${{ matrix.cluster }} KUBERNETES_VERSION: ${{ matrix.k8s-version }} @@ -83,6 +90,7 @@ jobs: HELM_VERSION: ${{ matrix.helm-version }} DOCKER_VERSION: ${{ matrix.docker-version }} TEST_UPGRADE_CHART: ${{ matrix.test-upgrade }} + SERVICE_MESH: ${{ matrix.service-mesh }} steps: - name: Free Disk Space (Ubuntu) uses: jlumbroso/free-disk-space@main @@ -148,7 +156,7 @@ jobs: with: timeout_minutes: 10 max_attempts: 3 - command: CLUSTER=${CLUSTER} KUBERNETES_VERSION=${KUBERNETES_VERSION} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup + command: CLUSTER=${CLUSTER} SERVICE_MESH=${SERVICE_MESH} KUBERNETES_VERSION=${KUBERNETES_VERSION} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup - name: Test chart template run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_test_template - name: Test set custom CA certificate diff --git a/charts/selenium-grid/CONFIGURATION.md b/charts/selenium-grid/CONFIGURATION.md index 8820f41210..b8e2a234ca 100644 --- a/charts/selenium-grid/CONFIGURATION.md +++ b/charts/selenium-grid/CONFIGURATION.md @@ -371,7 +371,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | chromeNode.hostAliases | string | `nil` | Custom host aliases for chrome nodes | | chromeNode.extraEnvironmentVariables | string | `nil` | Custom environment variables for chrome nodes | | chromeNode.extraEnvFrom | string | `nil` | Custom environment variables by sourcing entire configMap, Secret, etc. for chrome nodes | -| chromeNode.service.enabled | bool | `true` | Create a service for node | +| chromeNode.service.enabled | bool | `false` | Create a service for node | | chromeNode.service.type | string | `"ClusterIP"` | Service type | | chromeNode.service.loadBalancerIP | string | `""` | Set specific loadBalancerIP when serviceType is LoadBalancer (see https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) | | chromeNode.service.ports | string | `nil` | Extra ports exposed in node service | @@ -421,7 +421,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | firefoxNode.hostAliases | string | `nil` | Custom host aliases for firefox nodes | | firefoxNode.extraEnvironmentVariables | string | `nil` | Custom environment variables for firefox nodes | | firefoxNode.extraEnvFrom | string | `nil` | Custom environment variables by sourcing entire configMap, Secret, etc. for firefox nodes | -| firefoxNode.service.enabled | bool | `true` | Create a service for node | +| firefoxNode.service.enabled | bool | `false` | Create a service for node | | firefoxNode.service.type | string | `"ClusterIP"` | Service type | | firefoxNode.service.loadBalancerIP | string | `""` | Set specific loadBalancerIP when serviceType is LoadBalancer (see https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) | | firefoxNode.service.ports | string | `nil` | Extra ports exposed in node service | @@ -471,7 +471,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | edgeNode.hostAliases | string | `nil` | Custom host aliases for edge nodes | | edgeNode.extraEnvironmentVariables | string | `nil` | Custom environment variables for edge nodes | | edgeNode.extraEnvFrom | string | `nil` | Custom environment variables by sourcing entire configMap, Secret, etc. for edge nodes | -| edgeNode.service.enabled | bool | `true` | Create a service for node | +| edgeNode.service.enabled | bool | `false` | Create a service for node | | edgeNode.service.type | string | `"ClusterIP"` | Service type | | edgeNode.service.loadBalancerIP | string | `""` | Set specific loadBalancerIP when serviceType is LoadBalancer (see https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) | | edgeNode.service.ports | string | `nil` | Extra ports exposed in node service | diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index 3316b7ec56..3a97b7a048 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -989,7 +989,7 @@ chromeNode: # Service configuration service: # -- Create a service for node - enabled: true + enabled: false # -- Service type type: ClusterIP # -- Set specific loadBalancerIP when serviceType is LoadBalancer (see https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) @@ -1170,7 +1170,7 @@ firefoxNode: # Service configuration service: # -- Create a service for node - enabled: true + enabled: false # -- Service type type: ClusterIP # -- Set specific loadBalancerIP when serviceType is LoadBalancer (see https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) @@ -1350,7 +1350,7 @@ edgeNode: # Service configuration service: # -- Create a service for node - enabled: true + enabled: false # -- Service type type: ClusterIP # -- Set specific loadBalancerIP when serviceType is LoadBalancer (see https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) diff --git a/tests/charts/make/chart_cluster_setup.sh b/tests/charts/make/chart_cluster_setup.sh index 1d0ffe29e4..4b195180dc 100755 --- a/tests/charts/make/chart_cluster_setup.sh +++ b/tests/charts/make/chart_cluster_setup.sh @@ -18,6 +18,7 @@ SKIP_CLEANUP=${SKIP_CLEANUP:-"false"} # For debugging purposes, retain the clust KUBERNETES_VERSION=${KUBERNETES_VERSION:-$(curl -L -s https://dl.k8s.io/release/stable.txt)} CNI=${CNI:-"calico"} # auto, calico, cilium CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-"docker"} # docker, containerd, cri-o +SERVICE_MESH=${SERVICE_MESH:-"false"} # Function to clean up for retry step on workflow cleanup() { @@ -47,6 +48,10 @@ elif [ "${CLUSTER}" = "minikube" ]; then sudo -SE minikube start --vm-driver=none \ --kubernetes-version=${KUBERNETES_VERSION} --network-plugin=cni --cni=${CNI} --container-runtime=${CONTAINER_RUNTIME} --wait=all sudo chown -R $USER $HOME/.kube $HOME/.minikube + if [ "${SERVICE_MESH}" = "true" ]; then + minikube addons enable istio-provisioner + minikube addons enable istio + fi fi if [ "${CLUSTER}" = "kind" ]; then