From 1cee1aa73afa21a92b17205b49c4f9b1c4956caa Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Fri, 1 Apr 2022 00:22:06 +0200 Subject: [PATCH 1/7] Add an extra job for smoke test Signed-off-by: Jorge Turrado --- .github/workflows/build_canary.yml | 58 +++++++++++++++++++++++++++++ .github/workflows/build_release.yml | 58 +++++++++++++++++++++++++++++ go.mod | 20 +++++----- go.sum | 39 ++++++++++--------- 4 files changed, 148 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build_canary.yml b/.github/workflows/build_canary.yml index 8b51b972..8b926e95 100644 --- a/.github/workflows/build_canary.yml +++ b/.github/workflows/build_canary.yml @@ -128,3 +128,61 @@ jobs: file: scaler/Dockerfile context: . push: true + + smoke_tests: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + + - name: Helm install + uses: Azure/setup-helm@v1 + + - name: Create k8s v1.23 Kind Cluster + uses: JorTurFer/kind-action@main + with: + node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac + cluster_name: http-add-on-smoke-tests-cluster + + - name: Install KEDA + run: | + helm repo add kedacore https://kedacore.github.io/charts + helm repo update + helm install keda kedacore/keda --namespace keda --create-namespace --wait + + - name: Show Kubernetes resources in keda namespace + run: kubectl get all --namespace keda + + - name: Install Http-add-on + run: | + helm install http-add-on kedacore/keda-add-ons-http --set images.tag=canary --namespace http-add-on --create-namespace --wait + + - name: Show Kubernetes resources in http-add-on namespace + run: kubectl get all --namespace http-add-on + + - name: Create resources + run: | + kubectl create ns app + helm install xkcd ./examples/xkcd --set autoscaling.http.minReplicas=1 -n app --wait + + - name: Show Kubernetes resources in app namespace + run: kubectl get all --namespace app + + - name: Check http-add-on generated ScaledObject + run: | + n=0 + max=5 + until [ "$n" -ge "$max" ] + do + ready=$(kubectl get so xkcd-app -n app -o jsonpath="{.status.conditions[0].status}") + echo "ready: $ready" + if [ $ready == "True" ]; then + break + fi + n=$((n+1)) + sleep 15 + done + + if [ $n -eq $max ]; then + echo "The HPA is not working correctly" + exit 1 + fi diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index a2a6287f..e9cf38c6 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -141,3 +141,61 @@ jobs: file: scaler/Dockerfile context: . push: true + + smoke_tests: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + + - name: Helm install + uses: Azure/setup-helm@v1 + + - name: Create k8s v1.23 Kind Cluster + uses: JorTurFer/kind-action@main + with: + node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac + cluster_name: http-add-on-smoke-tests-cluster + + - name: Install KEDA + run: | + helm repo add kedacore https://kedacore.github.io/charts + helm repo update + helm install keda kedacore/keda --namespace keda --create-namespace --wait + + - name: Show Kubernetes resources in keda namespace + run: kubectl get all --namespace keda + + - name: Install Http-add-on + run: | + helm install http-add-on kedacore/keda-add-ons-http --set images.tag=${{ steps.get_version.outputs.VERSION }} --namespace http-add-on --create-namespace --wait + + - name: Show Kubernetes resources in http-add-on namespace + run: kubectl get all --namespace http-add-on + + - name: Create resources + run: | + kubectl create ns app + helm install xkcd ./examples/xkcd --set autoscaling.http.minReplicas=1 -n app --wait + + - name: Show Kubernetes resources in app namespace + run: kubectl get all --namespace app + + - name: Check http-add-on generated ScaledObject + run: | + n=0 + max=5 + until [ "$n" -ge "$max" ] + do + ready=$(kubectl get so xkcd-app -n app -o jsonpath="{.status.conditions[0].status}") + echo "ready: $ready" + if [ $ready == "True" ]; then + break + fi + n=$((n+1)) + sleep 15 + done + + if [ $n -eq $max ]; then + echo "The HPA is not working correctly" + exit 1 + fi diff --git a/go.mod b/go.mod index adc3f9fd..23735327 100644 --- a/go.mod +++ b/go.mod @@ -3,22 +3,22 @@ module github.com/kedacore/http-add-on go 1.17 require ( - github.com/go-logr/logr v1.2.2 + github.com/go-logr/logr v1.2.3 github.com/go-logr/zapr v1.2.3 github.com/golang/protobuf v1.5.2 github.com/kelseyhightower/envconfig v1.4.0 - github.com/magefile/mage v1.12.1 + github.com/magefile/mage v1.13.0 github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.18.1 + github.com/onsi/gomega v1.19.0 github.com/pkg/errors v0.9.1 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.uber.org/zap v1.21.0 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c google.golang.org/grpc v1.45.0 - google.golang.org/protobuf v1.27.1 - k8s.io/api v0.23.4 - k8s.io/apimachinery v0.23.4 - k8s.io/client-go v0.23.4 + google.golang.org/protobuf v1.28.0 + k8s.io/api v0.23.5 + k8s.io/apimachinery v0.23.5 + k8s.io/client-go v0.23.5 sigs.k8s.io/controller-runtime v0.11.1 ) @@ -49,10 +49,10 @@ require ( github.com/spf13/pflag v1.0.5 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect + golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect diff --git a/go.sum b/go.sum index 7df2a5d7..9177a2ad 100644 --- a/go.sum +++ b/go.sum @@ -153,8 +153,9 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/zapr v1.2.0/go.mod h1:Qa4Bsj2Vb+FAVeAKsLD8RLQ+YRJB8YDmOAKxaBQf7Ro= github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4= @@ -317,8 +318,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/magefile/mage v1.12.1 h1:oGdAbhIUd6iKamKlDGVtU6XGdy5SgNuCWn7gCTgHDtU= -github.com/magefile/mage v1.12.1/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= +github.com/magefile/mage v1.13.0 h1:XtLJl8bcCM7EFoO8FyH8XK3t7G5hQAeK+i4tq+veT9M= +github.com/magefile/mage v1.13.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -366,14 +367,14 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ= -github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/ginkgo/v2 v2.1.3 h1:e/3Cwtogj0HA+25nMP1jCMDIf8RtRYbGwGGuBIFztkc= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= -github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -452,8 +453,9 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -601,8 +603,9 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211209124913-491a49abca63 h1:iocB37TsdFuN6IBRZ+ry36wrkoV51/tl5vOWqkcPGvY= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -698,8 +701,9 @@ golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b h1:9zKuko04nR4gjZ4+DNjHqRlAJqbJETHwiNKDqTfOjfE= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -894,8 +898,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -938,19 +943,19 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.23.0/go.mod h1:8wmDdLBHBNxtOIytwLstXt5E9PddnZb0GaMcqsvDBpg= k8s.io/api v0.23.1/go.mod h1:WfXnOnwSqNtG62Y1CdjoMxh7r7u9QXGCkA1u0na2jgo= -k8s.io/api v0.23.4 h1:85gnfXQOWbJa1SiWGpE9EEtHs0UVvDyIsSMpEtl2D4E= -k8s.io/api v0.23.4/go.mod h1:i77F4JfyNNrhOjZF7OwwNJS5Y1S9dpwvb9iYRYRczfI= +k8s.io/api v0.23.5 h1:zno3LUiMubxD/V1Zw3ijyKO3wxrhbUF1Ck+VjBvfaoA= +k8s.io/api v0.23.5/go.mod h1:Na4XuKng8PXJ2JsploYYrivXrINeTaycCGcYgF91Xm8= k8s.io/apiextensions-apiserver v0.23.0 h1:uii8BYmHYiT2ZTAJxmvc3X8UhNYMxl2A0z0Xq3Pm+WY= k8s.io/apiextensions-apiserver v0.23.0/go.mod h1:xIFAEEDlAZgpVBl/1VSjGDmLoXAWRG40+GsWhKhAxY4= k8s.io/apimachinery v0.23.0/go.mod h1:fFCTTBKvKcwTPFzjlcxp91uPFZr+JA0FubU4fLzzFYc= k8s.io/apimachinery v0.23.1/go.mod h1:SADt2Kl8/sttJ62RRsi9MIV4o8f5S3coArm0Iu3fBno= -k8s.io/apimachinery v0.23.4 h1:fhnuMd/xUL3Cjfl64j5ULKZ1/J9n8NuQEgNL+WXWfdM= -k8s.io/apimachinery v0.23.4/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM= +k8s.io/apimachinery v0.23.5 h1:Va7dwhp8wgkUPWsEXk6XglXWU4IKYLKNlv8VkX7SDM0= +k8s.io/apimachinery v0.23.5/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM= k8s.io/apiserver v0.23.0/go.mod h1:Cec35u/9zAepDPPFyT+UMrgqOCjgJ5qtfVJDxjZYmt4= k8s.io/client-go v0.23.0/go.mod h1:hrDnpnK1mSr65lHHcUuIZIXDgEbzc7/683c6hyG4jTA= k8s.io/client-go v0.23.1/go.mod h1:6QSI8fEuqD4zgFK0xbdwfB/PthBsIxCJMa3s17WlcO0= -k8s.io/client-go v0.23.4 h1:YVWvPeerA2gpUudLelvsolzH7c2sFoXXR5wM/sWqNFU= -k8s.io/client-go v0.23.4/go.mod h1:PKnIL4pqLuvYUK1WU7RLTMYKPiIh7MYShLshtRY9cj0= +k8s.io/client-go v0.23.5 h1:zUXHmEuqx0RY4+CsnkOn5l0GU+skkRXKGJrhmE2SLd8= +k8s.io/client-go v0.23.5/go.mod h1:flkeinTO1CirYgzMPRWxUCnV0G4Fbu2vLhYCObnt/r4= k8s.io/code-generator v0.23.0/go.mod h1:vQvOhDXhuzqiVfM/YHp+dmg10WDZCchJVObc9MvowsE= k8s.io/component-base v0.23.0/go.mod h1:DHH5uiFvLC1edCpvcTDV++NKULdYYU6pR9Tt3HIKMKI= k8s.io/component-base v0.23.1 h1:j/BqdZUWeWKCy2v/jcgnOJAzpRYWSbGcjGVYICko8Uc= From 65022b5ed329737850943aae3750efda46ab3204 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Wed, 13 Apr 2022 00:34:03 +0200 Subject: [PATCH 2/7] Add script to run e2e tests Signed-off-by: Jorge Turrado --- .github/workflows/build_canary.yml | 46 +----------- .github/workflows/build_release.yml | 48 ++----------- tests/e2e-test.sh | 105 ++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 86 deletions(-) create mode 100755 tests/e2e-test.sh diff --git a/.github/workflows/build_canary.yml b/.github/workflows/build_canary.yml index 8b926e95..b1363fae 100644 --- a/.github/workflows/build_canary.yml +++ b/.github/workflows/build_canary.yml @@ -129,7 +129,7 @@ jobs: context: . push: true - smoke_tests: + e2e_tests: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -143,46 +143,6 @@ jobs: node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac cluster_name: http-add-on-smoke-tests-cluster - - name: Install KEDA + - name: Run e2e test run: | - helm repo add kedacore https://kedacore.github.io/charts - helm repo update - helm install keda kedacore/keda --namespace keda --create-namespace --wait - - - name: Show Kubernetes resources in keda namespace - run: kubectl get all --namespace keda - - - name: Install Http-add-on - run: | - helm install http-add-on kedacore/keda-add-ons-http --set images.tag=canary --namespace http-add-on --create-namespace --wait - - - name: Show Kubernetes resources in http-add-on namespace - run: kubectl get all --namespace http-add-on - - - name: Create resources - run: | - kubectl create ns app - helm install xkcd ./examples/xkcd --set autoscaling.http.minReplicas=1 -n app --wait - - - name: Show Kubernetes resources in app namespace - run: kubectl get all --namespace app - - - name: Check http-add-on generated ScaledObject - run: | - n=0 - max=5 - until [ "$n" -ge "$max" ] - do - ready=$(kubectl get so xkcd-app -n app -o jsonpath="{.status.conditions[0].status}") - echo "ready: $ready" - if [ $ready == "True" ]; then - break - fi - n=$((n+1)) - sleep 15 - done - - if [ $n -eq $max ]; then - echo "The HPA is not working correctly" - exit 1 - fi + ./tests/e2e-test.sh \ No newline at end of file diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index e9cf38c6..afb8d6bf 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -142,7 +142,7 @@ jobs: context: . push: true - smoke_tests: + e2e_tests: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -155,47 +155,9 @@ jobs: with: node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac cluster_name: http-add-on-smoke-tests-cluster - - - name: Install KEDA - run: | - helm repo add kedacore https://kedacore.github.io/charts - helm repo update - helm install keda kedacore/keda --namespace keda --create-namespace --wait - - - name: Show Kubernetes resources in keda namespace - run: kubectl get all --namespace keda - - - name: Install Http-add-on - run: | - helm install http-add-on kedacore/keda-add-ons-http --set images.tag=${{ steps.get_version.outputs.VERSION }} --namespace http-add-on --create-namespace --wait - - - name: Show Kubernetes resources in http-add-on namespace - run: kubectl get all --namespace http-add-on - - name: Create resources + - name: Run e2e test run: | - kubectl create ns app - helm install xkcd ./examples/xkcd --set autoscaling.http.minReplicas=1 -n app --wait - - - name: Show Kubernetes resources in app namespace - run: kubectl get all --namespace app - - - name: Check http-add-on generated ScaledObject - run: | - n=0 - max=5 - until [ "$n" -ge "$max" ] - do - ready=$(kubectl get so xkcd-app -n app -o jsonpath="{.status.conditions[0].status}") - echo "ready: $ready" - if [ $ready == "True" ]; then - break - fi - n=$((n+1)) - sleep 15 - done - - if [ $n -eq $max ]; then - echo "The HPA is not working correctly" - exit 1 - fi + ./tests/e2e-test.sh + env: + TAG: ${{ steps.get_version.outputs.VERSION }} diff --git a/tests/e2e-test.sh b/tests/e2e-test.sh new file mode 100755 index 00000000..06c5f2a5 --- /dev/null +++ b/tests/e2e-test.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +TAG=${TAG:-canary} + +# Install KEDA +helm repo add kedacore https://kedacore.github.io/charts +helm repo update +helm upgrade --install keda kedacore/keda --namespace keda --create-namespace --wait + +# Show Kubernetes resources in keda namespace +kubectl get all --namespace keda + +# Install Http-add-on +helm upgrade --install http-add-on kedacore/keda-add-ons-http --set images.tag=$TAG --namespace keda --create-namespace --wait + +# Show Kubernetes resources in http-add-on namespace +kubectl get all --namespace http-add-on + +# Create resources +kubectl create ns app +helm upgrade --install xkcd ./examples/xkcd -n app --wait + +# Show Kubernetes resources in app namespace +kubectl get all --namespace app + +# Check http-add-on generated ScaledObject +n=0 +max=5 +until [ "$n" -ge "$max" ] +do + ready=$(kubectl get so xkcd-app -n app -o jsonpath="{.status.conditions[0].status}") + echo "ready: $ready" + if [ $ready == "True" ]; then + break + fi + n=$((n+1)) + sleep 15 +done +if [ $n -eq $max ]; then + echo "The ScaledObject is not working correctly" + exit 1 +fi +echo "The ScaledObject is working correctly" + +# Check that deployment has 0 instances +n=0 +max=5 +until [ "$n" -ge "$max" ] +do + replicas=$(kubectl get deploy xkcd -n app -o jsonpath="{.spec.replicas}") + echo "replicas: $replicas" + if [ $replicas == "0" ]; then + break + fi + n=$((n+1)) + sleep 15 +done +if [ $n -eq $max ]; then + echo "Current replica count is not 0" + exit 1 +fi +echo "The workflow is scaled to zero" + +# Generate one request + +cat < Date: Wed, 13 Apr 2022 00:36:30 +0200 Subject: [PATCH 3/7] remove whiteline Signed-off-by: Jorge Turrado --- tests/e2e-test.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/e2e-test.sh b/tests/e2e-test.sh index 06c5f2a5..26341846 100755 --- a/tests/e2e-test.sh +++ b/tests/e2e-test.sh @@ -61,8 +61,7 @@ if [ $n -eq $max ]; then fi echo "The workflow is scaled to zero" -# Generate one request - +# Generate one request cat < Date: Wed, 13 Apr 2022 00:39:57 +0200 Subject: [PATCH 4/7] Add dummy integration Signed-off-by: Jorge Turrado --- .github/workflows/dummy.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/dummy.yml diff --git a/.github/workflows/dummy.yml b/.github/workflows/dummy.yml new file mode 100644 index 00000000..1ef42891 --- /dev/null +++ b/.github/workflows/dummy.yml @@ -0,0 +1,25 @@ +name: Check the e2e tests DUMMY + +on: [push, pull_request] + + +jobs: + e2e_tests: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + + - name: Helm install + uses: Azure/setup-helm@v1 + + - name: Create k8s v1.23 Kind Cluster + uses: JorTurFer/kind-action@main + with: + node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac + cluster_name: http-add-on-smoke-tests-cluster + + - name: Run e2e test + run: | + ./tests/e2e-test.sh + env: + TAG: 0.3.0 From 70a60932bcfa0ec4c8165383a0584815e59fbed4 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Wed, 13 Apr 2022 00:43:21 +0200 Subject: [PATCH 5/7] Add fail to check that e2e test work Signed-off-by: Jorge Turrado --- tests/e2e-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e-test.sh b/tests/e2e-test.sh index 26341846..569bf37c 100755 --- a/tests/e2e-test.sh +++ b/tests/e2e-test.sh @@ -88,7 +88,7 @@ until [ "$n" -ge "$max" ] do replicas=$(kubectl get deploy xkcd -n app -o jsonpath="{.spec.replicas}") echo "replicas: $replicas" - if [ $replicas == "1" ]; then + if [ $replicas == "3" ]; then break fi n=$((n+1)) From 5361dbfc7622e3d2ccaff463da2ec0c162f89c36 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Wed, 13 Apr 2022 00:48:06 +0200 Subject: [PATCH 6/7] Undo the dummy changes Signed-off-by: Jorge Turrado --- .github/workflows/dummy.yml | 25 ------------------------- tests/e2e-test.sh | 2 +- 2 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 .github/workflows/dummy.yml diff --git a/.github/workflows/dummy.yml b/.github/workflows/dummy.yml deleted file mode 100644 index 1ef42891..00000000 --- a/.github/workflows/dummy.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Check the e2e tests DUMMY - -on: [push, pull_request] - - -jobs: - e2e_tests: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - - name: Helm install - uses: Azure/setup-helm@v1 - - - name: Create k8s v1.23 Kind Cluster - uses: JorTurFer/kind-action@main - with: - node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac - cluster_name: http-add-on-smoke-tests-cluster - - - name: Run e2e test - run: | - ./tests/e2e-test.sh - env: - TAG: 0.3.0 diff --git a/tests/e2e-test.sh b/tests/e2e-test.sh index 569bf37c..26341846 100755 --- a/tests/e2e-test.sh +++ b/tests/e2e-test.sh @@ -88,7 +88,7 @@ until [ "$n" -ge "$max" ] do replicas=$(kubectl get deploy xkcd -n app -o jsonpath="{.spec.replicas}") echo "replicas: $replicas" - if [ $replicas == "3" ]; then + if [ $replicas == "1" ]; then break fi n=$((n+1)) From 84f37cdf3428aa3a246c875e8e53113978ad8ad8 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Wed, 13 Apr 2022 13:28:28 +0200 Subject: [PATCH 7/7] Update kind task to use the upstream Signed-off-by: Jorge Turrado --- .github/workflows/build_canary.yml | 2 +- .github/workflows/build_release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_canary.yml b/.github/workflows/build_canary.yml index b1363fae..a1ca3246 100644 --- a/.github/workflows/build_canary.yml +++ b/.github/workflows/build_canary.yml @@ -138,7 +138,7 @@ jobs: uses: Azure/setup-helm@v1 - name: Create k8s v1.23 Kind Cluster - uses: JorTurFer/kind-action@main + uses: helm/kind-action@main with: node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac cluster_name: http-add-on-smoke-tests-cluster diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index afb8d6bf..6c0051c6 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -151,7 +151,7 @@ jobs: uses: Azure/setup-helm@v1 - name: Create k8s v1.23 Kind Cluster - uses: JorTurFer/kind-action@main + uses: helm/kind-action@main with: node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac cluster_name: http-add-on-smoke-tests-cluster