Skip to content

Commit

Permalink
test(chart): CI tests run against different Kubernetes version
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Feb 19, 2024
1 parent 74fdf72 commit e6ac29f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 29 deletions.
46 changes: 28 additions & 18 deletions .github/workflows/helm-chart-test.yml
Expand Up @@ -15,9 +15,6 @@ on:
description: 'Test parameter for different request timeout'
required: false
default: '370'
cluster:
description: 'Cluster type to test (kind, minikube)'
required: false
schedule:
- cron: '0 0 * * *'

Expand All @@ -26,18 +23,31 @@ permissions:

jobs:
build-and-test:
name: Build & test
name: Test K8s
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-strategy:
- job
- job_https
- deployment
- deployment_https
include:
- k8s-version: 'v1.25.16'
test-strategy: job
cluster: 'kind'
- k8s-version: 'v1.26.14'
test-strategy: deployment
cluster: 'kind'
- k8s-version: 'v1.27.11'
test-strategy: job_https
cluster: 'kind'
- k8s-version: 'v1.28.7'
test-strategy: job
cluster: 'minikube'
- k8s-version: 'v1.29.2'
test-strategy: deployment_https
cluster: 'minikube'
env:
CLUSTER: ${{ github.event.inputs.cluster || 'minikube' }}
CLUSTER: ${{ matrix.cluster }}
KUBERNETES_VERSION: ${{ matrix.k8s-version }}
ARTIFACT_NAME: ${{ matrix.k8s-version }}-${{ matrix.test-strategy }}
steps:
- uses: actions/checkout@main
- name: Output Docker info
Expand Down Expand Up @@ -74,16 +84,16 @@ jobs:
BUILD_DATE=${BUILD_DATE} make chart_build
echo "CHART_PACKAGE_PATH=$(cat /tmp/selenium_chart_version)" >> $GITHUB_ENV
echo "CHART_FILE_NAME=$(basename $(cat /tmp/selenium_chart_version))" >> $GITHUB_ENV
- name: Test chart template
run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_test_template
- name: Build Docker images
run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
- name: Setup Kubernetes cluster
uses: nick-invision/retry@master
with:
timeout_minutes: 10
max_attempts: 3
command: CLUSTER=${CLUSTER} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup
- name: Build Docker images
run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
command: CLUSTER=${CLUSTER} 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
run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make test_custom_ca_cert
- name: Set test parameters
Expand All @@ -92,7 +102,7 @@ jobs:
echo "AUTOSCALING_POLL_INTERVAL=${AUTOSCALING_POLL_INTERVAL}" >> $GITHUB_ENV
env:
AUTOSCALING_POLL_INTERVAL: ${{ github.event.inputs.request-timeout || '370' }}
- name: Test Selenium Grid on Kubernetes (Autoscaling ${{ matrix.test-strategy }})
- name: Test Selenium Grid on Kubernetes ${{ matrix.k8s-version }} with Autoscaling ${{ matrix.test-strategy }}
uses: nick-invision/retry@master
with:
timeout_minutes: 30
Expand All @@ -106,12 +116,12 @@ jobs:
if: always()
uses: actions/upload-artifact@main
with:
name: ${{ matrix.test-strategy }}_${{ env.CHART_FILE_NAME }}
name: ${{ env.ARTIFACT_NAME }}_${{ env.CHART_FILE_NAME }}
path: ${{ env.CHART_PACKAGE_PATH }}
- name: Upload chart test artifacts
if: always()
uses: actions/upload-artifact@main
with:
name: ${{ matrix.test-strategy }}-artifacts
name: ${{ env.ARTIFACT_NAME }}-artifacts
path: ./tests/tests/
if-no-files-found: ignore
21 changes: 11 additions & 10 deletions charts/selenium-grid/README.md
Expand Up @@ -29,9 +29,11 @@ This chart enables the creation of a Selenium Grid Server in Kubernetes.
* [Configuration of Secure Communication (HTTPS)](#configuration-of-secure-communication-https)
* [Secure Communication](#secure-communication)
* [Node Registration](#node-registration)
* [Configuration of tracing observability](#configuration-of-tracing-observability)
* [Configuration of Selenium Grid chart](#configuration-of-selenium-grid-chart)
* [Configuration of KEDA](#configuration-of-keda)
* [Configuration of Ingress NGINX Controller](#configuration-of-ingress-nginx-controller)
* [Configuration of Jaeger](#configuration-of-jaeger)
* [Configuration for Selenium-Hub](#configuration-for-selenium-hub)
* [Configuration for isolated components](#configuration-for-isolated-components)
<!-- TOC -->
Expand Down Expand Up @@ -204,7 +206,7 @@ helm uninstall selenium-grid

By default, ingress is enabled without annotations set. If NGINX ingress controller is used, you need to set few annotations to override the default timeout values to avoid 504 errors (see [#1808](https://github.com/SeleniumHQ/docker-selenium/issues/1808)). Since in Selenium Grid the default of `SE_NODE_SESSION_TIMEOUT` and `SE_SESSION_REQUEST_TIMEOUT` is `300` seconds.

In order to make user experience better, there are few annotations will be set by default if NGINX ingress controller is used. Mostly relates to timeouts and buffer sizes.
To make the user experience better, there are few annotations will be set by default if NGINX ingress controller is used. Mostly relates to timeouts and buffer sizes.

If you are not using NGINX ingress controller, you can disable these default annotations by setting `ingress.nginx` to `nil` (aka null) via Helm CLI `--set ingress.nginx=null`) or via an override-values.yaml as below:

Expand Down Expand Up @@ -248,7 +250,7 @@ nginx.ingress.kubernetes.io/client-body-buffer-size
nginx.ingress.kubernetes.io/proxy-buffers-number
```

You can generate a dummy self-signed certificate specify for your `hostname`, assign it to spec `ingress.tls` and NGINX ingress controller default certificate (if it is enabled inline). For example:
You can generate a test double self-signed certificate specify for your `hostname`, assign it to spec `ingress.tls` and NGINX ingress controller default certificate (if it is enabled inline). For example:

```yaml
tls:
Expand Down Expand Up @@ -338,7 +340,7 @@ chromeNode:
targetPort: 7900
# NodePort will be assigned randomly if not set
edgeNode:
ports: # You also can give object following manifest of container ports
ports: # You also can give objects following manifest of container ports
- containerPort: 5900
name: vnc
protocol: TCP
Expand Down Expand Up @@ -366,7 +368,7 @@ Other settings of probe support to override under `.startupProbe` `.readinessPro
successThreshold
```

You can easily configure the probes (as Kubernetes [supports](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)) to override the default settings. For example:
You can configure the probes (as Kubernetes [supports](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)) to override the default settings. For example:

```yaml
edgeNode:
Expand Down Expand Up @@ -429,7 +431,7 @@ Files in `.extraScripts` will be mounted to the container with the same name wit

#### Video recorder

The video recorder is a sidecar that is deployed with the browser nodes. It is responsible for recording the video of the browser session. The video recorder is disabled by default. To enable it, you need to set the following values:
The video recorder is a sidecar deployed with the browser nodes. It is responsible for recording the video of the browser session. The video recorder is disabled by default. To enable it, you need to set the following values:

```yaml
videoRecorder:
Expand All @@ -445,7 +447,6 @@ from selenium import webdriver
options = ChromeOptions()
options.set_capability('se:recordVideo', False)
driver = webdriver.Remote(options=options, command_executor="http://localhost:4444")
)
```

In Node will perform query GraphQL in Hub based on Node SessionId and extract the value of `se:recordVideo` in capabilities before deciding to start video recording process or not. You can customize by reading on section [Configuration extra scripts mount to container](#configuration-extra-scripts-mount-to-container).
Expand Down Expand Up @@ -509,9 +510,9 @@ videoRecorder:
RCLONE_CONFIG_MYS3_ENDPOINT: "https://storage.googleapis.com"
```

Those 2 ways are equivalent. You can choose one of them or combine them together. When both config file and ENV vars are set, value in `upload.conf` will take precedence.
Those two ways are equivalent. You can choose one of them or combine them. When both config file and ENV vars are set, value in `upload.conf` will take precedence.

Beside the configuration, the script for entry point of uploader container also needed. You can override the script via `--set-file uploaderConfigMap.extraScripts.upload\.sh=/path/to/your_script.sh` or set via YAML values. For example:
Besides the configuration, the script for entry point of uploader container also needed. You can override the script via `--set-file uploaderConfigMap.extraScripts.upload\.sh=/path/to/your_script.sh` or set via YAML values. For example:

```yaml
uploaderConfigMap:
Expand Down Expand Up @@ -555,7 +556,7 @@ Selenium Grid supports secure communication between components. Refer to the [in

In the chart, there is directory [certs](./certs) contains the default certificate, private key (as PKCS8 format), and Java Keystore (JKS) to teach Java about secure connection (since we are using a non-standard CA) for your trial, local testing purpose. You can generate your own self-signed certificate put them in that default directory by using script [cert.sh](./certs/cert.sh) with adjust needed information. The certificate, private key, truststore are mounted to the components via `Secret`.

There are multiple ways to configure your certificate, private key, truststore to the components. You can choose one of them or combine them together.
There are multiple ways to configure your certificate, private key, truststore to the components. You can choose one of them or combine them.

- Use the default directory [certs](./certs). Rename your own files to be same as the default files and replace them. Give `--set tls.enabled=true` to enable secure communication.

Expand Down Expand Up @@ -608,7 +609,7 @@ ingress-nginx:

#### Node Registration

In order to enable secure in the node registration to make sure that the node is one you control and not a rouge node, you can enable and provide a registration secret string to Distributor, Router and
To enable secure in the node registration to make sure that the node is one you control and not a rouge node, you can enable and provide a registration secret string to Distributor, Router and
Node servers in config `tls.registrationSecret`. For example:

```yaml
Expand Down
2 changes: 1 addition & 1 deletion tests/charts/make/chart_cluster_setup.sh
Expand Up @@ -50,7 +50,7 @@ fi

if [ "${CLUSTER}" = "kind" ]; then
echo "Start Kind cluster"
kind create cluster --wait ${WAIT_TIMEOUT} --name ${CLUSTER_NAME} --config tests/charts/config/kind-cluster.yaml
kind create cluster --image kindest/node:${KUBERNETES_VERSION} --wait ${WAIT_TIMEOUT} --name ${CLUSTER_NAME} --config tests/charts/config/kind-cluster.yaml
elif [ "${CLUSTER}" = "minikube" ]; then
echo "Start Minikube cluster"
sudo chmod 777 /tmp
Expand Down

0 comments on commit e6ac29f

Please sign in to comment.