Skip to content

Commit

Permalink
K8s: Autoscaling using KEDA core 2.16.1
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Dec 25, 2024
1 parent 2112004 commit 4b2f662
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ env:

jobs:
docker-test:
if: !contains(toJson(github.event.commits), '[skip test]')
name: Test Seleium Grid on Docker
uses: ./.github/workflows/docker-test.yml
with:
release: ${{ inputs.release == 'true' }}

helm-chart-test:
if: !contains(toJson(github.event.commits), '[skip test]')
name: Test Selenium Grid on Kubernetes
uses: ./.github/workflows/helm-chart-test.yml
secrets: inherit
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ jobs:
run: |
git config --local user.email "[email protected]"
git config --local user.name "Selenium CI Bot"
git commit -m "Update tag ${RELEASE_TAG} in docs and files" -a
git commit -m "[ci] Update tag ${RELEASE_TAG} in docs and files" -m "[skip test]" -a
env:
RELEASE_TAG: "${{ env.GRID_VERSION }}-${{ env.BUILD_DATE }}"
- name: Push changes
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/helm-chart-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ env:

jobs:
helm-chart-test:
if: github.event.inputs.skip-test != 'true'
if: github.event.inputs.skip-test != 'true' && !contains(toJson(github.event.commits), '[skip test]')
uses: ./.github/workflows/helm-chart-test.yml
with:
release: ${{ github.event.inputs.release == 'true' }}
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
run: |
git config --local user.email "[email protected]"
git config --local user.name "Selenium CI Bot"
git commit -m "Update chart ${LATEST_CHART_VERSION} changelog [skip ci]" -a || true
git commit -m "[ci] Update chart ${LATEST_CHART_VERSION} changelog" -m "[skip ci]" -a || true
- name: Push changes
if: github.event.inputs.skip-commit != 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/k8s-scaling-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ jobs:
git config --local user.email "[email protected]"
git config --local user.name "Selenium CI Bot"
git add .keda/.
git commit -m "[ci] Upload autoscaling in K8s test results [skip ci]" -a
git commit -m "[ci] Upload autoscaling in K8s test results" -m "[skip ci]" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-chart-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: |
git config --local user.email "[email protected]"
git config --local user.name "Selenium CI Bot"
git commit -m "Update chart configuration table" -a
git commit -m "[ci] Update chart configuration table" -m "[skip test]" -a
- name: Push changes
if: env.diff == 'true'
uses: ad-m/github-push-action@master
Expand Down
4 changes: 2 additions & 2 deletions .keda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ You can involve to review and discuss the pull requests to help us early detect

[kedacore/keda](https://github.com/kedacore/keda)

- https://github.com/kedacore/keda/pull/6437
- ~~https://github.com/kedacore/keda/pull/6437 (merged, v2.16.1)~~

- https://github.com/kedacore/keda/pull/6368
- ~~https://github.com/kedacore/keda/pull/6368 (merged, v2.16.1)~~

- ~~https://github.com/kedacore/keda/pull/6169 (merged, v2.16.0)~~

Expand Down
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ CHROMIUM_VERSION := $(or $(CHROMIUM_VERSION),$(CHROMIUM_VERSION),latest)
FIREFOX_DOWNLOAD_URL := $(or $(FIREFOX_DOWNLOAD_URL),$(FIREFOX_DOWNLOAD_URL),https://download-installer.cdn.mozilla.net/pub/firefox/nightly/2024/10/2024-10-28-09-56-35-mozilla-central/firefox-133.0a1.en-US.linux-aarch64.tar.bz2)
SBOM_OUTPUT := $(or $(SBOM_OUTPUT),$(SBOM_OUTPUT),package_versions.txt)
KEDA_TAG_PREV_VERSION := $(or $(KEDA_TAG_PREV_VERSION),$(KEDA_TAG_PREV_VERSION),2.16.0-selenium-grid)
KEDA_TAG_VERSION := $(or $(KEDA_TAG_VERSION),$(KEDA_TAG_VERSION),2.16.0-selenium-grid)
KEDA_CORE_VERSION := $(or $(KEDA_CORE_VERSION),$(KEDA_CORE_VERSION),2.16.1)
KEDA_TAG_VERSION := $(or $(KEDA_TAG_VERSION),$(KEDA_TAG_VERSION),2.16.1-selenium-grid)
KEDA_BASED_NAME := $(or $(KEDA_BASED_NAME),$(KEDA_BASED_NAME),ndviet)
KEDA_BASED_TAG := $(or $(KEDA_BASED_TAG),$(KEDA_BASED_TAG),2.16.0-selenium-grid-20241224)
KEDA_BASED_TAG := $(or $(KEDA_BASED_TAG),$(KEDA_BASED_TAG),2.16.1-selenium-grid-20241224)
TEST_PATCHED_KEDA := $(or $(TEST_PATCHED_KEDA),$(TEST_PATCHED_KEDA),false)

all: hub \
distributor \
Expand Down Expand Up @@ -938,7 +940,7 @@ chart_test_autoscaling_deployment_https:
./tests/charts/make/chart_test.sh DeploymentAutoscaling

chart_test_autoscaling_deployment:
PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=true \
PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) \
SECURE_CONNECTION_SERVER=true SECURE_USE_EXTERNAL_CERT=true SERVICE_TYPE_NODEPORT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -I | cut -d' ' -f1) SELENIUM_GRID_PORT=31444 \
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=1 SET_MAX_REPLICAS=3 TEST_DELAY_AFTER_TEST=2 SELENIUM_GRID_MONITORING=false \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \
Expand All @@ -954,7 +956,7 @@ chart_test_autoscaling_job_https:
./tests/charts/make/chart_test.sh JobAutoscaling

