Skip to content

Commit

Permalink
Improve Selenium Grid Scaler on base KEDA core 2.15
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Sep 19, 2024
1 parent 09a4951 commit d076823
Show file tree
Hide file tree
Showing 5 changed files with 1,595 additions and 262 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/release-patch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: release-patch
on:
push:
tags:
- 'v*'
jobs:
build:
name: Push Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write # needed for signing the images with GitHub OIDC Token **not production ready**

# keda-tools is built from github.com/test-tools/tools/Dockerfile
container: ghcr.io/kedacore/keda-tools:1.22.5
steps:
- name: Check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 1

- name: Register workspace path
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- id: go-paths
run: |
echo "mod_cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
echo "build_cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT
- name: Go modules cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ steps.go-paths.outputs.mod_cache }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

- name: Go build cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ steps.go-paths.outputs.build_cache }}
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }}

- name: Go modules sync
run: go mod tidy -compat=1.22

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# Username used to log in to a Docker registry. If not set then no login will occur
username: ${{secrets.DOCKER_USERNAME}}
# Password or personal access token used to log in to a Docker registry. If not set then no login will occur
password: ${{secrets.DOCKER_PASSWORD}}
# Server address of Docker registry. If not set then will default to Docker Hub
registry: docker.io

- name: Get the version
id: get_version
run: |
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Release Deployment YAML file
run: IMAGE_REPO=${IMAGE_REPO} IMAGE_REGISTRY=${IMAGE_REGISTRY} make release
env:
IMAGE_REPO: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
IMAGE_REGISTRY: docker.io
VERSION: ${{ steps.get_version.outputs.VERSION }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Publish KEDA images on GitHub Container Registry
run: IMAGE_REPO=${IMAGE_REPO} IMAGE_REGISTRY=${IMAGE_REGISTRY} make publish-multiarch
env:
IMAGE_REPO: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
IMAGE_REGISTRY: docker.io
VERSION: ${{ steps.get_version.outputs.VERSION }}

# https://github.com/sigstore/cosign-installer
- name: Install Cosign
uses: sigstore/cosign-installer@v3

- name: Check Cosign install!
run: cosign version

- name: Sign KEDA images published on GitHub Container Registry
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: IMAGE_REPO=${IMAGE_REPO} IMAGE_REGISTRY=${IMAGE_REGISTRY} make sign-images
env:
IMAGE_REPO: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
IMAGE_REGISTRY: docker.io
VERSION: ${{ steps.get_version.outputs.VERSION }}

- name: Create Release
id: create_release
uses: softprops/action-gh-release@master
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "${{ steps.get_version.outputs.TAG_NAME }}"
name: "${{ steps.get_version.outputs.TAG_NAME }}"
generate_release_notes: true
prerelease: false
draft: false
append_body: false
files: |
keda-${{ steps.get_version.outputs.VERSION }}.yaml
keda-${{ steps.get_version.outputs.VERSION }}-core.yaml
keda-${{ steps.get_version.outputs.VERSION }}-crds.yaml
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ GOBIN=$(shell go env GOBIN)
endif

GO_BUILD_VARS= GO111MODULE=on CGO_ENABLED=$(CGO) GOOS=$(TARGET_OS) GOARCH=$(ARCH)
GO_LDFLAGS="-X=github.com/kedacore/keda/v2/version.GitCommit=$(GIT_COMMIT) -X=github.com/kedacore/keda/v2/version.Version=$(VERSION)"
GO_LDFLAGS="-X=github.com/$(IMAGE_REPO)/keda/v2/version.GitCommit=$(GIT_COMMIT) -X=github.com/$(IMAGE_REPO)/keda/v2/version.Version=$(VERSION)"

COSIGN_FLAGS ?= -y -a GIT_HASH=${GIT_COMMIT} -a GIT_VERSION=${VERSION} -a BUILD_DATE=${DATE}

Expand Down Expand Up @@ -184,7 +184,7 @@ pkg/mock/mock_client/mock_interfaces.go: vendor/sigs.k8s.io/controller-runtime/p
mkdir -p pkg/mock/mock_client
$(MOCKGEN) sigs.k8s.io/controller-runtime/pkg/client Patch,Reader,Writer,StatusClient,StatusWriter,Client,WithWatch,FieldIndexer > $@
pkg/scalers/liiklus/mocks/mock_liiklus.go:
$(MOCKGEN) -destination=$@ github.com/kedacore/keda/v2/pkg/scalers/liiklus LiiklusServiceClient
$(MOCKGEN) -destination=$@ github.com/$(IMAGE_REPO)/keda/v2/pkg/scalers/liiklus LiiklusServiceClient

##################################################
# Build #
Expand Down Expand Up @@ -233,11 +233,11 @@ publish-multiarch: publish-controller-multiarch publish-adapter-multiarch publis

release: manifests kustomize set-version ## Produce new KEDA release in keda-$(VERSION).yaml file.
cd config/manager && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda=${IMAGE_CONTROLLER}
$(KUSTOMIZE) edit set image $(IMAGE_REGISTRY)/$(IMAGE_REPO)/keda=${IMAGE_CONTROLLER}
cd config/metrics-server && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda-metrics-apiserver=${IMAGE_ADAPTER}
$(KUSTOMIZE) edit set image $(IMAGE_REGISTRY)/$(IMAGE_REPO)/keda-metrics-apiserver=${IMAGE_ADAPTER}
cd config/webhooks && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda-admission-webhooks=${IMAGE_WEBHOOKS}
$(KUSTOMIZE) edit set image $(IMAGE_REGISTRY)/$(IMAGE_REPO)/keda-admission-webhooks=${IMAGE_WEBHOOKS}
# Need this workaround to mitigate a problem with inserting labels into selectors,
# until this issue is solved: https://github.com/kubernetes-sigs/kustomize/issues/1009
@sed -i".out" -e 's@version:[ ].*@version: $(VERSION)@g' config/default/kustomize-config/metadataLabelTransformer.yaml
Expand Down Expand Up @@ -271,12 +271,12 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified

deploy: install ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda=${IMAGE_CONTROLLER} && \
$(KUSTOMIZE) edit set image $(IMAGE_REGISTRY)/$(IMAGE_REPO)/keda=${IMAGE_CONTROLLER} && \
if [ "$(AZURE_RUN_WORKLOAD_IDENTITY_TESTS)" = true ]; then \
$(KUSTOMIZE) edit add label --force azure.workload.identity/use:true; \
fi
cd config/metrics-server && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda-metrics-apiserver=${IMAGE_ADAPTER}
$(KUSTOMIZE) edit set image $(IMAGE_REGISTRY)/$(IMAGE_REPO)/keda-metrics-apiserver=${IMAGE_ADAPTER}

if [ "$(AZURE_RUN_WORKLOAD_IDENTITY_TESTS)" = true ]; then \
cd config/service_account && \
Expand All @@ -297,7 +297,7 @@ deploy: install ## Deploy controller to the K8s cluster specified in ~/.kube/con
fi

cd config/webhooks && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda-admission-webhooks=${IMAGE_WEBHOOKS}
$(KUSTOMIZE) edit set image $(IMAGE_REGISTRY)/$(IMAGE_REPO)/keda-admission-webhooks=${IMAGE_WEBHOOKS}

# Need this workaround to mitigate a problem with inserting labels into selectors,
# until this issue is solved: https://github.com/kubernetes-sigs/kustomize/issues/1009
Expand Down
Loading

0 comments on commit d076823

Please sign in to comment.