From 1fee2c413c100d866a0f75cd37ec4b2f2f6e2d77 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:44:06 +0530 Subject: [PATCH 01/38] chore(deps): bump golang from 1.23.0 to 1.23.2 (#1410) Bumps golang from 1.23.0 to 1.23.2. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Prashansa Kulshrestha --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ee9c51cb8..e3562724a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.23.0 AS build +FROM golang:1.23.2 AS build WORKDIR /deck COPY go.mod ./ COPY go.sum ./ From d10c3388c68730f71946f1bf903a307295d3585e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:24:21 +0530 Subject: [PATCH 02/38] chore(deps): bump github.com/docker/docker (#1419) Bumps [github.com/docker/docker](https://github.com/docker/docker) from 26.1.4+incompatible to 26.1.5+incompatible. - [Release notes](https://github.com/docker/docker/releases) - [Commits](https://github.com/docker/docker/compare/v26.1.4...v26.1.5) --- updated-dependencies: - dependency-name: github.com/docker/docker dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Prashansa Kulshrestha --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 99c50d77f..fa2d8dc91 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect github.com/distribution/reference v0.5.0 // indirect - github.com/docker/docker v26.1.4+incompatible // indirect + github.com/docker/docker v26.1.5+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.12.0 // indirect diff --git a/go.sum b/go.sum index 4cd80a5b7..c8a6fddf9 100644 --- a/go.sum +++ b/go.sum @@ -78,8 +78,8 @@ github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwu github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0= github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/docker/docker v26.1.4+incompatible h1:vuTpXDuoga+Z38m1OZHzl7NKisKWaWlhjQk7IDPSLsU= -github.com/docker/docker v26.1.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v26.1.5+incompatible h1:NEAxTwEjxV6VbBMBoGG3zPqbiJosIApZjxlbrG9q3/g= +github.com/docker/docker v26.1.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= From 8e377a0265e7138b3d08ee8077ec382717d2f204 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 6 Nov 2024 16:45:35 +0530 Subject: [PATCH 03/38] chore: updated go-apiops lib. (#1430) Added changelog and release info --- CHANGELOG.md | 12 ++++++++++++ README.md | 4 ++-- go.mod | 16 ++++++++-------- go.sum | 40 ++++++++++++++++++++-------------------- 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b626c09d9..34cbe367b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.41.2](#v1412) - [v1.41.1](#v1411) - [v1.41.0](#v1410) - [v1.40.3](#v1403) @@ -98,6 +99,16 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.41.2] +> Release date: 2024/11/06 + +### Fixes +- Added fix to validate for top-level type in parameter schemas in request-validator plugin while +using `deck file openapi2kong`. [go-apiops #215](https://github.com/Kong/go-apiops/pull/215) +- Added support for defining path parameters outside REST methods for request-validation while +using `deck file openapi2kong`. [go-apiops #216](https://github.com/Kong/go-apiops/pull/216) +(#1429)[https://github.com/Kong/deck/pull/1429] + ## [v1.41.1] > Release date: 2024/10/22 @@ -1843,6 +1854,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.41.2]: https://github.com/Kong/deck/compare/v1.41.1...v1.41.2 [v1.41.1]: https://github.com/Kong/deck/compare/v1.40.0...v1.41.1 [v1.41.0]: https://github.com/Kong/deck/compare/v1.40.3...v1.41.0 [v1.40.3]: https://github.com/Kong/deck/compare/v1.40.2...v1.40.3 diff --git a/README.md b/README.md index cd9bcc971..f575f8c47 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ the GitHub [release page](https://github.com/kong/deck/releases) or install by downloading the binary: ```shell -$ curl -sL https://github.com/kong/deck/releases/download/v1.41.1/deck_1.41.1_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.41.2/deck_1.41.2_linux_amd64.tar.gz -o deck.tar.gz $ tar -xf deck.tar.gz -C /tmp $ sudo cp /tmp/deck /usr/local/bin/ ``` @@ -84,7 +84,7 @@ If you are on Windows, you can download the binary from the GitHub [release page](https://github.com/kong/deck/releases) or via PowerShell: ```shell -$ curl -sL https://github.com/kong/deck/releases/download/v1.41.1/deck_1.41.1_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.41.2/deck_1.41.2_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ``` diff --git a/go.mod b/go.mod index fa2d8dc91..6f6b7e55e 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/daveshanley/vacuum v0.9.15 github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 - github.com/kong/go-apiops v0.1.38 + github.com/kong/go-apiops v0.1.39 github.com/kong/go-database-reconciler v1.15.0 github.com/kong/go-kong v0.59.1 github.com/mitchellh/go-homedir v1.1.0 @@ -135,7 +135,7 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect + github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect github.com/gookit/color v1.5.4 // indirect github.com/gosimple/slug v1.14.0 github.com/gosimple/unidecode v1.0.1 // indirect @@ -187,12 +187,12 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect - golang.org/x/mod v0.20.0 // indirect - golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // indirect - golang.org/x/text v0.17.0 // indirect - golang.org/x/tools v0.24.0 // indirect + golang.org/x/mod v0.21.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index c8a6fddf9..e22413bb0 100644 --- a/go.sum +++ b/go.sum @@ -184,8 +184,8 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -245,8 +245,8 @@ github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuOb github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= -github.com/kong/go-apiops v0.1.38 h1:He8MSQqGViUwwsSL9y7a8VaNh05CU9U0pZRwWu7iBVI= -github.com/kong/go-apiops v0.1.38/go.mod h1:UaZdXJMx+Im8AxjeNslg8e1qilRd3Z8e8Oj3mfJtD00= +github.com/kong/go-apiops v0.1.39 h1:OXUzHb6tyZ+bb1xWzpPvmZK7FNk4xtrcka8d0bRTQkI= +github.com/kong/go-apiops v0.1.39/go.mod h1:WghIt61r2b+HaeGVNWCd+aswTMHIjeP3GYK09/yYWA8= github.com/kong/go-database-reconciler v1.15.0 h1:5F5Zzp2H14aiDmqWUCaU4+LGR/lGnvhwBTmtr3N6RZQ= github.com/kong/go-database-reconciler v1.15.0/go.mod h1:T5BkBw13PZWub3y2jKAoM7fYD+UmXp2iNqj1YqD0L90= github.com/kong/go-kong v0.59.1 h1:AJZtyCD+Zyqe/mF/m+x3/qN/GPVxAH7jq9zGJTHRfjc= @@ -323,15 +323,15 @@ github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vv 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.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw= -github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= +github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= 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.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= -github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= +github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= +github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= @@ -501,8 +501,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -519,8 +519,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= @@ -564,16 +564,16 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -581,8 +581,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -596,8 +596,8 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From c88f497de9dfdaacfdca84f7fdb49f19b601d959 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 6 Nov 2024 17:37:07 +0530 Subject: [PATCH 04/38] Fixing integration test failures for 3.8.1 release (#1428) * fix: integration test fixes for 3.8.1 * removed stray comments * fixed semver range for dump test --- tests/integration/diff_test.go | 40 ++- tests/integration/dump_test.go | 21 +- tests/integration/sync_test.go | 312 +++++++++++++++++- .../001-entities-with-tags/expected381.yaml | 237 +++++++++++++ .../expected-no-skip-381.yaml | 64 ++++ 5 files changed, 658 insertions(+), 16 deletions(-) create mode 100644 tests/integration/testdata/dump/001-entities-with-tags/expected381.yaml create mode 100644 tests/integration/testdata/dump/002-skip-consumers/expected-no-skip-381.yaml diff --git a/tests/integration/diff_test.go b/tests/integration/diff_test.go index 1262124f8..797f465bd 100644 --- a/tests/integration/diff_test.go +++ b/tests/integration/diff_test.go @@ -752,18 +752,38 @@ func Test_Diff_Unmasked_NewerThan3x(t *testing.T) { // test scope: // - 3.5 func Test_Diff_NoDiffUnorderedArray(t *testing.T) { - runWhen(t, "enterprise", ">=3.5.0") - setup(t) + tests := []struct { + name string + stateFile string + runWhen string + }{ + { + name: "no diffs with unordered arrays >=3.5.0 <3.8.1", + stateFile: "testdata/diff/004-no-diff-plugin/kong.yaml", + runWhen: ">=3.5.0 <3.8.1", + }, + // Uncomment post solving: https://konghq.atlassian.net/browse/FTI-6303 + // { + // name: "no diffs with unordered arrays >=3.8.1", + // stateFile: "testdata/diff/004-no-diff-plugin/kong.yaml", + // runWhen: ">=3.8.1", + // }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + runWhen(t, "enterprise", tc.runWhen) + setup(t) - // test that the diff command does not return any changes when - // array fields are not sorted. - stateFile := "testdata/diff/004-no-diff-plugin/kong.yaml" - assert.NoError(t, sync(stateFile, "--timeout", "60")) + // test that the diff command does not return any changes when + // array fields are not sorted. + assert.NoError(t, sync(tc.stateFile, "--timeout", "60")) - out, err := diff(stateFile) - assert.NoError(t, err) - assert.Equal(t, emptyOutput, out) - reset(t) + out, err := diff(tc.stateFile) + assert.NoError(t, err) + assert.Equal(t, emptyOutput, out) + reset(t) + }) + } } // test scope: diff --git a/tests/integration/dump_test.go b/tests/integration/dump_test.go index ac2c0c924..39b891bf6 100644 --- a/tests/integration/dump_test.go +++ b/tests/integration/dump_test.go @@ -47,16 +47,24 @@ func Test_Dump_SelectTags_3x(t *testing.T) { name string stateFile string expectedFile string + runWhen string }{ { - name: "dump with select-tags", + name: "dump with select-tags >=3.1.0 <3.8.1", stateFile: "testdata/dump/001-entities-with-tags/kong.yaml", expectedFile: "testdata/dump/001-entities-with-tags/expected.yaml", + runWhen: ">=3.1.0 <3.8.1", + }, + { + name: "dump with select-tags 3.8.1", + stateFile: "testdata/dump/001-entities-with-tags/kong.yaml", + expectedFile: "testdata/dump/001-entities-with-tags/expected381.yaml", + runWhen: ">=3.8.1", }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - runWhen(t, "kong", ">=3.1.0") + runWhen(t, "kong", tc.runWhen) setup(t) assert.NoError(t, sync(tc.stateFile)) @@ -123,7 +131,14 @@ func Test_Dump_SkipConsumers(t *testing.T) { stateFile: "testdata/dump/002-skip-consumers/kong34.yaml", expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip-35.yaml", skipConsumers: false, - runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.5.0") }, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.5.0 <3.8.1") }, + }, + { + name: "3.8.1 dump with no skip-consumers", + stateFile: "testdata/dump/002-skip-consumers/kong34.yaml", + expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip-381.yaml", + skipConsumers: false, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.8.1") }, }, } for _, tc := range tests { diff --git a/tests/integration/sync_test.go b/tests/integration/sync_test.go index 173f7f9d1..7e9aa39dd 100644 --- a/tests/integration/sync_test.go +++ b/tests/integration/sync_test.go @@ -327,6 +327,72 @@ var ( }, } + plugin_on_entities381x = []*kong.Plugin{ //nolint:revive,stylecheck + { + Name: kong.String("prometheus"), + Protocols: []*string{ + kong.String("grpc"), + kong.String("grpcs"), + kong.String("http"), + kong.String("https"), + }, + Enabled: kong.Bool(true), + Config: kong.Configuration{ + "ai_metrics": false, + "bandwidth_metrics": false, + "latency_metrics": false, + "per_consumer": false, + "status_code_metrics": false, + "upstream_health_metrics": false, + }, + Service: &kong.Service{ + ID: kong.String("58076db2-28b6-423b-ba39-a797193017f7"), + }, + }, + { + Name: kong.String("prometheus"), + Protocols: []*string{ + kong.String("grpc"), + kong.String("grpcs"), + kong.String("http"), + kong.String("https"), + }, + Enabled: kong.Bool(true), + Config: kong.Configuration{ + "ai_metrics": false, + "bandwidth_metrics": false, + "latency_metrics": false, + "per_consumer": false, + "status_code_metrics": false, + "upstream_health_metrics": false, + }, + Route: &kong.Route{ + ID: kong.String("87b6a97e-f3f7-4c47-857a-7464cb9e202b"), + }, + }, + { + Name: kong.String("prometheus"), + Protocols: []*string{ + kong.String("grpc"), + kong.String("grpcs"), + kong.String("http"), + kong.String("https"), + }, + Enabled: kong.Bool(true), + Config: kong.Configuration{ + "ai_metrics": false, + "bandwidth_metrics": false, + "latency_metrics": false, + "per_consumer": false, + "status_code_metrics": false, + "upstream_health_metrics": false, + }, + Consumer: &kong.Consumer{ + ID: kong.String("d2965b9b-0608-4458-a9f8-0b93d88d03b8"), + }, + }, + } + plugin_on_entitiesKonnect = []*kong.Plugin{ //nolint:revive,stylecheck { Name: kong.String("prometheus"), @@ -1323,6 +1389,180 @@ var ( Protocols: []*string{kong.String("http"), kong.String("https")}, }, } + + consumerGroupScopedPlugins381x = []*kong.Plugin{ + { + Name: kong.String("rate-limiting-advanced"), + ConsumerGroup: &kong.ConsumerGroup{ + ID: kong.String("77e6691d-67c0-446a-9401-27be2b141aae"), + }, + Config: kong.Configuration{ + "consumer_groups": nil, + "dictionary_name": string("kong_rate_limiting_counters"), + "disable_penalty": bool(false), + "enforce_consumer_groups": bool(false), + "error_code": float64(429), + "error_message": string("API rate limit exceeded"), + "header_name": nil, + "hide_client_headers": bool(false), + "identifier": string("consumer"), + "limit": []any{float64(10)}, + "namespace": string("gold"), + "path": nil, + "redis": map[string]any{ + "cluster_addresses": nil, + "cluster_max_redirections": float64(5), + "cluster_nodes": nil, + "connect_timeout": float64(2000), + "connection_is_proxied": bool(false), + "database": float64(0), + "host": string("127.0.0.1"), + "keepalive_backlog": nil, + "keepalive_pool_size": float64(256), + "password": nil, + "port": float64(6379), + "read_timeout": float64(2000), + "send_timeout": float64(2000), + "sentinel_addresses": nil, + "sentinel_master": nil, + "sentinel_nodes": nil, + "sentinel_password": nil, + "sentinel_role": nil, + "sentinel_username": nil, + "server_name": nil, + "ssl": false, + "ssl_verify": false, + "timeout": float64(2000), + "username": nil, + }, + "retry_after_jitter_max": float64(1), + "strategy": string("local"), + "sync_rate": float64(-1), + "window_size": []any{float64(60)}, + "window_type": string("sliding"), + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")}, + }, + { + Name: kong.String("rate-limiting-advanced"), + ConsumerGroup: &kong.ConsumerGroup{ + ID: kong.String("5bcbd3a7-030b-4310-bd1d-2721ff85d236"), + }, + Config: kong.Configuration{ + "consumer_groups": nil, + "dictionary_name": string("kong_rate_limiting_counters"), + "disable_penalty": bool(false), + "enforce_consumer_groups": bool(false), + "error_code": float64(429), + "error_message": string("API rate limit exceeded"), + "header_name": nil, + "hide_client_headers": bool(false), + "identifier": string("consumer"), + "limit": []any{float64(7)}, + "namespace": string("silver"), + "path": nil, + "redis": map[string]any{ + "cluster_addresses": nil, + "cluster_max_redirections": float64(5), + "cluster_nodes": nil, + "connect_timeout": float64(2000), + "connection_is_proxied": bool(false), + "database": float64(0), + "host": string("127.0.0.1"), + "keepalive_backlog": nil, + "keepalive_pool_size": float64(256), + "password": nil, + "port": float64(6379), + "read_timeout": float64(2000), + "send_timeout": float64(2000), + "sentinel_addresses": nil, + "sentinel_master": nil, + "sentinel_nodes": nil, + "sentinel_password": nil, + "sentinel_role": nil, + "sentinel_username": nil, + "server_name": nil, + "ssl": false, + "ssl_verify": false, + "timeout": float64(2000), + "username": nil, + }, + "retry_after_jitter_max": float64(1), + "strategy": string("local"), + "sync_rate": float64(-1), + "window_size": []any{float64(60)}, + "window_type": string("sliding"), + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")}, + }, + { + Name: kong.String("rate-limiting-advanced"), + Config: kong.Configuration{ + "consumer_groups": nil, + "dictionary_name": string("kong_rate_limiting_counters"), + "disable_penalty": bool(false), + "enforce_consumer_groups": bool(false), + "error_code": float64(429), + "error_message": string("API rate limit exceeded"), + "header_name": nil, + "hide_client_headers": bool(false), + "identifier": string("consumer"), + "limit": []any{float64(5)}, + "namespace": string("silver"), + "path": nil, + "redis": map[string]any{ + "cluster_addresses": nil, + "cluster_max_redirections": float64(5), + "cluster_nodes": nil, + "connect_timeout": float64(2000), + "connection_is_proxied": bool(false), + "database": float64(0), + "host": string("127.0.0.1"), + "keepalive_backlog": nil, + "keepalive_pool_size": float64(256), + "password": nil, + "port": float64(6379), + "read_timeout": float64(2000), + "send_timeout": float64(2000), + "sentinel_addresses": nil, + "sentinel_master": nil, + "sentinel_nodes": nil, + "sentinel_password": nil, + "sentinel_role": nil, + "sentinel_username": nil, + "server_name": nil, + "ssl": false, + "ssl_verify": false, + "timeout": float64(2000), + "username": nil, + }, + "retry_after_jitter_max": float64(1), + "strategy": string("local"), + "sync_rate": float64(-1), + "window_size": []any{float64(60)}, + "window_type": string("sliding"), + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")}, + }, + { + Name: kong.String("key-auth"), + Config: kong.Configuration{ + "anonymous": nil, + "hide_credentials": false, + "key_in_body": false, + "key_in_header": true, + "key_in_query": true, + "key_names": []interface{}{"apikey"}, + "realm": nil, // This is present on 3.7.x+ + "run_on_preflight": true, + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("http"), kong.String("https")}, + }, + } ) // test scope: @@ -2728,9 +2968,10 @@ func Test_Sync_PluginsOnEntitiesFrom_3_0_0(t *testing.T) { name string kongFile string expectedState utils.KongRawState + runWhen string }{ { - name: "create plugins on services, routes and consumers", + name: "create plugins on services, routes and consumers <3.8.1", kongFile: "testdata/sync/xxx-plugins-on-entities/kong.yaml", expectedState: utils.KongRawState{ Services: svc1_207, @@ -2738,12 +2979,24 @@ func Test_Sync_PluginsOnEntitiesFrom_3_0_0(t *testing.T) { Plugins: plugin_on_entities3x, Consumers: consumer, }, + runWhen: ">=3.0.0 <3.8.1", + }, + { + name: "create plugins on services, routes and consumers >=3.8.1", + kongFile: "testdata/sync/xxx-plugins-on-entities/kong.yaml", + expectedState: utils.KongRawState{ + Services: svc1_207, + Routes: route1_20x, + Plugins: plugin_on_entities381x, + Consumers: consumer, + }, + runWhen: ">=3.8.1", }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - runWhen(t, "kong", ">=3.0.0") + runWhen(t, "kong", tc.runWhen) setup(t) sync(tc.kongFile) @@ -4571,7 +4824,7 @@ func Test_Sync_ConsumerGroupsScopedPlugins_After360(t *testing.T) { }, { name: "creates consumer groups scoped plugins", - runWhen: ">=3.7.0", + runWhen: ">=3.7.0 <3.8.1", kongFile: "testdata/sync/025-consumer-groups-scoped-plugins/kong3x.yaml", expectedState: utils.KongRawState{ Consumers: consumerGroupsConsumers, @@ -4622,6 +4875,59 @@ func Test_Sync_ConsumerGroupsScopedPlugins_After360(t *testing.T) { }, }, }, + { + name: "creates consumer groups scoped plugins", + runWhen: ">=3.8.1", + kongFile: "testdata/sync/025-consumer-groups-scoped-plugins/kong3x.yaml", + expectedState: utils.KongRawState{ + Consumers: consumerGroupsConsumers, + ConsumerGroups: []*kong.ConsumerGroupObject{ + { + ConsumerGroup: &kong.ConsumerGroup{ + Name: kong.String("silver"), + }, + Consumers: []*kong.Consumer{ + { + Username: kong.String("bar"), + }, + }, + }, + { + ConsumerGroup: &kong.ConsumerGroup{ + Name: kong.String("gold"), + }, + Consumers: []*kong.Consumer{ + { + Username: kong.String("foo"), + }, + }, + }, + }, + Plugins: consumerGroupScopedPlugins381x, + Services: svc1_207, + Routes: route1_20x, + KeyAuths: []*kong.KeyAuth{ + { + Consumer: &kong.Consumer{ + ID: kong.String("87095815-5395-454e-8c18-a11c9bc0ef04"), + }, + Key: kong.String("i-am-special"), + }, + { + Consumer: &kong.Consumer{ + ID: kong.String("5a5b9369-baeb-4faa-a902-c40ccdc2928e"), + }, + Key: kong.String("i-am-not-so-special"), + }, + { + Consumer: &kong.Consumer{ + ID: kong.String("e894ea9e-ad08-4acf-a960-5a23aa7701c7"), + }, + Key: kong.String("i-am-just-average"), + }, + }, + }, + }, } for _, tc := range tests { t.Run(tc.name+"/"+tc.runWhen, func(t *testing.T) { diff --git a/tests/integration/testdata/dump/001-entities-with-tags/expected381.yaml b/tests/integration/testdata/dump/001-entities-with-tags/expected381.yaml new file mode 100644 index 000000000..4a75042c6 --- /dev/null +++ b/tests/integration/testdata/dump/001-entities-with-tags/expected381.yaml @@ -0,0 +1,237 @@ +_format_version: "3.0" +_info: + defaults: {} + select_tags: + - managed-by-deck + - org-unit-42 +certificates: +- cert: | + -----BEGIN CERTIFICATE----- + MIIC1jCCAb4CCQCt23nwvxSCvjANBgkqhkiG9w0BAQsFADAtMRYwFAYDVQQDDA0q + LmV4YW1wbGUuY29tMRMwEQYDVQQKDAprb25naHEub3JnMB4XDTE4MTIzMTIwMTkw + MVoXDTE5MTIzMTIwMTkwMVowLTEWMBQGA1UEAwwNKi5leGFtcGxlLmNvbTETMBEG + A1UECgwKa29uZ2hxLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB + AKj/2r1AXo9x+2Csrd0SHbpnzuW+xYqgsd+YA9ZrZNV7SZGSbaZymsRMz8wg5OIU + iUik2GM1749/lYvojLFStBPy9UY/gd++5f3wLp4xHiI+IU2XQ97otXKGfyh36RmN + dKDqPLN8BG3R346s/y1GOulFvLthYmZVYF9ufHiqimfEDSbTt79P5C3X0Rw/afK1 + GjHEJPCB/XkZ6lkcEyL6LqZI5oBigDqa9hI/nWLxEzfm8pgosiS38p9TAijlOkpm + tX2p2b1pktlNIy3rxsqj6IynN9Wc7FpV1N4HoPKV7vQQ08hjwW6WfanVthaaJosj + Vr2TBCJ1ltAmsb+5B2VPYVkCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAnByTyQfV + 3LkwuoWS57CWcqbNw/cHnv/ChzmIv+6mIXvDBSvCgrPZIWCpaCfYRG6R51E44fr/ + 8V1AKT0Zt15DjrXEEcIGQgsIDO91/wlL091fTAUzSbL0yt7HTlm8sX6xndPNAZrq + cfcIPVMxknfqPy2VqS4IrNC03pHkDKtokphBjVUlkiWsdcq+fHYbS2xL2d1Da/uN + hX/iwgo+v5gOF5xtaXx7D7L3Cf+MHb/MOXWPfYXNiTpSBVX8/Kx5RP+QLI16nWvw + lrijTlXZFR8NIZBrCo/QZ2cNbUAbN3R0n+/kMFubxBL8WEm6Qhi9jBjbJeDMspd8 + C+/TZJQMpx5vyA== + -----END CERTIFICATE----- + id: 13c562a1-191c-4464-9b18-e5222b46035b + key: | + -----BEGIN PRIVATE KEY----- + MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCo/9q9QF6Pcftg + rK3dEh26Z87lvsWKoLHfmAPWa2TVe0mRkm2mcprETM/MIOTiFIlIpNhjNe+Pf5WL + 6IyxUrQT8vVGP4HfvuX98C6eMR4iPiFNl0Pe6LVyhn8od+kZjXSg6jyzfARt0d+O + rP8tRjrpRby7YWJmVWBfbnx4qopnxA0m07e/T+Qt19EcP2nytRoxxCTwgf15GepZ + HBMi+i6mSOaAYoA6mvYSP51i8RM35vKYKLIkt/KfUwIo5TpKZrV9qdm9aZLZTSMt + 68bKo+iMpzfVnOxaVdTeB6Dyle70ENPIY8Fuln2p1bYWmiaLI1a9kwQidZbQJrG/ + uQdlT2FZAgMBAAECggEAVnyRcda2Tcy0K7ZTR9aUlie370VhDN/OB7JhDGNreAEf + FjuMl+kAoUL5+OpAmB6QXzfVcXhRv+s4GiCJl9nORINK2Id5rIqiYwF+qgBS/o0z + N+UYm8QVz6Va/9fV1/jXXd5h8Cygi58jPH32HTJaxbSlsHNXCy3YIx6E3q/QIueR + 6ZdSXPqMEqxEU19M9jW8UeiRFrpmcyYxVpfxYIY/+O9lYjSpaeLs7hZeCP9PqWXA + Sxz2CnHZ8BcsDxAyuoHoVw+kjMpUMvA3sD4lwkV8BAYzfLmQf6PR83SFNsrE8XYu + /8WnQuCuytcl8Zg55R6tGCvf6Wyyf+MDRPwv/43QMQKBgQDbqK9Dq54k+EHgSNnP + K6AhNjFd6aqcNC1kom/sSlWBnuA/BEqJMECr8S2dYvzONUPPfX5NNUjB4Vw3Qw7a + pUgKuCQoVpzpZs5m1bk78itWDtA84LjkXfdejnUXVw/aVxLCM5QV9aEkm/dEWWMI + P1WTYVoWoZCLlEE08q0AvZQcdQKBgQDE9ZCmc6ncmhnQftuRj5PnXG2a79MLCT61 + sCEBDVvkcUJVqbzwGRLwRkdIzLgvmiuP+SukHgyfr8/RXG99xEW/q7NDrtEcqfXP + 19QXwOIp5NwDnOXyAlXiyZ50fCE2tSo2wP485+NIhmKj5Zt6y/DL6Qbc5k73XmK4 + KX5Ej15k1QKBgQCc6KeiIFLMt+Ze78tfORue/dZP7p3oDUGr1Hk9AnCIMlSfz1Hr + I+Per17VQaOzLcttyYhSYNDDZld4RlezCkQnHBkAE7bs53pjbSJv1vLr+5L3GdQZ + laIiEoNEE/YIExEcVrne4eKlgyAj2/JpLszThcRTzD+z5UibKQs6LzJBDQKBgDVa + dAGzCUt57w48nwvyQdWFgydaWef+bB9Zg8c+MCtUxuxfm4/Kqwetcff1hNtYPv60 + N68weKj1Pi1vhcAi3+YJA/mMrJbAL5dK1uhMVreUiEjuQpfpLAzQIv1Y9sJUFwhY + BUbIZhgqVyQguZptDmCeUj6aoL9/sOxESTEXSTG1AoGBAMQ5iJZMsdLCERv0+6Y1 + F/t/YSW8cugB3vdV9jHZuosoprz48p92pYP8OdQc70H5hZt53hoYNgYFSd+MU6H1 + hJCaXTsiP4IUmBjiwzSp3o1ctP8lWvnyJpAadYdDhaDaAAoaMjCo9cm5OMwc8t8x + hwAPXV2cgWH8fPcT9NLAcwWk + -----END PRIVATE KEY----- + snis: + - name: demo1.example.com + - name: demo2.example.com + - name: demo3.example.com + tags: + - cloudops-managed +consumers: +- acls: + - group: foo-group + hmacauth_credentials: + - secret: yeNZBeqCuk0D3H85VX77Umacf91MwqRo + username: hmac-user + jwt_secrets: + - algorithm: HS256 + key: MKWeR0nu9OAUR9HrjpUG82Hbfz7ZXsIw + secret: 6gkrxTKAraykMSpmnLNEGiEE3Yz8XL6U + keyauth_credentials: + - key: iwb6Djkk4HhUlOCmLilDIKh6nZrn90ts + username: harry +plugins: +- config: + ai_metrics: false + bandwidth_metrics: false + latency_metrics: false + per_consumer: false + status_code_metrics: false + upstream_health_metrics: false + enabled: true + name: prometheus + protocols: + - http + - https +services: +- connect_timeout: 60000 + enabled: true + host: mockbin.org + name: svc1 + port: 80 + protocol: http + read_timeout: 60000 + retries: 5 + routes: + - https_redirect_status_code: 301 + name: r1 + path_handling: v0 + paths: + - /r1 + preserve_host: false + protocols: + - http + - https + regex_priority: 0 + request_buffering: true + response_buffering: true + strip_path: true + tags: + - team-svc1 + write_timeout: 60000 +- connect_timeout: 60000 + enabled: true + host: mockbin.org + name: svc2 + port: 80 + protocol: http + read_timeout: 60000 + retries: 5 + routes: + - https_redirect_status_code: 301 + name: r2 + path_handling: v0 + paths: + - /r2 + preserve_host: false + protocols: + - http + - https + regex_priority: 0 + request_buffering: true + response_buffering: true + strip_path: true + write_timeout: 60000 +- connect_timeout: 60000 + enabled: true + host: mockbin.org + name: svc3 + port: 80 + protocol: http + read_timeout: 60000 + retries: 5 + routes: + - https_redirect_status_code: 301 + methods: + - GET + name: r3 + path_handling: v0 + paths: + - /r3 + preserve_host: false + protocols: + - http + - https + regex_priority: 0 + request_buffering: true + response_buffering: true + strip_path: true + write_timeout: 60000 +upstreams: +- algorithm: round-robin + hash_fallback: none + hash_on: none + hash_on_cookie_path: / + healthchecks: + active: + concurrency: 10 + healthy: + http_statuses: + - 200 + - 302 + interval: 0 + successes: 0 + http_path: / + https_verify_certificate: true + timeout: 1 + type: http + unhealthy: + http_failures: 0 + http_statuses: + - 429 + - 404 + - 500 + - 501 + - 502 + - 503 + - 504 + - 505 + interval: 0 + tcp_failures: 0 + timeouts: 0 + passive: + healthy: + http_statuses: + - 200 + - 201 + - 202 + - 203 + - 204 + - 205 + - 206 + - 207 + - 208 + - 226 + - 300 + - 301 + - 302 + - 303 + - 304 + - 305 + - 306 + - 307 + - 308 + successes: 0 + type: http + unhealthy: + http_failures: 0 + http_statuses: + - 429 + - 500 + - 503 + tcp_failures: 0 + timeouts: 0 + threshold: 0 + name: upstream1 + slots: 10000 + targets: + - target: 198.51.100.11:80 + weight: 100 + - target: 198.51.100.12:80 + weight: 100 + - target: 198.51.100.13:80 + weight: 100 + use_srv_name: false diff --git a/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip-381.yaml b/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip-381.yaml new file mode 100644 index 000000000..3a82a3f0d --- /dev/null +++ b/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip-381.yaml @@ -0,0 +1,64 @@ +_format_version: "3.0" +consumer_groups: +- name: basic + plugins: + - config: + consumer_groups: null + dictionary_name: kong_rate_limiting_counters + disable_penalty: false + enforce_consumer_groups: false + error_code: 429 + error_message: API rate limit exceeded + header_name: null + hide_client_headers: false + identifier: consumer + limit: + - 30000 + namespace: basic + path: null + redis: + cluster_addresses: null + cluster_max_redirections: 5 + cluster_nodes: null + connect_timeout: 2000 + connection_is_proxied: false + database: 0 + host: 127.0.0.1 + keepalive_backlog: null + keepalive_pool_size: 256 + password: null + port: 6379 + read_timeout: 2000 + send_timeout: 2000 + sentinel_addresses: null + sentinel_master: null + sentinel_nodes: null + sentinel_password: null + sentinel_role: null + sentinel_username: null + server_name: null + ssl: false + ssl_verify: false + timeout: 2000 + username: null + retry_after_jitter_max: 0 + strategy: local + sync_rate: -1 + window_size: + - 2628000 + window_type: sliding + name: rate-limiting-advanced +consumers: +- groups: + - name: basic + username: foo +services: +- connect_timeout: 60000 + enabled: true + host: mockbin.org + name: svc1 + port: 80 + protocol: http + read_timeout: 60000 + retries: 5 + write_timeout: 60000 From 3305886ffbbedac849e9352a10bf0dc6c7e12f2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 15:13:24 +0000 Subject: [PATCH 05/38] chore(deps): bump golangci/golangci-lint-action from 6.1.0 to 6.1.1 (#1411) Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.1.0 to 6.1.1. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v6.1.0...v6.1.1) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c1dd1fd0a..20e0f97a0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -38,7 +38,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version-file: go.mod - - uses: golangci/golangci-lint-action@v6.1.0 + - uses: golangci/golangci-lint-action@v6.1.1 build: timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }} From f8d3d2a972b4314c243a0d2e21520b6653662ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Thu, 7 Nov 2024 19:50:28 +0100 Subject: [PATCH 06/38] ci: add prealloc to linter rules (#1432) --- .golangci.yml | 1 + cmd/gateway_dump.go | 2 +- kong2kic/route.go | 2 +- kong2tf/generate_resource.go | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 5e40286e3..665e57207 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -27,6 +27,7 @@ linters: - nilerr - nolintlint - predeclared + - prealloc - revive - stylecheck - unconvert diff --git a/cmd/gateway_dump.go b/cmd/gateway_dump.go index 9e63931e1..f37e15ad6 100644 --- a/cmd/gateway_dump.go +++ b/cmd/gateway_dump.go @@ -30,7 +30,7 @@ func listWorkspaces(ctx context.Context, client *kong.Client) ([]string, error) if err != nil { return nil, fmt.Errorf("fetching workspaces from Kong: %w", err) } - var res []string + res := make([]string, 0, len(workspaces)) for _, workspace := range workspaces { res = append(res, *workspace.Name) } diff --git a/kong2kic/route.go b/kong2kic/route.go index 0c014c7ea..2f71a463d 100644 --- a/kong2kic/route.go +++ b/kong2kic/route.go @@ -87,7 +87,7 @@ func createIngressPaths( servicePort *int, pathType k8snetv1.PathType, ) []k8snetv1.HTTPIngressPath { - var paths []k8snetv1.HTTPIngressPath + paths := make([]k8snetv1.HTTPIngressPath, 0, len(route.Paths)) for _, path := range route.Paths { sCopy := *path if strings.HasPrefix(sCopy, "~") { diff --git a/kong2tf/generate_resource.go b/kong2tf/generate_resource.go index 1e293cfca..2e0fac1e0 100644 --- a/kong2tf/generate_resource.go +++ b/kong2tf/generate_resource.go @@ -219,7 +219,7 @@ func generateParents(parents map[string]string) string { return "" } - var result []string + result := make([]string, 0, len(parents)) for k, v := range parents { v = strings.ReplaceAll(v, "-", "_") // if parent ends with _id, use it as-is From 6e03802872b0be8fcdfc3fb398bea90a57f16586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Thu, 7 Nov 2024 20:48:03 +0100 Subject: [PATCH 07/38] fix: make terraform imports keys order deterministic (#1433) --- kong2tf/generate_resource.go | 51 +++++++++++++++++++++++++------ kong2tf/generate_resource_test.go | 8 +++-- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/kong2tf/generate_resource.go b/kong2tf/generate_resource.go index 2e0fac1e0..e212a862d 100644 --- a/kong2tf/generate_resource.go +++ b/kong2tf/generate_resource.go @@ -174,22 +174,55 @@ func generateImports( }`, entityType, name, generateImportKeys(keysFromEntity, cpID)) } -func generateImportKeys(keys map[string]*string, cpID *string) string { - if len(keys) == 0 { - return "" +type importKeys struct { + keyValues map[string]*string `json:"-"` + controlPlaneID *string `json:"-"` +} + +func (i importKeys) Marshal() (string, error) { + keys := make([]string, 0, len(i.keyValues)) + for k := range i.keyValues { + keys = append(keys, k) + } + sort.Strings(keys) + + var sb strings.Builder + if err := sb.WriteByte('{'); err != nil { + return "", err + } + for _, k := range keys { + _, err := sb.WriteString(fmt.Sprintf(`\"%s\": \"%s\", `, k, *i.keyValues[k])) + if err != nil { + return "", err + } } - s := "{" - for k, val := range keys { - s += fmt.Sprintf(`\"%s\": \"%s\", `, k, *val) + _, err := sb.WriteString(fmt.Sprintf(`\"control_plane_id\": \"%s\"`, *i.controlPlaneID)) + if err != nil { + return "", err } - s += fmt.Sprintf(`\"control_plane_id\": \"%s\", `, *cpID) + if err := sb.WriteByte('}'); err != nil { + return "", err + } - s = strings.TrimRight(s, ", ") + return sb.String(), nil +} - s += "}" +func generateImportKeys(keys map[string]*string, cpID *string) string { + if len(keys) == 0 { + return "" + } + importKeys := importKeys{ + keyValues: keys, + controlPlaneID: cpID, + } + + s, err := importKeys.Marshal() + if err != nil { + panic(err) + } return s } diff --git a/kong2tf/generate_resource_test.go b/kong2tf/generate_resource_test.go index 146c83aaa..3dd604b3d 100644 --- a/kong2tf/generate_resource_test.go +++ b/kong2tf/generate_resource_test.go @@ -190,8 +190,10 @@ func TestImports(t *testing.T) { import { to = konnect_entity_type.name - id = "{\"id\": \"some_id\", \"field2_nested\": \"subkey\", \"control_plane_id\": \"abc-123\"}" -}` + id = "{\"field2_nested\": \"subkey\", \"id\": \"some_id\", \"control_plane_id\": \"abc-123\"}" +} + +` cpID := new(string) *cpID = "abc-123" @@ -203,5 +205,5 @@ import { "field2_nested": func() *string { s := "subkey"; return &s }(), }, }, []string{}) - require.Equal(t, strings.Fields(expected), strings.Fields(result)) + require.Equal(t, expected, result) } From c08d0392f6d3e40d51d4494dd1aba6750bc962ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 10:42:12 +0100 Subject: [PATCH 08/38] chore(deps): bump golang from 1.23.2 to 1.23.3 (#1434) Bumps golang from 1.23.2 to 1.23.3. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e3562724a..57735be7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.23.2 AS build +FROM golang:1.23.3 AS build WORKDIR /deck COPY go.mod ./ COPY go.sum ./ From aee62199d8435df3a37a62d79f4f11ff2dfb05b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 11:08:57 +0100 Subject: [PATCH 09/38] chore(deps): bump alpine from 3.20.2 to 3.20.3 (#1393) Bumps alpine from 3.20.2 to 3.20.3. --- updated-dependencies: - dependency-name: alpine dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 57735be7f..3d7568a10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ ARG TAG RUN CGO_ENABLED=0 GOOS=linux go build -o deck \ -ldflags "-s -w -X github.com/kong/deck/cmd.VERSION=$TAG -X github.com/kong/deck/cmd.COMMIT=$COMMIT" -FROM alpine:3.20.2 +FROM alpine:3.20.3 RUN adduser --disabled-password --gecos "" deckuser RUN apk --no-cache add ca-certificates jq USER deckuser From 50699b60dea83ca8ccdf315b01bca51686b494b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:32:39 +0100 Subject: [PATCH 10/38] chore(deps): bump k8s.io/apimachinery from 0.31.0 to 0.31.2 (#1425) Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.31.0 to 0.31.2. - [Commits](https://github.com/kubernetes/apimachinery/compare/v0.31.0...v0.31.2) --- updated-dependencies: - dependency-name: k8s.io/apimachinery dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6f6b7e55e..72311989b 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( golang.org/x/sync v0.8.0 k8s.io/api v0.31.0 k8s.io/apiextensions-apiserver v0.31.0 - k8s.io/apimachinery v0.31.0 + k8s.io/apimachinery v0.31.2 k8s.io/client-go v0.31.0 k8s.io/code-generator v0.31.0 sigs.k8s.io/gateway-api v1.1.0 diff --git a/go.sum b/go.sum index e22413bb0..9b0867003 100644 --- a/go.sum +++ b/go.sum @@ -664,8 +664,8 @@ k8s.io/api v0.31.0 h1:b9LiSjR2ym/SzTOlfMHm1tr7/21aD7fSkqgD/CVJBCo= k8s.io/api v0.31.0/go.mod h1:0YiFF+JfFxMM6+1hQei8FY8M7s1Mth+z/q7eF1aJkTE= k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= -k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= -k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= +k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= k8s.io/cli-runtime v0.30.1 h1:kSBBpfrJGS6lllc24KeniI9JN7ckOOJKnmFYH1RpTOw= k8s.io/cli-runtime v0.30.1/go.mod h1:zhHgbqI4J00pxb6gM3gJPVf2ysDjhQmQtnTxnMScab8= k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= From 04bda87831db606e1604aed6f96061dab68a2dd7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:03:46 +0100 Subject: [PATCH 11/38] chore(deps): bump k8s.io/api from 0.31.0 to 0.31.2 (#1426) Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.31.0 to 0.31.2. - [Commits](https://github.com/kubernetes/api/compare/v0.31.0...v0.31.2) --- updated-dependencies: - dependency-name: k8s.io/api dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 72311989b..949829197 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 golang.org/x/sync v0.8.0 - k8s.io/api v0.31.0 + k8s.io/api v0.31.2 k8s.io/apiextensions-apiserver v0.31.0 k8s.io/apimachinery v0.31.2 k8s.io/client-go v0.31.0 diff --git a/go.sum b/go.sum index 9b0867003..660cac851 100644 --- a/go.sum +++ b/go.sum @@ -660,8 +660,8 @@ gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= 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.31.0 h1:b9LiSjR2ym/SzTOlfMHm1tr7/21aD7fSkqgD/CVJBCo= -k8s.io/api v0.31.0/go.mod h1:0YiFF+JfFxMM6+1hQei8FY8M7s1Mth+z/q7eF1aJkTE= +k8s.io/api v0.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0= +k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk= k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= From 38e644929ea44af5526a9741305146aef99ab888 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:24:39 +0100 Subject: [PATCH 12/38] chore(deps): bump github.com/kong/kubernetes-ingress-controller/v3 (#1386) Bumps [github.com/kong/kubernetes-ingress-controller/v3](https://github.com/kong/kubernetes-ingress-controller) from 3.2.4 to 3.3.1. - [Release notes](https://github.com/kong/kubernetes-ingress-controller/releases) - [Changelog](https://github.com/Kong/kubernetes-ingress-controller/blob/main/CHANGELOG.md) - [Commits](https://github.com/kong/kubernetes-ingress-controller/compare/v3.2.4...v3.3.1) --- updated-dependencies: - dependency-name: github.com/kong/kubernetes-ingress-controller/v3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 32 +++++++++++----------- go.sum | 84 ++++++++++++++++++++++++++++------------------------------ 2 files changed, 56 insertions(+), 60 deletions(-) diff --git a/go.mod b/go.mod index 949829197..889d39e81 100644 --- a/go.mod +++ b/go.mod @@ -33,23 +33,21 @@ require ( require ( github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect - github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect github.com/avast/retry-go/v4 v4.6.0 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/buger/jsonparser v1.1.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect - github.com/distribution/reference v0.5.0 // indirect - github.com/docker/docker v26.1.5+incompatible // indirect + github.com/distribution/reference v0.6.0 // indirect + github.com/docker/docker v27.1.2+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.12.0 // indirect - github.com/evanphx/json-patch v5.9.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect github.com/fatih/camelcase v1.0.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/fvbommel/sortorder v1.1.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-errors/errors v1.4.2 // indirect github.com/google/btree v1.1.2 // indirect @@ -81,7 +79,7 @@ require ( github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pkg/errors v0.9.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sethvargo/go-password v0.3.0 // indirect + github.com/sethvargo/go-password v0.3.1 // indirect github.com/shirou/gopsutil/v3 v3.24.5 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/ssgelm/cookiejarparser v1.0.1 // indirect @@ -94,18 +92,18 @@ require ( go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect - go4.org/netipx v0.0.0-20230728184502-ec4c8b891b28 // indirect - golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/time v0.5.0 // indirect + go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect + golang.org/x/oauth2 v0.22.0 // indirect + golang.org/x/time v0.6.0 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/cli-runtime v0.30.1 // indirect + k8s.io/cli-runtime v0.31.0 // indirect k8s.io/component-base v0.31.0 // indirect k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect - k8s.io/kubectl v0.30.1 // indirect - sigs.k8s.io/kind v0.23.0 // indirect - sigs.k8s.io/kustomize/api v0.17.2 // indirect - sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect + k8s.io/kubectl v0.31.0 // indirect + sigs.k8s.io/kind v0.24.0 // indirect + sigs.k8s.io/kustomize/api v0.17.3 // indirect + sigs.k8s.io/kustomize/kyaml v0.17.2 // indirect ) require ( @@ -147,8 +145,8 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kong/go-slugify v1.0.0 // indirect - github.com/kong/kubernetes-ingress-controller/v3 v3.2.4 - github.com/kong/kubernetes-testing-framework v0.47.1 + github.com/kong/kubernetes-ingress-controller/v3 v3.3.1 + github.com/kong/kubernetes-testing-framework v0.47.2 github.com/kong/semver/v4 v4.0.1 // indirect github.com/lithammer/fuzzysearch v1.1.8 // indirect github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect @@ -200,7 +198,7 @@ require ( k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect - sigs.k8s.io/controller-runtime v0.18.4 // indirect + sigs.k8s.io/controller-runtime v0.19.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) diff --git a/go.sum b/go.sum index 660cac851..acf303e1f 100644 --- a/go.sum +++ b/go.sum @@ -29,8 +29,8 @@ github.com/MarvinJWendt/testza v0.3.0/go.mod h1:eFcL4I0idjtIx8P9C6KkAuLgATNKpX4/ github.com/MarvinJWendt/testza v0.4.2/go.mod h1:mSdhXiKH8sg/gQehJ63bINcCKp7RtYewEjXsvsVUPbE= github.com/MarvinJWendt/testza v0.5.2 h1:53KDo64C1z/h/d/stCYCPY69bt/OSwjq5KpFNwi+zB4= github.com/MarvinJWendt/testza v0.5.2/go.mod h1:xu53QFE5sCdjtMCKk8YMQ2MnymimEctc4n3EjyIYvEY= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= github.com/adrg/strutil v0.3.0 h1:bi/HB2zQbDihC8lxvATDTDzkT4bG7PATtVnDYp5rvq4= @@ -72,14 +72,14 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/daveshanley/vacuum v0.9.15 h1:QeSHYhbcB7x4chhOTsdxlZNBdipbFthusQkzeISplT0= github.com/daveshanley/vacuum v0.9.15/go.mod h1:xTTqOXVYJcEtvRe9YD07rhb0eK4zG6MRRjrmMadP5Kg= -github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= -github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0= github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/docker/docker v26.1.5+incompatible h1:NEAxTwEjxV6VbBMBoGG3zPqbiJosIApZjxlbrG9q3/g= -github.com/docker/docker v26.1.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v27.1.2+incompatible h1:AhGzR1xaQIy53qCkxARaFluI00WPGtXn0AJuoQsVYTY= +github.com/docker/docker v27.1.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -98,8 +98,6 @@ github.com/emicklei/go-restful/v3 v3.12.0 h1:y2DdzBAURM29NFF94q6RaY4vjIH1rtwDapw github.com/emicklei/go-restful/v3 v3.12.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= -github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwCFad8crR9dcMQWvV9Hvulu6hwUh4tWPJnM= @@ -116,8 +114,6 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/fvbommel/sortorder v1.1.0 h1:fUmoe+HLsBTctBDoaBwpQo5N+nrCp8g/BjKb/6ZQmYw= -github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -141,8 +137,8 @@ github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+Gr github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -253,10 +249,10 @@ github.com/kong/go-kong v0.59.1 h1:AJZtyCD+Zyqe/mF/m+x3/qN/GPVxAH7jq9zGJTHRfjc= github.com/kong/go-kong v0.59.1/go.mod h1:8Vt6HmtgLNgL/7bSwAlz3DIWqBtzG7qEt9+OnMiQOa0= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= github.com/kong/go-slugify v1.0.0/go.mod h1:dbR2h3J2QKXQ1k0aww6cN7o4cIcwlWflr6RKRdcoaiw= -github.com/kong/kubernetes-ingress-controller/v3 v3.2.4 h1:5QKzRMHWAePwa9HGj3xtvgridzeG72xd3BftDP+PcjU= -github.com/kong/kubernetes-ingress-controller/v3 v3.2.4/go.mod h1:kbbsyyNw/2HdURecav7iFcjAOtNXoUP5CfYFYJgiJq4= -github.com/kong/kubernetes-testing-framework v0.47.1 h1:BE2mQLC0Zj/NC5Y8B1Nm5VZymmrdVfu7cfwVKSobWtg= -github.com/kong/kubernetes-testing-framework v0.47.1/go.mod h1:9E53E99mlIGLgBU7R529X7IAUnVY8H1IqZecvGLZeco= +github.com/kong/kubernetes-ingress-controller/v3 v3.3.1 h1:uWlcwz5oAnVyUZdtDV9p2l9CdlHhLNTKey3AcHF/Jxs= +github.com/kong/kubernetes-ingress-controller/v3 v3.3.1/go.mod h1:2CBAJ7/J+FyAFn7Y8OLoTO3ApM+qiGIgNLbCyy98Vqk= +github.com/kong/kubernetes-testing-framework v0.47.2 h1:+2Z9anTpbV/hwNeN+NFQz53BMU+g3QJydkweBp3tULo= +github.com/kong/kubernetes-testing-framework v0.47.2/go.mod h1:DJ5btl/srdIM03tg3f+jS9Izu7xkRkciAM69Ptqun1I= github.com/kong/semver/v4 v4.0.1 h1:DIcNR8W3gfx0KabFBADPalxxsp+q/5COwIFkkhrFQ2Y= github.com/kong/semver/v4 v4.0.1/go.mod h1:LImQ0oT15pJvSns/hs2laLca2zcYoHu5EsSNY0J6/QA= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -270,6 +266,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= +github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY= +github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4= github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4= github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a h1:N9zuLhTvBSRt0gWSiJswwQ2HqDmtX/ZCDJURnKUt1Ik= @@ -380,8 +378,8 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPO github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/sethvargo/go-password v0.3.0 h1:OLFHZ91Z7NiNP3dnaPxLxCDXlb6TBuxFzMvv6bu+Ptw= -github.com/sethvargo/go-password v0.3.0/go.mod h1:p6we8DZ0eyYXof9pon7Cqrw98N4KTaYiadDml1dUEEw= +github.com/sethvargo/go-password v0.3.1 h1:WqrLTjo7X6AcVYfC6R7GtSyuUQR9hGyAj/f1PYQZCJU= +github.com/sethvargo/go-password v0.3.1/go.mod h1:rXofC1zT54N7R8K/h1WDUdkf9BOx5OptoxrMBcrXzvs= github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI= github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= @@ -467,8 +465,8 @@ go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 h1:FyjCyI9jVEfqhUh2MoSkmolPjfh5fp2hnV0b0irxH4Q= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0/go.mod h1:hYwym2nDEeZfG/motx0p7L7J1N1vyzIThemQsb4g2qY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 h1:j9+03ymgYhPKmeXGk5Zu+cIZOlVzd9Zv7QIiyItjFBU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0/go.mod h1:Y5+XiUG4Emn1hTfciPzGPJaSI+RpDts6BnCIir0SLqk= go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= @@ -485,8 +483,8 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -go4.org/netipx v0.0.0-20230728184502-ec4c8b891b28 h1:zLxFnORHDFTSkJPawMU7LzsuGQJ4MUFS653jJHpORow= -go4.org/netipx v0.0.0-20230728184502-ec4c8b891b28/go.mod h1:TQvodOM+hJTioNQJilmLXu08JNb8i+ccq418+KWu1/Y= +go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= +go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= 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= @@ -522,8 +520,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -583,8 +581,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -608,10 +606,10 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -656,8 +654,8 @@ gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= -gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= 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.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0= @@ -666,8 +664,8 @@ k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24 k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/cli-runtime v0.30.1 h1:kSBBpfrJGS6lllc24KeniI9JN7ckOOJKnmFYH1RpTOw= -k8s.io/cli-runtime v0.30.1/go.mod h1:zhHgbqI4J00pxb6gM3gJPVf2ysDjhQmQtnTxnMScab8= +k8s.io/cli-runtime v0.31.0 h1:V2Q1gj1u3/WfhD475HBQrIYsoryg/LrhhK4RwpN+DhA= +k8s.io/cli-runtime v0.31.0/go.mod h1:vg3H94wsubuvWfSmStDbekvbla5vFGC+zLWqcf+bGDw= k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= k8s.io/code-generator v0.31.0 h1:w607nrMi1KeDKB3/F/J4lIoOgAwc+gV9ZKew4XRfMp8= @@ -680,22 +678,22 @@ k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f h1:0LQagt0gDpKqvIkAMPaRGcXawNMouPECM1+F9BVxEaM= k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f/go.mod h1:S9tOR0FxgyusSNR+MboCuiDpVWkAifZvaYI1Q2ubgro= -k8s.io/kubectl v0.30.1 h1:sHFIRI3oP0FFZmBAVEE8ErjnTyXDPkBcvO88mH9RjuY= -k8s.io/kubectl v0.30.1/go.mod h1:7j+L0Cc38RYEcx+WH3y44jRBe1Q1jxdGPKkX0h4iDq0= +k8s.io/kubectl v0.31.0 h1:kANwAAPVY02r4U4jARP/C+Q1sssCcN/1p9Nk+7BQKVg= +k8s.io/kubectl v0.31.0/go.mod h1:pB47hhFypGsaHAPjlwrNbvhXgmuAr01ZBvAIIUaI8d4= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= -sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= +sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= +sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= sigs.k8s.io/gateway-api v1.1.0 h1:DsLDXCi6jR+Xz8/xd0Z1PYl2Pn0TyaFMOPPZIj4inDM= sigs.k8s.io/gateway-api v1.1.0/go.mod h1:ZH4lHrL2sDi0FHZ9jjneb8kKnGzFWyrTya35sWUTrRs= 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/kind v0.23.0 h1:8fyDGWbWTeCcCTwA04v4Nfr45KKxbSPH1WO9K+jVrBg= -sigs.k8s.io/kind v0.23.0/go.mod h1:ZQ1iZuJLh3T+O8fzhdi3VWcFTzsdXtNv2ppsHc8JQ7s= -sigs.k8s.io/kustomize/api v0.17.2 h1:E7/Fjk7V5fboiuijoZHgs4aHuexi5Y2loXlVOAVAG5g= -sigs.k8s.io/kustomize/api v0.17.2/go.mod h1:UWTz9Ct+MvoeQsHcJ5e+vziRRkwimm3HytpZgIYqye0= -sigs.k8s.io/kustomize/kyaml v0.17.1 h1:TnxYQxFXzbmNG6gOINgGWQt09GghzgTP6mIurOgrLCQ= -sigs.k8s.io/kustomize/kyaml v0.17.1/go.mod h1:9V0mCjIEYjlXuCdYsSXvyoy2BTsLESH7TlGV81S282U= +sigs.k8s.io/kind v0.24.0 h1:g4y4eu0qa+SCeKESLpESgMmVFBebL0BDa6f777OIWrg= +sigs.k8s.io/kind v0.24.0/go.mod h1:t7ueEpzPYJvHA8aeLtI52rtFftNgUYUaCwvxjk7phfw= +sigs.k8s.io/kustomize/api v0.17.3 h1:6GCuHSsxq7fN5yhF2XrC+AAr8gxQwhexgHflOAD/JJU= +sigs.k8s.io/kustomize/api v0.17.3/go.mod h1:TuDH4mdx7jTfK61SQ/j1QZM/QWR+5rmEiNjvYlhzFhc= +sigs.k8s.io/kustomize/kyaml v0.17.2 h1:+AzvoJUY0kq4QAhH/ydPHHMRLijtUKiyVyh7fOSshr0= +sigs.k8s.io/kustomize/kyaml v0.17.2/go.mod h1:9V0mCjIEYjlXuCdYsSXvyoy2BTsLESH7TlGV81S282U= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= From 5cdea5db9d0f6e8bb8c9cc9c46bd2106cc1fc4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Nowak?= Date: Fri, 22 Nov 2024 15:32:44 +0100 Subject: [PATCH 13/38] fix(tests): add `lock_dictionary_name` to expected Konnect state (#1449) * fix(tests): add `lock_dictionary_name` to expected Konnect state * chore(lint): remove ignoring gosec --- kong2kic/route.go | 1 - tests/integration/sync_test.go | 167 +++++++++++++++++- .../expected-no-skip_konnect.yaml | 1 + 3 files changed, 167 insertions(+), 2 deletions(-) diff --git a/kong2kic/route.go b/kong2kic/route.go index 2f71a463d..5f8796d9b 100644 --- a/kong2kic/route.go +++ b/kong2kic/route.go @@ -103,7 +103,6 @@ func createIngressPaths( if *servicePort > 65535 || *servicePort < 0 { log.Fatalf("Port %d is not within the valid range. Please provide a port between 0 and 65535.\n", *servicePort) } - //nolint: gosec backend.Service.Port.Number = int32(*servicePort) } paths = append(paths, k8snetv1.HTTPIngressPath{ diff --git a/tests/integration/sync_test.go b/tests/integration/sync_test.go index 7e9aa39dd..746de8f0e 100644 --- a/tests/integration/sync_test.go +++ b/tests/integration/sync_test.go @@ -1390,6 +1390,171 @@ var ( }, } + consumerGroupScopedPluginsKonnect = []*kong.Plugin{ + { + Name: kong.String("rate-limiting-advanced"), + ConsumerGroup: &kong.ConsumerGroup{ + ID: kong.String("77e6691d-67c0-446a-9401-27be2b141aae"), + }, + Config: kong.Configuration{ + "consumer_groups": nil, + "dictionary_name": string("kong_rate_limiting_counters"), + "disable_penalty": bool(false), + "enforce_consumer_groups": bool(false), + "error_code": float64(429), + "error_message": string("API rate limit exceeded"), + "header_name": nil, + "hide_client_headers": bool(false), + "identifier": string("consumer"), + "limit": []any{float64(10)}, + "lock_dictionary_name": string("kong_locks"), + "namespace": string("gold"), + "path": nil, + "redis": map[string]any{ + "cluster_addresses": nil, + "connect_timeout": nil, + "database": float64(0), + "host": nil, + "keepalive_backlog": nil, + "keepalive_pool_size": float64(256), + "password": nil, + "port": nil, + "read_timeout": nil, + "send_timeout": nil, + "sentinel_addresses": nil, + "sentinel_master": nil, + "sentinel_password": nil, + "sentinel_role": nil, + "sentinel_username": nil, + "server_name": nil, + "ssl": false, + "ssl_verify": false, + "timeout": float64(2000), + "username": nil, + }, + "retry_after_jitter_max": float64(1), + "strategy": string("local"), + "sync_rate": float64(-1), + "window_size": []any{float64(60)}, + "window_type": string("sliding"), + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")}, + }, + { + Name: kong.String("rate-limiting-advanced"), + ConsumerGroup: &kong.ConsumerGroup{ + ID: kong.String("5bcbd3a7-030b-4310-bd1d-2721ff85d236"), + }, + Config: kong.Configuration{ + "consumer_groups": nil, + "dictionary_name": string("kong_rate_limiting_counters"), + "disable_penalty": bool(false), + "enforce_consumer_groups": bool(false), + "error_code": float64(429), + "error_message": string("API rate limit exceeded"), + "header_name": nil, + "hide_client_headers": bool(false), + "identifier": string("consumer"), + "limit": []any{float64(7)}, + "lock_dictionary_name": string("kong_locks"), + "namespace": string("silver"), + "path": nil, + "redis": map[string]any{ + "cluster_addresses": nil, + "connect_timeout": nil, + "database": float64(0), + "host": nil, + "keepalive_backlog": nil, + "keepalive_pool_size": float64(256), + "password": nil, + "port": nil, + "read_timeout": nil, + "send_timeout": nil, + "sentinel_addresses": nil, + "sentinel_master": nil, + "sentinel_password": nil, + "sentinel_role": nil, + "sentinel_username": nil, + "server_name": nil, + "ssl": false, + "ssl_verify": false, + "timeout": float64(2000), + "username": nil, + }, + "retry_after_jitter_max": float64(1), + "strategy": string("local"), + "sync_rate": float64(-1), + "window_size": []any{float64(60)}, + "window_type": string("sliding"), + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")}, + }, + { + Name: kong.String("rate-limiting-advanced"), + Config: kong.Configuration{ + "consumer_groups": nil, + "dictionary_name": string("kong_rate_limiting_counters"), + "disable_penalty": bool(false), + "enforce_consumer_groups": bool(false), + "error_code": float64(429), + "error_message": string("API rate limit exceeded"), + "header_name": nil, + "hide_client_headers": bool(false), + "identifier": string("consumer"), + "limit": []any{float64(5)}, + "lock_dictionary_name": string("kong_locks"), + "namespace": string("silver"), + "path": nil, + "redis": map[string]any{ + "cluster_addresses": nil, + "connect_timeout": nil, + "database": float64(0), + "host": nil, + "keepalive_backlog": nil, + "keepalive_pool_size": float64(256), + "password": nil, + "port": nil, + "read_timeout": nil, + "send_timeout": nil, + "sentinel_addresses": nil, + "sentinel_master": nil, + "sentinel_password": nil, + "sentinel_role": nil, + "sentinel_username": nil, + "server_name": nil, + "ssl": false, + "ssl_verify": false, + "timeout": float64(2000), + "username": nil, + }, + "retry_after_jitter_max": float64(1), + "strategy": string("local"), + "sync_rate": float64(-1), + "window_size": []any{float64(60)}, + "window_type": string("sliding"), + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")}, + }, + { + Name: kong.String("key-auth"), + Config: kong.Configuration{ + "anonymous": nil, + "hide_credentials": false, + "key_in_body": false, + "key_in_header": true, + "key_in_query": true, + "key_names": []interface{}{"apikey"}, + "realm": nil, // This is present on 3.7.x+ + "run_on_preflight": true, + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("http"), kong.String("https")}, + }, + } + consumerGroupScopedPlugins381x = []*kong.Plugin{ { Name: kong.String("rate-limiting-advanced"), @@ -5074,7 +5239,7 @@ func Test_Sync_ConsumerGroupsScopedPluginsKonnect(t *testing.T) { }, }, }, - Plugins: consumerGroupScopedPlugins37x, + Plugins: consumerGroupScopedPluginsKonnect, Services: svc1_207, Routes: route1_20x, KeyAuths: []*kong.KeyAuth{ diff --git a/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip_konnect.yaml b/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip_konnect.yaml index 428ccf1d9..aea340bc6 100644 --- a/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip_konnect.yaml +++ b/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip_konnect.yaml @@ -16,6 +16,7 @@ consumer_groups: identifier: consumer limit: - 30000 + lock_dictionary_name: kong_locks namespace: basic path: null redis: From 07aa9ffc5225297beaf2e34b3b3be4d818fb4463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Nowak?= Date: Sun, 24 Nov 2024 05:40:25 +0100 Subject: [PATCH 14/38] chore(deps): bump go-database-reconciler and go-kong (#1439) Bumps [github.com/Kong/go-kong](https://github.com/Kong/go-kong/) from v0.59.1 to v0.60.0 Bumps [github.com/Kong/go-database-reconciler](https://github.com/Kong/go-database-reconciler/) from v1.15.0 to v1.16.0 --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 889d39e81..f77a13c5d 100644 --- a/go.mod +++ b/go.mod @@ -13,8 +13,8 @@ require ( github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.39 - github.com/kong/go-database-reconciler v1.15.0 - github.com/kong/go-kong v0.59.1 + github.com/kong/go-database-reconciler v1.16.0 + github.com/kong/go-kong v0.60.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 @@ -25,7 +25,7 @@ require ( k8s.io/apiextensions-apiserver v0.31.0 k8s.io/apimachinery v0.31.2 k8s.io/client-go v0.31.0 - k8s.io/code-generator v0.31.0 + k8s.io/code-generator v0.31.2 sigs.k8s.io/gateway-api v1.1.0 sigs.k8s.io/yaml v1.4.0 ) @@ -172,7 +172,7 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/tidwall/gjson v1.17.3 // indirect + github.com/tidwall/gjson v1.18.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect diff --git a/go.sum b/go.sum index acf303e1f..4b0a7e3e6 100644 --- a/go.sum +++ b/go.sum @@ -243,10 +243,10 @@ github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/q github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kong/go-apiops v0.1.39 h1:OXUzHb6tyZ+bb1xWzpPvmZK7FNk4xtrcka8d0bRTQkI= github.com/kong/go-apiops v0.1.39/go.mod h1:WghIt61r2b+HaeGVNWCd+aswTMHIjeP3GYK09/yYWA8= -github.com/kong/go-database-reconciler v1.15.0 h1:5F5Zzp2H14aiDmqWUCaU4+LGR/lGnvhwBTmtr3N6RZQ= -github.com/kong/go-database-reconciler v1.15.0/go.mod h1:T5BkBw13PZWub3y2jKAoM7fYD+UmXp2iNqj1YqD0L90= -github.com/kong/go-kong v0.59.1 h1:AJZtyCD+Zyqe/mF/m+x3/qN/GPVxAH7jq9zGJTHRfjc= -github.com/kong/go-kong v0.59.1/go.mod h1:8Vt6HmtgLNgL/7bSwAlz3DIWqBtzG7qEt9+OnMiQOa0= +github.com/kong/go-database-reconciler v1.16.0 h1:GWZUzfIt+TgQdoQL8kAnBwCk3HAQ1gYOeTm1wvmHDWk= +github.com/kong/go-database-reconciler v1.16.0/go.mod h1:7CGvStUvUOmUnodUFsWcW3PX2bJgnaKClJ/yhNGEVIE= +github.com/kong/go-kong v0.60.0 h1:CVrLXRLVE+Gl4IZ3tdvpO7xNDz3c9YLTmra/HvT4oM8= +github.com/kong/go-kong v0.60.0/go.mod h1:t1eMY8GRS6778uQNzxgzRgnA3YKBXSZOEvYbNocH/aA= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= github.com/kong/go-slugify v1.0.0/go.mod h1:dbR2h3J2QKXQ1k0aww6cN7o4cIcwlWflr6RKRdcoaiw= github.com/kong/kubernetes-ingress-controller/v3 v3.3.1 h1:uWlcwz5oAnVyUZdtDV9p2l9CdlHhLNTKey3AcHF/Jxs= @@ -419,8 +419,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tidwall/gjson v1.17.3 h1:bwWLZU7icoKRG+C+0PNwIKC6FCJO/Q3p2pZvuP0jN94= -github.com/tidwall/gjson v1.17.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= +github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= @@ -668,8 +668,8 @@ k8s.io/cli-runtime v0.31.0 h1:V2Q1gj1u3/WfhD475HBQrIYsoryg/LrhhK4RwpN+DhA= k8s.io/cli-runtime v0.31.0/go.mod h1:vg3H94wsubuvWfSmStDbekvbla5vFGC+zLWqcf+bGDw= k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= -k8s.io/code-generator v0.31.0 h1:w607nrMi1KeDKB3/F/J4lIoOgAwc+gV9ZKew4XRfMp8= -k8s.io/code-generator v0.31.0/go.mod h1:84y4w3es8rOJOUUP1rLsIiGlO1JuEaPFXQPA9e/K6U0= +k8s.io/code-generator v0.31.2 h1:xLWxG0HEpMSHfcM//3u3Ro2Hmc6AyyLINQS//Z2GEOI= +k8s.io/code-generator v0.31.2/go.mod h1:eEQHXgBU/m7LDaToDoiz3t97dUUVyOblQdwOr8rivqc= k8s.io/component-base v0.31.0 h1:/KIzGM5EvPNQcYgwq5NwoQBaOlVFrghoVGr8lG6vNRs= k8s.io/component-base v0.31.0/go.mod h1:TYVuzI1QmN4L5ItVdMSXKvH7/DtvIuas5/mm8YT3rTo= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= From 63dc5b486d9d45cf66d608920ac4849b99fc5cd9 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Mon, 25 Nov 2024 12:30:23 +0530 Subject: [PATCH 15/38] chore: updated go-database-reconciler to v1.16.1 (#1451) * chore: updated go-database-reconciler to v1.16.1 * chore: prep for release deck 1.41.3 --- CHANGELOG.md | 14 ++++++++++++++ README.md | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34cbe367b..341b793e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.41.3](#v1413) - [v1.41.2](#v1412) - [v1.41.1](#v1411) - [v1.41.0](#v1410) @@ -99,6 +100,18 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.41.3] +> Release date: 2024/11/25 + +### Fixes +- Updated Konnect authentication logic to properly handle geo rewrites. +[#1451](https://github.com/Kong/deck/pull/1451) +[go-database-reconciler #146](https://github.com/Kong/go-database-reconciler/pull/146) +- Fixed false diffs for gateway by clearing unmatching deprecated fields from +plugin schemas. [#1451](https://github.com/Kong/deck/pull/1451) +[go-database-reconciler #145](https://github.com/Kong/go-database-reconciler/pull/145) +[go-kong #473](https://github.com/Kong/go-kong/pull/473) + ## [v1.41.2] > Release date: 2024/11/06 @@ -1854,6 +1867,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.41.3]: https://github.com/Kong/deck/compare/v1.41.2...v1.41.3 [v1.41.2]: https://github.com/Kong/deck/compare/v1.41.1...v1.41.2 [v1.41.1]: https://github.com/Kong/deck/compare/v1.40.0...v1.41.1 [v1.41.0]: https://github.com/Kong/deck/compare/v1.40.3...v1.41.0 diff --git a/README.md b/README.md index f575f8c47..356bbba30 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ the GitHub [release page](https://github.com/kong/deck/releases) or install by downloading the binary: ```shell -$ curl -sL https://github.com/kong/deck/releases/download/v1.41.2/deck_1.41.2_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.41.3/deck_1.41.3_linux_amd64.tar.gz -o deck.tar.gz $ tar -xf deck.tar.gz -C /tmp $ sudo cp /tmp/deck /usr/local/bin/ ``` @@ -84,7 +84,7 @@ If you are on Windows, you can download the binary from the GitHub [release page](https://github.com/kong/deck/releases) or via PowerShell: ```shell -$ curl -sL https://github.com/kong/deck/releases/download/v1.41.2/deck_1.41.2_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.41.3/deck_1.41.3_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ``` diff --git a/go.mod b/go.mod index f77a13c5d..bd8450d1f 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.39 - github.com/kong/go-database-reconciler v1.16.0 + github.com/kong/go-database-reconciler v1.16.1 github.com/kong/go-kong v0.60.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.1 diff --git a/go.sum b/go.sum index 4b0a7e3e6..d76c0dea6 100644 --- a/go.sum +++ b/go.sum @@ -243,8 +243,8 @@ github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/q github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kong/go-apiops v0.1.39 h1:OXUzHb6tyZ+bb1xWzpPvmZK7FNk4xtrcka8d0bRTQkI= github.com/kong/go-apiops v0.1.39/go.mod h1:WghIt61r2b+HaeGVNWCd+aswTMHIjeP3GYK09/yYWA8= -github.com/kong/go-database-reconciler v1.16.0 h1:GWZUzfIt+TgQdoQL8kAnBwCk3HAQ1gYOeTm1wvmHDWk= -github.com/kong/go-database-reconciler v1.16.0/go.mod h1:7CGvStUvUOmUnodUFsWcW3PX2bJgnaKClJ/yhNGEVIE= +github.com/kong/go-database-reconciler v1.16.1 h1:qcQzEuMGfpNjx3UgulBOKulKA+upmHwqw4dy6TMEV7A= +github.com/kong/go-database-reconciler v1.16.1/go.mod h1:7CGvStUvUOmUnodUFsWcW3PX2bJgnaKClJ/yhNGEVIE= github.com/kong/go-kong v0.60.0 h1:CVrLXRLVE+Gl4IZ3tdvpO7xNDz3c9YLTmra/HvT4oM8= github.com/kong/go-kong v0.60.0/go.mod h1:t1eMY8GRS6778uQNzxgzRgnA3YKBXSZOEvYbNocH/aA= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= From 43eef0607c658738248f8f33e71f4b5465e912f8 Mon Sep 17 00:00:00 2001 From: Jakub Warczarek Date: Tue, 26 Nov 2024 18:30:20 +0100 Subject: [PATCH 16/38] chore(deps): import kubernetes-configuration instead of KIC (#1450) --- .golangci.yml | 193 ++++++++++++++++--------------- go.mod | 16 +-- go.sum | 44 +++---- kong2kic/consumer.go | 4 +- kong2kic/consumer_credentials.go | 24 ++-- kong2kic/consumer_group.go | 12 +- kong2kic/global_plugin.go | 10 +- kong2kic/route.go | 6 +- kong2kic/types.go | 24 ++-- kong2kic/upstream.go | 44 +++---- kong2kic/utils.go | 8 +- 11 files changed, 206 insertions(+), 179 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 665e57207..0c36d0465 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,108 +1,119 @@ run: timeout: 10m build-tags: - - integration + - integration linters: enable: - - asciicheck - - dogsled - - durationcheck - - exhaustive - - copyloopvar - - gci - - goconst - - gofmt - - gofumpt - - goimports - - gomodguard - - gosec - - govet - - importas - - lll - - gosimple - - staticcheck - - unused - - misspell - - nakedret - - nilerr - - nolintlint - - predeclared - - prealloc - - revive - - stylecheck - - unconvert - - unparam - - wastedassign - - errorlint -issues: - max-same-issues: 0 - exclude-rules: - - linters: - - gosec - text: "weak cryptographic primitive" - path: "state/indexers/md5Indexer.*" - - linters: - - gosec - text: "TLS MinVersion too low" - path: "tests/integration/" - - linters: - - gosec - text: "weak random number generator" - path: _test\.go - - linters: - - errcheck - text: "Error return value" # ignore err not checked in test files - path: _test\.go - - linters: + - asciicheck + - dogsled + - durationcheck + - exhaustive + - copyloopvar + - gci + - goconst + - gofmt + - gofumpt + - goimports + - gomodguard - gosec - text: "Expect WriteFile permissions to be 0600 or less" - path: file/codegen/main.go - # ignore unused warnings in test utils files - - linters: + - govet + - importas + - lll + - gosimple + - staticcheck - unused + - misspell + - nakedret + - nilerr + - nolintlint + - predeclared + - prealloc + - revive + - stylecheck + - unconvert - unparam - path: test_.* - # ignore SA1019 deprecation warning - - linters: - - staticcheck - text: "SA1019: rand..*" - # ignore formatting warnings in cmd/root.go due to nolint statements - - linters: - - gofumpt - text: "File is not `gofumpt`-ed" - path: cmd/root.go - - linters: - - gofmt - text: "File is not `gofmt`-ed with `-s`" - path: cmd/root.go - - linters: - - goimports - text: "File is not `goimports`-ed" - path: cmd/root.go + - wastedassign + - errorlint +issues: + max-same-issues: 0 + exclude-rules: + - linters: + - gosec + text: "weak cryptographic primitive" + path: "state/indexers/md5Indexer.*" + - linters: + - gosec + text: "TLS MinVersion too low" + path: "tests/integration/" + - linters: + - gosec + text: "weak random number generator" + path: _test\.go + - linters: + - errcheck + text: "Error return value" # ignore err not checked in test files + path: _test\.go + - linters: + - gosec + text: "Expect WriteFile permissions to be 0600 or less" + path: file/codegen/main.go + # ignore unused warnings in test utils files + - linters: + - unused + - unparam + path: test_.* + # ignore SA1019 deprecation warning + - linters: + - staticcheck + text: "SA1019: rand..*" + # ignore formatting warnings in cmd/root.go due to nolint statements + - linters: + - gofumpt + text: "File is not `gofumpt`-ed" + path: cmd/root.go + - linters: + - gofmt + text: "File is not `gofmt`-ed with `-s`" + path: cmd/root.go + - linters: + - goimports + text: "File is not `goimports`-ed" + path: cmd/root.go linters-settings: gci: sections: - - standard - - default + - standard + - default goconst: min-occurrences: 10 gomodguard: blocked: modules: - - github.com/ghodss/yaml: - recommendations: - - sigs.k8s.io/yaml - - gopkg.in/yaml.v2: - recommendations: - - sigs.k8s.io/yaml - - gopkg.in/yaml.v3: - recommendations: - - sigs.k8s.io/yaml - - github.com/pkg/errors: - recommendations: - - fmt - - errors - - golang.org/x/net/context: - recommendations: - - context + - github.com/ghodss/yaml: + recommendations: + - sigs.k8s.io/yaml + - gopkg.in/yaml.v2: + recommendations: + - sigs.k8s.io/yaml + - gopkg.in/yaml.v3: + recommendations: + - sigs.k8s.io/yaml + - github.com/pkg/errors: + recommendations: + - fmt + - errors + - golang.org/x/net/context: + recommendations: + - context + - github.com/kong/kubernetes-ingress-controller/v3: + recommendations: + - github.com/kong/kubernetes-configuration + - github.com/kong/gateway-operator: + recommendations: + - github.com/kong/kubernetes-configuration + importas: + no-unaliased: true + alias: + - pkg: github.com/kong/kubernetes-configuration/api/configuration/(v[\w\d]+) + alias: configuration${1} diff --git a/go.mod b/go.mod index bd8450d1f..3db19f98e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/kong/deck -go 1.23.0 +go 1.23.2 replace github.com/yudai/gojsondiff v1.0.0 => github.com/Kong/gojsondiff v1.3.0 @@ -22,16 +22,17 @@ require ( github.com/stretchr/testify v1.9.0 golang.org/x/sync v0.8.0 k8s.io/api v0.31.2 - k8s.io/apiextensions-apiserver v0.31.0 + k8s.io/apiextensions-apiserver v0.31.2 k8s.io/apimachinery v0.31.2 - k8s.io/client-go v0.31.0 + k8s.io/client-go v0.31.2 k8s.io/code-generator v0.31.2 - sigs.k8s.io/gateway-api v1.1.0 + sigs.k8s.io/gateway-api v1.2.0 sigs.k8s.io/yaml v1.4.0 ) require ( github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect + github.com/Kong/sdk-konnect-go v0.1.6 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/avast/retry-go/v4 v4.6.0 // indirect @@ -44,6 +45,7 @@ require ( github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.12.0 // indirect + github.com/ericlagergren/decimal v0.0.0-20240411145413-00de7ca16731 // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect github.com/fatih/camelcase v1.0.0 // indirect @@ -98,7 +100,7 @@ require ( gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/cli-runtime v0.31.0 // indirect - k8s.io/component-base v0.31.0 // indirect + k8s.io/component-base v0.31.2 // indirect k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect k8s.io/kubectl v0.31.0 // indirect sigs.k8s.io/kind v0.24.0 // indirect @@ -145,7 +147,7 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kong/go-slugify v1.0.0 // indirect - github.com/kong/kubernetes-ingress-controller/v3 v3.3.1 + github.com/kong/kubernetes-configuration v0.0.46 github.com/kong/kubernetes-testing-framework v0.47.2 github.com/kong/semver/v4 v4.0.1 // indirect github.com/lithammer/fuzzysearch v1.1.8 // indirect @@ -198,7 +200,7 @@ require ( k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect - sigs.k8s.io/controller-runtime v0.19.0 // indirect + sigs.k8s.io/controller-runtime v0.19.1 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) diff --git a/go.sum b/go.sum index d76c0dea6..11ad319b8 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ github.com/Kong/go-diff v1.2.2 h1:KKKaqHc8IxuguFVIZMNt3bi6YuC/t9r7BGD8bOOpSgM= github.com/Kong/go-diff v1.2.2/go.mod h1:nlvdwVZQk3Rm+tbI0cDmKFrOjghtcZTrZBp+UruvvA8= github.com/Kong/gojsondiff v1.3.2 h1:qIOVq2mUXt+NXy8Be5gRUee9TP3Ve0MbQSafg9bXKZE= github.com/Kong/gojsondiff v1.3.2/go.mod h1:DiIxtU59q4alK7ecP+7k56C5UjgOviJ5gQVR2esEhYw= +github.com/Kong/sdk-konnect-go v0.1.6 h1:e0wSujJVVo16y2qOrKvzg6/4sMPc/FLK70eSt80HnXE= +github.com/Kong/sdk-konnect-go v0.1.6/go.mod h1:ipu67aQNnwDzu/LXKePG46cVqkkZnAHKWpsbhTEI8xE= github.com/Kong/yaml v1.0.0 h1:OWOxtLEamLYKZzcrfoH76imAwSi9FgSZapxg1Kh6IBA= github.com/Kong/yaml v1.0.0/go.mod h1:gVzJ3lyC0UdO7kZxmCpwn0Vj20y/02cFnDpHBirGrSQ= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= @@ -98,6 +100,8 @@ github.com/emicklei/go-restful/v3 v3.12.0 h1:y2DdzBAURM29NFF94q6RaY4vjIH1rtwDapw github.com/emicklei/go-restful/v3 v3.12.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/ericlagergren/decimal v0.0.0-20240411145413-00de7ca16731 h1:R/ZjJpjQKsZ6L/+Gf9WHbt31GG8NMVcpRqUE+1mMIyo= +github.com/ericlagergren/decimal v0.0.0-20240411145413-00de7ca16731/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwCFad8crR9dcMQWvV9Hvulu6hwUh4tWPJnM= @@ -249,8 +253,8 @@ github.com/kong/go-kong v0.60.0 h1:CVrLXRLVE+Gl4IZ3tdvpO7xNDz3c9YLTmra/HvT4oM8= github.com/kong/go-kong v0.60.0/go.mod h1:t1eMY8GRS6778uQNzxgzRgnA3YKBXSZOEvYbNocH/aA= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= github.com/kong/go-slugify v1.0.0/go.mod h1:dbR2h3J2QKXQ1k0aww6cN7o4cIcwlWflr6RKRdcoaiw= -github.com/kong/kubernetes-ingress-controller/v3 v3.3.1 h1:uWlcwz5oAnVyUZdtDV9p2l9CdlHhLNTKey3AcHF/Jxs= -github.com/kong/kubernetes-ingress-controller/v3 v3.3.1/go.mod h1:2CBAJ7/J+FyAFn7Y8OLoTO3ApM+qiGIgNLbCyy98Vqk= +github.com/kong/kubernetes-configuration v0.0.46 h1:dIxVu9dOtGi9aY2prTlQ1CkiSu8Fk/0oal9m9iiUdSk= +github.com/kong/kubernetes-configuration v0.0.46/go.mod h1:Bk0H032d+aPgVYakc7C9Zo5nLwiXXm9thKUWF8vvisA= github.com/kong/kubernetes-testing-framework v0.47.2 h1:+2Z9anTpbV/hwNeN+NFQz53BMU+g3QJydkweBp3tULo= github.com/kong/kubernetes-testing-framework v0.47.2/go.mod h1:DJ5btl/srdIM03tg3f+jS9Izu7xkRkciAM69Ptqun1I= github.com/kong/semver/v4 v4.0.1 h1:DIcNR8W3gfx0KabFBADPalxxsp+q/5COwIFkkhrFQ2Y= @@ -481,8 +485,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -606,15 +610,15 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f h1:b1Ln/PG8orm0SsBbHZWke8dDp2lrCD4jSmfglFpTZbk= +google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f/go.mod h1:AHT0dDg3SoMOgZGnZk29b5xTbPHMoEC8qthmBLJCpys= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf h1:liao9UHurZLtiEwBgT9LMOnKYsHze6eA6w1KQCMVN2Q= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= @@ -660,18 +664,18 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0= k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk= -k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= -k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= +k8s.io/apiextensions-apiserver v0.31.2 h1:W8EwUb8+WXBLu56ser5IudT2cOho0gAKeTOnywBLxd0= +k8s.io/apiextensions-apiserver v0.31.2/go.mod h1:i+Geh+nGCJEGiCGR3MlBDkS7koHIIKWVfWeRFiOsUcM= k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= k8s.io/cli-runtime v0.31.0 h1:V2Q1gj1u3/WfhD475HBQrIYsoryg/LrhhK4RwpN+DhA= k8s.io/cli-runtime v0.31.0/go.mod h1:vg3H94wsubuvWfSmStDbekvbla5vFGC+zLWqcf+bGDw= -k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= -k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= +k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc= +k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs= k8s.io/code-generator v0.31.2 h1:xLWxG0HEpMSHfcM//3u3Ro2Hmc6AyyLINQS//Z2GEOI= k8s.io/code-generator v0.31.2/go.mod h1:eEQHXgBU/m7LDaToDoiz3t97dUUVyOblQdwOr8rivqc= -k8s.io/component-base v0.31.0 h1:/KIzGM5EvPNQcYgwq5NwoQBaOlVFrghoVGr8lG6vNRs= -k8s.io/component-base v0.31.0/go.mod h1:TYVuzI1QmN4L5ItVdMSXKvH7/DtvIuas5/mm8YT3rTo= +k8s.io/component-base v0.31.2 h1:Z1J1LIaC0AV+nzcPRFqfK09af6bZ4D1nAOpWsy9owlA= +k8s.io/component-base v0.31.2/go.mod h1:9PeyyFN/drHjtJZMCTkSpQJS3U9OXORnHQqMLDz0sUQ= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= @@ -682,10 +686,10 @@ k8s.io/kubectl v0.31.0 h1:kANwAAPVY02r4U4jARP/C+Q1sssCcN/1p9Nk+7BQKVg= k8s.io/kubectl v0.31.0/go.mod h1:pB47hhFypGsaHAPjlwrNbvhXgmuAr01ZBvAIIUaI8d4= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= -sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= -sigs.k8s.io/gateway-api v1.1.0 h1:DsLDXCi6jR+Xz8/xd0Z1PYl2Pn0TyaFMOPPZIj4inDM= -sigs.k8s.io/gateway-api v1.1.0/go.mod h1:ZH4lHrL2sDi0FHZ9jjneb8kKnGzFWyrTya35sWUTrRs= +sigs.k8s.io/controller-runtime v0.19.1 h1:Son+Q40+Be3QWb+niBXAg2vFiYWolDjjRfO8hn/cxOk= +sigs.k8s.io/controller-runtime v0.19.1/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= +sigs.k8s.io/gateway-api v1.2.0 h1:LrToiFwtqKTKZcZtoQPTuo3FxhrrhTgzQG0Te+YGSo8= +sigs.k8s.io/gateway-api v1.2.0/go.mod h1:EpNfEXNjiYfUJypf0eZ0P5iXA9ekSGWaS1WgPaM42X0= 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/kind v0.24.0 h1:g4y4eu0qa+SCeKESLpESgMmVFBebL0BDa6f777OIWrg= diff --git a/kong2kic/consumer.go b/kong2kic/consumer.go index d0b30e203..7ae1ee824 100644 --- a/kong2kic/consumer.go +++ b/kong2kic/consumer.go @@ -4,7 +4,7 @@ import ( "log" "github.com/kong/go-database-reconciler/pkg/file" - kicv1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1" + configurationv1 "github.com/kong/kubernetes-configuration/api/configuration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -16,7 +16,7 @@ func populateKICConsumers(content *file.Content, file *KICContent) error { continue } username := *consumer.Username - kongConsumer := kicv1.KongConsumer{ + kongConsumer := configurationv1.KongConsumer{ TypeMeta: metav1.TypeMeta{ APIVersion: KICAPIVersion, Kind: "KongConsumer", diff --git a/kong2kic/consumer_credentials.go b/kong2kic/consumer_credentials.go index 55760f019..ad4dc507d 100644 --- a/kong2kic/consumer_credentials.go +++ b/kong2kic/consumer_credentials.go @@ -4,7 +4,7 @@ import ( "strconv" "github.com/kong/go-database-reconciler/pkg/file" - kicv1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1" + configurationv1 "github.com/kong/kubernetes-configuration/api/configuration/v1" k8scorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -43,7 +43,7 @@ func createCredentialSecret(consumerUsername, credentialType string, dataFields } // Functions to populate different credential types -func populateKICKeyAuthSecrets(consumer *file.FConsumer, kongConsumer *kicv1.KongConsumer, file *KICContent) { +func populateKICKeyAuthSecrets(consumer *file.FConsumer, kongConsumer *configurationv1.KongConsumer, file *KICContent) { for _, keyAuth := range consumer.KeyAuths { dataFields := map[string]*string{ "key": keyAuth.Key, @@ -54,7 +54,7 @@ func populateKICKeyAuthSecrets(consumer *file.FConsumer, kongConsumer *kicv1.Kon } } -func populateKICHMACSecrets(consumer *file.FConsumer, kongConsumer *kicv1.KongConsumer, file *KICContent) { +func populateKICHMACSecrets(consumer *file.FConsumer, kongConsumer *configurationv1.KongConsumer, file *KICContent) { for _, hmacAuth := range consumer.HMACAuths { dataFields := map[string]*string{ "username": hmacAuth.Username, @@ -66,7 +66,7 @@ func populateKICHMACSecrets(consumer *file.FConsumer, kongConsumer *kicv1.KongCo } } -func populateKICJWTAuthSecrets(consumer *file.FConsumer, kongConsumer *kicv1.KongConsumer, file *KICContent) { +func populateKICJWTAuthSecrets(consumer *file.FConsumer, kongConsumer *configurationv1.KongConsumer, file *KICContent) { for _, jwtAuth := range consumer.JWTAuths { dataFields := map[string]*string{ "key": jwtAuth.Key, @@ -80,7 +80,9 @@ func populateKICJWTAuthSecrets(consumer *file.FConsumer, kongConsumer *kicv1.Kon } } -func populateKICBasicAuthSecrets(consumer *file.FConsumer, kongConsumer *kicv1.KongConsumer, file *KICContent) { +func populateKICBasicAuthSecrets( + consumer *file.FConsumer, kongConsumer *configurationv1.KongConsumer, file *KICContent, +) { for _, basicAuth := range consumer.BasicAuths { dataFields := map[string]*string{ "username": basicAuth.Username, @@ -92,7 +94,9 @@ func populateKICBasicAuthSecrets(consumer *file.FConsumer, kongConsumer *kicv1.K } } -func populateKICOAuth2CredSecrets(consumer *file.FConsumer, kongConsumer *kicv1.KongConsumer, file *KICContent) { +func populateKICOAuth2CredSecrets( + consumer *file.FConsumer, kongConsumer *configurationv1.KongConsumer, file *KICContent, +) { for _, oauth2Cred := range consumer.Oauth2Creds { dataFields := map[string]*string{ "name": oauth2Cred.Name, @@ -110,7 +114,9 @@ func populateKICOAuth2CredSecrets(consumer *file.FConsumer, kongConsumer *kicv1. } } -func populateKICACLGroupSecrets(consumer *file.FConsumer, kongConsumer *kicv1.KongConsumer, file *KICContent) { +func populateKICACLGroupSecrets( + consumer *file.FConsumer, kongConsumer *configurationv1.KongConsumer, file *KICContent, +) { for _, aclGroup := range consumer.ACLGroups { dataFields := map[string]*string{ "group": aclGroup.Group, @@ -121,7 +127,9 @@ func populateKICACLGroupSecrets(consumer *file.FConsumer, kongConsumer *kicv1.Ko } } -func populateKICMTLSAuthSecrets(consumer *file.FConsumer, kongConsumer *kicv1.KongConsumer, file *KICContent) { +func populateKICMTLSAuthSecrets( + consumer *file.FConsumer, kongConsumer *configurationv1.KongConsumer, file *KICContent, +) { for _, mtlsAuth := range consumer.MTLSAuths { dataFields := map[string]*string{ "subject_name": mtlsAuth.SubjectName, diff --git a/kong2kic/consumer_group.go b/kong2kic/consumer_group.go index a39f30666..ebde749e1 100644 --- a/kong2kic/consumer_group.go +++ b/kong2kic/consumer_group.go @@ -6,20 +6,22 @@ import ( "github.com/kong/go-database-reconciler/pkg/file" "github.com/kong/go-kong/kong" - kicv1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1" - kicv1beta1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1beta1" + configurationv1 "github.com/kong/kubernetes-configuration/api/configuration/v1" + configurationv1beta1 "github.com/kong/kubernetes-configuration/api/configuration/v1beta1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // Helper function to populate consumer group plugins -func createConsumerGroupKongPlugin(plugin *kong.ConsumerGroupPlugin, ownerName string) (*kicv1.KongPlugin, error) { +func createConsumerGroupKongPlugin( + plugin *kong.ConsumerGroupPlugin, ownerName string, +) (*configurationv1.KongPlugin, error) { if plugin.Name == nil { log.Println("Plugin name is empty. Please provide a name for the plugin.") return nil, nil } pluginName := *plugin.Name - kongPlugin := &kicv1.KongPlugin{ + kongPlugin := &configurationv1.KongPlugin{ TypeMeta: metav1.TypeMeta{ APIVersion: "configuration.konghq.com/v1", Kind: "KongPlugin", @@ -51,7 +53,7 @@ func populateKICConsumerGroups(content *file.Content, kicContent *KICContent) er } groupName := *consumerGroup.Name - kongConsumerGroup := kicv1beta1.KongConsumerGroup{ + kongConsumerGroup := configurationv1beta1.KongConsumerGroup{ TypeMeta: metav1.TypeMeta{ APIVersion: "configuration.konghq.com/v1beta1", Kind: "KongConsumerGroup", diff --git a/kong2kic/global_plugin.go b/kong2kic/global_plugin.go index b5ab3fa39..266fe7c06 100644 --- a/kong2kic/global_plugin.go +++ b/kong2kic/global_plugin.go @@ -7,21 +7,21 @@ import ( "github.com/kong/go-database-reconciler/pkg/file" "github.com/kong/go-kong/kong" - kicv1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1" + configurationv1 "github.com/kong/kubernetes-configuration/api/configuration/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" ) func populateKICKongClusterPlugins(content *file.Content, file *KICContent) error { // Global Plugins map to KongClusterPlugins - // iterate content.Plugins and copy them into kicv1.KongPlugin manifests - // add the kicv1.KongPlugin to the KICContent.KongClusterPlugins slice + // iterate content.Plugins and copy them into configurationv1.KongPlugin manifests + // add the configurationv1.KongPlugin to the KICContent.KongClusterPlugins slice for _, plugin := range content.Plugins { // skip this plugin instance if it is a kongconsumergroup plugin. // It is a kongconsumergroup plugin if it has a consumer_group property if plugin.ConsumerGroup != nil { continue } - var kongClusterPlugin kicv1.KongClusterPlugin + var kongClusterPlugin configurationv1.KongClusterPlugin kongClusterPlugin.APIVersion = KICAPIVersion kongClusterPlugin.Kind = "KongClusterPlugin" kongClusterPlugin.ObjectMeta.Annotations = map[string]string{IngressClass: ClassName} @@ -54,7 +54,7 @@ func populateKICKongClusterPlugins(content *file.Content, file *KICContent) erro protocols[i] = *protocol } } - kongClusterPlugin.Protocols = kicv1.StringsToKongProtocols(protocols) + kongClusterPlugin.Protocols = configurationv1.StringsToKongProtocols(protocols) } // add konghq.com/tags annotation if plugin.Tags is not nil diff --git a/kong2kic/route.go b/kong2kic/route.go index 5f8796d9b..7e0bc2ef8 100644 --- a/kong2kic/route.go +++ b/kong2kic/route.go @@ -8,7 +8,7 @@ import ( "github.com/kong/go-database-reconciler/pkg/file" "github.com/kong/go-kong/kong" - kicv1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1" + configurationv1 "github.com/kong/kubernetes-configuration/api/configuration/v1" k8snetv1 "k8s.io/api/networking/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -192,7 +192,7 @@ func addPluginsToRoute( continue } pluginName := *plugin.Name - kongPlugin := kicv1.KongPlugin{ + kongPlugin := configurationv1.KongPlugin{ TypeMeta: metav1.TypeMeta{ APIVersion: KICAPIVersion, Kind: KongPluginKind, @@ -224,7 +224,7 @@ func addPluginsToRoute( protocols = append(protocols, *protocol) } } - kongPlugin.Protocols = kicv1.StringsToKongProtocols(protocols) + kongPlugin.Protocols = configurationv1.StringsToKongProtocols(protocols) } if plugin.Tags != nil { var tags []string diff --git a/kong2kic/types.go b/kong2kic/types.go index d264662e9..4ed328172 100644 --- a/kong2kic/types.go +++ b/kong2kic/types.go @@ -4,8 +4,8 @@ import ( "encoding/json" "github.com/kong/go-database-reconciler/pkg/file" - kicv1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1" - kicv1beta1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1beta1" + configurationv1 "github.com/kong/kubernetes-configuration/api/configuration/v1" + configurationv1beta1 "github.com/kong/kubernetes-configuration/api/configuration/v1beta1" k8scorev1 "k8s.io/api/core/v1" k8snetv1 "k8s.io/api/networking/v1" k8sgwapiv1 "sigs.k8s.io/gateway-api/apis/v1" @@ -15,16 +15,16 @@ import ( // KICContent represents a serialized Kong state for KIC. // +k8s:deepcopy-gen=true type KICContent struct { - KongIngresses []kicv1.KongIngress `json:"kongIngresses,omitempty" yaml:",omitempty"` - KongPlugins []kicv1.KongPlugin `json:"kongPlugins,omitempty" yaml:",omitempty"` - KongClusterPlugins []kicv1.KongClusterPlugin `json:"clusterPlugins,omitempty" yaml:",omitempty"` - Ingresses []k8snetv1.Ingress `json:"ingresses,omitempty" yaml:",omitempty"` - Services []k8scorev1.Service `json:"services,omitempty" yaml:",omitempty"` - Secrets []k8scorev1.Secret `json:"secrets,omitempty" yaml:",omitempty"` - KongConsumers []kicv1.KongConsumer `json:"consumers,omitempty" yaml:",omitempty"` - KongConsumerGroups []kicv1beta1.KongConsumerGroup `json:"consumerGroups,omitempty" yaml:",omitempty"` - HTTPRoutes []k8sgwapiv1.HTTPRoute `json:"httpRoutes,omitempty" yaml:",omitempty"` - KongUpstreamPolicies []kicv1beta1.KongUpstreamPolicy `json:"upstreamPolicies,omitempty" yaml:",omitempty"` + KongIngresses []configurationv1.KongIngress `json:"kongIngresses,omitempty" yaml:",omitempty"` + KongPlugins []configurationv1.KongPlugin `json:"kongPlugins,omitempty" yaml:",omitempty"` + KongClusterPlugins []configurationv1.KongClusterPlugin `json:"clusterPlugins,omitempty" yaml:",omitempty"` + Ingresses []k8snetv1.Ingress `json:"ingresses,omitempty" yaml:",omitempty"` + Services []k8scorev1.Service `json:"services,omitempty" yaml:",omitempty"` + Secrets []k8scorev1.Secret `json:"secrets,omitempty" yaml:",omitempty"` + KongConsumers []configurationv1.KongConsumer `json:"consumers,omitempty" yaml:",omitempty"` + KongConsumerGroups []configurationv1beta1.KongConsumerGroup `json:"consumerGroups,omitempty" yaml:",omitempty"` + HTTPRoutes []k8sgwapiv1.HTTPRoute `json:"httpRoutes,omitempty" yaml:",omitempty"` + KongUpstreamPolicies []configurationv1beta1.KongUpstreamPolicy `json:"upstreamPolicies,omitempty" yaml:",omitempty"` } func (k KICContent) marshalKICContentToFormat(format string) ([]byte, error) { diff --git a/kong2kic/upstream.go b/kong2kic/upstream.go index b27af4bcc..0611658ef 100644 --- a/kong2kic/upstream.go +++ b/kong2kic/upstream.go @@ -6,8 +6,8 @@ import ( "github.com/kong/go-database-reconciler/pkg/file" "github.com/kong/go-kong/kong" - kicv1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1" - kicv1beta1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1beta1" + configurationv1 "github.com/kong/kubernetes-configuration/api/configuration/v1" + configurationv1beta1 "github.com/kong/kubernetes-configuration/api/configuration/v1beta1" k8scorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -26,23 +26,23 @@ func findMatchingUpstream(serviceHost *string, upstreams []file.FUpstream) *file } // Helper function to convert HTTP statuses -func convertHTTPStatuses(statuses []int) []kicv1beta1.HTTPStatus { +func convertHTTPStatuses(statuses []int) []configurationv1beta1.HTTPStatus { if statuses == nil { return nil } - result := make([]kicv1beta1.HTTPStatus, len(statuses)) + result := make([]configurationv1beta1.HTTPStatus, len(statuses)) for i, status := range statuses { - result[i] = kicv1beta1.HTTPStatus(status) + result[i] = configurationv1beta1.HTTPStatus(status) } return result } // Helper function to populate active healthcheck -func populateActiveHealthcheck(active *kong.ActiveHealthcheck) *kicv1beta1.KongUpstreamActiveHealthcheck { +func populateActiveHealthcheck(active *kong.ActiveHealthcheck) *configurationv1beta1.KongUpstreamActiveHealthcheck { if active == nil { return nil } - return &kicv1beta1.KongUpstreamActiveHealthcheck{ + return &configurationv1beta1.KongUpstreamActiveHealthcheck{ Type: active.Type, Concurrency: active.Concurrency, HTTPPath: active.HTTPPath, @@ -56,11 +56,11 @@ func populateActiveHealthcheck(active *kong.ActiveHealthcheck) *kicv1beta1.KongU } // Helper function to populate passive healthcheck -func populatePassiveHealthcheck(passive *kong.PassiveHealthcheck) *kicv1beta1.KongUpstreamPassiveHealthcheck { +func populatePassiveHealthcheck(passive *kong.PassiveHealthcheck) *configurationv1beta1.KongUpstreamPassiveHealthcheck { if passive == nil { return nil } - return &kicv1beta1.KongUpstreamPassiveHealthcheck{ + return &configurationv1beta1.KongUpstreamPassiveHealthcheck{ Type: passive.Type, Healthy: populateHealthcheckHealthy(passive.Healthy), Unhealthy: populateHealthcheckUnhealthy(passive.Unhealthy), @@ -68,11 +68,11 @@ func populatePassiveHealthcheck(passive *kong.PassiveHealthcheck) *kicv1beta1.Ko } // Helper function to populate healthcheck healthy settings -func populateHealthcheckHealthy(healthy *kong.Healthy) *kicv1beta1.KongUpstreamHealthcheckHealthy { +func populateHealthcheckHealthy(healthy *kong.Healthy) *configurationv1beta1.KongUpstreamHealthcheckHealthy { if healthy == nil { return nil } - return &kicv1beta1.KongUpstreamHealthcheckHealthy{ + return &configurationv1beta1.KongUpstreamHealthcheckHealthy{ Interval: healthy.Interval, Successes: healthy.Successes, HTTPStatuses: convertHTTPStatuses(healthy.HTTPStatuses), @@ -80,11 +80,11 @@ func populateHealthcheckHealthy(healthy *kong.Healthy) *kicv1beta1.KongUpstreamH } // Helper function to populate healthcheck unhealthy settings -func populateHealthcheckUnhealthy(unhealthy *kong.Unhealthy) *kicv1beta1.KongUpstreamHealthcheckUnhealthy { +func populateHealthcheckUnhealthy(unhealthy *kong.Unhealthy) *configurationv1beta1.KongUpstreamHealthcheckUnhealthy { if unhealthy == nil { return nil } - return &kicv1beta1.KongUpstreamHealthcheckUnhealthy{ + return &configurationv1beta1.KongUpstreamHealthcheckUnhealthy{ HTTPFailures: unhealthy.HTTPFailures, TCPFailures: unhealthy.TCPFailures, Timeouts: unhealthy.Timeouts, @@ -112,7 +112,7 @@ func populateKICUpstreamPolicy( } // Create KongUpstreamPolicy - kongUpstreamPolicy := kicv1beta1.KongUpstreamPolicy{ + kongUpstreamPolicy := configurationv1beta1.KongUpstreamPolicy{ TypeMeta: metav1.TypeMeta{ APIVersion: KICAPIVersionV1Beta1, Kind: UpstreamPolicyKind, @@ -140,7 +140,7 @@ func populateKICUpstreamPolicy( } // Helper function to populate KongUpstreamPolicy Spec -func populateKongUpstreamPolicySpec(upstream *file.FUpstream, policy *kicv1beta1.KongUpstreamPolicy) { +func populateKongUpstreamPolicySpec(upstream *file.FUpstream, policy *configurationv1beta1.KongUpstreamPolicy) { if upstream.Algorithm != nil { policy.Spec.Algorithm = upstream.Algorithm } @@ -150,8 +150,8 @@ func populateKongUpstreamPolicySpec(upstream *file.FUpstream, policy *kicv1beta1 if upstream.Algorithm != nil && *upstream.Algorithm == "consistent-hashing" { if upstream.HashOn != nil { - policy.Spec.HashOn = &kicv1beta1.KongUpstreamHash{ - Input: (*kicv1beta1.HashInput)(upstream.HashOn), + policy.Spec.HashOn = &configurationv1beta1.KongUpstreamHash{ + Input: (*configurationv1beta1.HashInput)(upstream.HashOn), Header: upstream.HashOnHeader, Cookie: upstream.HashOnCookie, CookiePath: upstream.HashOnCookiePath, @@ -160,8 +160,8 @@ func populateKongUpstreamPolicySpec(upstream *file.FUpstream, policy *kicv1beta1 } } if upstream.HashFallback != nil { - policy.Spec.HashOnFallback = &kicv1beta1.KongUpstreamHash{ - Input: (*kicv1beta1.HashInput)(upstream.HashFallback), + policy.Spec.HashOnFallback = &configurationv1beta1.KongUpstreamHash{ + Input: (*configurationv1beta1.HashInput)(upstream.HashFallback), Header: upstream.HashFallbackHeader, QueryArg: upstream.HashFallbackQueryArg, URICapture: upstream.HashFallbackURICapture, @@ -175,7 +175,7 @@ func populateKongUpstreamPolicySpec(upstream *file.FUpstream, policy *kicv1beta1 if upstream.Healthchecks.Threshold != nil { threshold = int(*upstream.Healthchecks.Threshold) } - policy.Spec.Healthchecks = &kicv1beta1.KongUpstreamHealthcheck{ + policy.Spec.Healthchecks = &configurationv1beta1.KongUpstreamHealthcheck{ Threshold: &threshold, Active: populateActiveHealthcheck(upstream.Healthchecks.Active), Passive: populatePassiveHealthcheck(upstream.Healthchecks.Passive), @@ -202,7 +202,7 @@ func populateKICUpstream( } // Create KongIngress - kongIngress := kicv1.KongIngress{ + kongIngress := configurationv1.KongIngress{ TypeMeta: metav1.TypeMeta{ APIVersion: KICAPIVersion, Kind: IngressKind, @@ -211,7 +211,7 @@ func populateKICUpstream( Name: calculateSlug(*service.Name + "-upstream"), Annotations: map[string]string{IngressClass: ClassName}, }, - Upstream: &kicv1.KongIngressUpstream{ + Upstream: &configurationv1.KongIngressUpstream{ HostHeader: upstream.HostHeader, Algorithm: upstream.Algorithm, Slots: upstream.Slots, diff --git a/kong2kic/utils.go b/kong2kic/utils.go index 6b0ba3308..2e22f77b4 100644 --- a/kong2kic/utils.go +++ b/kong2kic/utils.go @@ -7,7 +7,7 @@ import ( "github.com/kong/go-database-reconciler/pkg/file" "github.com/kong/go-kong/kong" - kicv1 "github.com/kong/kubernetes-ingress-controller/v3/pkg/apis/configuration/v1" + configurationv1 "github.com/kong/kubernetes-configuration/api/configuration/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -37,13 +37,13 @@ func addPluginToAnnotations(pluginName string, annotations map[string]string) { } // Helper function to create a KongPlugin from a plugin -func createKongPlugin(plugin *file.FPlugin, ownerName string) (*kicv1.KongPlugin, error) { +func createKongPlugin(plugin *file.FPlugin, ownerName string) (*configurationv1.KongPlugin, error) { if plugin.Name == nil { log.Println("Plugin name is empty. Please provide a name for the plugin.") return nil, nil } pluginName := *plugin.Name - kongPlugin := &kicv1.KongPlugin{ + kongPlugin := &configurationv1.KongPlugin{ TypeMeta: metav1.TypeMeta{ APIVersion: KICAPIVersion, Kind: KongPluginKind, @@ -78,7 +78,7 @@ func createKongPlugin(plugin *file.FPlugin, ownerName string) (*kicv1.KongPlugin protocols = append(protocols, *protocol) } } - kongPlugin.Protocols = kicv1.StringsToKongProtocols(protocols) + kongPlugin.Protocols = configurationv1.StringsToKongProtocols(protocols) } // Transform the plugin config From 4da4246f7b42c92cd757d5b0c1147023a706030c Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Fri, 29 Nov 2024 09:43:21 +0530 Subject: [PATCH 17/38] Updated go-apiops (#1452) * chore: updated go-apiops to v0.1.40 * chore: release prep for v1.41.4 --- CHANGELOG.md | 17 +++++++++++++++++ README.md | 4 ++-- go.mod | 8 ++++---- go.sum | 19 ++++++++++--------- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 341b793e1..e03bc6636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.41.4](#v1414) - [v1.41.3](#v1413) - [v1.41.2](#v1412) - [v1.41.1](#v1411) @@ -100,6 +101,21 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.41.4] +> Release date: 2024/11/26 + +### Fixes +- Added validation for ensuring that cookie parameters in parameter schemas are skipped +and a warning is logged for the user while using `deck file openapi2kong` command. +[#1452](https://github.com/Kong/deck/pull/1452) +[go-apiops #255](https://github.com/Kong/go-apiops/pull/225) +- Fixed issue where creating arrays with mixed types using oneOf in OAS specifications were +failing while using `deck file openapi2kong` command. +[#1452](https://github.com/Kong/deck/pull/1452) +[go-apiops #231](https://github.com/Kong/go-apiops/pull/231) + + + ## [v1.41.3] > Release date: 2024/11/25 @@ -1867,6 +1883,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.41.4]: https://github.com/Kong/deck/compare/v1.41.3...v1.41.4 [v1.41.3]: https://github.com/Kong/deck/compare/v1.41.2...v1.41.3 [v1.41.2]: https://github.com/Kong/deck/compare/v1.41.1...v1.41.2 [v1.41.1]: https://github.com/Kong/deck/compare/v1.40.0...v1.41.1 diff --git a/README.md b/README.md index 356bbba30..5122cefca 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ the GitHub [release page](https://github.com/kong/deck/releases) or install by downloading the binary: ```shell -$ curl -sL https://github.com/kong/deck/releases/download/v1.41.3/deck_1.41.3_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.41.4/deck_1.41.4_linux_amd64.tar.gz -o deck.tar.gz $ tar -xf deck.tar.gz -C /tmp $ sudo cp /tmp/deck /usr/local/bin/ ``` @@ -84,7 +84,7 @@ If you are on Windows, you can download the binary from the GitHub [release page](https://github.com/kong/deck/releases) or via PowerShell: ```shell -$ curl -sL https://github.com/kong/deck/releases/download/v1.41.3/deck_1.41.3_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.41.4/deck_1.41.4_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ``` diff --git a/go.mod b/go.mod index 3db19f98e..4df4ce063 100644 --- a/go.mod +++ b/go.mod @@ -12,14 +12,14 @@ require ( github.com/daveshanley/vacuum v0.9.15 github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 - github.com/kong/go-apiops v0.1.39 + github.com/kong/go-apiops v0.1.40 github.com/kong/go-database-reconciler v1.16.1 github.com/kong/go-kong v0.60.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 golang.org/x/sync v0.8.0 k8s.io/api v0.31.2 k8s.io/apiextensions-apiserver v0.31.2 @@ -189,8 +189,8 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.30.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/term v0.25.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/term v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/go.sum b/go.sum index 11ad319b8..dc7be4dfe 100644 --- a/go.sum +++ b/go.sum @@ -245,8 +245,8 @@ github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuOb github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= -github.com/kong/go-apiops v0.1.39 h1:OXUzHb6tyZ+bb1xWzpPvmZK7FNk4xtrcka8d0bRTQkI= -github.com/kong/go-apiops v0.1.39/go.mod h1:WghIt61r2b+HaeGVNWCd+aswTMHIjeP3GYK09/yYWA8= +github.com/kong/go-apiops v0.1.40 h1:Dp4IHJ3h61VeOAeQkOisf1BcOP+Ww+gpqnv14HvC6DQ= +github.com/kong/go-apiops v0.1.40/go.mod h1:CNfsa9mHFRfAhT9E2IWTul0Mi1/BldTDmFu5fWcp2us= github.com/kong/go-database-reconciler v1.16.1 h1:qcQzEuMGfpNjx3UgulBOKulKA+upmHwqw4dy6TMEV7A= github.com/kong/go-database-reconciler v1.16.1/go.mod h1:7CGvStUvUOmUnodUFsWcW3PX2bJgnaKClJ/yhNGEVIE= github.com/kong/go-kong v0.60.0 h1:CVrLXRLVE+Gl4IZ3tdvpO7xNDz3c9YLTmra/HvT4oM8= @@ -325,8 +325,8 @@ github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vv 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.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= -github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= +github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= +github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= 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= @@ -419,8 +419,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= @@ -566,16 +567,16 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= -golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= +golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= +golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 4c52f38e0dee4341fa441376be892ab689267362 Mon Sep 17 00:00:00 2001 From: Antoine Jacquemin Date: Fri, 6 Dec 2024 12:06:43 +0100 Subject: [PATCH 18/38] add feature online plugins filter flag (#1458) * add feature online plugins filter flag * list refactor fix reflection add test fix lint fix lint add valid entities fux lint Updated go-apiops (#1452) * chore: updated go-apiops to v0.1.40 * chore: release prep for v1.41.4 fux lint fix lint fix lint * fix test * fix err msg * add tests * add tests --- cmd/gateway_validate.go | 47 ++++-- tests/integration/sync_test.go | 3 + .../expected-no-skip_konnect.yaml | 2 + tests/integration/validate_test.go | 36 +++++ validate/validate.go | 153 +++++++++--------- 5 files changed, 156 insertions(+), 85 deletions(-) diff --git a/cmd/gateway_validate.go b/cmd/gateway_validate.go index 0d2ee3690..e3dca9ec5 100644 --- a/cmd/gateway_validate.go +++ b/cmd/gateway_validate.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "os" + "sort" "github.com/blang/semver/v4" "github.com/kong/deck/utils" @@ -17,12 +18,13 @@ import ( ) var ( - validateCmdKongStateFile []string - validateCmdRBACResourcesOnly bool - validateOnline bool - validateWorkspace string - validateParallelism int - validateKonnectCompatibility bool + validateCmdKongStateFile []string + validateCmdOnlineEntitiesFilter []string + validateCmdRBACResourcesOnly bool + validateOnline bool + validateKonnectCompatibility bool + validateWorkspace string + validateParallelism int ) func executeValidate(cmd *cobra.Command, _ []string) error { @@ -210,6 +212,26 @@ this command unless --online flag is used. if len(validateCmdKongStateFile) == 0 { validateCmdKongStateFile = []string{"-"} } + + // Iterate over the input values and validate them against the keys in entityMap + for _, value := range validateCmdOnlineEntitiesFilter { + // Check if the value is valid by comparing it with keys in EntityMap + if _, exists := validate.EntityMap[value]; !exists { + // Generate an error message with the list of valid keys + listOfKeys := make([]string, 0, len(validate.EntityMap)) + for key := range validate.EntityMap { + listOfKeys = append(listOfKeys, key) + } + // Sort the keys alphabetically + sort.Strings(listOfKeys) + + return fmt.Errorf( + "invalid value '%s' for --online-entities-list; it should be a valid Kong entity (case-sensitive). "+ + "Valid entities: %v", + value, listOfKeys, + ) + } + } return preRunSilenceEventsFlag() } @@ -237,6 +259,8 @@ this command unless --online flag is used. validateCmd.Flags().BoolVar(&validateCmdRBACResourcesOnly, "rbac-resources-only", false, "indicate that the state file(s) contains RBAC resources only (Kong Enterprise only).") + validateCmd.Flags().StringSliceVarP(&validateCmdOnlineEntitiesFilter, "online-entities-list", + "", []string{}, "indicate the list of entities that should be validated online validation.") if deprecated { validateCmd.Flags().StringSliceVarP(&validateCmdKongStateFile, "state", "s", []string{"kong.yaml"}, "file(s) containing Kong's configuration.\n"+ @@ -279,11 +303,12 @@ func validateWithKong( return []error{fmt.Errorf("parsing Kong version: %w", err)} } opts := validate.ValidatorOpts{ - Ctx: ctx, - State: ks, - Client: kongClient, - Parallelism: validateParallelism, - RBACResourcesOnly: validateCmdRBACResourcesOnly, + Ctx: ctx, + State: ks, + Client: kongClient, + Parallelism: validateParallelism, + RBACResourcesOnly: validateCmdRBACResourcesOnly, + OnlineEntitiesFilter: validateCmdOnlineEntitiesFilter, } validator := validate.NewValidator(opts) return validator.Validate(parsedFormatVersion) diff --git a/tests/integration/sync_test.go b/tests/integration/sync_test.go index 746de8f0e..ca5e084ad 100644 --- a/tests/integration/sync_test.go +++ b/tests/integration/sync_test.go @@ -1397,6 +1397,7 @@ var ( ID: kong.String("77e6691d-67c0-446a-9401-27be2b141aae"), }, Config: kong.Configuration{ + "compound_identifier": nil, "consumer_groups": nil, "dictionary_name": string("kong_rate_limiting_counters"), "disable_penalty": bool(false), @@ -1447,6 +1448,7 @@ var ( ID: kong.String("5bcbd3a7-030b-4310-bd1d-2721ff85d236"), }, Config: kong.Configuration{ + "compound_identifier": nil, "consumer_groups": nil, "dictionary_name": string("kong_rate_limiting_counters"), "disable_penalty": bool(false), @@ -1494,6 +1496,7 @@ var ( { Name: kong.String("rate-limiting-advanced"), Config: kong.Configuration{ + "compound_identifier": nil, "consumer_groups": nil, "dictionary_name": string("kong_rate_limiting_counters"), "disable_penalty": bool(false), diff --git a/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip_konnect.yaml b/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip_konnect.yaml index aea340bc6..7080d6137 100644 --- a/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip_konnect.yaml +++ b/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip_konnect.yaml @@ -5,6 +5,7 @@ consumer_groups: - name: basic plugins: - config: + compound_identifier: null consumer_groups: null dictionary_name: kong_rate_limiting_counters disable_penalty: false @@ -32,6 +33,7 @@ consumer_groups: password: null port: 6379 read_timeout: 2000 + redis_proxy_type: null send_timeout: 2000 sentinel_addresses: null sentinel_master: null diff --git a/tests/integration/validate_test.go b/tests/integration/validate_test.go index 410bce2ef..f8e5e40c3 100644 --- a/tests/integration/validate_test.go +++ b/tests/integration/validate_test.go @@ -76,6 +76,22 @@ func Test_Validate_Konnect(t *testing.T) { additionalArgs: []string{"--konnect-runtime-group-name=default"}, errorExpected: false, }, + { + name: "validate with wrong online list, passed via --online-entities-list cli flag", + stateFile: "testdata/validate/kong3x.yaml", + additionalArgs: []string{"--online-entities-list=services,Routes,Plugins"}, + errorExpected: true, + errorString: "invalid value 'services' for --online-entities-list; it should be a valid " + + "Kong entity (case-sensitive). Valid entities: [ACLGroups BasicAuths CACertificates Certificates Consumers " + + "Documents FilterChains HMACAuths JWTAuths KeyAuths Oauth2Creds Plugins RBACEndpointPermissions RBACRoles " + + "Routes SNIs Services Targets Upstreams Vaults]", + }, + { + name: "validate with correct online list, passed via --online-entities-list cli flag", + stateFile: "testdata/validate/kong3x.yaml", + additionalArgs: []string{"--online-entities-list=Services,Routes,Plugins"}, + errorExpected: false, + }, } for _, tc := range tests { @@ -173,6 +189,16 @@ func Test_Validate_Gateway(t *testing.T) { stateFile: "testdata/validate/konnect.yaml", additionalArgs: []string{"--konnect-compatibility"}, }, + { + name: "validate format version 3.0 with --online-entities-list", + stateFile: "testdata/validate/kong3x.yaml", + additionalArgs: []string{"--online-entities-list=Services,Routes,Plugins"}, + }, + { + name: "validate with konnect and --online-entities-list", + stateFile: "testdata/validate/konnect.yaml", + additionalArgs: []string{"--online-entities-list=Services,Routes,Plugins"}, + }, } for _, tc := range tests { @@ -218,6 +244,16 @@ func Test_Validate_Gateway_EE(t *testing.T) { stateFile: "testdata/validate/kong-ee.yaml", additionalArgs: []string{"--workspace=default"}, }, + { + name: "validate format version 3.0 with --online-entities-list", + stateFile: "testdata/validate/kong-ee.yaml", + additionalArgs: []string{"--online-entities-list=Services,Routes,Plugins"}, + }, + { + name: "validate with konnect and --online-entities-list", + stateFile: "testdata/validate/konnect.yaml", + additionalArgs: []string{"--online-entities-list=Services,Routes,Plugins"}, + }, // TODO: Add a rbac flag test, once the behaviour is fixed } diff --git a/validate/validate.go b/validate/validate.go index 256b33718..2372b8cac 100644 --- a/validate/validate.go +++ b/validate/validate.go @@ -16,28 +16,55 @@ import ( ) type Validator struct { - ctx context.Context - state *state.KongState - client *kong.Client - parallelism int - rbacResourcesOnly bool + ctx context.Context + state *state.KongState + client *kong.Client + parallelism int + rbacResourcesOnly bool + onlineEntitiesFilter []string } type ValidatorOpts struct { - Ctx context.Context - State *state.KongState - Client *kong.Client - Parallelism int - RBACResourcesOnly bool + Ctx context.Context + State *state.KongState + Client *kong.Client + Parallelism int + RBACResourcesOnly bool + OnlineEntitiesFilter []string +} + +// Define a map of entity object field names and their corresponding string names +var EntityMap = map[string]string{ + "ACLGroups": "acls", + "BasicAuths": "basicauth_credentials", + "CACertificates": "ca_certificates", + "Certificates": "certificates", + "Consumers": "consumers", + "Documents": "documents", + "FilterChains": "filter_chains", + "HMACAuths": "hmacauth_credentials", + "JWTAuths": "jwt_secrets", + "KeyAuths": "keyauth_credentials", + "Oauth2Creds": "oauth2_credentials", + "Plugins": "plugins", + "RBACEndpointPermissions": "rbac-endpointpermission", + "RBACRoles": "rbac-role", + "Routes": "routes", + "SNIs": "snis", + "Services": "services", + "Targets": "targets", + "Upstreams": "upstreams", + "Vaults": "vaults", } func NewValidator(opt ValidatorOpts) *Validator { return &Validator{ - ctx: opt.Ctx, - state: opt.State, - client: opt.Client, - parallelism: opt.Parallelism, - rbacResourcesOnly: opt.RBACResourcesOnly, + ctx: opt.Ctx, + state: opt.State, + client: opt.Client, + parallelism: opt.Parallelism, + rbacResourcesOnly: opt.RBACResourcesOnly, + onlineEntitiesFilter: opt.OnlineEntitiesFilter, } } @@ -119,70 +146,48 @@ func (v *Validator) entities(obj interface{}, entityType string) []error { func (v *Validator) Validate(formatVersion semver.Version) []error { allErr := []error{} - // validate RBAC resources first. - if err := v.entities(v.state.RBACEndpointPermissions, "rbac-endpointpermission"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.RBACRoles, "rbac-role"); err != nil { - allErr = append(allErr, err...) - } if v.rbacResourcesOnly { + // validate RBAC resources first. + if err := v.entities(v.state.RBACEndpointPermissions, "rbac-endpointpermission"); err != nil { + allErr = append(allErr, err...) + } + if err := v.entities(v.state.RBACRoles, "rbac-role"); err != nil { + allErr = append(allErr, err...) + } return allErr } - if err := v.entities(v.state.Services, "services"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.ACLGroups, "acls"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.BasicAuths, "basicauth_credentials"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.CACertificates, "ca_certificates"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.Certificates, "certificates"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.Consumers, "consumers"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.Documents, "documents"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.HMACAuths, "hmacauth_credentials"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.JWTAuths, "jwt_secrets"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.KeyAuths, "keyauth_credentials"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.Oauth2Creds, "oauth2_credentials"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.Plugins, "plugins"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.Routes, "routes"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.SNIs, "snis"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.Targets, "targets"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.Upstreams, "upstreams"); err != nil { - allErr = append(allErr, err...) - } - if err := v.entities(v.state.FilterChains, "filter_chains"); err != nil { - allErr = append(allErr, err...) + // Create a copy of entityMap with only the specififed resources to check online. + filteredEntityMap := make(map[string]string) + if len(v.onlineEntitiesFilter) > 0 { + for _, value := range v.onlineEntitiesFilter { + for key, entityName := range EntityMap { + if value == key { + filteredEntityMap[key] = entityName + } + } + } + } else { + // If no filter is specified, use the original entityMap. + filteredEntityMap = EntityMap } - if err := v.entities(v.state.Vaults, "vaults"); err != nil { - allErr = append(allErr, err...) + + // Validate each entity using the filtered entityMap + for fieldName, entityName := range filteredEntityMap { + // Use reflection to get the value of the field from v.state + valueOfState := reflect.ValueOf(v.state) + if valueOfState.Kind() == reflect.Ptr { + valueOfState = valueOfState.Elem() // Dereference if it's a pointer + } + + fieldValue := valueOfState.FieldByName(fieldName) + if fieldValue.IsValid() && fieldValue.CanInterface() { + if err := v.entities(fieldValue.Interface(), entityName); err != nil { + allErr = append(allErr, err...) + } + } else { + allErr = append(allErr, fmt.Errorf("invalid field '%s' in state", fieldName)) + } } // validate routes format with Kong 3.x From 3c24be73b14c89cd4f62afe89ff7332ed0715d1f Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Thu, 12 Dec 2024 12:42:01 +0530 Subject: [PATCH 19/38] chore: fixed integration tests for gw 3.9 release (#1470) * chore: fixed integration tests for gw 3.9 release * chore: uncommented diff test for unordered arrays --- tests/integration/diff_test.go | 11 +- tests/integration/dump_test.go | 9 +- tests/integration/sync_test.go | 238 +++++++++++++++++- .../expected-no-skip-39.yaml | 67 +++++ 4 files changed, 317 insertions(+), 8 deletions(-) create mode 100644 tests/integration/testdata/dump/002-skip-consumers/expected-no-skip-39.yaml diff --git a/tests/integration/diff_test.go b/tests/integration/diff_test.go index 797f465bd..ff2fd9b59 100644 --- a/tests/integration/diff_test.go +++ b/tests/integration/diff_test.go @@ -762,12 +762,11 @@ func Test_Diff_NoDiffUnorderedArray(t *testing.T) { stateFile: "testdata/diff/004-no-diff-plugin/kong.yaml", runWhen: ">=3.5.0 <3.8.1", }, - // Uncomment post solving: https://konghq.atlassian.net/browse/FTI-6303 - // { - // name: "no diffs with unordered arrays >=3.8.1", - // stateFile: "testdata/diff/004-no-diff-plugin/kong.yaml", - // runWhen: ">=3.8.1", - // }, + { + name: "no diffs with unordered arrays >=3.8.1", + stateFile: "testdata/diff/004-no-diff-plugin/kong.yaml", + runWhen: ">=3.8.1", + }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { diff --git a/tests/integration/dump_test.go b/tests/integration/dump_test.go index 39b891bf6..87ec7c453 100644 --- a/tests/integration/dump_test.go +++ b/tests/integration/dump_test.go @@ -138,7 +138,14 @@ func Test_Dump_SkipConsumers(t *testing.T) { stateFile: "testdata/dump/002-skip-consumers/kong34.yaml", expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip-381.yaml", skipConsumers: false, - runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.8.1") }, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.8.1 <3.9.0") }, + }, + { + name: "3.9.0 dump with no skip-consumers", + stateFile: "testdata/dump/002-skip-consumers/kong34.yaml", + expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip-39.yaml", + skipConsumers: false, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.9.0") }, }, } for _, tc := range tests { diff --git a/tests/integration/sync_test.go b/tests/integration/sync_test.go index ca5e084ad..910e5f957 100644 --- a/tests/integration/sync_test.go +++ b/tests/integration/sync_test.go @@ -1731,6 +1731,189 @@ var ( Protocols: []*string{kong.String("http"), kong.String("https")}, }, } + + consumerGroupScopedPlugins390x = []*kong.Plugin{ + { + Name: kong.String("rate-limiting-advanced"), + ConsumerGroup: &kong.ConsumerGroup{ + ID: kong.String("77e6691d-67c0-446a-9401-27be2b141aae"), + }, + Config: kong.Configuration{ + "compound_identifier": nil, + "consumer_groups": nil, + "dictionary_name": string("kong_rate_limiting_counters"), + "disable_penalty": bool(false), + "enforce_consumer_groups": bool(false), + "error_code": float64(429), + "error_message": string("API rate limit exceeded"), + "header_name": nil, + "hide_client_headers": bool(false), + "identifier": string("consumer"), + "limit": []any{float64(10)}, + "lock_dictionary_name": string("kong_locks"), + "namespace": string("gold"), + "path": nil, + "redis": map[string]any{ + "cluster_addresses": nil, + "cluster_max_redirections": float64(5), + "cluster_nodes": nil, + "connect_timeout": float64(2000), + "connection_is_proxied": bool(false), + "database": float64(0), + "host": string("127.0.0.1"), + "keepalive_backlog": nil, + "keepalive_pool_size": float64(256), + "password": nil, + "port": float64(6379), + "read_timeout": float64(2000), + "redis_proxy_type": nil, + "send_timeout": float64(2000), + "sentinel_addresses": nil, + "sentinel_master": nil, + "sentinel_nodes": nil, + "sentinel_password": nil, + "sentinel_role": nil, + "sentinel_username": nil, + "server_name": nil, + "ssl": false, + "ssl_verify": false, + "timeout": float64(2000), + "username": nil, + }, + "retry_after_jitter_max": float64(1), + "strategy": string("local"), + "sync_rate": float64(-1), + "window_size": []any{float64(60)}, + "window_type": string("sliding"), + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")}, + }, + { + Name: kong.String("rate-limiting-advanced"), + ConsumerGroup: &kong.ConsumerGroup{ + ID: kong.String("5bcbd3a7-030b-4310-bd1d-2721ff85d236"), + }, + Config: kong.Configuration{ + "compound_identifier": nil, + "consumer_groups": nil, + "dictionary_name": string("kong_rate_limiting_counters"), + "disable_penalty": bool(false), + "enforce_consumer_groups": bool(false), + "error_code": float64(429), + "error_message": string("API rate limit exceeded"), + "header_name": nil, + "hide_client_headers": bool(false), + "identifier": string("consumer"), + "limit": []any{float64(7)}, + "lock_dictionary_name": string("kong_locks"), + "namespace": string("silver"), + "path": nil, + "redis": map[string]any{ + "cluster_addresses": nil, + "cluster_max_redirections": float64(5), + "cluster_nodes": nil, + "connect_timeout": float64(2000), + "connection_is_proxied": bool(false), + "database": float64(0), + "host": string("127.0.0.1"), + "keepalive_backlog": nil, + "keepalive_pool_size": float64(256), + "password": nil, + "port": float64(6379), + "read_timeout": float64(2000), + "redis_proxy_type": nil, + "send_timeout": float64(2000), + "sentinel_addresses": nil, + "sentinel_master": nil, + "sentinel_nodes": nil, + "sentinel_password": nil, + "sentinel_role": nil, + "sentinel_username": nil, + "server_name": nil, + "ssl": false, + "ssl_verify": false, + "timeout": float64(2000), + "username": nil, + }, + "retry_after_jitter_max": float64(1), + "strategy": string("local"), + "sync_rate": float64(-1), + "window_size": []any{float64(60)}, + "window_type": string("sliding"), + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")}, + }, + { + Name: kong.String("rate-limiting-advanced"), + Config: kong.Configuration{ + "compound_identifier": nil, + "consumer_groups": nil, + "dictionary_name": string("kong_rate_limiting_counters"), + "disable_penalty": bool(false), + "enforce_consumer_groups": bool(false), + "error_code": float64(429), + "error_message": string("API rate limit exceeded"), + "header_name": nil, + "hide_client_headers": bool(false), + "identifier": string("consumer"), + "limit": []any{float64(5)}, + "lock_dictionary_name": string("kong_locks"), + "namespace": string("silver"), + "path": nil, + "redis": map[string]any{ + "cluster_addresses": nil, + "cluster_max_redirections": float64(5), + "cluster_nodes": nil, + "connect_timeout": float64(2000), + "connection_is_proxied": bool(false), + "database": float64(0), + "host": string("127.0.0.1"), + "keepalive_backlog": nil, + "keepalive_pool_size": float64(256), + "password": nil, + "port": float64(6379), + "read_timeout": float64(2000), + "redis_proxy_type": nil, + "send_timeout": float64(2000), + "sentinel_addresses": nil, + "sentinel_master": nil, + "sentinel_nodes": nil, + "sentinel_password": nil, + "sentinel_role": nil, + "sentinel_username": nil, + "server_name": nil, + "ssl": false, + "ssl_verify": false, + "timeout": float64(2000), + "username": nil, + }, + "retry_after_jitter_max": float64(1), + "strategy": string("local"), + "sync_rate": float64(-1), + "window_size": []any{float64(60)}, + "window_type": string("sliding"), + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")}, + }, + { + Name: kong.String("key-auth"), + Config: kong.Configuration{ + "anonymous": nil, + "hide_credentials": false, + "key_in_body": false, + "key_in_header": true, + "key_in_query": true, + "key_names": []interface{}{"apikey"}, + "realm": nil, // This is present on 3.7.x+ + "run_on_preflight": true, + }, + Enabled: kong.Bool(true), + Protocols: []*string{kong.String("http"), kong.String("https")}, + }, + } ) // test scope: @@ -5045,7 +5228,7 @@ func Test_Sync_ConsumerGroupsScopedPlugins_After360(t *testing.T) { }, { name: "creates consumer groups scoped plugins", - runWhen: ">=3.8.1", + runWhen: ">=3.8.1 <3.9.0", kongFile: "testdata/sync/025-consumer-groups-scoped-plugins/kong3x.yaml", expectedState: utils.KongRawState{ Consumers: consumerGroupsConsumers, @@ -5096,6 +5279,59 @@ func Test_Sync_ConsumerGroupsScopedPlugins_After360(t *testing.T) { }, }, }, + { + name: "creates consumer groups scoped plugins", + runWhen: ">=3.9.0", + kongFile: "testdata/sync/025-consumer-groups-scoped-plugins/kong3x.yaml", + expectedState: utils.KongRawState{ + Consumers: consumerGroupsConsumers, + ConsumerGroups: []*kong.ConsumerGroupObject{ + { + ConsumerGroup: &kong.ConsumerGroup{ + Name: kong.String("silver"), + }, + Consumers: []*kong.Consumer{ + { + Username: kong.String("bar"), + }, + }, + }, + { + ConsumerGroup: &kong.ConsumerGroup{ + Name: kong.String("gold"), + }, + Consumers: []*kong.Consumer{ + { + Username: kong.String("foo"), + }, + }, + }, + }, + Plugins: consumerGroupScopedPlugins390x, + Services: svc1_207, + Routes: route1_20x, + KeyAuths: []*kong.KeyAuth{ + { + Consumer: &kong.Consumer{ + ID: kong.String("87095815-5395-454e-8c18-a11c9bc0ef04"), + }, + Key: kong.String("i-am-special"), + }, + { + Consumer: &kong.Consumer{ + ID: kong.String("5a5b9369-baeb-4faa-a902-c40ccdc2928e"), + }, + Key: kong.String("i-am-not-so-special"), + }, + { + Consumer: &kong.Consumer{ + ID: kong.String("e894ea9e-ad08-4acf-a960-5a23aa7701c7"), + }, + Key: kong.String("i-am-just-average"), + }, + }, + }, + }, } for _, tc := range tests { t.Run(tc.name+"/"+tc.runWhen, func(t *testing.T) { diff --git a/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip-39.yaml b/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip-39.yaml new file mode 100644 index 000000000..9e2ce7712 --- /dev/null +++ b/tests/integration/testdata/dump/002-skip-consumers/expected-no-skip-39.yaml @@ -0,0 +1,67 @@ +_format_version: "3.0" +consumer_groups: +- name: basic + plugins: + - config: + compound_identifier: null + consumer_groups: null + dictionary_name: kong_rate_limiting_counters + disable_penalty: false + enforce_consumer_groups: false + error_code: 429 + error_message: API rate limit exceeded + header_name: null + hide_client_headers: false + identifier: consumer + limit: + - 30000 + lock_dictionary_name: kong_locks + namespace: basic + path: null + redis: + cluster_addresses: null + cluster_max_redirections: 5 + cluster_nodes: null + connect_timeout: 2000 + connection_is_proxied: false + database: 0 + host: 127.0.0.1 + keepalive_backlog: null + keepalive_pool_size: 256 + password: null + port: 6379 + read_timeout: 2000 + redis_proxy_type: null + send_timeout: 2000 + sentinel_addresses: null + sentinel_master: null + sentinel_nodes: null + sentinel_password: null + sentinel_role: null + sentinel_username: null + server_name: null + ssl: false + ssl_verify: false + timeout: 2000 + username: null + retry_after_jitter_max: 0 + strategy: local + sync_rate: -1 + window_size: + - 2628000 + window_type: sliding + name: rate-limiting-advanced +consumers: +- groups: + - name: basic + username: foo +services: +- connect_timeout: 60000 + enabled: true + host: mockbin.org + name: svc1 + port: 80 + protocol: http + read_timeout: 60000 + retries: 5 + write_timeout: 60000 From 9c2f736abb18f1c0697c0c6c94377b27d3447ae6 Mon Sep 17 00:00:00 2001 From: Jordi Fernandez Date: Thu, 12 Dec 2024 13:45:25 +0100 Subject: [PATCH 20/38] chore(cmd): enhance help message for generate-imports-for-control-plane-id flag (#1448) Co-authored-by: Prashansa Kulshrestha --- cmd/file_kong2tf.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/file_kong2tf.go b/cmd/file_kong2tf.go index 5fbae1c15..ea015d9ab 100644 --- a/cmd/file_kong2tf.go +++ b/cmd/file_kong2tf.go @@ -86,7 +86,9 @@ into Terraform resources.`, kong2TfCmd.Flags().StringVarP(&cmdKong2TfOutputFilename, "output-file", "o", "-", "Output file to write. Use - to write to stdout.") kong2TfCmd.Flags().StringVarP(&cmdKong2TfGenerateImportsForControlPlaneID, - "generate-imports-for-control-plane-id", "g", "", "Generate terraform import statements for the control plane ID.") + "generate-imports-for-control-plane-id", "g", "", + "Generate terraform import statements for the control plane ID."+ + "Typically used after `deck gateway dump --with-id` to obtain the IDs of all entities.") kong2TfCmd.Flags().BoolVar(&cmdKong2TfIgnoreCredentialChanges, "ignore-credential-changes", false, "Enable flag to add a 'lifecycle' block to each consumer credential, "+ "that ignores any changes from local to remote state.") From 9c52126dcda15535c08cfcd9954e8304bf54ee95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Thu, 12 Dec 2024 14:07:10 +0100 Subject: [PATCH 21/38] tests: add GOTESTFLAGS to test-integration Makefile target (#1462) Co-authored-by: Prashansa Kulshrestha --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index c4c6bf028..b31594126 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,7 @@ setup-kong-ee: test-integration: go test -v -count=1 -tags=integration \ -race \ + $(GOTESTFLAGS) \ ./tests/integration/... .PHONY: clean From 18cbd8d1d91be5bed4ddc90c32d02992cb4d5f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Thu, 12 Dec 2024 14:29:23 +0100 Subject: [PATCH 22/38] ci: do not run Konnect integration tests in parallel (#1471) --- .github/workflows/integration-konnect.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-konnect.yaml b/.github/workflows/integration-konnect.yaml index 94d08d5aa..f7900a65d 100644 --- a/.github/workflows/integration-konnect.yaml +++ b/.github/workflows/integration-konnect.yaml @@ -1,9 +1,11 @@ name: Konnect Integration Test concurrency: - # Run only for most recent commit in PRs but for all tags and commits on main + # Only run one workflow at a time. Konnect integration tests cannot be run in parallel + # as they rely on manifests with static identifiers and/or names that would conflict + # if run in parallel. # Ref: https://docs.github.com/en/actions/using-jobs/using-concurrency - group: ${{ github.workflow }}-${{ github.head_ref || github.sha }} + group: ${{ github.workflow }} cancel-in-progress: true on: [pull_request] From 3e608350b2c2f8cbf3385733890022a8d2c5cb8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:44:40 +0100 Subject: [PATCH 23/38] chore(deps): bump k8s.io/client-go from 0.31.2 to 0.32.0 (#1469) Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.31.2 to 0.32.0. - [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md) - [Commits](https://github.com/kubernetes/client-go/compare/v0.31.2...v0.32.0) --- updated-dependencies: - dependency-name: k8s.io/client-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 26 +++++++++++++------------- go.sum | 53 ++++++++++++++++++++++++++--------------------------- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/go.mod b/go.mod index 4df4ce063..909ae0f5c 100644 --- a/go.mod +++ b/go.mod @@ -21,10 +21,10 @@ require ( github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 golang.org/x/sync v0.8.0 - k8s.io/api v0.31.2 + k8s.io/api v0.32.0 k8s.io/apiextensions-apiserver v0.31.2 - k8s.io/apimachinery v0.31.2 - k8s.io/client-go v0.31.2 + k8s.io/apimachinery v0.32.0 + k8s.io/client-go v0.32.0 k8s.io/code-generator v0.31.2 sigs.k8s.io/gateway-api v1.2.0 sigs.k8s.io/yaml v1.4.0 @@ -57,7 +57,7 @@ require ( github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.1 // indirect - github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect + github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect github.com/hashicorp/go-memdb v1.3.4 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect @@ -67,7 +67,7 @@ require ( github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect - github.com/moby/spdystream v0.4.0 // indirect + github.com/moby/spdystream v0.5.0 // indirect github.com/moby/term v0.5.0 // indirect github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect @@ -95,13 +95,13 @@ require ( go.opentelemetry.io/otel/trace v1.28.0 // indirect go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect - golang.org/x/oauth2 v0.22.0 // indirect - golang.org/x/time v0.6.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/time v0.7.0 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/cli-runtime v0.31.0 // indirect k8s.io/component-base v0.31.2 // indirect - k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect + k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7 // indirect k8s.io/kubectl v0.31.0 // indirect sigs.k8s.io/kind v0.24.0 // indirect sigs.k8s.io/kustomize/api v0.17.3 // indirect @@ -193,14 +193,14 @@ require ( golang.org/x/term v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/tools v0.26.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/protobuf v1.35.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f // indirect - k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect + k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect + k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect sigs.k8s.io/controller-runtime v0.19.1 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect ) diff --git a/go.sum b/go.sum index dc7be4dfe..6ffdbcbb5 100644 --- a/go.sum +++ b/go.sum @@ -200,8 +200,8 @@ github.com/gosimple/slug v1.14.0 h1:RtTL/71mJNDfpUbCOmnf/XFkzKRtD6wL6Uy+3akm4Es= github.com/gosimple/slug v1.14.0/go.mod h1:UiRaFH+GEilHstLUmcBgWcI42viBN7mAb818JrYOeFQ= github.com/gosimple/unidecode v1.0.1 h1:hZzFTMMqSswvf0LBJZCZgThIZrpDHFXux9KeGmn6T/o= github.com/gosimple/unidecode v1.0.1/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA= +github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= @@ -296,8 +296,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/moby/spdystream v0.4.0 h1:Vy79D6mHeJJjiPdFEL2yku1kl0chZpJfZcPpb16BRl8= -github.com/moby/spdystream v0.4.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= +github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU= +github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -525,8 +525,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= -golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -586,8 +586,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -631,8 +631,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD 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.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= 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= @@ -651,7 +651,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= @@ -663,43 +662,43 @@ gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= 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.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0= -k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk= +k8s.io/api v0.32.0 h1:OL9JpbvAU5ny9ga2fb24X8H6xQlVp+aJMFlgtQjR9CE= +k8s.io/api v0.32.0/go.mod h1:4LEwHZEf6Q/cG96F3dqR965sYOfmPM7rq81BLgsE0p0= k8s.io/apiextensions-apiserver v0.31.2 h1:W8EwUb8+WXBLu56ser5IudT2cOho0gAKeTOnywBLxd0= k8s.io/apiextensions-apiserver v0.31.2/go.mod h1:i+Geh+nGCJEGiCGR3MlBDkS7koHIIKWVfWeRFiOsUcM= -k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= -k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/apimachinery v0.32.0 h1:cFSE7N3rmEEtv4ei5X6DaJPHHX0C+upp+v5lVPiEwpg= +k8s.io/apimachinery v0.32.0/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= k8s.io/cli-runtime v0.31.0 h1:V2Q1gj1u3/WfhD475HBQrIYsoryg/LrhhK4RwpN+DhA= k8s.io/cli-runtime v0.31.0/go.mod h1:vg3H94wsubuvWfSmStDbekvbla5vFGC+zLWqcf+bGDw= -k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc= -k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs= +k8s.io/client-go v0.32.0 h1:DimtMcnN/JIKZcrSrstiwvvZvLjG0aSxy8PxN8IChp8= +k8s.io/client-go v0.32.0/go.mod h1:boDWvdM1Drk4NJj/VddSLnx59X3OPgwrOo0vGbtq9+8= k8s.io/code-generator v0.31.2 h1:xLWxG0HEpMSHfcM//3u3Ro2Hmc6AyyLINQS//Z2GEOI= k8s.io/code-generator v0.31.2/go.mod h1:eEQHXgBU/m7LDaToDoiz3t97dUUVyOblQdwOr8rivqc= k8s.io/component-base v0.31.2 h1:Z1J1LIaC0AV+nzcPRFqfK09af6bZ4D1nAOpWsy9owlA= k8s.io/component-base v0.31.2/go.mod h1:9PeyyFN/drHjtJZMCTkSpQJS3U9OXORnHQqMLDz0sUQ= -k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= -k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= +k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7 h1:cErOOTkQ3JW19o4lo91fFurouhP8NcoBvb7CkvhZZpk= +k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f h1:0LQagt0gDpKqvIkAMPaRGcXawNMouPECM1+F9BVxEaM= -k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f/go.mod h1:S9tOR0FxgyusSNR+MboCuiDpVWkAifZvaYI1Q2ubgro= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= k8s.io/kubectl v0.31.0 h1:kANwAAPVY02r4U4jARP/C+Q1sssCcN/1p9Nk+7BQKVg= k8s.io/kubectl v0.31.0/go.mod h1:pB47hhFypGsaHAPjlwrNbvhXgmuAr01ZBvAIIUaI8d4= -k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= -k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/controller-runtime v0.19.1 h1:Son+Q40+Be3QWb+niBXAg2vFiYWolDjjRfO8hn/cxOk= sigs.k8s.io/controller-runtime v0.19.1/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= sigs.k8s.io/gateway-api v1.2.0 h1:LrToiFwtqKTKZcZtoQPTuo3FxhrrhTgzQG0Te+YGSo8= sigs.k8s.io/gateway-api v1.2.0/go.mod h1:EpNfEXNjiYfUJypf0eZ0P5iXA9ekSGWaS1WgPaM42X0= -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/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= +sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= sigs.k8s.io/kind v0.24.0 h1:g4y4eu0qa+SCeKESLpESgMmVFBebL0BDa6f777OIWrg= sigs.k8s.io/kind v0.24.0/go.mod h1:t7ueEpzPYJvHA8aeLtI52rtFftNgUYUaCwvxjk7phfw= sigs.k8s.io/kustomize/api v0.17.3 h1:6GCuHSsxq7fN5yhF2XrC+AAr8gxQwhexgHflOAD/JJU= sigs.k8s.io/kustomize/api v0.17.3/go.mod h1:TuDH4mdx7jTfK61SQ/j1QZM/QWR+5rmEiNjvYlhzFhc= sigs.k8s.io/kustomize/kyaml v0.17.2 h1:+AzvoJUY0kq4QAhH/ydPHHMRLijtUKiyVyh7fOSshr0= sigs.k8s.io/kustomize/kyaml v0.17.2/go.mod h1:9V0mCjIEYjlXuCdYsSXvyoy2BTsLESH7TlGV81S282U= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= From 1d603986df5c0209a18fcd3d6803b5f531241982 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:54:12 +0000 Subject: [PATCH 24/38] chore(deps): bump alpine from 3.20.3 to 3.21.0 (#1464) Bumps alpine from 3.20.3 to 3.21.0. --- updated-dependencies: - dependency-name: alpine dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3d7568a10..310fa02f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ ARG TAG RUN CGO_ENABLED=0 GOOS=linux go build -o deck \ -ldflags "-s -w -X github.com/kong/deck/cmd.VERSION=$TAG -X github.com/kong/deck/cmd.COMMIT=$COMMIT" -FROM alpine:3.20.3 +FROM alpine:3.21.0 RUN adduser --disabled-password --gecos "" deckuser RUN apk --no-cache add ca-certificates jq USER deckuser From d21f8cf5358f22cf3c62d8cfe022017b52c4ba95 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:03:22 +0000 Subject: [PATCH 25/38] chore(deps): bump golang.org/x/sync from 0.8.0 to 0.10.0 (#1463) Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.8.0 to 0.10.0. - [Commits](https://github.com/golang/sync/compare/v0.8.0...v0.10.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 909ae0f5c..2cb013aad 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 - golang.org/x/sync v0.8.0 + golang.org/x/sync v0.10.0 k8s.io/api v0.32.0 k8s.io/apiextensions-apiserver v0.31.2 k8s.io/apimachinery v0.32.0 diff --git a/go.sum b/go.sum index 6ffdbcbb5..91388a717 100644 --- a/go.sum +++ b/go.sum @@ -534,8 +534,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= From 41c5236b3cc4d9cc756a0447ccfd65a4a8e883d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:25:13 +0100 Subject: [PATCH 26/38] chore(deps): bump golang from 1.23.3 to 1.23.4 (#1460) Bumps golang from 1.23.3 to 1.23.4. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 310fa02f8..b62f51b2e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.23.3 AS build +FROM golang:1.23.4 AS build WORKDIR /deck COPY go.mod ./ COPY go.sum ./ From 983b82eab9dc2eb435be897af11c4b39c9e55580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Fri, 13 Dec 2024 08:58:21 +0100 Subject: [PATCH 27/38] chore(ci): add kong 3.8 (#1472) * chore(ci): add kong 3.8 * chore: fixed gw 3.8.0 tests (#1474) --------- Co-authored-by: Prashansa Kulshrestha --- .github/workflows/integration-enterprise.yaml | 1 + .github/workflows/integration.yaml | 1 + tests/integration/diff_test.go | 8 ++++---- tests/integration/dump_test.go | 14 +++++++------- tests/integration/sync_test.go | 12 ++++++------ 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/integration-enterprise.yaml b/.github/workflows/integration-enterprise.yaml index fbce80e50..997ad1c7a 100644 --- a/.github/workflows/integration-enterprise.yaml +++ b/.github/workflows/integration-enterprise.yaml @@ -23,6 +23,7 @@ jobs: - 'kong/kong-gateway:3.5' - 'kong/kong-gateway:3.6' - 'kong/kong-gateway:3.7' + - 'kong/kong-gateway:3.8' - 'kong/kong-gateway-dev:latest' env: KONG_ANONYMOUS_REPORTS: "off" diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 7786e2b09..c411780f6 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -23,6 +23,7 @@ jobs: - 'kong:3.5' - 'kong:3.6' - 'kong:3.7' + - 'kong:3.8' - 'kong/kong:master' env: KONG_ANONYMOUS_REPORTS: "off" diff --git a/tests/integration/diff_test.go b/tests/integration/diff_test.go index ff2fd9b59..bd1bd8557 100644 --- a/tests/integration/diff_test.go +++ b/tests/integration/diff_test.go @@ -758,14 +758,14 @@ func Test_Diff_NoDiffUnorderedArray(t *testing.T) { runWhen string }{ { - name: "no diffs with unordered arrays >=3.5.0 <3.8.1", + name: "no diffs with unordered arrays >=3.5.0 <3.8.0", stateFile: "testdata/diff/004-no-diff-plugin/kong.yaml", - runWhen: ">=3.5.0 <3.8.1", + runWhen: ">=3.5.0 <3.8.0", }, { - name: "no diffs with unordered arrays >=3.8.1", + name: "no diffs with unordered arrays >=3.8.0", stateFile: "testdata/diff/004-no-diff-plugin/kong.yaml", - runWhen: ">=3.8.1", + runWhen: ">=3.8.0", }, } for _, tc := range tests { diff --git a/tests/integration/dump_test.go b/tests/integration/dump_test.go index 87ec7c453..ac0e76a92 100644 --- a/tests/integration/dump_test.go +++ b/tests/integration/dump_test.go @@ -50,16 +50,16 @@ func Test_Dump_SelectTags_3x(t *testing.T) { runWhen string }{ { - name: "dump with select-tags >=3.1.0 <3.8.1", + name: "dump with select-tags >=3.1.0 <3.8.0", stateFile: "testdata/dump/001-entities-with-tags/kong.yaml", expectedFile: "testdata/dump/001-entities-with-tags/expected.yaml", - runWhen: ">=3.1.0 <3.8.1", + runWhen: ">=3.1.0 <3.8.0", }, { - name: "dump with select-tags 3.8.1", + name: "dump with select-tags 3.8.0", stateFile: "testdata/dump/001-entities-with-tags/kong.yaml", expectedFile: "testdata/dump/001-entities-with-tags/expected381.yaml", - runWhen: ">=3.8.1", + runWhen: ">=3.8.0", }, } for _, tc := range tests { @@ -131,14 +131,14 @@ func Test_Dump_SkipConsumers(t *testing.T) { stateFile: "testdata/dump/002-skip-consumers/kong34.yaml", expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip-35.yaml", skipConsumers: false, - runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.5.0 <3.8.1") }, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.5.0 <3.8.0") }, }, { - name: "3.8.1 dump with no skip-consumers", + name: "3.8.0 dump with no skip-consumers", stateFile: "testdata/dump/002-skip-consumers/kong34.yaml", expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip-381.yaml", skipConsumers: false, - runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.8.1 <3.9.0") }, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.8.0 <3.9.0") }, }, { name: "3.9.0 dump with no skip-consumers", diff --git a/tests/integration/sync_test.go b/tests/integration/sync_test.go index 910e5f957..a84c24460 100644 --- a/tests/integration/sync_test.go +++ b/tests/integration/sync_test.go @@ -3322,7 +3322,7 @@ func Test_Sync_PluginsOnEntitiesFrom_3_0_0(t *testing.T) { runWhen string }{ { - name: "create plugins on services, routes and consumers <3.8.1", + name: "create plugins on services, routes and consumers <3.8.0", kongFile: "testdata/sync/xxx-plugins-on-entities/kong.yaml", expectedState: utils.KongRawState{ Services: svc1_207, @@ -3330,10 +3330,10 @@ func Test_Sync_PluginsOnEntitiesFrom_3_0_0(t *testing.T) { Plugins: plugin_on_entities3x, Consumers: consumer, }, - runWhen: ">=3.0.0 <3.8.1", + runWhen: ">=3.0.0 <3.8.0", }, { - name: "create plugins on services, routes and consumers >=3.8.1", + name: "create plugins on services, routes and consumers >=3.8.0", kongFile: "testdata/sync/xxx-plugins-on-entities/kong.yaml", expectedState: utils.KongRawState{ Services: svc1_207, @@ -3341,7 +3341,7 @@ func Test_Sync_PluginsOnEntitiesFrom_3_0_0(t *testing.T) { Plugins: plugin_on_entities381x, Consumers: consumer, }, - runWhen: ">=3.8.1", + runWhen: ">=3.8.0", }, } @@ -5175,7 +5175,7 @@ func Test_Sync_ConsumerGroupsScopedPlugins_After360(t *testing.T) { }, { name: "creates consumer groups scoped plugins", - runWhen: ">=3.7.0 <3.8.1", + runWhen: ">=3.7.0 <3.8.0", kongFile: "testdata/sync/025-consumer-groups-scoped-plugins/kong3x.yaml", expectedState: utils.KongRawState{ Consumers: consumerGroupsConsumers, @@ -5228,7 +5228,7 @@ func Test_Sync_ConsumerGroupsScopedPlugins_After360(t *testing.T) { }, { name: "creates consumer groups scoped plugins", - runWhen: ">=3.8.1 <3.9.0", + runWhen: ">=3.8.0 <3.9.0", kongFile: "testdata/sync/025-consumer-groups-scoped-plugins/kong3x.yaml", expectedState: utils.KongRawState{ Consumers: consumerGroupsConsumers, From 1031d1fbea3ecaacf37e6125531fc957fab6f6cf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 08:14:22 +0000 Subject: [PATCH 28/38] chore(deps): bump sigs.k8s.io/gateway-api from 1.2.0 to 1.2.1 (#1476) Bumps [sigs.k8s.io/gateway-api](https://github.com/kubernetes-sigs/gateway-api) from 1.2.0 to 1.2.1. - [Release notes](https://github.com/kubernetes-sigs/gateway-api/releases) - [Changelog](https://github.com/kubernetes-sigs/gateway-api/blob/main/RELEASE.md) - [Commits](https://github.com/kubernetes-sigs/gateway-api/compare/v1.2.0...v1.2.1) --- updated-dependencies: - dependency-name: sigs.k8s.io/gateway-api dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2cb013aad..7f2f18069 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( k8s.io/apimachinery v0.32.0 k8s.io/client-go v0.32.0 k8s.io/code-generator v0.31.2 - sigs.k8s.io/gateway-api v1.2.0 + sigs.k8s.io/gateway-api v1.2.1 sigs.k8s.io/yaml v1.4.0 ) diff --git a/go.sum b/go.sum index 91388a717..1221948d0 100644 --- a/go.sum +++ b/go.sum @@ -688,8 +688,8 @@ k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6J k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/controller-runtime v0.19.1 h1:Son+Q40+Be3QWb+niBXAg2vFiYWolDjjRfO8hn/cxOk= sigs.k8s.io/controller-runtime v0.19.1/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= -sigs.k8s.io/gateway-api v1.2.0 h1:LrToiFwtqKTKZcZtoQPTuo3FxhrrhTgzQG0Te+YGSo8= -sigs.k8s.io/gateway-api v1.2.0/go.mod h1:EpNfEXNjiYfUJypf0eZ0P5iXA9ekSGWaS1WgPaM42X0= +sigs.k8s.io/gateway-api v1.2.1 h1:fZZ/+RyRb+Y5tGkwxFKuYuSRQHu9dZtbjenblleOLHM= +sigs.k8s.io/gateway-api v1.2.1/go.mod h1:EpNfEXNjiYfUJypf0eZ0P5iXA9ekSGWaS1WgPaM42X0= sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= sigs.k8s.io/kind v0.24.0 h1:g4y4eu0qa+SCeKESLpESgMmVFBebL0BDa6f777OIWrg= From c52a569f2a45ab83d876486b54abdd2512824654 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 08:28:36 +0000 Subject: [PATCH 29/38] chore(deps): bump docker/metadata-action from 5.5.1 to 5.6.1 (#1443) Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 5.5.1 to 5.6.1. - [Release notes](https://github.com/docker/metadata-action/releases) - [Commits](https://github.com/docker/metadata-action/compare/v5.5.1...v5.6.1) --- updated-dependencies: - dependency-name: docker/metadata-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 404cac8bf..94f61b69b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -59,7 +59,7 @@ jobs: password: ${{ secrets.DOCKER_TOKEN }} - name: Docker meta id: meta - uses: docker/metadata-action@v5.5.1 + uses: docker/metadata-action@v5.6.1 with: images: kong/deck tags: ${{ env.TAGS_STANDARD }}${{ env.TAGS_SUPPLEMENTAL }} From ba070711ee18493224406d281ad54a0a41e71669 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 08:50:04 +0000 Subject: [PATCH 30/38] chore(deps): bump github.com/kong/kubernetes-configuration (#1475) Bumps [github.com/kong/kubernetes-configuration](https://github.com/kong/kubernetes-configuration) from 0.0.46 to 1.0.0. - [Release notes](https://github.com/kong/kubernetes-configuration/releases) - [Changelog](https://github.com/Kong/kubernetes-configuration/blob/main/CHANGELOG.md) - [Commits](https://github.com/kong/kubernetes-configuration/compare/v0.0.46...v1.0.0) --- updated-dependencies: - dependency-name: github.com/kong/kubernetes-configuration dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 24 +++++++++++------------ go.sum | 60 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/go.mod b/go.mod index 7f2f18069..b43ff9405 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.40 github.com/kong/go-database-reconciler v1.16.1 - github.com/kong/go-kong v0.60.0 + github.com/kong/go-kong v0.61.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 @@ -22,17 +22,17 @@ require ( github.com/stretchr/testify v1.10.0 golang.org/x/sync v0.10.0 k8s.io/api v0.32.0 - k8s.io/apiextensions-apiserver v0.31.2 + k8s.io/apiextensions-apiserver v0.32.0 k8s.io/apimachinery v0.32.0 k8s.io/client-go v0.32.0 - k8s.io/code-generator v0.31.2 + k8s.io/code-generator v0.32.0 sigs.k8s.io/gateway-api v1.2.1 sigs.k8s.io/yaml v1.4.0 ) require ( - github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect - github.com/Kong/sdk-konnect-go v0.1.6 // indirect + github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect + github.com/Kong/sdk-konnect-go v0.1.11 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/avast/retry-go/v4 v4.6.0 // indirect @@ -100,8 +100,8 @@ require ( gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/cli-runtime v0.31.0 // indirect - k8s.io/component-base v0.31.2 // indirect - k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7 // indirect + k8s.io/component-base v0.32.0 // indirect + k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9 // indirect k8s.io/kubectl v0.31.0 // indirect sigs.k8s.io/kind v0.24.0 // indirect sigs.k8s.io/kustomize/api v0.17.3 // indirect @@ -147,7 +147,7 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kong/go-slugify v1.0.0 // indirect - github.com/kong/kubernetes-configuration v0.0.46 + github.com/kong/kubernetes-configuration v1.0.0 github.com/kong/kubernetes-testing-framework v0.47.2 github.com/kong/semver/v4 v4.0.1 // indirect github.com/lithammer/fuzzysearch v1.1.8 // indirect @@ -189,9 +189,9 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.30.0 // indirect - golang.org/x/sys v0.27.0 // indirect - golang.org/x/term v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/term v0.27.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.35.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect @@ -200,7 +200,7 @@ require ( k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect - sigs.k8s.io/controller-runtime v0.19.1 // indirect + sigs.k8s.io/controller-runtime v0.19.3 // indirect sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect ) diff --git a/go.sum b/go.sum index 1221948d0..2826e297c 100644 --- a/go.sum +++ b/go.sum @@ -9,15 +9,15 @@ atomicgo.dev/schedule v0.1.0/go.mod h1:xeUa3oAkiuHYh8bKiQBRojqAMq3PXXbJujjb0hw8p cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Kong/go-diff v1.2.2 h1:KKKaqHc8IxuguFVIZMNt3bi6YuC/t9r7BGD8bOOpSgM= github.com/Kong/go-diff v1.2.2/go.mod h1:nlvdwVZQk3Rm+tbI0cDmKFrOjghtcZTrZBp+UruvvA8= github.com/Kong/gojsondiff v1.3.2 h1:qIOVq2mUXt+NXy8Be5gRUee9TP3Ve0MbQSafg9bXKZE= github.com/Kong/gojsondiff v1.3.2/go.mod h1:DiIxtU59q4alK7ecP+7k56C5UjgOviJ5gQVR2esEhYw= -github.com/Kong/sdk-konnect-go v0.1.6 h1:e0wSujJVVo16y2qOrKvzg6/4sMPc/FLK70eSt80HnXE= -github.com/Kong/sdk-konnect-go v0.1.6/go.mod h1:ipu67aQNnwDzu/LXKePG46cVqkkZnAHKWpsbhTEI8xE= +github.com/Kong/sdk-konnect-go v0.1.11 h1:qFO0vmOM/PEuD9Yk5zFoO7PaOX+ufanYdAdzmQk48Wo= +github.com/Kong/sdk-konnect-go v0.1.11/go.mod h1:xsmTIkBbmVyUh1nRFjQMOhxYIPDl+sMfmRmPuZHtwLE= github.com/Kong/yaml v1.0.0 h1:OWOxtLEamLYKZzcrfoH76imAwSi9FgSZapxg1Kh6IBA= github.com/Kong/yaml v1.0.0/go.mod h1:gVzJ3lyC0UdO7kZxmCpwn0Vj20y/02cFnDpHBirGrSQ= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= @@ -249,12 +249,12 @@ github.com/kong/go-apiops v0.1.40 h1:Dp4IHJ3h61VeOAeQkOisf1BcOP+Ww+gpqnv14HvC6DQ github.com/kong/go-apiops v0.1.40/go.mod h1:CNfsa9mHFRfAhT9E2IWTul0Mi1/BldTDmFu5fWcp2us= github.com/kong/go-database-reconciler v1.16.1 h1:qcQzEuMGfpNjx3UgulBOKulKA+upmHwqw4dy6TMEV7A= github.com/kong/go-database-reconciler v1.16.1/go.mod h1:7CGvStUvUOmUnodUFsWcW3PX2bJgnaKClJ/yhNGEVIE= -github.com/kong/go-kong v0.60.0 h1:CVrLXRLVE+Gl4IZ3tdvpO7xNDz3c9YLTmra/HvT4oM8= -github.com/kong/go-kong v0.60.0/go.mod h1:t1eMY8GRS6778uQNzxgzRgnA3YKBXSZOEvYbNocH/aA= +github.com/kong/go-kong v0.61.0 h1:EWnQVMk1u1gy8//Hvui3NVCJZZ+fBnifVcoaIyLq60A= +github.com/kong/go-kong v0.61.0/go.mod h1:e0zgpuCnCbOXQN6e0e235TFJr4IYY8dDg9nLQgG9m7A= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= github.com/kong/go-slugify v1.0.0/go.mod h1:dbR2h3J2QKXQ1k0aww6cN7o4cIcwlWflr6RKRdcoaiw= -github.com/kong/kubernetes-configuration v0.0.46 h1:dIxVu9dOtGi9aY2prTlQ1CkiSu8Fk/0oal9m9iiUdSk= -github.com/kong/kubernetes-configuration v0.0.46/go.mod h1:Bk0H032d+aPgVYakc7C9Zo5nLwiXXm9thKUWF8vvisA= +github.com/kong/kubernetes-configuration v1.0.0 h1:f/OaX6oq8/MPur45KzcrIFGJ9Kl6OyTjlXqTJH+ij4s= +github.com/kong/kubernetes-configuration v1.0.0/go.mod h1:lq/MxAtpz35I5I9MeTe4CdDG1iSd67aV0Ft9wih2UUs= github.com/kong/kubernetes-testing-framework v0.47.2 h1:+2Z9anTpbV/hwNeN+NFQz53BMU+g3QJydkweBp3tULo= github.com/kong/kubernetes-testing-framework v0.47.2/go.mod h1:DJ5btl/srdIM03tg3f+jS9Izu7xkRkciAM69Ptqun1I= github.com/kong/semver/v4 v4.0.1 h1:DIcNR8W3gfx0KabFBADPalxxsp+q/5COwIFkkhrFQ2Y= @@ -486,8 +486,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= -go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -567,16 +567,16 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= -golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -584,8 +584,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -611,10 +611,10 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= -google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f h1:b1Ln/PG8orm0SsBbHZWke8dDp2lrCD4jSmfglFpTZbk= -google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f/go.mod h1:AHT0dDg3SoMOgZGnZk29b5xTbPHMoEC8qthmBLJCpys= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf h1:liao9UHurZLtiEwBgT9LMOnKYsHze6eA6w1KQCMVN2Q= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 h1:YcyjlL1PRr2Q17/I0dPk2JmYS5CDXfcdb2Z3YRioEbw= +google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 h1:2035KHhUv+EpyB+hWgJnaWKJOdX1E95w2S8Rr4uWKTs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -664,20 +664,20 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.32.0 h1:OL9JpbvAU5ny9ga2fb24X8H6xQlVp+aJMFlgtQjR9CE= k8s.io/api v0.32.0/go.mod h1:4LEwHZEf6Q/cG96F3dqR965sYOfmPM7rq81BLgsE0p0= -k8s.io/apiextensions-apiserver v0.31.2 h1:W8EwUb8+WXBLu56ser5IudT2cOho0gAKeTOnywBLxd0= -k8s.io/apiextensions-apiserver v0.31.2/go.mod h1:i+Geh+nGCJEGiCGR3MlBDkS7koHIIKWVfWeRFiOsUcM= +k8s.io/apiextensions-apiserver v0.32.0 h1:S0Xlqt51qzzqjKPxfgX1xh4HBZE+p8KKBq+k2SWNOE0= +k8s.io/apiextensions-apiserver v0.32.0/go.mod h1:86hblMvN5yxMvZrZFX2OhIHAuFIMJIZ19bTvzkP+Fmw= k8s.io/apimachinery v0.32.0 h1:cFSE7N3rmEEtv4ei5X6DaJPHHX0C+upp+v5lVPiEwpg= k8s.io/apimachinery v0.32.0/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= k8s.io/cli-runtime v0.31.0 h1:V2Q1gj1u3/WfhD475HBQrIYsoryg/LrhhK4RwpN+DhA= k8s.io/cli-runtime v0.31.0/go.mod h1:vg3H94wsubuvWfSmStDbekvbla5vFGC+zLWqcf+bGDw= k8s.io/client-go v0.32.0 h1:DimtMcnN/JIKZcrSrstiwvvZvLjG0aSxy8PxN8IChp8= k8s.io/client-go v0.32.0/go.mod h1:boDWvdM1Drk4NJj/VddSLnx59X3OPgwrOo0vGbtq9+8= -k8s.io/code-generator v0.31.2 h1:xLWxG0HEpMSHfcM//3u3Ro2Hmc6AyyLINQS//Z2GEOI= -k8s.io/code-generator v0.31.2/go.mod h1:eEQHXgBU/m7LDaToDoiz3t97dUUVyOblQdwOr8rivqc= -k8s.io/component-base v0.31.2 h1:Z1J1LIaC0AV+nzcPRFqfK09af6bZ4D1nAOpWsy9owlA= -k8s.io/component-base v0.31.2/go.mod h1:9PeyyFN/drHjtJZMCTkSpQJS3U9OXORnHQqMLDz0sUQ= -k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7 h1:cErOOTkQ3JW19o4lo91fFurouhP8NcoBvb7CkvhZZpk= -k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU= +k8s.io/code-generator v0.32.0 h1:s0lNN8VSWny8LBz5t5iy7MCdgwdOhdg7vAGVxvS+VWU= +k8s.io/code-generator v0.32.0/go.mod h1:b7Q7KMZkvsYFy72A79QYjiv4aTz3GvW0f1T3UfhFq4s= +k8s.io/component-base v0.32.0 h1:d6cWHZkCiiep41ObYQS6IcgzOUQUNpywm39KVYaUqzU= +k8s.io/component-base v0.32.0/go.mod h1:JLG2W5TUxUu5uDyKiH2R/7NnxJo1HlPoRIIbVLkK5eM= +k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9 h1:si3PfKm8dDYxgfbeA6orqrtLkvvIeH8UqffFJDl0bz4= +k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= @@ -686,8 +686,8 @@ k8s.io/kubectl v0.31.0 h1:kANwAAPVY02r4U4jARP/C+Q1sssCcN/1p9Nk+7BQKVg= k8s.io/kubectl v0.31.0/go.mod h1:pB47hhFypGsaHAPjlwrNbvhXgmuAr01ZBvAIIUaI8d4= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.19.1 h1:Son+Q40+Be3QWb+niBXAg2vFiYWolDjjRfO8hn/cxOk= -sigs.k8s.io/controller-runtime v0.19.1/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= +sigs.k8s.io/controller-runtime v0.19.3 h1:XO2GvC9OPftRst6xWCpTgBZO04S2cbp0Qqkj8bX1sPw= +sigs.k8s.io/controller-runtime v0.19.3/go.mod h1:j4j87DqtsThvwTv5/Tc5NFRyyF/RF0ip4+62tbTSIUM= sigs.k8s.io/gateway-api v1.2.1 h1:fZZ/+RyRb+Y5tGkwxFKuYuSRQHu9dZtbjenblleOLHM= sigs.k8s.io/gateway-api v1.2.1/go.mod h1:EpNfEXNjiYfUJypf0eZ0P5iXA9ekSGWaS1WgPaM42X0= sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= From ca82e63ea01fa9b7482ed688d3ff3170b09b5230 Mon Sep 17 00:00:00 2001 From: Jordi Fernandez Date: Fri, 13 Dec 2024 11:07:23 +0100 Subject: [PATCH 31/38] fix: restore Gateway API generation (issue #1427). (#1431) * fix: restore Gateway API generation (issue #1427). Separate integration tests in kong2kic_integration_test.go and must be explicitly invoked with -tags=integration. Fix tests to evaluate all yaml objects. * refactor: replace hardcoded strings with constants in KIC components * fix: remove nolint directive for service port assignment in createIngressPaths --------- Co-authored-by: Prashansa Kulshrestha --- kong2kic/builder_v2_gw_api.go | 2 +- kong2kic/builder_v3_gw_api.go | 2 +- kong2kic/ca_certificate.go | 4 +- kong2kic/certificate.go | 2 +- kong2kic/consumer.go | 4 +- kong2kic/consumer_credentials.go | 4 +- kong2kic/consumer_group.go | 8 +- kong2kic/global_plugin.go | 6 +- kong2kic/kong2kic.go | 16 - kong2kic/kong2kic_integration_test.go | 344 ++++++++++++++++++ kong2kic/kong2kic_test.go | 344 +----------------- kong2kic/route.go | 340 ++++++++++++++++- kong2kic/service.go | 18 +- .../testdata/consumer-v2-output-expected.yaml | 12 +- .../testdata/consumer-v3-output-expected.yaml | 12 +- kong2kic/types.go | 5 + kong2kic/upstream.go | 10 +- kong2kic/utils.go | 55 ++- 18 files changed, 784 insertions(+), 404 deletions(-) create mode 100644 kong2kic/kong2kic_integration_test.go diff --git a/kong2kic/builder_v2_gw_api.go b/kong2kic/builder_v2_gw_api.go index a30d4e21f..74b9a3db7 100644 --- a/kong2kic/builder_v2_gw_api.go +++ b/kong2kic/builder_v2_gw_api.go @@ -24,7 +24,7 @@ func (b *KICv2GatewayAPIBuilder) buildServices(content *file.Content) { } func (b *KICv2GatewayAPIBuilder) buildRoutes(content *file.Content) { - err := populateKICIngressesWithAnnotations(content, b.kicContent) + err := populateKICIngressesWithGatewayAPI(content, b.kicContent) if err != nil { log.Fatal(err) } diff --git a/kong2kic/builder_v3_gw_api.go b/kong2kic/builder_v3_gw_api.go index 81f62b8d7..4f1b6820c 100644 --- a/kong2kic/builder_v3_gw_api.go +++ b/kong2kic/builder_v3_gw_api.go @@ -24,7 +24,7 @@ func (b *KICv3GatewayAPIBuider) buildServices(content *file.Content) { } func (b *KICv3GatewayAPIBuider) buildRoutes(content *file.Content) { - err := populateKICIngressesWithAnnotations(content, b.kicContent) + err := populateKICIngressesWithGatewayAPI(content, b.kicContent) if err != nil { log.Fatal(err) } diff --git a/kong2kic/ca_certificate.go b/kong2kic/ca_certificate.go index 7cd4e92a2..d7404338e 100644 --- a/kong2kic/ca_certificate.go +++ b/kong2kic/ca_certificate.go @@ -32,7 +32,7 @@ func populateKICCACertificate(content *file.Content, file *KICContent) { continue } if caCert.CertDigest != nil { - secret.StringData["ca.digest"] = *caCert.CertDigest + secret.StringData[SecretCADigest] = *caCert.CertDigest } // add konghq.com/tags annotation if cacert.Tags is not nil @@ -43,7 +43,7 @@ func populateKICCACertificate(content *file.Content, file *KICContent) { tags = append(tags, *tag) } } - secret.ObjectMeta.Annotations["konghq.com/tags"] = strings.Join(tags, ",") + secret.ObjectMeta.Annotations[KongHQTags] = strings.Join(tags, ",") } file.Secrets = append(file.Secrets, secret) diff --git a/kong2kic/certificate.go b/kong2kic/certificate.go index 48c4e9daf..0c4d590b4 100644 --- a/kong2kic/certificate.go +++ b/kong2kic/certificate.go @@ -42,7 +42,7 @@ func populateKICCertificates(content *file.Content, file *KICContent) { tags = append(tags, *tag) } } - secret.ObjectMeta.Annotations["konghq.com/tags"] = strings.Join(tags, ",") + secret.ObjectMeta.Annotations[KongHQTags] = strings.Join(tags, ",") } file.Secrets = append(file.Secrets, secret) diff --git a/kong2kic/consumer.go b/kong2kic/consumer.go index 7ae1ee824..93824fe20 100644 --- a/kong2kic/consumer.go +++ b/kong2kic/consumer.go @@ -18,8 +18,8 @@ func populateKICConsumers(content *file.Content, file *KICContent) error { username := *consumer.Username kongConsumer := configurationv1.KongConsumer{ TypeMeta: metav1.TypeMeta{ - APIVersion: KICAPIVersion, - Kind: "KongConsumer", + APIVersion: ConfigurationKongHQv1, + Kind: KongConsumerKind, }, ObjectMeta: metav1.ObjectMeta{ Name: calculateSlug(username), diff --git a/kong2kic/consumer_credentials.go b/kong2kic/consumer_credentials.go index ad4dc507d..f3bb40c2b 100644 --- a/kong2kic/consumer_credentials.go +++ b/kong2kic/consumer_credentials.go @@ -15,9 +15,9 @@ func createCredentialSecret(consumerUsername, credentialType string, dataFields stringData := make(map[string]string) labels := map[string]string{} if targetKICVersionAPI == KICV3GATEWAY || targetKICVersionAPI == KICV3INGRESS { - labels["konghq.com/credential"] = credentialType + labels[KongHQCredential] = credentialType } else { - stringData["kongCredType"] = credentialType + stringData[KongCredType] = credentialType } // Add the data fields to stringData diff --git a/kong2kic/consumer_group.go b/kong2kic/consumer_group.go index ebde749e1..1b547c0b0 100644 --- a/kong2kic/consumer_group.go +++ b/kong2kic/consumer_group.go @@ -23,8 +23,8 @@ func createConsumerGroupKongPlugin( pluginName := *plugin.Name kongPlugin := &configurationv1.KongPlugin{ TypeMeta: metav1.TypeMeta{ - APIVersion: "configuration.konghq.com/v1", - Kind: "KongPlugin", + APIVersion: ConfigurationKongHQv1, + Kind: KongPluginKind, }, ObjectMeta: metav1.ObjectMeta{ Name: calculateSlug(ownerName + "-" + pluginName), @@ -55,8 +55,8 @@ func populateKICConsumerGroups(content *file.Content, kicContent *KICContent) er kongConsumerGroup := configurationv1beta1.KongConsumerGroup{ TypeMeta: metav1.TypeMeta{ - APIVersion: "configuration.konghq.com/v1beta1", - Kind: "KongConsumerGroup", + APIVersion: ConfigurationKongHQv1beta1, + Kind: KongConsumerGroupKind, }, ObjectMeta: metav1.ObjectMeta{ Name: calculateSlug(groupName), diff --git a/kong2kic/global_plugin.go b/kong2kic/global_plugin.go index 266fe7c06..f4c062d5a 100644 --- a/kong2kic/global_plugin.go +++ b/kong2kic/global_plugin.go @@ -22,8 +22,8 @@ func populateKICKongClusterPlugins(content *file.Content, file *KICContent) erro continue } var kongClusterPlugin configurationv1.KongClusterPlugin - kongClusterPlugin.APIVersion = KICAPIVersion - kongClusterPlugin.Kind = "KongClusterPlugin" + kongClusterPlugin.APIVersion = ConfigurationKongHQv1 + kongClusterPlugin.Kind = KongClusterPluginKind kongClusterPlugin.ObjectMeta.Annotations = map[string]string{IngressClass: ClassName} if plugin.Name != nil { kongClusterPlugin.PluginName = *plugin.Name @@ -65,7 +65,7 @@ func populateKICKongClusterPlugins(content *file.Content, file *KICContent) erro tags = append(tags, *tag) } } - kongClusterPlugin.ObjectMeta.Annotations["konghq.com/tags"] = strings.Join(tags, ",") + kongClusterPlugin.ObjectMeta.Annotations[KongHQTags] = strings.Join(tags, ",") } // transform the plugin config from map[string]interface{} to apiextensionsv1.JSON diff --git a/kong2kic/kong2kic.go b/kong2kic/kong2kic.go index 981826a2f..ed7ecad60 100644 --- a/kong2kic/kong2kic.go +++ b/kong2kic/kong2kic.go @@ -9,22 +9,6 @@ import ( "github.com/kong/go-database-reconciler/pkg/file" ) -const ( - KICV3GATEWAY = "KICV3_GATEWAY" - KICV3INGRESS = "KICV3_INGRESS" - KICV2GATEWAY = "KICV2_GATEWAY" - KICV2INGRESS = "KICV2_INGRESS" - KICAPIVersion = "configuration.konghq.com/v1" - KICAPIVersionV1Beta1 = "configuration.konghq.com/v1beta1" - GatewayAPIVersionV1Beta1 = "gateway.networking.k8s.io/v1beta1" - GatewayAPIVersionV1 = "gateway.networking.k8s.io/v1" - KongPluginKind = "KongPlugin" - SecretKind = "Secret" - IngressKind = "KongIngress" - UpstreamPolicyKind = "KongUpstreamPolicy" - IngressClass = "kubernetes.io/ingress.class" -) - // ClassName is set by the CLI flag --class-name var ClassName = "kong" diff --git a/kong2kic/kong2kic_integration_test.go b/kong2kic/kong2kic_integration_test.go new file mode 100644 index 000000000..7471faf61 --- /dev/null +++ b/kong2kic/kong2kic_integration_test.go @@ -0,0 +1,344 @@ +//go:build integration +// +build integration + +// invoke with go test -tags=integration -run ^Test_deployManifests$ ./... +package kong2kic + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "os" + "path/filepath" + "regexp" + "strings" + "sync" + "testing" + "time" + + "github.com/kong/kubernetes-testing-framework/pkg/clusters/addons/kong" + "github.com/kong/kubernetes-testing-framework/pkg/clusters/addons/metallb" + environment "github.com/kong/kubernetes-testing-framework/pkg/environments" + "github.com/stretchr/testify/require" + apiv1 "k8s.io/api/core/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/rest" +) + +func Test_deployManifests(t *testing.T) { + versions := []string{"2.12", "3.0", "3.1", "3.2", "3.3"} + for _, version := range versions { + t.Run("KIC Version "+version, func(t *testing.T) { + t.Parallel() + ctx := context.Background() + + // Configure the testing environment with the specified KIC version + env, kongAddon, err := setupTestingEnvironmentWithVersion(ctx, version) + require.NoError(t, err) + defer teardownEnvironment(ctx, t, env) + + t.Log("waiting for the test environment to be ready for use") + require.NoError(t, <-env.WaitForReady(ctx)) + + t.Log("verifying the test environment becomes ready for use") + waitForObjects, ready, err := env.Ready(ctx) + require.NoError(t, err) + require.Empty(t, waitForObjects) + require.True(t, ready) + + t.Log("verifying the kong proxy is returning its default 404 response") + proxyURL, err := getKongProxyURL(ctx, env) + require.NoError(t, err) + verifyKongProxyResponse(t, proxyURL) + + t.Log("verifying that the kong addon deployed both proxy and controller") + verifyKongDeployment(ctx, t, env, kongAddon) + + config := env.Cluster().Config() + + t.Log("deploying the Gateway API CRDs") + clientset, err := deployGatewayAPICRDs(t, config) + require.NoError(t, err) + + t.Log("obtaining the ServerPreferredResources from the cluster") + kindToResource, err := getKindToResourceMap(clientset) + require.NoError(t, err) + + t.Log("creating a dynamic client for Kubernetes resources") + dynamicClient, err := dynamic.NewForConfig(config) + require.NoError(t, err) + + t.Log("deploying manifests to the cluster") + err = deployManifestsToClusterForVersion(t, dynamicClient, kindToResource, version) + require.NoError(t, err) + }) + } +} + +// Helper function to set up the testing environment with a specific KIC version +func setupTestingEnvironmentWithVersion( + ctx context.Context, + kicVersion string, +) (environment.Environment, *kong.Addon, error) { + builder := environment.NewBuilder() + kongAddonBuilder := kong.NewBuilder(). + WithControllerImage("kong/kubernetes-ingress-controller", kicVersion). + WithProxyImage("kong", "3.4") // Adjust proxy image if needed + + kongAddon := kongAddonBuilder.Build() + env, err := builder.WithAddons(metallb.New(), kongAddon).Build(ctx) + if err != nil { + return nil, nil, err + } + return env, kongAddon, nil +} + +// Mutex to avoid race condition on ~/.kube/config file +var teardownMutex sync.Mutex + +func teardownEnvironment(ctx context.Context, t *testing.T, env environment.Environment) { + // Lock the mutex to ensure only one teardown process at a time + teardownMutex.Lock() + defer teardownMutex.Unlock() + + t.Logf("cleaning up environment %s and cluster %s", env.Name(), env.Cluster().Name()) + require.NoError(t, env.Cleanup(ctx)) +} + +// Helper function to get Kong proxy URL +func getKongProxyURL(ctx context.Context, env environment.Environment) (string, error) { + kongAon, err := env.Cluster().GetAddon("kong") + if err != nil { + return "", err + } + kongAddonRaw, ok := kongAon.(*kong.Addon) + if !ok { + return "", errors.New("failed to cast kong addon") + } + proxyURL, err := kongAddonRaw.ProxyHTTPURL(ctx, env.Cluster()) + if err != nil { + return "", err + } + return proxyURL.String(), nil +} + +// Helper function to verify Kong proxy response +func verifyKongProxyResponse(t *testing.T, proxyURL string) { + httpc := http.Client{Timeout: time.Second * 10} + require.Eventually(t, func() bool { + resp, err := httpc.Get(proxyURL) + if err != nil { + return false + } + defer resp.Body.Close() + return resp.StatusCode == http.StatusNotFound + }, time.Minute*3, time.Second) +} + +// Helper function to verify Kong deployment +func verifyKongDeployment(ctx context.Context, t *testing.T, env environment.Environment, kongAddon *kong.Addon) { + client := env.Cluster().Client() + appsV1 := client.AppsV1() + deployments := appsV1.Deployments(kongAddon.Namespace()) + kongDeployment, err := deployments.Get(ctx, "ingress-controller-kong", metav1.GetOptions{}) + require.NoError(t, err) + require.Len(t, kongDeployment.Spec.Template.Spec.Containers, 2) + require.Equal(t, "ingress-controller", kongDeployment.Spec.Template.Spec.Containers[0].Name) + require.Equal(t, "proxy", kongDeployment.Spec.Template.Spec.Containers[1].Name) +} + +// Helper function to deploy Gateway API CRDs +func deployGatewayAPICRDs(t *testing.T, config *rest.Config) (*clientset.Clientset, error) { + clientset, err := clientset.NewForConfig(config) + if err != nil { + return nil, err + } + + gatewayAPICrdPath := filepath.Join("testdata", "gateway-api-crd.yaml") + gatewayAPICrdFile, err := os.ReadFile(gatewayAPICrdPath) + if err != nil { + return nil, err + } + + // Split the YAML file into individual documents. + yamlDocs := regexp.MustCompile(`(?m)^---\s*$`).Split(string(gatewayAPICrdFile), -1) + + for _, doc := range yamlDocs { + if strings.TrimSpace(doc) == "" { + continue + } + + dec := yaml.NewYAMLOrJSONDecoder(bytes.NewReader([]byte(doc)), 4096) + var crd apiextensionsv1.CustomResourceDefinition + err := dec.Decode(&crd) + if err != nil { + return nil, err + } + + _, err = clientset.ApiextensionsV1().CustomResourceDefinitions().Create(context.TODO(), &crd, metav1.CreateOptions{}) + if err != nil { + return nil, err + } + t.Logf("created CRD: %s", crd.Name) + } + + // Wait for CRDs to be available + time.Sleep(2 * time.Second) + return clientset, nil +} + +// Helper function to get Kind to Resource mapping +func getKindToResourceMap(clientset *clientset.Clientset) (map[string]string, error) { + kindToResource := make(map[string]string) + groups, err := clientset.Discovery().ServerPreferredResources() + if err != nil { + return nil, err + } + for _, group := range groups { + for _, resource := range group.APIResources { + kindToResource[resource.Kind] = resource.Name + } + } + return kindToResource, nil +} + +// Helper function to deploy manifests to the cluster +func deployManifestsToClusterForVersion( + t *testing.T, + dynamicClient dynamic.Interface, + kindToResource map[string]string, + version string, +) error { + files, err := os.ReadDir("testdata/") + if err != nil { + return err + } + + for _, file := range files { + filename := file.Name() + if !strings.HasSuffix(filename, "output-expected.yaml") { + continue + } + // Skip files based on version + if version == "2.12" && strings.Contains(filename, "-v3-") { + continue + } + if version != "2.12" && strings.Contains(filename, "-v2-") { + continue + } + content, err := os.ReadFile(filepath.Join("testdata", filename)) + if err != nil { + return err + } + t.Logf("DEPLOYING MANIFEST: %s for KIC version %s", filename, version) + err = deployManifestToCluster(t, content, kindToResource, dynamicClient) + if err != nil { + return err + } + } + return nil +} + +// Simplify the deployManifestToCluster function +func deployManifestToCluster( + t *testing.T, + manifest []byte, + kindToResource map[string]string, + dynamicClient dynamic.Interface, +) error { + decoder := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(manifest), 4096) + var objectsToDelete []ObjectToDelete + + for { + var rawObj unstructured.Unstructured + if err := decoder.Decode(&rawObj); err != nil { + if errors.Is(err, io.EOF) { + break + } + return err + } + + gvr, err := getGroupVersionResource(&rawObj, kindToResource) + if err != nil { + return err + } + + setNamespaceIfNeeded(&rawObj) + + _, err = dynamicClient.Resource(gvr). + Namespace(rawObj.GetNamespace()). + Create(context.TODO(), &rawObj, metav1.CreateOptions{}) + if err != nil { + return err + } + t.Logf("created object: %s of Kind: %s in Namespace: %s", rawObj.GetName(), rawObj.GetKind(), rawObj.GetNamespace()) + objectsToDelete = append(objectsToDelete, ObjectToDelete{object: rawObj, gvr: gvr}) + } + + // Clean up created objects + for _, obj := range objectsToDelete { + err := dynamicClient.Resource(obj.gvr). + Namespace(obj.object.GetNamespace()). + Delete(context.TODO(), obj.object.GetName(), metav1.DeleteOptions{}) + if err != nil { + return err + } + t.Logf("deleted object: %s of Kind: %s in Namespace: %s", + obj.object.GetName(), + obj.object.GetKind(), + obj.object.GetNamespace()) + } + return nil +} + +// Helper function to get GroupVersionResource from an unstructured object +func getGroupVersionResource( + obj *unstructured.Unstructured, + kindToResource map[string]string, +) (schema.GroupVersionResource, error) { + apiVersion := obj.GetAPIVersion() + kind := obj.GetKind() + resource, exists := kindToResource[kind] + if !exists { + return schema.GroupVersionResource{}, errors.New("resource not found for kind: " + kind) + } + + parts := strings.Split(apiVersion, "/") + if len(parts) == 2 { + return schema.GroupVersionResource{ + Group: parts[0], + Version: parts[1], + Resource: resource, + }, nil + } else if len(parts) == 1 { + return schema.GroupVersionResource{ + Group: "", + Version: parts[0], + Resource: resource, + }, nil + } + return schema.GroupVersionResource{}, errors.New("invalid apiVersion: " + apiVersion) +} + +// Helper function to set namespace if needed +func setNamespaceIfNeeded(obj *unstructured.Unstructured) { + if obj.GetKind() == "KongClusterPlugin" { + obj.SetNamespace(apiv1.NamespaceAll) + } else if obj.GetNamespace() == "" { + obj.SetNamespace(apiv1.NamespaceDefault) + } +} + +// Type definition for objects to delete +type ObjectToDelete struct { + object unstructured.Unstructured + gvr schema.GroupVersionResource +} diff --git a/kong2kic/kong2kic_test.go b/kong2kic/kong2kic_test.go index a7ca821b6..4b6d08d59 100644 --- a/kong2kic/kong2kic_test.go +++ b/kong2kic/kong2kic_test.go @@ -1,33 +1,14 @@ package kong2kic import ( - "bytes" - "context" - "errors" - "io" - "net/http" "os" "path/filepath" "regexp" "strings" - "sync" "testing" - "time" "github.com/kong/go-database-reconciler/pkg/file" - "github.com/kong/kubernetes-testing-framework/pkg/clusters/addons/kong" - "github.com/kong/kubernetes-testing-framework/pkg/clusters/addons/metallb" - environment "github.com/kong/kubernetes-testing-framework/pkg/environments" "github.com/stretchr/testify/require" - apiv1 "k8s.io/api/core/v1" - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/yaml" - "k8s.io/client-go/dynamic" - "k8s.io/client-go/rest" ) var baseLocation = "testdata/" @@ -61,7 +42,20 @@ func compareFileContent(t *testing.T, expectedFilename string, actualContent []b actualJSON := "[" + strings.ReplaceAll(string(actualContent), "}{", "},{") + "]" require.JSONEq(t, expectedJSON, actualJSON) } else { - require.YAMLEq(t, string(expectedContent), string(actualContent)) + // Split the content into individual YAML documents using regex + re := regexp.MustCompile(`(?m)^---\s*$`) + expectedYAMLs := re.Split(string(expectedContent), -1) + actualYAMLs := re.Split(string(actualContent), -1) + + // Ensure both have the same number of YAML documents + require.Equal(t, len(expectedYAMLs), len(actualYAMLs), "number of YAML documents do not match") + + // Compare each YAML document + for i := range expectedYAMLs { + expectedYAML := strings.TrimSpace(expectedYAMLs[i]) + actualYAML := strings.TrimSpace(actualYAMLs[i]) + require.YAMLEq(t, expectedYAML, actualYAML, "YAML document %d does not match", i+1) + } } } @@ -198,313 +192,3 @@ func Test_convertKongGatewayToKIC(t *testing.T) { }) } } - -func Test_deployManifests(t *testing.T) { - versions := []string{"2.12", "3.0", "3.1", "3.2", "3.3"} - for _, version := range versions { - t.Run("KIC Version "+version, func(t *testing.T) { - t.Parallel() - ctx := context.Background() - - // Configure the testing environment with the specified KIC version - env, kongAddon, err := setupTestingEnvironmentWithVersion(ctx, version) - require.NoError(t, err) - defer teardownEnvironment(ctx, t, env) - - t.Log("waiting for the test environment to be ready for use") - require.NoError(t, <-env.WaitForReady(ctx)) - - t.Log("verifying the test environment becomes ready for use") - waitForObjects, ready, err := env.Ready(ctx) - require.NoError(t, err) - require.Empty(t, waitForObjects) - require.True(t, ready) - - t.Log("verifying the kong proxy is returning its default 404 response") - proxyURL, err := getKongProxyURL(ctx, env) - require.NoError(t, err) - verifyKongProxyResponse(t, proxyURL) - - t.Log("verifying that the kong addon deployed both proxy and controller") - verifyKongDeployment(ctx, t, env, kongAddon) - - config := env.Cluster().Config() - - t.Log("deploying the Gateway API CRDs") - clientset, err := deployGatewayAPICRDs(t, config) - require.NoError(t, err) - - t.Log("obtaining the ServerPreferredResources from the cluster") - kindToResource, err := getKindToResourceMap(clientset) - require.NoError(t, err) - - t.Log("creating a dynamic client for Kubernetes resources") - dynamicClient, err := dynamic.NewForConfig(config) - require.NoError(t, err) - - t.Log("deploying manifests to the cluster") - err = deployManifestsToClusterForVersion(t, dynamicClient, kindToResource, version) - require.NoError(t, err) - }) - } -} - -// Helper function to set up the testing environment with a specific KIC version -func setupTestingEnvironmentWithVersion( - ctx context.Context, - kicVersion string, -) (environment.Environment, *kong.Addon, error) { - builder := environment.NewBuilder() - kongAddonBuilder := kong.NewBuilder(). - WithControllerImage("kong/kubernetes-ingress-controller", kicVersion). - WithProxyImage("kong", "3.4") // Adjust proxy image if needed - - kongAddon := kongAddonBuilder.Build() - env, err := builder.WithAddons(metallb.New(), kongAddon).Build(ctx) - if err != nil { - return nil, nil, err - } - return env, kongAddon, nil -} - -// Mutex to avoid race condition on ~/.kube/config file -var teardownMutex sync.Mutex - -func teardownEnvironment(ctx context.Context, t *testing.T, env environment.Environment) { - // Lock the mutex to ensure only one teardown process at a time - teardownMutex.Lock() - defer teardownMutex.Unlock() - - t.Logf("cleaning up environment %s and cluster %s", env.Name(), env.Cluster().Name()) - require.NoError(t, env.Cleanup(ctx)) -} - -// Helper function to get Kong proxy URL -func getKongProxyURL(ctx context.Context, env environment.Environment) (string, error) { - kongAon, err := env.Cluster().GetAddon("kong") - if err != nil { - return "", err - } - kongAddonRaw, ok := kongAon.(*kong.Addon) - if !ok { - return "", errors.New("failed to cast kong addon") - } - proxyURL, err := kongAddonRaw.ProxyHTTPURL(ctx, env.Cluster()) - if err != nil { - return "", err - } - return proxyURL.String(), nil -} - -// Helper function to verify Kong proxy response -func verifyKongProxyResponse(t *testing.T, proxyURL string) { - httpc := http.Client{Timeout: time.Second * 10} - require.Eventually(t, func() bool { - resp, err := httpc.Get(proxyURL) - if err != nil { - return false - } - defer resp.Body.Close() - return resp.StatusCode == http.StatusNotFound - }, time.Minute*3, time.Second) -} - -// Helper function to verify Kong deployment -func verifyKongDeployment(ctx context.Context, t *testing.T, env environment.Environment, kongAddon *kong.Addon) { - client := env.Cluster().Client() - appsV1 := client.AppsV1() - deployments := appsV1.Deployments(kongAddon.Namespace()) - kongDeployment, err := deployments.Get(ctx, "ingress-controller-kong", metav1.GetOptions{}) - require.NoError(t, err) - require.Len(t, kongDeployment.Spec.Template.Spec.Containers, 2) - require.Equal(t, "ingress-controller", kongDeployment.Spec.Template.Spec.Containers[0].Name) - require.Equal(t, "proxy", kongDeployment.Spec.Template.Spec.Containers[1].Name) -} - -// Helper function to deploy Gateway API CRDs -func deployGatewayAPICRDs(t *testing.T, config *rest.Config) (*clientset.Clientset, error) { - clientset, err := clientset.NewForConfig(config) - if err != nil { - return nil, err - } - - gatewayAPICrdPath := filepath.Join("testdata", "gateway-api-crd.yaml") - gatewayAPICrdFile, err := os.ReadFile(gatewayAPICrdPath) - if err != nil { - return nil, err - } - - // Split the YAML file into individual documents. - yamlDocs := regexp.MustCompile(`(?m)^---\s*$`).Split(string(gatewayAPICrdFile), -1) - - for _, doc := range yamlDocs { - if strings.TrimSpace(doc) == "" { - continue - } - - dec := yaml.NewYAMLOrJSONDecoder(bytes.NewReader([]byte(doc)), 4096) - var crd apiextensionsv1.CustomResourceDefinition - err := dec.Decode(&crd) - if err != nil { - return nil, err - } - - _, err = clientset.ApiextensionsV1().CustomResourceDefinitions().Create(context.TODO(), &crd, metav1.CreateOptions{}) - if err != nil { - return nil, err - } - t.Logf("created CRD: %s", crd.Name) - } - - // Wait for CRDs to be available - time.Sleep(2 * time.Second) - return clientset, nil -} - -// Helper function to get Kind to Resource mapping -func getKindToResourceMap(clientset *clientset.Clientset) (map[string]string, error) { - kindToResource := make(map[string]string) - groups, err := clientset.Discovery().ServerPreferredResources() - if err != nil { - return nil, err - } - for _, group := range groups { - for _, resource := range group.APIResources { - kindToResource[resource.Kind] = resource.Name - } - } - return kindToResource, nil -} - -// Helper function to deploy manifests to the cluster -func deployManifestsToClusterForVersion( - t *testing.T, - dynamicClient dynamic.Interface, - kindToResource map[string]string, - version string, -) error { - files, err := os.ReadDir("testdata/") - if err != nil { - return err - } - - for _, file := range files { - filename := file.Name() - if !strings.HasSuffix(filename, "output-expected.yaml") { - continue - } - // Skip files based on version - if version == "2.12" && strings.Contains(filename, "-v3-") { - continue - } - if version != "2.12" && strings.Contains(filename, "-v2-") { - continue - } - content, err := os.ReadFile(filepath.Join("testdata", filename)) - if err != nil { - return err - } - t.Logf("DEPLOYING MANIFEST: %s for KIC version %s", filename, version) - err = deployManifestToCluster(t, content, kindToResource, dynamicClient) - if err != nil { - return err - } - } - return nil -} - -// Simplify the deployManifestToCluster function -func deployManifestToCluster( - t *testing.T, - manifest []byte, - kindToResource map[string]string, - dynamicClient dynamic.Interface, -) error { - decoder := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(manifest), 4096) - var objectsToDelete []ObjectToDelete - - for { - var rawObj unstructured.Unstructured - if err := decoder.Decode(&rawObj); err != nil { - if errors.Is(err, io.EOF) { - break - } - return err - } - - gvr, err := getGroupVersionResource(&rawObj, kindToResource) - if err != nil { - return err - } - - setNamespaceIfNeeded(&rawObj) - - _, err = dynamicClient.Resource(gvr). - Namespace(rawObj.GetNamespace()). - Create(context.TODO(), &rawObj, metav1.CreateOptions{}) - if err != nil { - return err - } - t.Logf("created object: %s of Kind: %s in Namespace: %s", rawObj.GetName(), rawObj.GetKind(), rawObj.GetNamespace()) - objectsToDelete = append(objectsToDelete, ObjectToDelete{object: rawObj, gvr: gvr}) - } - - // Clean up created objects - for _, obj := range objectsToDelete { - err := dynamicClient.Resource(obj.gvr). - Namespace(obj.object.GetNamespace()). - Delete(context.TODO(), obj.object.GetName(), metav1.DeleteOptions{}) - if err != nil { - return err - } - t.Logf("deleted object: %s of Kind: %s in Namespace: %s", - obj.object.GetName(), - obj.object.GetKind(), - obj.object.GetNamespace()) - } - return nil -} - -// Helper function to get GroupVersionResource from an unstructured object -func getGroupVersionResource( - obj *unstructured.Unstructured, - kindToResource map[string]string, -) (schema.GroupVersionResource, error) { - apiVersion := obj.GetAPIVersion() - kind := obj.GetKind() - resource, exists := kindToResource[kind] - if !exists { - return schema.GroupVersionResource{}, errors.New("resource not found for kind: " + kind) - } - - parts := strings.Split(apiVersion, "/") - if len(parts) == 2 { - return schema.GroupVersionResource{ - Group: parts[0], - Version: parts[1], - Resource: resource, - }, nil - } else if len(parts) == 1 { - return schema.GroupVersionResource{ - Group: "", - Version: parts[0], - Resource: resource, - }, nil - } - return schema.GroupVersionResource{}, errors.New("invalid apiVersion: " + apiVersion) -} - -// Helper function to set namespace if needed -func setNamespaceIfNeeded(obj *unstructured.Unstructured) { - if obj.GetKind() == "KongClusterPlugin" { - obj.SetNamespace(apiv1.NamespaceAll) - } else if obj.GetNamespace() == "" { - obj.SetNamespace(apiv1.NamespaceDefault) - } -} - -// Type definition for objects to delete -type ObjectToDelete struct { - object unstructured.Unstructured - gvr schema.GroupVersionResource -} diff --git a/kong2kic/route.go b/kong2kic/route.go index 7e0bc2ef8..4a91997aa 100644 --- a/kong2kic/route.go +++ b/kong2kic/route.go @@ -2,7 +2,9 @@ package kong2kic import ( "encoding/json" + "errors" "log" + "sort" "strconv" "strings" @@ -12,6 +14,7 @@ import ( k8snetv1 "k8s.io/api/networking/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + k8sgwapiv1 "sigs.k8s.io/gateway-api/apis/v1" ) // Helper function to add annotations from a route to an ingress @@ -23,27 +26,27 @@ func addAnnotationsFromRoute(route *file.FRoute, annotations map[string]string) protocols = append(protocols, *protocol) } } - annotations["konghq.com/protocols"] = strings.Join(protocols, ",") + annotations[KongHQProtocols] = strings.Join(protocols, ",") } if route.StripPath != nil { - annotations["konghq.com/strip-path"] = strconv.FormatBool(*route.StripPath) + annotations[KongHQStripPath] = strconv.FormatBool(*route.StripPath) } if route.PreserveHost != nil { - annotations["konghq.com/preserve-host"] = strconv.FormatBool(*route.PreserveHost) + annotations[KongHQPreserveHost] = strconv.FormatBool(*route.PreserveHost) } if route.RegexPriority != nil { - annotations["konghq.com/regex-priority"] = strconv.Itoa(*route.RegexPriority) + annotations[KongHQRegexPriority] = strconv.Itoa(*route.RegexPriority) } if route.HTTPSRedirectStatusCode != nil { - annotations["konghq.com/https-redirect-status-code"] = strconv.Itoa(*route.HTTPSRedirectStatusCode) + annotations[KongHQHTTPSRedirectStatusCode] = strconv.Itoa(*route.HTTPSRedirectStatusCode) } if route.Headers != nil { for key, value := range route.Headers { - annotations["konghq.com/headers."+key] = strings.Join(value, ",") + annotations[KongHQHeaders+"."+key] = strings.Join(value, ",") } } if route.PathHandling != nil { - annotations["konghq.com/path-handling"] = *route.PathHandling + annotations[KongHQPathHandling] = *route.PathHandling } if route.SNIs != nil { var snis []string @@ -52,13 +55,13 @@ func addAnnotationsFromRoute(route *file.FRoute, annotations map[string]string) snis = append(snis, *sni) } } - annotations["konghq.com/snis"] = strings.Join(snis, ",") + annotations[KongHQSNIs] = strings.Join(snis, ",") } if route.RequestBuffering != nil { - annotations["konghq.com/request-buffering"] = strconv.FormatBool(*route.RequestBuffering) + annotations[KongHQRequestBuffering] = strconv.FormatBool(*route.RequestBuffering) } if route.ResponseBuffering != nil { - annotations["konghq.com/response-buffering"] = strconv.FormatBool(*route.ResponseBuffering) + annotations[KongHQResponseBuffering] = strconv.FormatBool(*route.ResponseBuffering) } if route.Methods != nil { var methods []string @@ -67,7 +70,8 @@ func addAnnotationsFromRoute(route *file.FRoute, annotations map[string]string) methods = append(methods, *method) } } - annotations["konghq.com/methods"] = strings.Join(methods, ",") + + annotations[KongHQMethods] = strings.Join(methods, ",") } if route.Tags != nil { var tags []string @@ -76,7 +80,7 @@ func addAnnotationsFromRoute(route *file.FRoute, annotations map[string]string) tags = append(tags, *tag) } } - annotations["konghq.com/tags"] = strings.Join(tags, ",") + annotations[KongHQTags] = strings.Join(tags, ",") } } @@ -131,8 +135,8 @@ func populateKICIngressesWithAnnotations(content *file.Content, kicContent *KICC k8sIngress := k8snetv1.Ingress{ TypeMeta: metav1.TypeMeta{ - APIVersion: "networking.k8s.io/v1", - Kind: "Ingress", + APIVersion: IngressAPIVersion, + Kind: IngressKind, }, ObjectMeta: metav1.ObjectMeta{ Name: calculateSlug(serviceName + "-" + routeName), @@ -194,7 +198,7 @@ func addPluginsToRoute( pluginName := *plugin.Name kongPlugin := configurationv1.KongPlugin{ TypeMeta: metav1.TypeMeta{ - APIVersion: KICAPIVersion, + APIVersion: ConfigurationKongHQv1, Kind: KongPluginKind, }, ObjectMeta: metav1.ObjectMeta{ @@ -233,7 +237,7 @@ func addPluginsToRoute( tags = append(tags, *tag) } } - kongPlugin.ObjectMeta.Annotations["konghq.com/tags"] = strings.Join(tags, ",") + kongPlugin.ObjectMeta.Annotations[KongHQTags] = strings.Join(tags, ",") } configJSON, err := json.Marshal(plugin.Config) @@ -245,11 +249,309 @@ func addPluginsToRoute( } // Add plugin reference to ingress annotations - pluginsAnnotation := ingress.ObjectMeta.Annotations["konghq.com/plugins"] + pluginsAnnotation := ingress.ObjectMeta.Annotations[KongHQPlugins] if pluginsAnnotation == "" { - ingress.ObjectMeta.Annotations["konghq.com/plugins"] = kongPlugin.ObjectMeta.Name + ingress.ObjectMeta.Annotations[KongHQPlugins] = kongPlugin.ObjectMeta.Name } else { - ingress.ObjectMeta.Annotations["konghq.com/plugins"] = pluginsAnnotation + "," + kongPlugin.ObjectMeta.Name + ingress.ObjectMeta.Annotations[KongHQPlugins] = pluginsAnnotation + "," + kongPlugin.ObjectMeta.Name + } + + kicContent.KongPlugins = append(kicContent.KongPlugins, kongPlugin) + } + return nil +} + +// HeadersByNameTypeAndValue is a type to sort headers by name, type and value. +// This is needed to ensure that the order of headers is consistent across runs. +type HeadersByNameTypeAndValue []k8sgwapiv1.HTTPHeaderMatch + +func (a HeadersByNameTypeAndValue) Len() int { return len(a) } +func (a HeadersByNameTypeAndValue) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a HeadersByNameTypeAndValue) Less(i, j int) bool { + if a[i].Name < a[j].Name { + return true + } + if a[i].Name > a[j].Name { + return false + } + + if a[i].Type != nil && a[j].Type == nil { + return true + } + if a[i].Type == nil && a[j].Type != nil { + return false + } + + if *a[i].Type < *a[j].Type { + return true + } + if *a[i].Type > *a[j].Type { + return false + } + return a[i].Value < a[j].Value +} + +// Convert route to HTTPRoute (Gateway API) +func populateKICIngressesWithGatewayAPI(content *file.Content, kicContent *KICContent) error { + for _, service := range content.Services { + for _, route := range service.Routes { + httpRoute, err := createHTTPRoute(service, route) + if err != nil { + log.Println(err) + continue + } + + err = addPluginsToGatewayAPIRoute(service, route, httpRoute, kicContent) + if err != nil { + return err + } + kicContent.HTTPRoutes = append(kicContent.HTTPRoutes, httpRoute) + } + } + return nil +} + +func createHTTPRoute(service file.FService, route *file.FRoute) (k8sgwapiv1.HTTPRoute, error) { + var httpRoute k8sgwapiv1.HTTPRoute + + httpRoute.Kind = HTTPRouteKind + if targetKICVersionAPI == KICV3GATEWAY { + httpRoute.APIVersion = GatewayAPIVersionV1 + } else { + httpRoute.APIVersion = GatewayAPIVersionV1Beta1 + } + if service.Name != nil && route.Name != nil { + httpRoute.ObjectMeta.Name = calculateSlug(*service.Name + "-" + *route.Name) + } else { + return httpRoute, errors.New( + "service name or route name is empty. Please provide a name for the service" + + "and the route before generating HTTPRoute manifests", + ) + } + httpRoute.ObjectMeta.Annotations = make(map[string]string) + + addAnnotations(&httpRoute, route) + addHosts(&httpRoute, route) + addParentRefs(&httpRoute) + addBackendRefs(&httpRoute, service, route) + + return httpRoute, nil +} + +func addAnnotations(httpRoute *k8sgwapiv1.HTTPRoute, route *file.FRoute) { + if route.PreserveHost != nil { + httpRoute.ObjectMeta.Annotations[KongHQPreserveHost] = strconv.FormatBool(*route.PreserveHost) + } + if route.StripPath != nil { + httpRoute.ObjectMeta.Annotations[KongHQStripPath] = strconv.FormatBool(*route.StripPath) + } + if route.HTTPSRedirectStatusCode != nil { + value := strconv.Itoa(*route.HTTPSRedirectStatusCode) + httpRoute.ObjectMeta.Annotations[KongHQHTTPSRedirectStatusCode] = value + } + if route.RegexPriority != nil { + httpRoute.ObjectMeta.Annotations[KongHQRegexPriority] = strconv.Itoa(*route.RegexPriority) + } + if route.PathHandling != nil { + httpRoute.ObjectMeta.Annotations[KongHQPathHandling] = *route.PathHandling + } + if route.Tags != nil { + var tags []string + for _, tag := range route.Tags { + if tag != nil { + tags = append(tags, *tag) + } + } + httpRoute.ObjectMeta.Annotations[KongHQTags] = strings.Join(tags, ",") + } + if route.SNIs != nil { + var snis string + var sb strings.Builder + for _, sni := range route.SNIs { + if sb.Len() > 0 { + sb.WriteString(",") + } + sb.WriteString(*sni) + } + snis = sb.String() + httpRoute.ObjectMeta.Annotations[KongHQSNIs] = snis + } + if route.RequestBuffering != nil { + httpRoute.ObjectMeta.Annotations[KongHQRequestBuffering] = strconv.FormatBool(*route.RequestBuffering) + } + if route.ResponseBuffering != nil { + httpRoute.ObjectMeta.Annotations[KongHQResponseBuffering] = strconv.FormatBool(*route.ResponseBuffering) + } +} + +func addHosts(httpRoute *k8sgwapiv1.HTTPRoute, route *file.FRoute) { + if route.Hosts != nil { + for _, host := range route.Hosts { + httpRoute.Spec.Hostnames = append(httpRoute.Spec.Hostnames, k8sgwapiv1.Hostname(*host)) + } + } +} + +func addParentRefs(httpRoute *k8sgwapiv1.HTTPRoute) { + httpRoute.Spec.ParentRefs = append(httpRoute.Spec.ParentRefs, k8sgwapiv1.ParentReference{ + Name: k8sgwapiv1.ObjectName(ClassName), + }) +} + +// Adds backend references to the given HTTPRoute based on the provided service and route. +// It constructs BackendRef, HTTPHeaderMatch, and HTTPPathMatch objects and appends them to the HTTPRoute's rules. +// The function handles different matching types for headers and paths, and supports multiple methods for each route. +func addBackendRefs(httpRoute *k8sgwapiv1.HTTPRoute, service file.FService, route *file.FRoute) { + // make this HTTPRoute point to the service + backendRef := k8sgwapiv1.BackendRef{ + BackendObjectReference: k8sgwapiv1.BackendObjectReference{ + Name: k8sgwapiv1.ObjectName(*service.Name), + }, + } + if service.Port != nil { + portNumber := k8sgwapiv1.PortNumber(*service.Port) //nolint:gosec + backendRef.Port = &portNumber + } + + // add header match conditions to the HTTPRoute + var httpHeaderMatch []k8sgwapiv1.HTTPHeaderMatch + headerMatchExact := k8sgwapiv1.HeaderMatchExact + headerMatchRegex := k8sgwapiv1.HeaderMatchRegularExpression + if route.Headers != nil { + for key, values := range route.Headers { + if len(values) == 1 && strings.HasPrefix(values[0], "~*") { + // it's a regular expression header match condition + httpHeaderMatch = append(httpHeaderMatch, k8sgwapiv1.HTTPHeaderMatch{ + Name: k8sgwapiv1.HTTPHeaderName(key), + Value: values[0][2:], + Type: &headerMatchRegex, + }) + } else { + // it's an exact header match condition + var value string + if len(values) > 1 { + value = strings.Join(values, ",") + } else { + value = values[0] + } + httpHeaderMatch = append(httpHeaderMatch, k8sgwapiv1.HTTPHeaderMatch{ + Name: k8sgwapiv1.HTTPHeaderName(key), + Value: value, + Type: &headerMatchExact, + }) + } + } + sort.Sort(HeadersByNameTypeAndValue(httpHeaderMatch)) + } + + if route.Paths != nil { + // evaluate each path and method combination and add them to the HTTPRoute + for _, path := range route.Paths { + var httpPathMatch k8sgwapiv1.HTTPPathMatch + pathMatchRegex := k8sgwapiv1.PathMatchRegularExpression + pathMatchPrefix := k8sgwapiv1.PathMatchPathPrefix + + if strings.HasPrefix(*path, "~") { + // add regex path match condition + httpPathMatch.Type = &pathMatchRegex + regexPath := (*path)[1:] + httpPathMatch.Value = ®exPath + } else { + // add regular path match condition + httpPathMatch.Type = &pathMatchPrefix + httpPathMatch.Value = path + } + + if route.Methods == nil { + // this route has specific http methods to match + httpRoute.Spec.Rules = append(httpRoute.Spec.Rules, k8sgwapiv1.HTTPRouteRule{ + Matches: []k8sgwapiv1.HTTPRouteMatch{ + { + Path: &httpPathMatch, + Headers: httpHeaderMatch, + }, + }, + BackendRefs: []k8sgwapiv1.HTTPBackendRef{ + { + BackendRef: backendRef, + }, + }, + }) + } + + for _, method := range route.Methods { + httpMethod := k8sgwapiv1.HTTPMethod(*method) + httpRoute.Spec.Rules = append(httpRoute.Spec.Rules, k8sgwapiv1.HTTPRouteRule{ + Matches: []k8sgwapiv1.HTTPRouteMatch{ + { + Path: &httpPathMatch, + Method: &httpMethod, + Headers: httpHeaderMatch, + }, + }, + BackendRefs: []k8sgwapiv1.HTTPBackendRef{ + { + BackendRef: backendRef, + }, + }, + }) + } + } + } else { + for _, method := range route.Methods { + httpMethod := k8sgwapiv1.HTTPMethod(*method) + httpRoute.Spec.Rules = append(httpRoute.Spec.Rules, k8sgwapiv1.HTTPRouteRule{ + Matches: []k8sgwapiv1.HTTPRouteMatch{ + { + Method: &httpMethod, + Headers: httpHeaderMatch, + }, + }, + BackendRefs: []k8sgwapiv1.HTTPBackendRef{ + { + BackendRef: backendRef, + }, + }, + }) + } + } +} + +func addPluginsToGatewayAPIRoute( + service file.FService, route *file.FRoute, httpRoute k8sgwapiv1.HTTPRoute, kicContent *KICContent, +) error { + for _, plugin := range route.Plugins { + var kongPlugin configurationv1.KongPlugin + kongPlugin.APIVersion = ConfigurationKongHQv1 + kongPlugin.Kind = KongPluginKind + if plugin.Name != nil && route.Name != nil && service.Name != nil { + kongPlugin.ObjectMeta.Name = calculateSlug(*service.Name + "-" + *route.Name + "-" + *plugin.Name) + } else { + log.Println("Service name, route name or plugin name is empty. This is not recommended." + + "Please, provide a name for the service, route and the plugin before generating Kong Ingress Controller manifests.") + continue + } + kongPlugin.ObjectMeta.Annotations = map[string]string{IngressClass: ClassName} + kongPlugin.PluginName = *plugin.Name + + var configJSON apiextensionsv1.JSON + var err error + configJSON.Raw, err = json.Marshal(plugin.Config) + if err != nil { + return err + } + kongPlugin.Config = configJSON + + // add plugins as extensionRef under filters for every rule + for i := range httpRoute.Spec.Rules { + httpRoute.Spec.Rules[i].Filters = append(httpRoute.Spec.Rules[i].Filters, k8sgwapiv1.HTTPRouteFilter{ + ExtensionRef: &k8sgwapiv1.LocalObjectReference{ + Name: k8sgwapiv1.ObjectName(kongPlugin.ObjectMeta.Name), + Kind: KongPluginKind, + Group: ConfigurationKongHQ, + }, + Type: k8sgwapiv1.HTTPRouteFilterExtensionRef, + }) } kicContent.KongPlugins = append(kicContent.KongPlugins, kongPlugin) diff --git a/kong2kic/service.go b/kong2kic/service.go index 756b03bb3..d096982e7 100644 --- a/kong2kic/service.go +++ b/kong2kic/service.go @@ -48,8 +48,8 @@ func populateKICServicesWithAnnotations(content *file.Content, kicContent *KICCo func createK8sService(service *file.FService, upstreams []file.FUpstream) *k8scorev1.Service { k8sService := &k8scorev1.Service{ TypeMeta: metav1.TypeMeta{ - APIVersion: "v1", - Kind: "Service", + APIVersion: ServiceAPIVersionv1, + Kind: ServiceKind, }, ObjectMeta: metav1.ObjectMeta{ Name: calculateSlug(*service.Name), @@ -109,25 +109,25 @@ func isUpstreamReferenced(host *string, upstreams []file.FUpstream) bool { // Helper function to add annotations from a service to a Kubernetes service func addAnnotationsFromService(service *file.FService, annotations map[string]string) { if service.Protocol != nil { - annotations["konghq.com/protocol"] = *service.Protocol + annotations[KongHQProtocol] = *service.Protocol } if service.Path != nil { - annotations["konghq.com/path"] = *service.Path + annotations[KongHQPath] = *service.Path } if service.ClientCertificate != nil && service.ClientCertificate.ID != nil { - annotations["konghq.com/client-cert"] = *service.ClientCertificate.ID + annotations[KongHQClientCert] = *service.ClientCertificate.ID } if service.ReadTimeout != nil { - annotations["konghq.com/read-timeout"] = strconv.Itoa(*service.ReadTimeout) + annotations[KongHQReadTimeout] = strconv.Itoa(*service.ReadTimeout) } if service.WriteTimeout != nil { - annotations["konghq.com/write-timeout"] = strconv.Itoa(*service.WriteTimeout) + annotations[KongHQWriteTimeout] = strconv.Itoa(*service.WriteTimeout) } if service.ConnectTimeout != nil { - annotations["konghq.com/connect-timeout"] = strconv.Itoa(*service.ConnectTimeout) + annotations[KongHQConnectTimeout] = strconv.Itoa(*service.ConnectTimeout) } if service.Retries != nil { - annotations["konghq.com/retries"] = strconv.Itoa(*service.Retries) + annotations[KongHQRetries] = strconv.Itoa(*service.Retries) } addTagsToAnnotations(service.Tags, annotations) } diff --git a/kong2kic/testdata/consumer-v2-output-expected.yaml b/kong2kic/testdata/consumer-v2-output-expected.yaml index 9978ab114..56f7c36f6 100644 --- a/kong2kic/testdata/consumer-v2-output-expected.yaml +++ b/kong2kic/testdata/consumer-v2-output-expected.yaml @@ -19,13 +19,14 @@ metadata: stringData: key: my_api_key kongCredType: key-auth +type: Opaque --- apiVersion: v1 kind: Secret metadata: annotations: kubernetes.io/ingress.class: kong - name: jwt-auth-example-user + name: jwt-example-user stringData: algorithm: HS256 key: my_jwt_secret @@ -41,6 +42,7 @@ stringData: ewIDAQAB -----END PUBLIC KEY----- secret: my_secret_key +type: Opaque --- apiVersion: v1 kind: Secret @@ -52,16 +54,18 @@ stringData: kongCredType: basic-auth password: my_basic_password username: my_basic_user +type: Opaque --- apiVersion: v1 kind: Secret metadata: annotations: kubernetes.io/ingress.class: kong - name: acl-group-example-user + name: acl-example-user stringData: group: acl_group kongCredType: acl +type: Opaque --- apiVersion: v1 kind: Secret @@ -78,9 +82,9 @@ type: Opaque apiVersion: configuration.konghq.com/v1 credentials: - key-auth-example-user -- jwt-auth-example-user +- jwt-example-user - basic-auth-example-user -- acl-group-example-user +- acl-example-user - mtls-auth-example-user custom_id: "1234567890" kind: KongConsumer diff --git a/kong2kic/testdata/consumer-v3-output-expected.yaml b/kong2kic/testdata/consumer-v3-output-expected.yaml index 6e843caad..5e7ae9150 100644 --- a/kong2kic/testdata/consumer-v3-output-expected.yaml +++ b/kong2kic/testdata/consumer-v3-output-expected.yaml @@ -20,6 +20,7 @@ metadata: name: key-auth-example-user stringData: key: my_api_key +type: Opaque --- apiVersion: v1 kind: Secret @@ -28,7 +29,7 @@ metadata: kubernetes.io/ingress.class: kong labels: konghq.com/credential: jwt - name: jwt-auth-example-user + name: jwt-example-user stringData: algorithm: HS256 key: my_jwt_secret @@ -43,6 +44,7 @@ stringData: ewIDAQAB -----END PUBLIC KEY----- secret: my_secret_key +type: Opaque --- apiVersion: v1 kind: Secret @@ -55,6 +57,7 @@ metadata: stringData: password: my_basic_password username: my_basic_user +type: Opaque --- apiVersion: v1 kind: Secret @@ -63,9 +66,10 @@ metadata: kubernetes.io/ingress.class: kong labels: konghq.com/credential: acl - name: acl-group-example-user + name: acl-example-user stringData: group: acl_group +type: Opaque --- apiVersion: v1 kind: Secret @@ -83,9 +87,9 @@ type: Opaque apiVersion: configuration.konghq.com/v1 credentials: - key-auth-example-user -- jwt-auth-example-user +- jwt-example-user - basic-auth-example-user -- acl-group-example-user +- acl-example-user - mtls-auth-example-user custom_id: "1234567890" kind: KongConsumer diff --git a/kong2kic/types.go b/kong2kic/types.go index 4ed328172..b9541143e 100644 --- a/kong2kic/types.go +++ b/kong2kic/types.go @@ -162,6 +162,11 @@ func SerializeObjectDroppingFields(obj interface{}, format string) ([]byte, erro delete(genericObj, "status") delete(genericObj["metadata"].(map[string]interface{}), "creationTimestamp") + // if genericObject has a Kind field with value "KongConsumer" then delete the field "spec" + if genericObj["kind"] == "KongConsumer" || genericObj["kind"] == "KongConsumerGroup" { + delete(genericObj, "spec") + } + if format == file.JSON { result, err = json.MarshalIndent(genericObj, "", " ") if err != nil { diff --git a/kong2kic/upstream.go b/kong2kic/upstream.go index 0611658ef..b19c79f91 100644 --- a/kong2kic/upstream.go +++ b/kong2kic/upstream.go @@ -114,7 +114,7 @@ func populateKICUpstreamPolicy( // Create KongUpstreamPolicy kongUpstreamPolicy := configurationv1beta1.KongUpstreamPolicy{ TypeMeta: metav1.TypeMeta{ - APIVersion: KICAPIVersionV1Beta1, + APIVersion: ConfigurationKongHQv1beta1, Kind: UpstreamPolicyKind, }, ObjectMeta: metav1.ObjectMeta{ @@ -127,7 +127,7 @@ func populateKICUpstreamPolicy( if k8sService.ObjectMeta.Annotations == nil { k8sService.ObjectMeta.Annotations = make(map[string]string) } - k8sService.ObjectMeta.Annotations["konghq.com/upstream-policy"] = kongUpstreamPolicy.ObjectMeta.Name + k8sService.ObjectMeta.Annotations[KongHQUpstreamPolicy] = kongUpstreamPolicy.ObjectMeta.Name // Populate the Upstream Policy Spec populateKongUpstreamPolicySpec(upstream, &kongUpstreamPolicy) @@ -204,8 +204,8 @@ func populateKICUpstream( // Create KongIngress kongIngress := configurationv1.KongIngress{ TypeMeta: metav1.TypeMeta{ - APIVersion: KICAPIVersion, - Kind: IngressKind, + APIVersion: ConfigurationKongHQv1, + Kind: KongIngressKind, }, ObjectMeta: metav1.ObjectMeta{ Name: calculateSlug(*service.Name + "-upstream"), @@ -233,7 +233,7 @@ func populateKICUpstream( if k8sService.ObjectMeta.Annotations == nil { k8sService.ObjectMeta.Annotations = make(map[string]string) } - k8sService.ObjectMeta.Annotations["konghq.com/override"] = kongIngress.ObjectMeta.Name + k8sService.ObjectMeta.Annotations[KongHQOverride] = kongIngress.ObjectMeta.Name // Add tags to annotations addTagsToAnnotations(upstream.Tags, kongIngress.ObjectMeta.Annotations) diff --git a/kong2kic/utils.go b/kong2kic/utils.go index 2e22f77b4..4c0a3f539 100644 --- a/kong2kic/utils.go +++ b/kong2kic/utils.go @@ -12,6 +12,59 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +const ( + KongHQClientCert = "konghq.com/client-cert" + KongHQConnectTimeout = "konghq.com/connect-timeout" + KongHQCredential = "konghq.com/credential" //nolint: gosec + KongHQHeaders = "konghq.com/headers" + KongHQHTTPSRedirectStatusCode = "konghq.com/https-redirect-status-code" + KongHQMethods = "konghq.com/methods" + KongHQOverride = "konghq.com/override" + KongHQPath = "konghq.com/path" + KongHQPathHandling = "konghq.com/path-handling" + KongHQPlugins = "konghq.com/plugins" + KongHQPreserveHost = "konghq.com/preserve-host" + KongHQProtocol = "konghq.com/protocol" + KongHQProtocols = "konghq.com/protocols" + KongHQReadTimeout = "konghq.com/read-timeout" + KongHQRegexPriority = "konghq.com/regex-priority" + KongHQRequestBuffering = "konghq.com/request-buffering" + KongHQResponseBuffering = "konghq.com/response-buffering" + KongHQRetries = "konghq.com/retries" + KongHQSNIs = "konghq.com/snis" + KongHQStripPath = "konghq.com/strip-path" + KongHQTags = "konghq.com/tags" + KongHQUpstreamPolicy = "konghq.com/upstream-policy" + KongHQWriteTimeout = "konghq.com/write-timeout" +) + +const ( + ConfigurationKongHQ = "configuration.konghq.com" + ConfigurationKongHQv1 = "configuration.konghq.com/v1" + ConfigurationKongHQv1beta1 = "configuration.konghq.com/v1beta1" + GatewayAPIVersionV1 = "gateway.networking.k8s.io/v1" + GatewayAPIVersionV1Beta1 = "gateway.networking.k8s.io/v1beta1" + HTTPRouteKind = "HTTPRoute" + IngressAPIVersion = "networking.k8s.io/v1" + IngressClass = "kubernetes.io/ingress.class" + IngressKind = "Ingress" + KICV2GATEWAY = "KICV2_GATEWAY" + KICV2INGRESS = "KICV2_INGRESS" + KICV3GATEWAY = "KICV3_GATEWAY" + KICV3INGRESS = "KICV3_INGRESS" + KongClusterPluginKind = "KongClusterPlugin" + KongConsumerKind = "KongConsumer" + KongConsumerGroupKind = "KongConsumerGroup" + KongCredType = "kongCredType" + KongIngressKind = "KongIngress" + KongPluginKind = "KongPlugin" + SecretKind = "Secret" + SecretCADigest = "ca.digest" + ServiceAPIVersionv1 = "v1" + ServiceKind = "Service" + UpstreamPolicyKind = "KongUpstreamPolicy" +) + // Helper function to add tags to annotations func addTagsToAnnotations(tags []*string, annotations map[string]string) { if tags != nil { @@ -45,7 +98,7 @@ func createKongPlugin(plugin *file.FPlugin, ownerName string) (*configurationv1. pluginName := *plugin.Name kongPlugin := &configurationv1.KongPlugin{ TypeMeta: metav1.TypeMeta{ - APIVersion: KICAPIVersion, + APIVersion: ConfigurationKongHQv1, Kind: KongPluginKind, }, ObjectMeta: metav1.ObjectMeta{ From 63fd4c71b58c861b7ac2bcb43d4b3e82b43a5a34 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Fri, 13 Dec 2024 16:34:14 +0530 Subject: [PATCH 32/38] chore: release prep for v1.42.0 (#1478) --- CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ README.md | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e03bc6636..a7476ae35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.42.0](#v1420) - [v1.41.4](#v1414) - [v1.41.3](#v1413) - [v1.41.2](#v1412) @@ -101,6 +102,36 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.42.0] +> Release date: 2024/12/13 + +### Added +- Added a new flag `--online-entities-list` to validate the specified entities +via `deck gateway validate` command. +[#1458](https://github.com/Kong/deck/pull/1458) +- Added feature to ignore entities tagged with `konnect-managed` during +deck dump, sync and diff. This is valid for Konnect entities only. +[#1478](https://github.com/Kong/deck/pull/1478) +[go-database-reconciler #153](https://github.com/Kong/go-database-reconciler/pull/153) +- Improved speed for deck sync/diff operations involving consumer-groups +for gw 3.9+. The underlying API call to `GET /consumer_group` is called +with query parameter `list_consumers=false`, making it faster for deck +to deal with cases where a consumer-group holds many consumers. +(#1475)[https://github.com/Kong/deck/pull/1475] +(go-kong #487)[https://github.com/Kong/go-kong/pull/487] + + +### Fixes +- Fixed issue where tags were not getting propagated to consumer-group plugins. +[#1478](https://github.com/Kong/deck/pull/1458) +[go-database-reconciler #151](https://github.com/Kong/go-database-reconciler/pull/151) +[go-kong #485](https://github.com/Kong/go-kong/pull/485) +- Enhanced help message for generate-imports-for-control-plane-id flag +[#1448](https://github.com/Kong/deck/pull/1448) +- Restored to using Gateway API generation in `deck file kong2kic`, rather than +Ingress API +[#1431](https://github.com/Kong/deck/pull/1431) + ## [v1.41.4] > Release date: 2024/11/26 @@ -1883,6 +1914,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.42.0]: https://github.com/Kong/deck/compare/v1.41.4...v1.42.0 [v1.41.4]: https://github.com/Kong/deck/compare/v1.41.3...v1.41.4 [v1.41.3]: https://github.com/Kong/deck/compare/v1.41.2...v1.41.3 [v1.41.2]: https://github.com/Kong/deck/compare/v1.41.1...v1.41.2 diff --git a/README.md b/README.md index 5122cefca..04c242f8d 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ the GitHub [release page](https://github.com/kong/deck/releases) or install by downloading the binary: ```shell -$ curl -sL https://github.com/kong/deck/releases/download/v1.41.4/deck_1.41.4_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.42.0/deck_1.42.0_linux_amd64.tar.gz -o deck.tar.gz $ tar -xf deck.tar.gz -C /tmp $ sudo cp /tmp/deck /usr/local/bin/ ``` @@ -84,7 +84,7 @@ If you are on Windows, you can download the binary from the GitHub [release page](https://github.com/kong/deck/releases) or via PowerShell: ```shell -$ curl -sL https://github.com/kong/deck/releases/download/v1.41.4/deck_1.41.4_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.42.0/deck_1.42.0_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ``` diff --git a/go.mod b/go.mod index b43ff9405..153fd0381 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.40 - github.com/kong/go-database-reconciler v1.16.1 + github.com/kong/go-database-reconciler v1.17.0 github.com/kong/go-kong v0.61.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.1 diff --git a/go.sum b/go.sum index 2826e297c..a785f7e27 100644 --- a/go.sum +++ b/go.sum @@ -247,8 +247,8 @@ github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/q github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kong/go-apiops v0.1.40 h1:Dp4IHJ3h61VeOAeQkOisf1BcOP+Ww+gpqnv14HvC6DQ= github.com/kong/go-apiops v0.1.40/go.mod h1:CNfsa9mHFRfAhT9E2IWTul0Mi1/BldTDmFu5fWcp2us= -github.com/kong/go-database-reconciler v1.16.1 h1:qcQzEuMGfpNjx3UgulBOKulKA+upmHwqw4dy6TMEV7A= -github.com/kong/go-database-reconciler v1.16.1/go.mod h1:7CGvStUvUOmUnodUFsWcW3PX2bJgnaKClJ/yhNGEVIE= +github.com/kong/go-database-reconciler v1.17.0 h1:vL/KskveUR8fflbw+r/6QphSHxV8YahjfSDjNe9pDrI= +github.com/kong/go-database-reconciler v1.17.0/go.mod h1:3L4DP3/YGaDv9Hks4XA1YFm7HfPur2CuBxHI/4+r7NY= github.com/kong/go-kong v0.61.0 h1:EWnQVMk1u1gy8//Hvui3NVCJZZ+fBnifVcoaIyLq60A= github.com/kong/go-kong v0.61.0/go.mod h1:e0zgpuCnCbOXQN6e0e235TFJr4IYY8dDg9nLQgG9m7A= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= From f73569d2eec42cd63f63ed8f9143c169beec790d Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Tue, 24 Dec 2024 15:02:33 +0530 Subject: [PATCH 33/38] chore: update golang.org/x/net dep to avoid vulnerability (#1481) * chore: update golang.org/x/net dep to avoid vulnerability * chore: release prep for patch version * chore: removed stray newline --- CHANGELOG.md | 10 ++++++++++ README.md | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7476ae35..0e895f828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.42.1](#v1421) - [v1.42.0](#v1420) - [v1.41.4](#v1414) - [v1.41.3](#v1413) @@ -102,6 +103,14 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.42.1] +> Release date: 2024/12/24 + +### Fixed +- Updated `golang.org/x/net` to version `v0.33.0` to account for +vulnerability [CVE-2024-45338](https://avd.aquasec.com/nvd/2024/cve-2024-45338/) +[#1481](https://github.com/Kong/deck/pull/1481) + ## [v1.42.0] > Release date: 2024/12/13 @@ -1914,6 +1923,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.42.1]: https://github.com/Kong/deck/compare/v1.42.0...v1.42.1 [v1.42.0]: https://github.com/Kong/deck/compare/v1.41.4...v1.42.0 [v1.41.4]: https://github.com/Kong/deck/compare/v1.41.3...v1.41.4 [v1.41.3]: https://github.com/Kong/deck/compare/v1.41.2...v1.41.3 diff --git a/README.md b/README.md index 04c242f8d..a5a5cb0e1 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ the GitHub [release page](https://github.com/kong/deck/releases) or install by downloading the binary: ```shell -$ curl -sL https://github.com/kong/deck/releases/download/v1.42.0/deck_1.42.0_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.42.1/deck_1.42.1_linux_amd64.tar.gz -o deck.tar.gz $ tar -xf deck.tar.gz -C /tmp $ sudo cp /tmp/deck /usr/local/bin/ ``` @@ -84,7 +84,7 @@ If you are on Windows, you can download the binary from the GitHub [release page](https://github.com/kong/deck/releases) or via PowerShell: ```shell -$ curl -sL https://github.com/kong/deck/releases/download/v1.42.0/deck_1.42.0_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.42.1/deck_1.42.1_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ``` diff --git a/go.mod b/go.mod index 153fd0381..64fa9a79f 100644 --- a/go.mod +++ b/go.mod @@ -188,7 +188,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.30.0 // indirect + golang.org/x/net v0.33.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/term v0.27.0 // indirect golang.org/x/text v0.21.0 // indirect diff --git a/go.sum b/go.sum index a785f7e27..80792a08a 100644 --- a/go.sum +++ b/go.sum @@ -522,8 +522,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= From caaf75c5bfe2ce2041be5f86e048b8f2ecd7c1b5 Mon Sep 17 00:00:00 2001 From: Jordi Fernandez Date: Mon, 6 Jan 2025 12:58:00 +0100 Subject: [PATCH 34/38] fix: adjust multiline string formatting in resource generation (#1482) * fix: adjust multiline string formatting in resource generation * fix: simplify multiline string formatting in resource generation tests --- kong2tf/generate_resource.go | 2 +- kong2tf/generate_resource_test.go | 45 ++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/kong2tf/generate_resource.go b/kong2tf/generate_resource.go index e212a862d..d1b824cd9 100644 --- a/kong2tf/generate_resource.go +++ b/kong2tf/generate_resource.go @@ -410,7 +410,7 @@ func quote(input interface{}) string { return fmt.Sprintf("%v", v) case string: if strings.Contains(v, "\n") { - return fmt.Sprintf("< Date: Wed, 8 Jan 2025 15:22:28 +0100 Subject: [PATCH 35/38] ci: queue up Konnect integration tests that are run at the same time (#1473) --- .github/workflows/integration-konnect.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-konnect.yaml b/.github/workflows/integration-konnect.yaml index f7900a65d..8ab6cf422 100644 --- a/.github/workflows/integration-konnect.yaml +++ b/.github/workflows/integration-konnect.yaml @@ -6,7 +6,7 @@ concurrency: # if run in parallel. # Ref: https://docs.github.com/en/actions/using-jobs/using-concurrency group: ${{ github.workflow }} - cancel-in-progress: true + cancel-in-progress: false on: [pull_request] From 2c9a599ce403da3130586955a8b98356a2d09e63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:17:31 +0000 Subject: [PATCH 36/38] chore(deps): bump alpine from 3.21.0 to 3.21.1 (#1484) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps alpine from 3.21.0 to 3.21.1. --- updated-dependencies: - dependency-name: alpine dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Patryk Małek --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b62f51b2e..cd8e9732f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ ARG TAG RUN CGO_ENABLED=0 GOOS=linux go build -o deck \ -ldflags "-s -w -X github.com/kong/deck/cmd.VERSION=$TAG -X github.com/kong/deck/cmd.COMMIT=$COMMIT" -FROM alpine:3.21.0 +FROM alpine:3.21.1 RUN adduser --disabled-password --gecos "" deckuser RUN apk --no-cache add ca-certificates jq USER deckuser From 6472d173d98df2ed0d28c84b61eeb14a5d0be93e Mon Sep 17 00:00:00 2001 From: Harsha P Dixit Date: Wed, 15 Jan 2025 13:24:37 +0530 Subject: [PATCH 37/38] fix: improve error messaging when mandatory flag is missing in file convert (#1429) (#1487) * fix: improve error messaging when mandatory flag is missing in file convert (#1429) When mandatory flags for file convert are missing, the error message is not helpful. In this commit, we have added additional validation to communicate more details in the message. * add a reusable validation function for strings * assert converted file contents and address review feedback * limit file convert tests to yaml format for now --- cmd/file_convert.go | 16 ++++ cmd/utils.go | 17 +++++ tests/integration/file_convert_test.go | 73 +++++++++++++++++++ tests/integration/test_utils.go | 22 ++++++ .../kong-gateway-2-x.yaml | 10 +++ .../kong-gateway-3-x.yaml | 10 +++ 6 files changed, 148 insertions(+) create mode 100644 tests/integration/file_convert_test.go create mode 100644 tests/integration/testdata/file-convert/001-kong-gateway-config/kong-gateway-2-x.yaml create mode 100644 tests/integration/testdata/file-convert/001-kong-gateway-config/kong-gateway-3-x.yaml diff --git a/cmd/file_convert.go b/cmd/file_convert.go index 37debd53e..f3270226c 100644 --- a/cmd/file_convert.go +++ b/cmd/file_convert.go @@ -113,6 +113,22 @@ into another compatible format. For example, a configuration for 'kong-gateway-2 can be converted into a 'kong-gateway-3.x' configuration file.`, Args: validateNoArgs, RunE: execute, + PreRunE: func(_ *cobra.Command, _ []string) error { + validSourceFormats := []string{string(convert.FormatKongGateway), string(convert.FormatKongGateway2x)} + validDestinationFormats := []string{string(convert.FormatKonnect), string(convert.FormatKongGateway3x)} + + err := validateInputFlag("from", convertCmdSourceFormat, validSourceFormats, "") + if err != nil { + return err + } + + err = validateInputFlag("to", convertCmdDestinationFormat, validDestinationFormats, "") + if err != nil { + return err + } + + return nil + }, } sourceFormats := []convert.Format{convert.FormatKongGateway, convert.FormatKongGateway2x} diff --git a/cmd/utils.go b/cmd/utils.go index 476743903..ba0c70ed0 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -1,6 +1,10 @@ package cmd import ( + "errors" + "fmt" + "slices" + "github.com/fatih/color" "github.com/kong/go-database-reconciler/pkg/cprint" "github.com/kong/go-database-reconciler/pkg/diff" @@ -30,3 +34,16 @@ func addSilenceEventsFlag(set *pflag.FlagSet) { set.BoolVar(&silenceEvents, "silence-events", false, "disable printing events to stdout") } + +func validateInputFlag(flagName string, flagValue string, allowedValues []string, errorMessage string) error { + if slices.Contains(allowedValues, flagValue) { + return nil + } + + if errorMessage != "" { + return errors.New(errorMessage) + } + + return fmt.Errorf("invalid value '%s' found for the '%s' flag. Allowed values: %v", + flagValue, flagName, allowedValues) +} diff --git a/tests/integration/file_convert_test.go b/tests/integration/file_convert_test.go new file mode 100644 index 000000000..c36b6515f --- /dev/null +++ b/tests/integration/file_convert_test.go @@ -0,0 +1,73 @@ +package integration + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" + "sigs.k8s.io/yaml" +) + +func Test_FileConvert(t *testing.T) { + tests := []struct { + name string + convertCmdSourceFormat string + convertCmdDestinationFormat string + errorExpected bool + errorString string + expectedOutputFile string + }{ + { + name: "Valid source and destination format", + convertCmdSourceFormat: "kong-gateway-2.x", + convertCmdDestinationFormat: "kong-gateway-3.x", + errorExpected: false, + expectedOutputFile: "testdata/file-convert/001-kong-gateway-config/kong-gateway-3-x.yaml", + }, + { + name: "Invalid source format", + convertCmdSourceFormat: "random-value", + convertCmdDestinationFormat: "kong-gateway-3.x", + errorExpected: true, + errorString: "invalid value 'random-value' found for the 'from' flag." + + " Allowed values: [kong-gateway kong-gateway-2.x]", + }, + { + name: "Invalid destination format", + convertCmdSourceFormat: "kong-gateway-2.x", + convertCmdDestinationFormat: "random-value", + errorExpected: true, + errorString: "invalid value 'random-value' found for the 'to' flag." + + " Allowed values: [konnect kong-gateway-3.x]", + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + output, err := fileConvert( + "--from", tc.convertCmdSourceFormat, + "--to", tc.convertCmdDestinationFormat, + "--input-file", "testdata/file-convert/001-kong-gateway-config/kong-gateway-2-x.yaml", + ) + + if tc.errorExpected { + assert.Error(t, err) + assert.Contains(t, err.Error(), tc.errorString) + + return + } + + assert.NoError(t, err) + + var expectedOutput interface{} + var currentOutput interface{} + content, err := os.ReadFile(tc.expectedOutputFile) + assert.NoError(t, err) + + err = yaml.Unmarshal(content, &expectedOutput) + assert.NoError(t, err) + err = yaml.Unmarshal([]byte(output), ¤tOutput) + assert.NoError(t, err) + assert.Equal(t, expectedOutput, currentOutput) + }) + } +} diff --git a/tests/integration/test_utils.go b/tests/integration/test_utils.go index 41a23b40e..41718b7bb 100644 --- a/tests/integration/test_utils.go +++ b/tests/integration/test_utils.go @@ -342,6 +342,28 @@ func lint(opts ...string) (string, error) { return stripansi.Strip(string(out)), cmdErr } +func fileConvert(opts ...string) (string, error) { + deckCmd := cmd.NewRootCmd() + args := []string{"file", "convert"} + if len(opts) > 0 { + args = append(args, opts...) + } + deckCmd.SetArgs(args) + + // capture command output to be used during tests + rescueStdout := os.Stdout + r, w, _ := os.Pipe() + os.Stdout = w + + cmdErr := deckCmd.ExecuteContext(context.Background()) + + w.Close() + out, _ := io.ReadAll(r) + os.Stdout = rescueStdout + + return stripansi.Strip(string(out)), cmdErr +} + func ping(opts ...string) error { deckCmd := cmd.NewRootCmd() args := []string{"gateway", "ping"} diff --git a/tests/integration/testdata/file-convert/001-kong-gateway-config/kong-gateway-2-x.yaml b/tests/integration/testdata/file-convert/001-kong-gateway-config/kong-gateway-2-x.yaml new file mode 100644 index 000000000..398199a29 --- /dev/null +++ b/tests/integration/testdata/file-convert/001-kong-gateway-config/kong-gateway-2-x.yaml @@ -0,0 +1,10 @@ +_format_version: "1.1" +services: +- connect_timeout: 60000 + id: 58076db2-28b6-423b-ba39-a797193017f7 + host: mockbin.org + name: svc1 + port: 80 + protocol: http + read_timeout: 60000 + retries: 5 \ No newline at end of file diff --git a/tests/integration/testdata/file-convert/001-kong-gateway-config/kong-gateway-3-x.yaml b/tests/integration/testdata/file-convert/001-kong-gateway-config/kong-gateway-3-x.yaml new file mode 100644 index 000000000..747af52e0 --- /dev/null +++ b/tests/integration/testdata/file-convert/001-kong-gateway-config/kong-gateway-3-x.yaml @@ -0,0 +1,10 @@ +_format_version: "3.0" +services: +- connect_timeout: 60000 + id: 58076db2-28b6-423b-ba39-a797193017f7 + host: mockbin.org + name: svc1 + port: 80 + protocol: http + read_timeout: 60000 + retries: 5 From a6e0d6087730a40c6b2eb9b7196bc834e8ea15ad Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Thu, 16 Jan 2025 12:01:24 +0530 Subject: [PATCH 38/38] fix: fixing consumer-group related dump config for deck. (#1486) * fix: fixing consumer-group related dump config for deck. With changes added in go-kong, to skip listing consumers while doing a GET call on a consumer_group, dump config with gw 3.9+ starting showing issues. Associations between a consumer and consumer-group were missing. Thus, we are pushing the no listing consumers feature behind a flag for now, applicable only for dump command as a starting point. * chore: updated gdr to v1.18.0 and go-kong to v0.63.0 These new versions have the necessary changes to not list consumers during a deck dump while using the necessary flag * fix: added validation to ensure that the new flag is not used with Konnect * tests: added integration tests for the new flag in deck dump * tests: added test-case for gw <3.0.0 * chore: removed stray code --- cmd/gateway_dump.go | 9 ++ go.mod | 4 +- go.sum | 10 +- tests/integration/dump_test.go | 105 ++++++++++++++++++ tests/integration/test_utils.go | 4 +- .../expected-konnect.yaml | 31 ++++++ .../expected-no-flag.yaml | 29 +++++ .../expected-no-flag_1.yaml | 29 +++++ .../expected-with-flag.yaml | 14 +++ .../expected-with-flag_1.yaml | 14 +++ .../kong.yaml | 20 ++++ .../kong3x.yaml | 20 ++++ 12 files changed, 281 insertions(+), 8 deletions(-) create mode 100644 tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-konnect.yaml create mode 100644 tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag.yaml create mode 100644 tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag_1.yaml create mode 100644 tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag.yaml create mode 100644 tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag_1.yaml create mode 100644 tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/kong.yaml create mode 100644 tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/kong3x.yaml diff --git a/cmd/gateway_dump.go b/cmd/gateway_dump.go index f37e15ad6..952afaebe 100644 --- a/cmd/gateway_dump.go +++ b/cmd/gateway_dump.go @@ -2,6 +2,7 @@ package cmd import ( "context" + "errors" "fmt" "os" "strings" @@ -48,6 +49,10 @@ func executeDump(cmd *cobra.Command, _ []string) error { } if inKonnectMode(nil) { + if dumpConfig.SkipConsumersWithConsumerGroups { + return errors.New("the flag --skip-consumers-with-consumer-groups can not be used with Konnect") + } + _ = sendAnalytics("dump", "", modeKonnect) return dumpKonnectV2(ctx) } @@ -188,6 +193,10 @@ configure Kong.`, false, "assume `yes` to prompts and run non-interactively.") dumpCmd.Flags().BoolVar(&dumpConfig.SkipCACerts, "skip-ca-certificates", false, "do not dump CA certificates.") + dumpCmd.Flags().BoolVar(&dumpConfig.SkipConsumersWithConsumerGroups, "skip-consumers-with-consumer-groups", + false, "do not show the association between consumer and consumer-group.\n"+ + "If set to true, deck skips listing consumers with consumer-groups,\n"+ + "thus gaining some performance with large configs. This flag is not valid with Konnect.") if deprecated { dumpCmd.Flags().StringVarP(&dumpCmdKongStateFileDeprecated, "output-file", "o", fileOutDefault, "file to which to write Kong's configuration."+ diff --git a/go.mod b/go.mod index 64fa9a79f..266a0f37c 100644 --- a/go.mod +++ b/go.mod @@ -13,8 +13,8 @@ require ( github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.40 - github.com/kong/go-database-reconciler v1.17.0 - github.com/kong/go-kong v0.61.0 + github.com/kong/go-database-reconciler v1.18.0 + github.com/kong/go-kong v0.63.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 80792a08a..b34a79bfb 100644 --- a/go.sum +++ b/go.sum @@ -247,10 +247,10 @@ github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/q github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kong/go-apiops v0.1.40 h1:Dp4IHJ3h61VeOAeQkOisf1BcOP+Ww+gpqnv14HvC6DQ= github.com/kong/go-apiops v0.1.40/go.mod h1:CNfsa9mHFRfAhT9E2IWTul0Mi1/BldTDmFu5fWcp2us= -github.com/kong/go-database-reconciler v1.17.0 h1:vL/KskveUR8fflbw+r/6QphSHxV8YahjfSDjNe9pDrI= -github.com/kong/go-database-reconciler v1.17.0/go.mod h1:3L4DP3/YGaDv9Hks4XA1YFm7HfPur2CuBxHI/4+r7NY= -github.com/kong/go-kong v0.61.0 h1:EWnQVMk1u1gy8//Hvui3NVCJZZ+fBnifVcoaIyLq60A= -github.com/kong/go-kong v0.61.0/go.mod h1:e0zgpuCnCbOXQN6e0e235TFJr4IYY8dDg9nLQgG9m7A= +github.com/kong/go-database-reconciler v1.18.0 h1:j1gVZ1uPfKglBXTyLEqDn0N374z2y/oaXOuCnWRuQTE= +github.com/kong/go-database-reconciler v1.18.0/go.mod h1:T0SYIHeC/3DeHzThtUS+ooxouN5KBGeKWcjkuCg4MS8= +github.com/kong/go-kong v0.63.0 h1:8ECLgkgDqON61qCMq/M0gTwZKYxg55Oy692dRDOOBiU= +github.com/kong/go-kong v0.63.0/go.mod h1:ma9GWnhkxtrXZlLFfED955HjVzmUojYEHet3lm+PDik= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= github.com/kong/go-slugify v1.0.0/go.mod h1:dbR2h3J2QKXQ1k0aww6cN7o4cIcwlWflr6RKRdcoaiw= github.com/kong/kubernetes-configuration v1.0.0 h1:f/OaX6oq8/MPur45KzcrIFGJ9Kl6OyTjlXqTJH+ij4s= @@ -377,6 +377,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= +github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= diff --git a/tests/integration/dump_test.go b/tests/integration/dump_test.go index ac0e76a92..225c34098 100644 --- a/tests/integration/dump_test.go +++ b/tests/integration/dump_test.go @@ -344,3 +344,108 @@ func Test_Dump_FilterChains(t *testing.T) { }) } } + +func Test_SkipConsumersWithConsumerGroups(t *testing.T) { + tests := []struct { + name string + stateFile string + expectedFile string + errorExpected bool + errorString string + skipConsumersWithConsumerGroups bool + runWhen func(t *testing.T) + }{ + { + name: "dump with flag --skip-consumers-with-consumer-groups set: <3.0.0 ", + stateFile: "testdata/dump/004-skip-consumers-with-consumer-groups/kong.yaml", + expectedFile: "testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag_1.yaml", + skipConsumersWithConsumerGroups: true, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", "<3.0.0") }, + }, + { + name: "dump with flag --skip-consumers-with-consumer-groups not set: <3.0.0 ", + stateFile: "testdata/dump/004-skip-consumers-with-consumer-groups/kong.yaml", + expectedFile: "testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag_1.yaml", + skipConsumersWithConsumerGroups: false, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", "<3.0.0") }, + }, + { + name: "dump with flag --skip-consumers-with-consumer-groups set: <3.9.0 ", + stateFile: "testdata/dump/004-skip-consumers-with-consumer-groups/kong3x.yaml", + expectedFile: "testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag.yaml", + skipConsumersWithConsumerGroups: true, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.0.0 <3.9.0") }, + }, + { + name: "dump with flag --skip-consumers-with-consumer-groups not set: <3.9.0 ", + stateFile: "testdata/dump/004-skip-consumers-with-consumer-groups/kong3x.yaml", + expectedFile: "testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag.yaml", + skipConsumersWithConsumerGroups: false, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.0.0 <3.9.0") }, + }, + { + name: "dump with flag --skip-consumers-with-consumer-groups set: >=3.9.0 ", + stateFile: "testdata/dump/004-skip-consumers-with-consumer-groups/kong3x.yaml", + expectedFile: "testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag.yaml", + skipConsumersWithConsumerGroups: true, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.9.0") }, + }, + { + name: "dump with flag --skip-consumers-with-consumer-groups not set: >=3.9.0 ", + stateFile: "testdata/dump/004-skip-consumers-with-consumer-groups/kong3x.yaml", + expectedFile: "testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag.yaml", + skipConsumersWithConsumerGroups: false, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.9.0") }, + }, + { + name: "dump with flag --skip-consumers-with-consumer-groups set: Konnect ", + stateFile: "testdata/dump/004-skip-consumers-with-consumer-groups/kong3x.yaml", + skipConsumersWithConsumerGroups: true, + runWhen: func(t *testing.T) { runWhenKonnect(t) }, + errorExpected: true, + errorString: "the flag --skip-consumers-with-consumer-groups can not be used with Konnect", + }, + { + name: "dump with flag --skip-consumers-with-consumer-groups not set: Konnect ", + stateFile: "testdata/dump/004-skip-consumers-with-consumer-groups/kong3x.yaml", + expectedFile: "testdata/dump/004-skip-consumers-with-consumer-groups/expected-konnect.yaml", + skipConsumersWithConsumerGroups: false, + runWhen: func(t *testing.T) { runWhenKonnect(t) }, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + tc.runWhen(t) + setup(t) + + assert.NoError(t, sync(tc.stateFile)) + + var ( + output string + err error + ) + if tc.skipConsumersWithConsumerGroups { + output, err = dump( + "--skip-consumers-with-consumer-groups", + "-o", "-", + ) + } else { + output, err = dump( + "-o", "-", + ) + } + + if tc.errorExpected { + assert.Equal(t, err.Error(), tc.errorString) + return + } + + assert.NoError(t, err) + + expected, err := readFile(tc.expectedFile) + assert.NoError(t, err) + assert.Equal(t, expected, output) + }) + } +} diff --git a/tests/integration/test_utils.go b/tests/integration/test_utils.go index 41718b7bb..f73a032c7 100644 --- a/tests/integration/test_utils.go +++ b/tests/integration/test_utils.go @@ -268,7 +268,7 @@ func setup(t *testing.T) { func sync(kongFile string, opts ...string) error { deckCmd := cmd.NewRootCmd() - args := []string{"sync", "-s", kongFile} + args := []string{"gateway", "sync", kongFile} if len(opts) > 0 { args = append(args, opts...) } @@ -300,7 +300,7 @@ func diff(kongFile string, opts ...string) (string, error) { func dump(opts ...string) (string, error) { deckCmd := cmd.NewRootCmd() - args := []string{"dump"} + args := []string{"gateway", "dump"} if len(opts) > 0 { args = append(args, opts...) } diff --git a/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-konnect.yaml b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-konnect.yaml new file mode 100644 index 000000000..114f118a4 --- /dev/null +++ b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-konnect.yaml @@ -0,0 +1,31 @@ +_format_version: "3.0" +_konnect: + control_plane_name: default +consumer_groups: +- name: gold + tags: + - tag1 + - tag2 +- name: silver + tags: + - tag1 + - tag3 +consumers: +- groups: + - name: silver + tags: + - tag1 + - tag3 + username: bar +- groups: + - name: silver + tags: + - tag1 + - tag3 + username: baz +- groups: + - name: gold + tags: + - tag1 + - tag2 + username: foo diff --git a/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag.yaml b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag.yaml new file mode 100644 index 000000000..80618e070 --- /dev/null +++ b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag.yaml @@ -0,0 +1,29 @@ +_format_version: "3.0" +consumer_groups: +- name: gold + tags: + - tag1 + - tag2 +- name: silver + tags: + - tag1 + - tag3 +consumers: +- groups: + - name: silver + tags: + - tag1 + - tag3 + username: bar +- groups: + - name: silver + tags: + - tag1 + - tag3 + username: baz +- groups: + - name: gold + tags: + - tag1 + - tag2 + username: foo diff --git a/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag_1.yaml b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag_1.yaml new file mode 100644 index 000000000..8ce685420 --- /dev/null +++ b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-no-flag_1.yaml @@ -0,0 +1,29 @@ +_format_version: "1.1" +consumer_groups: +- name: gold + tags: + - tag1 + - tag2 +- name: silver + tags: + - tag1 + - tag3 +consumers: +- groups: + - name: silver + tags: + - tag1 + - tag3 + username: bar +- groups: + - name: silver + tags: + - tag1 + - tag3 + username: baz +- groups: + - name: gold + tags: + - tag1 + - tag2 + username: foo diff --git a/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag.yaml b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag.yaml new file mode 100644 index 000000000..d78edb6d8 --- /dev/null +++ b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag.yaml @@ -0,0 +1,14 @@ +_format_version: "3.0" +consumer_groups: +- name: gold + tags: + - tag1 + - tag2 +- name: silver + tags: + - tag1 + - tag3 +consumers: +- username: bar +- username: baz +- username: foo diff --git a/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag_1.yaml b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag_1.yaml new file mode 100644 index 000000000..e2edf0580 --- /dev/null +++ b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/expected-with-flag_1.yaml @@ -0,0 +1,14 @@ +_format_version: "1.1" +consumer_groups: +- name: gold + tags: + - tag1 + - tag2 +- name: silver + tags: + - tag1 + - tag3 +consumers: +- username: bar +- username: baz +- username: foo diff --git a/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/kong.yaml b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/kong.yaml new file mode 100644 index 000000000..2aa29eee3 --- /dev/null +++ b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/kong.yaml @@ -0,0 +1,20 @@ +_format_version: "1.1" +consumer_groups: +- name: silver + tags: + - tag1 + - tag3 +- name: gold + tags: + - tag1 + - tag2 +consumers: +- username: foo + groups: + - name: gold +- username: bar + groups: + - name: silver +- username: baz + groups: + - name: silver diff --git a/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/kong3x.yaml b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/kong3x.yaml new file mode 100644 index 000000000..b50eeac90 --- /dev/null +++ b/tests/integration/testdata/dump/004-skip-consumers-with-consumer-groups/kong3x.yaml @@ -0,0 +1,20 @@ +_format_version: "3.0" +consumer_groups: +- name: silver + tags: + - tag1 + - tag3 +- name: gold + tags: + - tag1 + - tag2 +consumers: +- username: foo + groups: + - name: gold +- username: bar + groups: + - name: silver +- username: baz + groups: + - name: silver