chart_test_autoscaling_job_hostname:
PLATFORMS=$(PLATFORMS) CHART_ENABLE_TRACING=true CHART_ENABLE_BASIC_AUTH=true BASIC_AUTH_EMBEDDED_URL=true TEST_PATCHED_KEDA=true \
PLATFORMS=$(PLATFORMS) CHART_ENABLE_TRACING=true CHART_ENABLE_BASIC_AUTH=true BASIC_AUTH_EMBEDDED_URL=true TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) \
SECURE_INGRESS_ONLY_DEFAULT=true SECURE_USE_EXTERNAL_CERT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -I | cut -d' ' -f1) SELENIUM_GRID_PORT=443 \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \
TEMPLATE_OUTPUT_FILENAME="k8s_enableTracing_basicAuth_secureIngress_externalCerts_ingressPublicIP_autoScaling_originKEDA_scaledJob_subPath.yaml" \
Expand Down Expand Up @@ -992,7 +994,7 @@ test_k8s_autoscaling_job_count_strategy_default_with_node_max_sessions:

test_k8s_autoscaling_job_count_strategy_default:
MATRIX_TESTS=$(or $(MATRIX_TESTS), "AutoscalingTestsScaleUp") SCALING_STRATEGY=$(or $(SCALING_STRATEGY), "default") \
PLATFORMS=$(PLATFORMS) RELEASE_NAME=selenium TEST_PATCHED_KEDA=true SELENIUM_GRID_PROTOCOL=http SELENIUM_GRID_HOST=localhost SELENIUM_GRID_PORT=80 \
PLATFORMS=$(PLATFORMS) RELEASE_NAME=selenium TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) SELENIUM_GRID_PROTOCOL=http SELENIUM_GRID_HOST=localhost SELENIUM_GRID_PORT=80 \
SELENIUM_GRID_MONITORING=false CLEAR_POD_HISTORY=true SET_MAX_REPLICAS=100 ENABLE_VIDEO_RECORDER=false \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \
./tests/charts/make/chart_test.sh JobAutoscaling
Expand All @@ -1007,7 +1009,7 @@ test_k8s_autoscaling_deployment_count_with_node_max_sessions:

