From fe035b96826a1345598dca6edec8d6405f8a6b1b Mon Sep 17 00:00:00 2001 From: similark <85114352+similark@users.noreply.github.com> Date: Mon, 31 Jul 2023 13:55:02 +0300 Subject: [PATCH 1/5] interceptor: don't override Host header (#746) --- CHANGELOG.md | 1 + interceptor/handler/upstream.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6ff3ec44..d99711110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This changelog keeps track of work items that have been completed and are ready - **Operator**: Remove ScaledObject `name` & `app` custom labels ([#717](https://github.com/kedacore/http-add-on/issues/717)) - **Interceptor**: fatal error: concurrent map iteration and map write ([#726](https://github.com/kedacore/http-add-on/issues/726)) - **Interceptor**: Provide graceful shutdown for http servers on SIGINT and SIGTERM ([#731](https://github.com/kedacore/http-add-on/issues/731)) +- **Interceptor**: Keep original Host in the Host header ([#731](https://github.com/kedacore/http-add-on/issues/331)) - **Scaler**: Provide graceful shutdown for grpc server on SIGINT and SIGTERM ([#731](https://github.com/kedacore/http-add-on/issues/731)) ### Deprecations diff --git a/interceptor/handler/upstream.go b/interceptor/handler/upstream.go index c3658c6e8..b1260523b 100644 --- a/interceptor/handler/upstream.go +++ b/interceptor/handler/upstream.go @@ -37,10 +37,11 @@ func (uh *Upstream) ServeHTTP(w http.ResponseWriter, r *http.Request) { } proxy := httputil.NewSingleHostReverseProxy(stream) + superDirector := proxy.Director proxy.Transport = uh.roundTripper proxy.Director = func(req *http.Request) { + superDirector(req) req.URL = stream - req.Host = stream.Host req.URL.Path = r.URL.Path req.URL.RawQuery = r.URL.RawQuery // delete the incoming X-Forwarded-For header so the proxy From 04204c20bd4710238d44ef72612c409254ad553f Mon Sep 17 00:00:00 2001 From: Jorge Turrado Ferrero Date: Tue, 22 Aug 2023 14:10:09 +0200 Subject: [PATCH 2/5] chore: bump deps (#700) --- .devcontainer/Dockerfile | 2 +- .github/workflows/build_canary.yml | 2 +- .github/workflows/build_release.yml | 2 +- .github/workflows/e2e-tests.yaml | 2 +- .github/workflows/images.yaml | 6 +-- .github/workflows/tests.yaml | 4 +- go.mod | 33 +++++++------ go.sum | 64 ++++++++++++------------- interceptor/Dockerfile | 2 +- interceptor/main.go | 5 -- interceptor/middleware/counting_test.go | 4 +- interceptor/proxy_handlers_test.go | 10 ++-- operator/Dockerfile | 2 +- pkg/k8s/scaledobject.go | 4 +- pkg/routing/table_test.go | 8 ++-- pkg/routing/tablememory_test.go | 8 ++-- scaler/Dockerfile | 2 +- scaler/handlers.go | 9 +--- scaler/handlers_test.go | 6 +-- 19 files changed, 82 insertions(+), 93 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7698bc4ed..21bc589a7 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- -FROM golang:1.19.7 +FROM golang:1.20.5 # Avoid warnings by switching to noninteractive ENV DEBIAN_FRONTEND=noninteractive diff --git a/.github/workflows/build_canary.yml b/.github/workflows/build_canary.yml index 1380bcd5f..02c2aaae5 100644 --- a/.github/workflows/build_canary.yml +++ b/.github/workflows/build_canary.yml @@ -8,7 +8,7 @@ on: jobs: build: runs-on: ubuntu-20.04 - container: ghcr.io/kedacore/build-tools:1.19.5 + container: ghcr.io/kedacore/keda-tools:1.20.5 steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index d004f2ecc..58390941e 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -7,7 +7,7 @@ on: jobs: build: runs-on: ubuntu-20.04 - container: ghcr.io/kedacore/build-tools:1.19.5 + container: ghcr.io/kedacore/keda-tools:1.20.5 steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/e2e-tests.yaml b/.github/workflows/e2e-tests.yaml index 7607fec99..2dcb97e03 100644 --- a/.github/workflows/e2e-tests.yaml +++ b/.github/workflows/e2e-tests.yaml @@ -98,7 +98,7 @@ jobs: - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: "1.20" - name: Helm install uses: Azure/setup-helm@v3 diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml index 9971d6100..d57e97e85 100644 --- a/.github/workflows/images.yaml +++ b/.github/workflows/images.yaml @@ -6,7 +6,7 @@ on: jobs: build_scaler: runs-on: ubuntu-latest - container: ghcr.io/kedacore/build-tools:1.19.5 + container: ghcr.io/kedacore/keda-tools:1.20.5 steps: - uses: actions/checkout@v3 - name: Register workspace path @@ -18,7 +18,7 @@ jobs: build_operator: runs-on: ubuntu-latest - container: ghcr.io/kedacore/build-tools:1.19.5 + container: ghcr.io/kedacore/keda-tools:1.20.5 steps: - uses: actions/checkout@v3 - name: Register workspace path @@ -30,7 +30,7 @@ jobs: build_interceptor: runs-on: ubuntu-latest - container: ghcr.io/kedacore/build-tools:1.19.5 + container: ghcr.io/kedacore/keda-tools:1.20.5 steps: - uses: actions/checkout@v3 - name: Register workspace path diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 10ebf702d..05d38e21c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -9,7 +9,7 @@ jobs: validate: name: validate - ${{ matrix.name }} runs-on: ${{ matrix.runner }} - container: ghcr.io/kedacore/build-tools:1.19.5 + container: ghcr.io/kedacore/keda-tools:1.20.5 strategy: matrix: include: @@ -72,7 +72,7 @@ jobs: python-version: 3.x - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: "1.20" - name: Get golangci run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2 - uses: pre-commit/action@v3.0.0 diff --git a/go.mod b/go.mod index 89a726b02..ec9cc95e0 100644 --- a/go.mod +++ b/go.mod @@ -1,28 +1,28 @@ module github.com/kedacore/http-add-on -go 1.19 +go 1.20 require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/zapr v1.2.4 github.com/golang/mock v1.7.0-rc.1.0.20220812172401-5b455625bd2c github.com/hashicorp/go-immutable-radix/v2 v2.0.0 - github.com/kedacore/keda/v2 v2.11.1 + github.com/kedacore/keda/v2 v2.11.2 github.com/kelseyhightower/envconfig v1.4.0 github.com/onsi/ginkgo/v2 v2.11.0 - github.com/onsi/gomega v1.27.8 + github.com/onsi/gomega v1.27.10 github.com/stretchr/testify v1.8.4 github.com/tj/assert v0.0.3 - go.uber.org/zap v1.24.0 + go.uber.org/zap v1.25.0 golang.org/x/sync v0.3.0 - google.golang.org/grpc v1.56.1 - google.golang.org/protobuf v1.30.0 - k8s.io/api v0.27.3 - k8s.io/apimachinery v0.27.3 - k8s.io/client-go v0.27.3 - k8s.io/code-generator v0.27.3 - k8s.io/utils v0.0.0-20230505201702-9f6742963106 - sigs.k8s.io/controller-runtime v0.15.0 + google.golang.org/grpc v1.57.0 + google.golang.org/protobuf v1.31.0 + k8s.io/api v0.27.4 + k8s.io/apimachinery v0.27.4 + k8s.io/client-go v0.27.4 + k8s.io/code-generator v0.27.4 + k8s.io/utils v0.0.0-20230726121419-3b25d923346b + sigs.k8s.io/controller-runtime v0.15.1 ) require ( @@ -62,14 +62,13 @@ require ( github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect github.com/spf13/pflag v1.0.5 // indirect - go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.10.0 // indirect golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.11.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/oauth2 v0.9.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/term v0.9.0 // indirect - golang.org/x/text v0.10.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/term v0.10.0 // indirect + golang.org/x/text v0.11.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.9.3 // indirect gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect diff --git a/go.sum b/go.sum index cb551af07..24c6bc2bc 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= @@ -109,8 +109,8 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kedacore/keda/v2 v2.11.1 h1:fDcXb/4LIOaKJwY7lExQ2x+EPgDtkboPRzSdTD98Bm8= -github.com/kedacore/keda/v2 v2.11.1/go.mod h1:eutYX+QXTi3QH90F7JvY3tYtV5Jq10o5f56Chk5IVF8= +github.com/kedacore/keda/v2 v2.11.2 h1:UgPww0NREqUkM1PGERUz+eb5PlO5oU8V/sT9Hh+ZD60= +github.com/kedacore/keda/v2 v2.11.2/go.mod h1:eutYX+QXTi3QH90F7JvY3tYtV5Jq10o5f56Chk5IVF8= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -138,8 +138,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= -github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= -github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -155,7 +155,7 @@ github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -184,14 +184,14 @@ github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= +go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -221,8 +221,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= @@ -247,19 +247,19 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= -golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= +golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -299,8 +299,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -313,8 +313,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba 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/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 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= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -334,16 +334,16 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.27.3 h1:yR6oQXXnUEBWEWcvPWS0jQL575KoAboQPfJAuKNrw5Y= -k8s.io/api v0.27.3/go.mod h1:C4BNvZnQOF7JA/0Xed2S+aUyJSfTGkGFxLXz9MnpIpg= +k8s.io/api v0.27.4 h1:0pCo/AN9hONazBKlNUdhQymmnfLRbSZjd5H5H3f0bSs= +k8s.io/api v0.27.4/go.mod h1:O3smaaX15NfxjzILfiln1D8Z3+gEYpjEpiNA/1EVK1Y= k8s.io/apiextensions-apiserver v0.27.2 h1:iwhyoeS4xj9Y7v8YExhUwbVuBhMr3Q4bd/laClBV6Bo= k8s.io/apiextensions-apiserver v0.27.2/go.mod h1:Oz9UdvGguL3ULgRdY9QMUzL2RZImotgxvGjdWRq6ZXQ= -k8s.io/apimachinery v0.27.3 h1:Ubye8oBufD04l9QnNtW05idcOe9Z3GQN8+7PqmuVcUM= -k8s.io/apimachinery v0.27.3/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= -k8s.io/client-go v0.27.3 h1:7dnEGHZEJld3lYwxvLl7WoehK6lAq7GvgjxpA3nv1E8= -k8s.io/client-go v0.27.3/go.mod h1:2MBEKuTo6V1lbKy3z1euEGnhPfGZLKTS9tiJ2xodM48= -k8s.io/code-generator v0.27.3 h1:JRhRQkzKdQhHmv9s5f7vuqveL8qukAQ2IqaHm6MFspM= -k8s.io/code-generator v0.27.3/go.mod h1:DPung1sI5vBgn4AGKtlPRQAyagj/ir/4jI55ipZHVww= +k8s.io/apimachinery v0.27.4 h1:CdxflD4AF61yewuid0fLl6bM4a3q04jWel0IlP+aYjs= +k8s.io/apimachinery v0.27.4/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/client-go v0.27.4 h1:vj2YTtSJ6J4KxaC88P4pMPEQECWMY8gqPqsTgUKzvjk= +k8s.io/client-go v0.27.4/go.mod h1:ragcly7lUlN0SRPk5/ZkGnDjPknzb37TICq07WhI6Xc= +k8s.io/code-generator v0.27.4 h1:bw2xFEBnthhCSC7Bt6FFHhPTfWX21IJ30GXxOzywsFE= +k8s.io/code-generator v0.27.4/go.mod h1:DPung1sI5vBgn4AGKtlPRQAyagj/ir/4jI55ipZHVww= k8s.io/component-base v0.27.2 h1:neju+7s/r5O4x4/txeUONNTS9r1HsPbyoPBAtHsDCpo= k8s.io/component-base v0.27.2/go.mod h1:5UPk7EjfgrfgRIuDBFtsEFAe4DAvP3U+M8RTzoSJkpo= k8s.io/gengo v0.0.0-20230306165830-ab3349d207d4 h1:aClvVG6GbX10ISHcc24J+tqbr0S7fEe1MWkFJ7cWWCI= @@ -353,12 +353,12 @@ k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= -k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU= -k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= knative.dev/pkg v0.0.0-20230616134650-eb63a40adfb0 h1:weQWWxEEbNOPuL4qtGiBZuMSFhcjF/Cu163uktd/xFE= knative.dev/pkg v0.0.0-20230616134650-eb63a40adfb0/go.mod h1:dqC6IrvyBE7E+oZocs5PkVhq1G59pDTA7r8U17EAKMk= -sigs.k8s.io/controller-runtime v0.15.0 h1:ML+5Adt3qZnMSYxZ7gAverBLNPSMQEibtzAgp0UPojU= -sigs.k8s.io/controller-runtime v0.15.0/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= +sigs.k8s.io/controller-runtime v0.15.1 h1:9UvgKD4ZJGcj24vefUFgZFP3xej/3igL9BsOUTb/+4c= +sigs.k8s.io/controller-runtime v0.15.1/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= diff --git a/interceptor/Dockerfile b/interceptor/Dockerfile index 89bcd5a8d..0e2356b6e 100644 --- a/interceptor/Dockerfile +++ b/interceptor/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM} ghcr.io/kedacore/build-tools:1.20.4 as builder +FROM --platform=${BUILDPLATFORM} ghcr.io/kedacore/keda-tools:1.20.5 as builder WORKDIR /workspace COPY go.* . RUN go mod download diff --git a/interceptor/main.go b/interceptor/main.go index 685174c5c..c5c08876b 100644 --- a/interceptor/main.go +++ b/interceptor/main.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "math/rand" "net/http" "os" "time" @@ -29,10 +28,6 @@ import ( "github.com/kedacore/http-add-on/pkg/util" ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - // +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch // +kubebuilder:rbac:groups=http.keda.sh,resources=httpscaledobjects,verbs=get;list;watch diff --git a/interceptor/middleware/counting_test.go b/interceptor/middleware/counting_test.go index 577a7370a..7f15b40cf 100644 --- a/interceptor/middleware/counting_test.go +++ b/interceptor/middleware/counting_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" httpv1alpha1 "github.com/kedacore/http-add-on/operator/apis/http/v1alpha1" "github.com/kedacore/http-add-on/pkg/k8s" @@ -38,7 +38,7 @@ func TestCountMiddleware(t *testing.T) { Service: ":", Port: 8080, }, - TargetPendingRequests: pointer.Int32(123), + TargetPendingRequests: ptr.To[int32](123), }, } namespacedName := k8s.NamespacedNameFromObject(httpso).String() diff --git a/interceptor/proxy_handlers_test.go b/interceptor/proxy_handlers_test.go index a303612dd..6bbfa21fe 100644 --- a/interceptor/proxy_handlers_test.go +++ b/interceptor/proxy_handlers_test.go @@ -15,7 +15,7 @@ import ( "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" "github.com/kedacore/http-add-on/interceptor/config" httpv1alpha1 "github.com/kedacore/http-add-on/operator/apis/http/v1alpha1" @@ -113,7 +113,7 @@ func TestWaitFailedConnection(t *testing.T) { Service: "nosuchdepl", Port: 8081, }, - TargetPendingRequests: pointer.Int32(1234), + TargetPendingRequests: ptr.To[int32](1234), }, }) req = util.RequestWithStream(req, stream) @@ -163,7 +163,7 @@ func TestTimesOutOnWaitFunc(t *testing.T) { Service: "nosuchsvc", Port: 9091, }, - TargetPendingRequests: pointer.Int32(1234), + TargetPendingRequests: ptr.To[int32](1234), }, }) req = util.RequestWithStream(req, stream) @@ -311,7 +311,7 @@ func TestWaitHeaderTimeout(t *testing.T) { Service: "testsvc", Port: 9094, }, - TargetPendingRequests: pointer.Int32(1234), + TargetPendingRequests: ptr.To[int32](1234), }, }) req = util.RequestWithStream(req, originURL) @@ -377,7 +377,7 @@ func targetFromURL( Service: ":" + host, Port: int32(port), }, - TargetPendingRequests: pointer.Int32(123), + TargetPendingRequests: ptr.To[int32](123), }, } } diff --git a/operator/Dockerfile b/operator/Dockerfile index 28474939f..bdbc840b4 100644 --- a/operator/Dockerfile +++ b/operator/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM} ghcr.io/kedacore/build-tools:1.20.4 as builder +FROM --platform=${BUILDPLATFORM} ghcr.io/kedacore/keda-tools:1.20.5 as builder WORKDIR /workspace COPY go.* . RUN go mod download diff --git a/pkg/k8s/scaledobject.go b/pkg/k8s/scaledobject.go index 7a776d9cf..9ba5aefc4 100644 --- a/pkg/k8s/scaledobject.go +++ b/pkg/k8s/scaledobject.go @@ -6,7 +6,7 @@ import ( kedav1alpha1 "github.com/kedacore/keda/v2/apis/keda/v1alpha1" appsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ) const ( @@ -45,7 +45,7 @@ func NewScaledObject( Kind: ObjectKind(&appsv1.Deployment{}), Name: deploymentName, }, - PollingInterval: pointer.Int32(soPollingInterval), + PollingInterval: ptr.To[int32](soPollingInterval), CooldownPeriod: cooldownPeriod, MinReplicaCount: minReplicas, MaxReplicaCount: maxReplicas, diff --git a/pkg/routing/table_test.go b/pkg/routing/table_test.go index 835e48df6..fe36aa739 100644 --- a/pkg/routing/table_test.go +++ b/pkg/routing/table_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/watch" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" httpv1alpha1 "github.com/kedacore/http-add-on/operator/apis/http/v1alpha1" clientsetmock "github.com/kedacore/http-add-on/operator/generated/clientset/versioned/mock" @@ -53,7 +53,7 @@ var _ = Describe("Table", func() { Hosts: []string{ "kubernetes.io", }, - TargetPendingRequests: pointer.Int32(1), + TargetPendingRequests: ptr.To[int32](1), }, }, { @@ -66,7 +66,7 @@ var _ = Describe("Table", func() { "github.com", }, Replicas: &httpv1alpha1.ReplicaStruct{ - Min: pointer.Int32(3), + Min: ptr.To[int32](3), }, }, }, @@ -236,7 +236,7 @@ var _ = Describe("Table", func() { "azure.com", }, Replicas: &httpv1alpha1.ReplicaStruct{ - Min: pointer.Int32(3), + Min: ptr.To[int32](3), }, }, } diff --git a/pkg/routing/tablememory_test.go b/pkg/routing/tablememory_test.go index 116fb58a5..79eaac041 100644 --- a/pkg/routing/tablememory_test.go +++ b/pkg/routing/tablememory_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" httpv1alpha1 "github.com/kedacore/http-add-on/operator/apis/http/v1alpha1" "github.com/kedacore/http-add-on/pkg/k8s" @@ -213,7 +213,7 @@ var _ = Describe("TableMemory", func() { tm = tm.Remember(&httpso0).(tableMemory) httpso1 := *httpso0.DeepCopy() - httpso1.Spec.TargetPendingRequests = pointer.Int32(1) + httpso1.Spec.TargetPendingRequests = ptr.To[int32](1) tm = tm.Remember(&httpso1).(tableMemory) assertTrees(tm, &httpso0, &httpso1) @@ -228,7 +228,7 @@ var _ = Describe("TableMemory", func() { tm = tm.Remember(&httpso1).(tableMemory) httpso2 := *httpso1.DeepCopy() - httpso2.Spec.TargetPendingRequests = pointer.Int32(1) + httpso2.Spec.TargetPendingRequests = ptr.To[int32](1) tm = tm.Remember(&httpso2).(tableMemory) assertTrees(tm, &httpso1, &httpso2) @@ -574,7 +574,7 @@ var _ = Describe("TableMemory", func() { Expect(ret8).To(BeNil()) httpso := *httpso1.DeepCopy() - httpso.Spec.TargetPendingRequests = pointer.Int32(1) + httpso.Spec.TargetPendingRequests = ptr.To[int32](1) tm = tm.Remember(&httpso) diff --git a/scaler/Dockerfile b/scaler/Dockerfile index 5416a5975..61cafbd7a 100644 --- a/scaler/Dockerfile +++ b/scaler/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM} ghcr.io/kedacore/build-tools:1.20.4 as builder +FROM --platform=${BUILDPLATFORM} ghcr.io/kedacore/keda-tools:1.20.5 as builder WORKDIR /workspace COPY go.* . RUN go mod download diff --git a/scaler/handlers.go b/scaler/handlers.go index bee3d2f52..a5c23ecae 100644 --- a/scaler/handlers.go +++ b/scaler/handlers.go @@ -7,23 +7,18 @@ package main import ( "context" "errors" - "math/rand" "strconv" "time" "github.com/go-logr/logr" "github.com/kedacore/keda/v2/pkg/scalers/externalscaler" "google.golang.org/protobuf/types/known/emptypb" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" informershttpv1alpha1 "github.com/kedacore/http-add-on/operator/generated/informers/externalversions/http/v1alpha1" "github.com/kedacore/http-add-on/pkg/k8s" ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - const ( keyInterceptorTargetPendingRequests = "interceptorTargetPendingRequests" ) @@ -138,7 +133,7 @@ func (e *impl) GetMetricSpec( lggr.Error(err, "unable to get HTTPScaledObject", "name", sor.Name, "namespace", sor.Namespace) return nil, err } - targetPendingRequests := int64(pointer.Int32Deref(httpso.Spec.TargetPendingRequests, 100)) + targetPendingRequests := int64(ptr.Deref(httpso.Spec.TargetPendingRequests, 100)) res := &externalscaler.GetMetricSpecResponse{ MetricSpecs: []*externalscaler.MetricSpec{ diff --git a/scaler/handlers_test.go b/scaler/handlers_test.go index 4eb8bdb84..fe1ec82c5 100644 --- a/scaler/handlers_test.go +++ b/scaler/handlers_test.go @@ -17,7 +17,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" httpv1alpha1 "github.com/kedacore/http-add-on/operator/apis/http/v1alpha1" informersexternalversionshttpv1alpha1mock "github.com/kedacore/http-add-on/operator/generated/informers/externalversions/http/v1alpha1/mock" @@ -350,7 +350,7 @@ func TestGetMetricSpecTable(t *testing.T) { Service: "testsrv", Port: 8080, }, - TargetPendingRequests: pointer.Int32(123), + TargetPendingRequests: ptr.To[int32](123), }, } namespaceLister.EXPECT(). @@ -391,7 +391,7 @@ func TestGetMetricSpecTable(t *testing.T) { Service: "testsrv", Port: 8080, }, - TargetPendingRequests: pointer.Int32(123), + TargetPendingRequests: ptr.To[int32](123), }, } namespaceLister.EXPECT(). From 19861610447c2c2289056f86702017a3b6b182b9 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Ferrero Date: Tue, 22 Aug 2023 14:39:47 +0200 Subject: [PATCH 3/5] chore: add deployment yamls to release (#760) --- .github/workflows/build_release.yml | 36 +++++++++++++++++++++++++++++ CHANGELOG.md | 2 +- Makefile | 10 ++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 58390941e..0e533b7e5 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -19,6 +19,11 @@ jobs: run: | echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} + - name: Release Deployment YAML file + run: make release + env: + VERSION: ${{ steps.get_version.outputs.VERSION }} + - name: Login to GHCR uses: docker/login-action@v2 with: @@ -36,3 +41,34 @@ jobs: run: make publish-multiarch env: VERSION: ${{ steps.get_version.outputs.VERSION }} + + # Get release information to determine id of the current release + - name: Get Release + id: get-release-info + uses: bruceadams/get-release@v1.3.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Upload deployment YAML file to GitHub release + - name: Upload Deployment YAML file + id: upload-deployment-yaml + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/kedacore/keda/releases/${{ steps.get-release-info.outputs.id }}/assets?name=keda-http-add-on-${{ steps.get_version.outputs.VERSION }}.yaml + asset_path: keda-http-add-on-${{ steps.get_version.outputs.VERSION }}.yaml + asset_name: keda-http-add-on-${{ steps.get_version.outputs.VERSION }}.yaml + asset_content_type: application/x-yaml + + # Upload CRD deployment YAML file to GitHub release + - name: Upload Deployment YAML file + id: upload-crd-deployment-yaml + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/kedacore/keda/releases/${{ steps.get-release-info.outputs.id }}/assets?name=keda-http-add-on-${{ steps.get_version.outputs.VERSION }}-crds.yaml + asset_path: keda-http-add-on-${{ steps.get_version.outputs.VERSION }}-crds.yaml + asset_name: keda-http-add-on-${{ steps.get_version.outputs.VERSION }}-crds.yaml + asset_content_type: application/x-yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index d99711110..28a6c7aef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ This changelog keeps track of work items that have been completed and are ready ### New -- **General**: TODO ([#TODO](https://github.com/kedacore/http-add-on/issues/TODO)) +- **General**: Add manifests to deploy the Add-on ([#716](https://github.com/kedacore/http-add-on/issues/716)) ### Improvements diff --git a/Makefile b/Makefile index f19f420c9..17a31fcd2 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,16 @@ publish-scaler-multiarch: publish-multiarch: publish-operator-multiarch publish-interceptor-multiarch publish-scaler-multiarch +release: manifests kustomize ## Produce new KEDA Http Add-on release in keda-http-add-on-$(VERSION).yaml file. + cd config/interceptor && \ + $(KUSTOMIZE) edit set image ghcr.io/kedacore/http-add-on-interceptor=${IMAGE_INTERCEPTOR_VERSIONED_TAG} + cd config/scaler && \ + $(KUSTOMIZE) edit set image ghcr.io/kedacore/http-add-on-scaler=${IMAGE_SCALER_VERSIONED_TAG} + cd config/operator && \ + $(KUSTOMIZE) edit set image ghcr.io/kedacore/http-add-on-operator=${IMAGE_OPERATOR_VERSIONED_TAG} + $(KUSTOMIZE) build config/default > keda-http-add-on-$(VERSION).yaml + $(KUSTOMIZE) build config/crd > keda-http-add-on-$(VERSION)-crds.yaml + # Development generate: codegen manifests mockgen ## Generate code, manifests, and mocks. From 179b26a58e211c95523fdb23354b0bdce1cebe6f Mon Sep 17 00:00:00 2001 From: Jorge Turrado Ferrero Date: Tue, 22 Aug 2023 15:25:12 +0200 Subject: [PATCH 4/5] chore: add a validation for the changelog format (#761) * chore: add a validation for the changelog format Signed-off-by: Jorge Turrado * update changelog Signed-off-by: Jorge Turrado --------- Signed-off-by: Jorge Turrado Co-authored-by: Tom Kerkhove --- .pre-commit-config.yaml | 6 ++++ CHANGELOG.md | 16 ++++----- hack/validate-changelog.sh | 73 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 8 deletions(-) create mode 100755 hack/validate-changelog.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7be7eb683..2e988050c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,3 +37,9 @@ repos: entry: golangci-lint run types: [go] pass_filenames: false + - id: validate-changelog + name: Validate Changelog + language: system + entry: "bash hack/validate-changelog.sh" + pass_filenames: false + files: CHANGELOG\.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 28a6c7aef..8ecd267e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,12 +28,12 @@ This changelog keeps track of work items that have been completed and are ready ### Fixes -- **Scaler**: remplement custom interceptor metrics ([#718](https://github.com/kedacore/http-add-on/issues/718)) -- **Operator**: Remove ScaledObject `name` & `app` custom labels ([#717](https://github.com/kedacore/http-add-on/issues/717)) - **Interceptor**: fatal error: concurrent map iteration and map write ([#726](https://github.com/kedacore/http-add-on/issues/726)) +- **Interceptor**: Keep original Host in the Host header ([#331](https://github.com/kedacore/http-add-on/issues/331)) - **Interceptor**: Provide graceful shutdown for http servers on SIGINT and SIGTERM ([#731](https://github.com/kedacore/http-add-on/issues/731)) -- **Interceptor**: Keep original Host in the Host header ([#731](https://github.com/kedacore/http-add-on/issues/331)) +- **Operator**: Remove ScaledObject `name` & `app` custom labels ([#717](https://github.com/kedacore/http-add-on/issues/717)) - **Scaler**: Provide graceful shutdown for grpc server on SIGINT and SIGTERM ([#731](https://github.com/kedacore/http-add-on/issues/731)) +- **Scaler**: remplement custom interceptor metrics ([#718](https://github.com/kedacore/http-add-on/issues/718)) ### Deprecations @@ -49,7 +49,7 @@ Previously announced deprecation(s): ### Other -- **General**: TODO ([#TODO](https://github.com/kedacore/http-add-on/issues/TODO)) +- **General**: Adding a changelog validating script to check for formatting and order ([#761](https://github.com/kedacore/http-add-on/pull/761)) ## v0.5.0 @@ -59,23 +59,23 @@ None. ### New +- **General**: Log incoming requests using the Combined Log Format ([#669](https://github.com/kedacore/http-add-on/pull/669)) - **Routing**: Add multi-host support to `HTTPScaledObject` ([#552](https://github.com/kedacore/http-add-on/issues/552)) - **Routing**: Support path-based routing ([#338](https://github.com/kedacore/http-add-on/issues/338)) -- **General**: Log incoming requests using the Combined Log Format ([#669](https://github.com/kedacore/http-add-on/pull/669)) ### Improvements - **General**: Automatically tag Docker image with commit SHA ([#567](https://github.com/kedacore/http-add-on/issues/567)) -- **RBAC**: Introduce fine-grained permissions per component and reduce required permissions ([#612](https://github.com/kedacore/http-add-on/issues/612)) - **Operator**: Migrate project to Kubebuilder v3 ([#625](https://github.com/kedacore/http-add-on/issues/625)) +- **RBAC**: Introduce fine-grained permissions per component and reduce required permissions ([#612](https://github.com/kedacore/http-add-on/issues/612)) - **Routing**: New routing table implementation that relies on the live state of HTTPScaledObjects on the K8s Cluster instead of a ConfigMap that is updated periodically ([#605](https://github.com/kedacore/http-add-on/issues/605)) ### Fixes +- **General**: Changes to HTTPScaledObjects now take effect ([#605](https://github.com/kedacore/http-add-on/issues/605)) - **General**: HTTPScaledObject is the owner of the underlying ScaledObject ([#703](https://github.com/kedacore/http-add-on/issues/703)) -- **Routing**: Lookup host without port ([#608](https://github.com/kedacore/http-add-on/issues/608)) - **Controller**: Use kedav1alpha1.ScaledObject default values ([#607](https://github.com/kedacore/http-add-on/issues/607)) -- **General**: Changes to HTTPScaledObjects now take effect ([#605](https://github.com/kedacore/http-add-on/issues/605)) +- **Routing**: Lookup host without port ([#608](https://github.com/kedacore/http-add-on/issues/608)) ### Deprecations diff --git a/hack/validate-changelog.sh b/hack/validate-changelog.sh new file mode 100755 index 000000000..2c2cd4884 --- /dev/null +++ b/hack/validate-changelog.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. + +# Define filename +filename="$SCRIPT_ROOT/CHANGELOG.md" + +# Check if file exists +if [[ ! -f "$filename" ]]; then + echo "Error: $filename does not exist." + exit 1 +fi + +# Storing the version to be checked +mapfile -t versions < <(awk '/## History/{flag=1;next}/## /{flag=0}flag' "$filename" | grep -o '\[[^]]*\]' | grep -v "v1." | sed 's/[][]//g') + +# Define a function to extract and sort sections +function extract_and_check() { + local section=$1 + local content_block=$2 + local content=$(awk "/### $section/{flag=1;next}/### /{flag=0}flag" <<< "$content_block" | grep '^- \*\*') + + # Skip if content does not exist + if [[ -z "$content" ]]; then + return + fi + + # Separate and sort the **General**: lines + local sorted_general_lines=$(echo "$content" | grep '^- \*\*General\*\*:' | sort --ignore-case) + + # Sort the remaining lines + local sorted_content=$(echo "$content" | grep -v '^- \*\*General\*\*:' | sort --ignore-case) + + # Check if sorted_general_lines is not empty, then concatenate + if [[ -n "$sorted_general_lines" ]]; then + sorted_content=$(printf "%s\n%s" "$sorted_general_lines" "$sorted_content") + fi + + # Check pattern and throw error if wrong pattern found + while IFS= read -r line; do + echo "Error: Wrong pattern found in section: $section , line: $line" + exit 1 + done < <(grep -Pv '^(-\s\*\*[^*]+\*\*: .*\(\[#([\d|TODO]+)\]\(https:\/\/github\.com\/kedacore\/(http-add-on|charts|governance)\/(pull|issues|discussions)\/\2\)(?:\|\[#(\d+)\]\(https:\/\/github\.com\/kedacore\/(http-add-on|charts|governance)\/(pull|issues|discussions)\/\5\)){0,}\))$' <<< "$content") + + if [ "$content" != "$sorted_content" ]; then + echo "Error: Section: $section is not sorted correctly. Correct order:" + echo "$sorted_content" + exit 1 + fi +} + + +# Extract release sections, including "Unreleased", and check them +for version in "${versions[@]}"; do + release_content=$(awk "/## $version/{flag=1;next}/## v[0-9\.]+/{flag=0}flag" "$filename") + + + if [[ -z "$release_content" ]]; then + echo "No content found for $version Skipping." + continue + fi + + echo "Checking section: $version" + + # Separate content into different sections and check sorting for each release + extract_and_check "New" "$release_content" + extract_and_check "Experimental" "$release_content" + extract_and_check "Improvements" "$release_content" + extract_and_check "Fixes" "$release_content" + extract_and_check "Deprecations" "$release_content" + extract_and_check "Other" "$release_content" + +done From 0321ee0bef2f0879bbf1d900b4d339b4b1fd7c1c Mon Sep 17 00:00:00 2001 From: Tom Kerkhove Date: Wed, 23 Aug 2023 13:28:28 +0200 Subject: [PATCH 5/5] chore: KEDA is a CNCF Graduated project (#762) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a6218b5b3..b0d52a072 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ This project follows the KEDA contributing guidelines, which are outlined in [CO If you would like to contribute code to this project, please see [docs/developing.md](./docs/developing.md). --- -We are a Cloud Native Computing Foundation (CNCF) incubation project. +We are a Cloud Native Computing Foundation (CNCF) graduated project.

## Code of Conduct