test_k8s_autoscaling_deployment_count:
MATRIX_TESTS=$(or $(MATRIX_TESTS), "AutoscalingTestsScaleUp") \
PLATFORMS=$(PLATFORMS) RELEASE_NAME=selenium TEST_PATCHED_KEDA=true SELENIUM_GRID_PROTOCOL=http SELENIUM_GRID_HOST=localhost SELENIUM_GRID_PORT=80 \
PLATFORMS=$(PLATFORMS) RELEASE_NAME=selenium TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) SELENIUM_GRID_PROTOCOL=http SELENIUM_GRID_HOST=localhost SELENIUM_GRID_PORT=80 \
SELENIUM_GRID_MONITORING=false CLEAR_POD_HISTORY=true SET_MAX_REPLICAS=100 ENABLE_VIDEO_RECORDER=false \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \
./tests/charts/make/chart_test.sh DeploymentAutoscaling
Expand Down
7 changes: 3 additions & 4 deletions charts/selenium-grid/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| chromeNode.hpa.browserName | string | `"chrome"` | browserName from the capability |
| chromeNode.hpa.sessionBrowserName | string | `"chrome"` | sessionBrowserName if the browserName is different from the sessionBrowserName |
| chromeNode.hpa.browserVersion | string | `""` | browserVersion from the capability |
| chromeNode.hpa.platformName | string | `"linux"` | platformName from the capability |
| chromeNode.hpa.platformName | string | `"Linux"` | platformName from the capability |
| chromeNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint |
| chromeNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option |
| chromeNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option |
Expand Down Expand Up @@ -459,7 +459,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| firefoxNode.hpa.browserName | string | `"firefox"` | browserName from the capability |
| firefoxNode.hpa.sessionBrowserName | string | `"firefox"` | sessionBrowserName if the browserName is different from the sessionBrowserName |
| firefoxNode.hpa.browserVersion | string | `""` | browserVersion from the capability |
| firefoxNode.hpa.platformName | string | `"linux"` | platformName from the capability |
| firefoxNode.hpa.platformName | string | `"Linux"` | platformName from the capability |
| firefoxNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint |
| firefoxNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option |
| firefoxNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option |
Expand Down Expand Up @@ -511,7 +511,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| edgeNode.hpa.browserName | string | `"MicrosoftEdge"` | browserName from the capability |
| edgeNode.hpa.sessionBrowserName | string | `"msedge"` | sessionBrowserName if the browserName is different from the sessionBrowserName |
| edgeNode.hpa.browserVersion | string | `""` | browserVersion from the capability |
| edgeNode.hpa.platformName | string | `"linux"` | platformName from the capability |
| edgeNode.hpa.platformName | string | `"Linux"` | platformName from the capability |
| edgeNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint |
| edgeNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option |
| edgeNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option |
Expand Down Expand Up @@ -595,7 +595,6 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| videoRecorder.extraVolumes | list | `[]` | Extra volumes for video recorder pod |
| videoRecorder.s3 | object | `{"args":[],"command":[],"extraEnvironmentVariables":null,"imageName":"aws-cli","imagePullPolicy":"IfNotPresent","imageRegistry":"bitnami","imageTag":"latest","securityContext":{"runAsUser":0}}` | Container spec for the uploader if above it is defined as "uploader.name: s3" |
| customLabels | object | `{}` | Custom labels for k8s resources |
| keda.image | object | `{"keda":{"registry":"selenium","repository":"keda","tag":"2.16.0-selenium-grid-20241204"},"metricsApiServer":{"registry":"selenium","repository":"keda-metrics-apiserver","tag":"2.16.0-selenium-grid-20241204"},"webhooks":{"registry":"selenium","repository":"keda-admission-webhooks","tag":"2.16.0-selenium-grid-20241204"}}` | Specify image for KEDA components |
| keda.additionalAnnotations | string | `nil` | Annotations for KEDA resources |
| keda.http.timeout | int | `60000` | |
| keda.webhooks | object | `{"enabled":false}` | Enable KEDA admission webhooks component |
Expand Down
32 changes: 16 additions & 16 deletions charts/selenium-grid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ chromeNode:
# -- browserVersion from the capability
browserVersion: ""
# -- platformName from the capability
platformName: "linux"
platformName: "Linux"
# browserVersion: '91.0' # Optional. Only required when supporting multiple versions of browser in your Selenium Grid.
# -- Skip check SSL when connecting to the Graphql endpoint
unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional
Expand Down Expand Up @@ -1305,7 +1305,7 @@ firefoxNode:
# -- browserVersion from the capability
browserVersion: ""
# -- platformName from the capability
platformName: "linux"
platformName: "Linux"
# -- Skip check SSL when connecting to the Graphql endpoint
unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional

Expand Down Expand Up @@ -1489,7 +1489,7 @@ edgeNode:
# -- browserVersion from the capability
browserVersion: ""
# -- platformName from the capability
platformName: "linux"
platformName: "Linux"
# -- Skip check SSL when connecting to the Graphql endpoint
unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional

Expand Down Expand Up @@ -1826,19 +1826,19 @@ customLabels: {}
keda:
# enabled: false
# -- Specify image for KEDA components
image:
keda:
registry: selenium
repository: keda
tag: "2.16.0-selenium-grid-20241204"
metricsApiServer:
registry: selenium
repository: keda-metrics-apiserver
tag: "2.16.0-selenium-grid-20241204"
webhooks:
registry: selenium
repository: keda-admission-webhooks
tag: "2.16.0-selenium-grid-20241204"
# image:
# keda:
# registry: selenium
# repository: keda
# tag: "2.16.0-selenium-grid-20241204"
# metricsApiServer:
# registry: selenium
# repository: keda-metrics-apiserver
# tag: "2.16.0-selenium-grid-20241204"
# webhooks:
# registry: selenium
# repository: keda-admission-webhooks
# tag: "2.16.0-selenium-grid-20241204"
# -- Annotations for KEDA resources
additionalAnnotations:
http:
Expand Down
14 changes: 10 additions & 4 deletions generate_chart_changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ DEFAULT_TAG="trunk"
SET_TAG=${1:-$(git rev-parse --abbrev-ref HEAD)}

function get_keda_version() {
KEDA_CORE_VERSION=$(grep KEDA_CORE_VERSION Makefile | sed 's/.*,\([^)]*\))/\1/p' | head -n 1)
KEDA_TAG_VERSION=$(grep KEDA_TAG_VERSION Makefile | sed 's/.*,\([^)]*\))/\1/p' | head -n 1)
KEDA_IMAGE_TAG=$(find . \( -type d -name .git -prune \) -o -type f -wholename '*/selenium-grid/values.yaml' -print0 | xargs -0 cat | grep $KEDA_TAG_VERSION | head -n 1 | cut -d ':' -f 2 | tr -d '[:space:]' | tr -d '"')
IS_PATCHED_VERSION=$(grep TEST_PATCHED_KEDA Makefile | sed 's/.*,\([^)]*\))/\1/p' | head -n 1)
}

# Get current chart app version
Expand Down Expand Up @@ -88,10 +90,14 @@ generate_changelog() {
fi

get_keda_version
echo "### Experimental" >>"$temp_file"
echo "- Selenium Grid Scaler implementation preview. [README](https://github.com/seleniumhq/docker-selenium/tree/trunk/.keda/README.md)" >>"$temp_file"
if [ -n "$KEDA_IMAGE_TAG" ]; then
echo "- Chart is tested autoscaling capabilities with KEDA image tag: $KEDA_IMAGE_TAG" >>"$temp_file"
if [ "${IS_PATCHED_VERSION}" == "true" ]; then
echo "### Experimental" >>"$temp_file"
echo "- Selenium Grid Scaler implementation preview. [README](https://github.com/seleniumhq/docker-selenium/tree/trunk/.keda/README.md)" >>"$temp_file"
if [ -n "$KEDA_IMAGE_TAG" ]; then
echo "- Chart is tested autoscaling capabilities with KEDA image tag: $KEDA_IMAGE_TAG" >>"$temp_file"
fi
else
echo "- Chart is tested autoscaling capabilities with KEDA image tag: $KEDA_CORE_VERSION" >>"$temp_file"
fi
echo "" >>"$temp_file"

Expand Down
2 changes: 1 addition & 1 deletion tests/charts/make/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ MAX_SESSIONS_CHROME=${MAX_SESSIONS_CHROME:-${TEST_NODE_MAX_SESSIONS}}
MAX_SESSIONS_FIREFOX=${MAX_SESSIONS_FIREFOX:-${TEST_NODE_MAX_SESSIONS}}
MAX_SESSIONS_EDGE=${MAX_SESSIONS_EDGE:-${TEST_NODE_MAX_SESSIONS}}
TEST_NAME_OVERRIDE=${TEST_NAME_OVERRIDE:-"false"}
TEST_PATCHED_KEDA=${TEST_PATCHED_KEDA:-"true"}
TEST_PATCHED_KEDA=${TEST_PATCHED_KEDA:-"false"}
BASIC_AUTH_EMBEDDED_URL=${BASIC_AUTH_EMBEDDED_URL:-"false"}
SELENIUM_GRID_MONITORING=${SELENIUM_GRID_MONITORING:-"true"}
TEST_EXISTING_PTS=${TEST_EXISTING_PTS:-"false"}
Expand Down

0 comments on commit 4b2f662

Please sign in to comment.