From 927f88d8e2b01560d59c57d8db9b257af7c249b4 Mon Sep 17 00:00:00 2001 From: Gabriele Gerbino Date: Wed, 3 Jul 2024 11:03:25 +0200 Subject: [PATCH 01/43] chore: bump go-database-reconciler dependency - make lookups for consumer-group's consumers more performant - properly expand ipv6 targets avoid misleading diffs --- go.mod | 2 +- go.sum | 4 ++-- tests/integration/diff_test.go | 17 +++++++++++++++++ .../testdata/diff/005-no-diff-target/kong.yaml | 6 ++++++ 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 tests/integration/testdata/diff/005-no-diff-target/kong.yaml diff --git a/go.mod b/go.mod index 11e1fcb4b..d020c1160 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/fatih/color v1.15.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.33 - github.com/kong/go-database-reconciler v1.12.2 + github.com/kong/go-database-reconciler v1.13.0 github.com/kong/go-kong v0.55.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.0 diff --git a/go.sum b/go.sum index 373811ed5..00c075318 100644 --- a/go.sum +++ b/go.sum @@ -186,8 +186,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.33 h1:Y7IVksHPdHcXM6C+gPc25JiY4KRgYDAOn/jTx3sDU1k= github.com/kong/go-apiops v0.1.33/go.mod h1:o8lzBtbCLSXCMKzzqR8dcBhB7yzPs+9csAMZ1T1hsL0= -github.com/kong/go-database-reconciler v1.12.2 h1:bnlvLCgP4OjgJOK5JYqq1MlIJ2F7erXERMj8n/LNU8M= -github.com/kong/go-database-reconciler v1.12.2/go.mod h1:bUPJkoeW//x4hzNxewQMoIkeoDzJzunI0stDMYJ3BkU= +github.com/kong/go-database-reconciler v1.13.0 h1:6gRGeLDep0mvzT/5fCQY5waQp0F/T9MsyZ9fJmJq+Cc= +github.com/kong/go-database-reconciler v1.13.0/go.mod h1:bUPJkoeW//x4hzNxewQMoIkeoDzJzunI0stDMYJ3BkU= github.com/kong/go-kong v0.55.0 h1:lonKRzsDGk12dh9E+y+pWnY2ThXhKuMHjzBHSpCvQLw= github.com/kong/go-kong v0.55.0/go.mod h1:i1cMgTu6RYPHSyMpviShddRnc+DML/vlpgKC00hr8kU= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= diff --git a/tests/integration/diff_test.go b/tests/integration/diff_test.go index 347ed9d17..1262124f8 100644 --- a/tests/integration/diff_test.go +++ b/tests/integration/diff_test.go @@ -765,3 +765,20 @@ func Test_Diff_NoDiffUnorderedArray(t *testing.T) { assert.Equal(t, emptyOutput, out) reset(t) } + +// test scope: +// - 3.5 +func Test_Diff_NoDiffCompressedTarget(t *testing.T) { + runWhen(t, "kong", ">=3.5.0") + setup(t) + + // test that the diff command does not return any changes when + // target is a compressed IPv6. + stateFile := "testdata/diff/005-no-diff-target/kong.yaml" + assert.NoError(t, sync(stateFile)) + + out, err := diff(stateFile) + assert.NoError(t, err) + assert.Equal(t, emptyOutput, out) + reset(t) +} diff --git a/tests/integration/testdata/diff/005-no-diff-target/kong.yaml b/tests/integration/testdata/diff/005-no-diff-target/kong.yaml new file mode 100644 index 000000000..cc37613d2 --- /dev/null +++ b/tests/integration/testdata/diff/005-no-diff-target/kong.yaml @@ -0,0 +1,6 @@ +_format_version: "3.0" +upstreams: +- name: upstream1 + algorithm: round-robin + targets: + - target: "::1" \ No newline at end of file From 57c8e3c99b047e48af357ba704c78fa9f64ca8cc Mon Sep 17 00:00:00 2001 From: Gabriele Gerbino Date: Thu, 4 Jul 2024 09:53:16 +0200 Subject: [PATCH 02/43] chore: bump changelog date for v1.39.2 --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62aa17cea..8986f62fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.39.2](#v1392) - [v1.39.1](#v1391) - [v1.39.0](#v1390) - [v1.38.1](#v1381) @@ -87,6 +88,19 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.39.2] + +> Release date: 2024/07/04 + +### Fixes + +- Correct IPv6 targets comparison to avoid misleading diffs and failing syncs. + [#1333](https://github.com/Kong/deck/pull/1333) + [go-database-reconciler #109](https://github.com/Kong/go-database-reconciler/pull/109) +- Make lookups for consumer-group's consumers more performant. + [#1333](https://github.com/Kong/deck/pull/1333) + [go-database-reconciler #102](https://github.com/Kong/go-database-reconciler/pull/102) + ## [v1.39.1] > Release date: 2024/06/28 @@ -1723,6 +1737,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.39.2]: https://github.com/kong/deck/compare/v1.39.1...v1.39.2 [v1.39.1]: https://github.com/kong/deck/compare/v1.39.0...v1.39.1 [v1.39.0]: https://github.com/kong/deck/compare/v1.38.1...v1.39.0 [v1.38.1]: https://github.com/kong/deck/compare/v1.38.0...v1.38.1 From c7109a94c0fb67d49d6e8c833dd99a28897d7e78 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Tue, 16 Jul 2024 14:03:07 +0530 Subject: [PATCH 03/43] Updated git workflows to use go.mod for go versions (#1336) --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/integration-enterprise.yaml | 2 +- .github/workflows/integration-konnect.yaml | 2 +- .github/workflows/integration.yaml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/test.yaml | 2 +- .github/workflows/validate-kong-release.yaml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b20ded408..2f9b88416 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -45,7 +45,7 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: '^1.20' + go-version-file: go.mod # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/integration-enterprise.yaml b/.github/workflows/integration-enterprise.yaml index 44c301766..01673c7ca 100644 --- a/.github/workflows/integration-enterprise.yaml +++ b/.github/workflows/integration-enterprise.yaml @@ -46,7 +46,7 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: '^1.20' + go-version-file: go.mod - name: Login to Docker Hub uses: docker/login-action@v3 with: diff --git a/.github/workflows/integration-konnect.yaml b/.github/workflows/integration-konnect.yaml index 9dc8b15c0..94d08d5aa 100644 --- a/.github/workflows/integration-konnect.yaml +++ b/.github/workflows/integration-konnect.yaml @@ -24,6 +24,6 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: '^1.20' + go-version-file: go.mod - name: Run integration tests run: make test-integration diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 12a2c5094..5b835e7cf 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -47,7 +47,7 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: '^1.20' + go-version-file: go.mod - name: Setup Kong run: make setup-kong - name: Run integration tests diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4d1181968..fea95a8e2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,7 +17,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '^1.20' + go-version-file: go.mod - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c8aad3daa..a90704dd6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,7 +22,7 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: '^1.20' + go-version-file: go.mod - name: Setup golangci-lint uses: golangci/golangci-lint-action@v6.0.1 - name: Run tests with Coverage diff --git a/.github/workflows/validate-kong-release.yaml b/.github/workflows/validate-kong-release.yaml index fbeeddc45..eb4478127 100644 --- a/.github/workflows/validate-kong-release.yaml +++ b/.github/workflows/validate-kong-release.yaml @@ -32,7 +32,7 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: '^1.20' + go-version-file: go.mod - uses: Kong/kong-license@master id: license with: From f68fb7e90c3daef249bee944b23c55142e2f2744 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Tue, 16 Jul 2024 14:42:15 +0530 Subject: [PATCH 04/43] CI: Ignoring errors from latest images to account for flaky tests (#1337) --- .github/workflows/integration-enterprise.yaml | 1 + .github/workflows/integration.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/integration-enterprise.yaml b/.github/workflows/integration-enterprise.yaml index 01673c7ca..8c6c48907 100644 --- a/.github/workflows/integration-enterprise.yaml +++ b/.github/workflows/integration-enterprise.yaml @@ -65,3 +65,4 @@ jobs: env: KONG_LICENSE_DATA: ${{ steps.license.outputs.license }} run: make test-integration + continue-on-error: ${{ matrix.kong_image == 'kong/kong-gateway-dev:latest' }} diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 5b835e7cf..ceabcc380 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -52,3 +52,4 @@ jobs: run: make setup-kong - name: Run integration tests run: make test-integration + continue-on-error: ${{ matrix.kong_image == 'kong/kong:master' }} From 200a471c902e9fe27e517ec4cae377ac0d283824 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Tue, 16 Jul 2024 15:06:10 +0530 Subject: [PATCH 05/43] Releasing v1.39.3 (#1338) * Releasing v1.39.3 * Updated the changelog entry --- CHANGELOG.md | 10 ++++++++++ README.md | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8986f62fc..ea7159df2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.39.3](#v1393) - [v1.39.2](#v1392) - [v1.39.1](#v1391) - [v1.39.0](#v1390) @@ -88,6 +89,14 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.39.3] +> Release date: 2024/07/16 + +### Chores + +- Fixes [#1228](https://github.com/Kong/deck/issues/1282) by updating the golang version from 1.21 to 1.22, thus removing the inconsistency between decK releases' version and the one used in the project. + [#1336](https://github.com/Kong/deck/pull/1336) + ## [v1.39.2] > Release date: 2024/07/04 @@ -1737,6 +1746,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.39.3]: https://github.com/Kong/deck/compare/v1.39.2...v1.39.3 [v1.39.2]: https://github.com/kong/deck/compare/v1.39.1...v1.39.2 [v1.39.1]: https://github.com/kong/deck/compare/v1.39.0...v1.39.1 [v1.39.0]: https://github.com/kong/deck/compare/v1.38.1...v1.39.0 diff --git a/README.md b/README.md index 679b05e68..78121a5cd 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.37.0/deck_1.37.0_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.39.3/deck_1.39.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.37.0/deck_1.37.0_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.39.3/deck_1.39.3_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ``` From 0cdef1ebd97589e4302ae4b48fde271467537ce3 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 17 Jul 2024 13:50:58 +0530 Subject: [PATCH 06/43] fix: correct --no-color flag behaviour in non-tty environments (#1339) The non-tty environments had no option of getting a colorised output. This change retains the default behaviour of showing colors in tty and no colors in non-tty if no flag is passed. However, on passing the --no-color=false, non-tty environments can also get colored output. Fix #1313 --- cmd/root.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index fd15edbd2..fee3bef69 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -373,7 +373,9 @@ func initConfig() { // cookie-jar support rootConfig.CookieJarPath = viper.GetString("kong-cookie-jar-path") - color.NoColor = (color.NoColor || viper.GetBool("no-color")) + if viper.IsSet("no-color") { + color.NoColor = viper.GetBool("no-color") + } if err := initKonnectConfig(); err != nil { fmt.Println(err) From 4b632fd8caac00f0f013a19e6b6247bfdbcd087a Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Thu, 18 Jul 2024 11:39:37 +0530 Subject: [PATCH 07/43] fix: validate presence of flags and args in file patch command (#1342) The command intends to patch input files either via selector-value flags or patch file arguments. The change ensures that at least one of these is present, but not both at the same time. Till now, the command accepted patches from flags and patch files at the same time, but ignored the patches passed via flags. This was a confusing behaviour for customers. Fix #1130 --- cmd/file_patch.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/file_patch.go b/cmd/file_patch.go index ada47fc25..0ab8baea8 100644 --- a/cmd/file_patch.go +++ b/cmd/file_patch.go @@ -167,6 +167,18 @@ If the 'values' object instead is an array, then any arrays returned by the sele will get the 'values' appended to them. `, RunE: executePatch, + PersistentPreRunE: func(_ *cobra.Command, args []string) error { + if len(args) > 0 && (len(cmdPatchSelectors) > 0 || len(cmdPatchValues) > 0) { + return fmt.Errorf("cannot use patch file argument along with '--selector' and '--value'") + } + + if len(args) == 0 && len(cmdPatchSelectors) == 0 && len(cmdPatchValues) == 0 { + return fmt.Errorf("must specify at least one of these: " + + "a patch file argument or a '--selector' and '--value' combination") + } + + return nil + }, Example: "# update the read-timeout on all services\n" + "cat kong.yml | deck file patch --selector=\"$..services[*]\" --value=\"read_timeout:10000\"", } From 6475b4b4246e28c64851d28ea78a0ac879145423 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Mon, 22 Jul 2024 18:08:13 +0530 Subject: [PATCH 08/43] fix: update go-database-reconciler for fixing expression route handling (#1344) Till now, expression routes were getting incorrectly rendered. Added changes in go-database-reconciler to allow proper rendering for both kinds of routes. Added tests here to ensure the functionality stays intact for future updates. Fix #1250. --- go.mod | 6 +++--- go.sum | 12 ++++++------ tests/integration/render_test.go | 14 ++++++++++++++ .../003-traditional-routes/expected.yaml | 19 +++++++++++++++++++ .../render/003-traditional-routes/input.yaml | 14 ++++++++++++++ .../004-expression-routes/expected.yaml | 19 +++++++++++++++++++ .../render/004-expression-routes/input.yaml | 9 +++++++++ 7 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 tests/integration/testdata/render/003-traditional-routes/expected.yaml create mode 100644 tests/integration/testdata/render/003-traditional-routes/input.yaml create mode 100644 tests/integration/testdata/render/004-expression-routes/expected.yaml create mode 100644 tests/integration/testdata/render/004-expression-routes/input.yaml diff --git a/go.mod b/go.mod index d020c1160..935f1c82e 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/fatih/color v1.15.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.33 - github.com/kong/go-database-reconciler v1.13.0 + github.com/kong/go-database-reconciler v1.14.1 github.com/kong/go-kong v0.55.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.0 @@ -136,8 +136,8 @@ require ( golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/term v0.22.0 // indirect golang.org/x/text v0.15.0 // indirect golang.org/x/tools v0.21.0 // indirect google.golang.org/protobuf v1.33.0 // indirect diff --git a/go.sum b/go.sum index 00c075318..057c8e188 100644 --- a/go.sum +++ b/go.sum @@ -186,8 +186,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.33 h1:Y7IVksHPdHcXM6C+gPc25JiY4KRgYDAOn/jTx3sDU1k= github.com/kong/go-apiops v0.1.33/go.mod h1:o8lzBtbCLSXCMKzzqR8dcBhB7yzPs+9csAMZ1T1hsL0= -github.com/kong/go-database-reconciler v1.13.0 h1:6gRGeLDep0mvzT/5fCQY5waQp0F/T9MsyZ9fJmJq+Cc= -github.com/kong/go-database-reconciler v1.13.0/go.mod h1:bUPJkoeW//x4hzNxewQMoIkeoDzJzunI0stDMYJ3BkU= +github.com/kong/go-database-reconciler v1.14.1 h1:NkMiarWUnCzK/0kMgMVlVRqFlccBq3XfZeQAuy72dKk= +github.com/kong/go-database-reconciler v1.14.1/go.mod h1:OsyUWH3SUvXAd5HJx3PhRU3PyzH0uCy7bTlzoSfw8Ew= github.com/kong/go-kong v0.55.0 h1:lonKRzsDGk12dh9E+y+pWnY2ThXhKuMHjzBHSpCvQLw= github.com/kong/go-kong v0.55.0/go.mod h1:i1cMgTu6RYPHSyMpviShddRnc+DML/vlpgKC00hr8kU= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= @@ -440,15 +440,15 @@ 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.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.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.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= +golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= 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= diff --git a/tests/integration/render_test.go b/tests/integration/render_test.go index 908dde2e1..19698faa0 100644 --- a/tests/integration/render_test.go +++ b/tests/integration/render_test.go @@ -33,6 +33,20 @@ func Test_RenderPlain(t *testing.T) { "DECK_FOO_FLOAT": "123", }, }, + { + name: "render with traditional route", + stateFile: "testdata/render/003-traditional-routes/input.yaml", + additionalArgs: []string{}, + expectedFile: "testdata/render/003-traditional-routes/expected.yaml", + envVars: map[string]string{}, + }, + { + name: "render with expression route", + stateFile: "testdata/render/004-expression-routes/input.yaml", + additionalArgs: []string{}, + expectedFile: "testdata/render/004-expression-routes/expected.yaml", + envVars: map[string]string{}, + }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { diff --git a/tests/integration/testdata/render/003-traditional-routes/expected.yaml b/tests/integration/testdata/render/003-traditional-routes/expected.yaml new file mode 100644 index 000000000..b3d95eea1 --- /dev/null +++ b/tests/integration/testdata/render/003-traditional-routes/expected.yaml @@ -0,0 +1,19 @@ +_format_version: "3.0" +services: +- connect_timeout: 60000 + host: localhost + name: foo + port: 8001 + protocol: http + read_timeout: 60000 + routes: + - name: foo + paths: + - /foo + preserve_host: false + protocols: + - http + - https + regex_priority: 0 + strip_path: true + write_timeout: 60000 diff --git a/tests/integration/testdata/render/003-traditional-routes/input.yaml b/tests/integration/testdata/render/003-traditional-routes/input.yaml new file mode 100644 index 000000000..2c0d18dc6 --- /dev/null +++ b/tests/integration/testdata/render/003-traditional-routes/input.yaml @@ -0,0 +1,14 @@ +services: +- host: localhost + name: foo + port: 8001 + protocol: http + routes: + routes: + - name: foo + paths: + - /foo + preserve_host: false + protocols: + - http + - https \ No newline at end of file diff --git a/tests/integration/testdata/render/004-expression-routes/expected.yaml b/tests/integration/testdata/render/004-expression-routes/expected.yaml new file mode 100644 index 000000000..331579278 --- /dev/null +++ b/tests/integration/testdata/render/004-expression-routes/expected.yaml @@ -0,0 +1,19 @@ +_format_version: "3.0" +services: +- connect_timeout: 60000 + host: localhost + name: foo + port: 8001 + protocol: http + read_timeout: 60000 + routes: + - expression: (net.protocol == "http") && (http.method == "GET") && (http.path == + "/foo") + name: foo + preserve_host: false + priority: 0 + protocols: + - http + - https + strip_path: true + write_timeout: 60000 diff --git a/tests/integration/testdata/render/004-expression-routes/input.yaml b/tests/integration/testdata/render/004-expression-routes/input.yaml new file mode 100644 index 000000000..89f779fd2 --- /dev/null +++ b/tests/integration/testdata/render/004-expression-routes/input.yaml @@ -0,0 +1,9 @@ +services: +- host: localhost + name: foo + port: 8001 + protocol: http + routes: + - expression: (net.protocol == "http") && (http.method == "GET") && (http.path == + "/foo") + name: foo \ No newline at end of file From b57e490971b2f3dbce19cbf5e584c3a9b8ab5812 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:46:52 +0200 Subject: [PATCH 09/43] chore(deps): bump alpine from 3.20.1 to 3.20.2 (#1345) 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 908d01c93..81e32d9bb 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.1 +FROM alpine:3.20.2 RUN adduser --disabled-password --gecos "" deckuser RUN apk --no-cache add ca-certificates jq USER deckuser From 535f511ce0becc850c060809756c3a311c8522ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:58:52 +0200 Subject: [PATCH 10/43] chore(deps): bump k8s.io/apiextensions-apiserver from 0.29.2 to 0.30.3 (#1340) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 935f1c82e..ee40d4261 100644 --- a/go.mod +++ b/go.mod @@ -19,10 +19,10 @@ require ( github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 golang.org/x/sync v0.7.0 - k8s.io/api v0.29.3 - k8s.io/apiextensions-apiserver v0.29.2 - k8s.io/apimachinery v0.30.2 - k8s.io/code-generator v0.30.2 + k8s.io/api v0.30.3 + k8s.io/apiextensions-apiserver v0.30.3 + k8s.io/apimachinery v0.30.3 + k8s.io/code-generator v0.30.3 sigs.k8s.io/gateway-api v1.0.0 sigs.k8s.io/yaml v1.4.0 ) diff --git a/go.sum b/go.sum index 057c8e188..7ca171e9d 100644 --- a/go.sum +++ b/go.sum @@ -507,14 +507,14 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.29.3 h1:2ORfZ7+bGC3YJqGpV0KSDDEVf8hdGQ6A03/50vj8pmw= -k8s.io/api v0.29.3/go.mod h1:y2yg2NTyHUUkIoTC+phinTnEa3KFM6RZ3szxt014a80= -k8s.io/apiextensions-apiserver v0.29.2 h1:UK3xB5lOWSnhaCk0RFZ0LUacPZz9RY4wi/yt2Iu+btg= -k8s.io/apiextensions-apiserver v0.29.2/go.mod h1:aLfYjpA5p3OwtqNXQFkhJ56TB+spV8Gc4wfMhUA3/b8= -k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg= -k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/code-generator v0.30.2 h1:ZY1+aGkqZVwKIyGsOzquaeZ5rSfE6wZHur8z3jQAaiw= -k8s.io/code-generator v0.30.2/go.mod h1:RQP5L67QxqgkVquk704CyvWFIq0e6RCMmLTXxjE8dVA= +k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= +k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= +k8s.io/apiextensions-apiserver v0.30.3 h1:oChu5li2vsZHx2IvnGP3ah8Nj3KyqG3kRSaKmijhB9U= +k8s.io/apiextensions-apiserver v0.30.3/go.mod h1:uhXxYDkMAvl6CJw4lrDN4CPbONkF3+XL9cacCT44kV4= +k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc= +k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= +k8s.io/code-generator v0.30.3 h1:bmtnLJKagDS5f5uOEpLyJiDfIMKXGMKgOLBdde+w0Mc= +k8s.io/code-generator v0.30.3/go.mod h1:PFgBiv+miFV7TZYp+RXgROkhA+sWYZ+mtpbMLofMke8= 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.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= From 9b0fbb24e1811c4f23a01574de5e6325831b0604 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:08:03 +0200 Subject: [PATCH 11/43] chore(deps): bump golangci/golangci-lint-action from 6.0.1 to 6.1.0 (#1350) 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 a90704dd6..06e402047 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -24,7 +24,7 @@ jobs: with: go-version-file: go.mod - name: Setup golangci-lint - uses: golangci/golangci-lint-action@v6.0.1 + uses: golangci/golangci-lint-action@v6.1.0 - name: Run tests with Coverage run: make coverage - name: Upload Code Coverage From e51335a3052cd69bcf07fdfbc62925e32ce43450 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 31 Jul 2024 18:57:47 +0530 Subject: [PATCH 12/43] fix: updated go-database-reconciler library. (#1351) This ensures that fields from traditional routes do not propagate into expression routes in case kong gateway version is < 3.7.0 This change goes along with https://github.com/Kong/go-database-reconciler/pull/118/files --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ee40d4261..3f3af0650 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/fatih/color v1.15.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.33 - github.com/kong/go-database-reconciler v1.14.1 + github.com/kong/go-database-reconciler v1.14.2 github.com/kong/go-kong v0.55.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.0 diff --git a/go.sum b/go.sum index 7ca171e9d..fca6eb041 100644 --- a/go.sum +++ b/go.sum @@ -186,8 +186,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.33 h1:Y7IVksHPdHcXM6C+gPc25JiY4KRgYDAOn/jTx3sDU1k= github.com/kong/go-apiops v0.1.33/go.mod h1:o8lzBtbCLSXCMKzzqR8dcBhB7yzPs+9csAMZ1T1hsL0= -github.com/kong/go-database-reconciler v1.14.1 h1:NkMiarWUnCzK/0kMgMVlVRqFlccBq3XfZeQAuy72dKk= -github.com/kong/go-database-reconciler v1.14.1/go.mod h1:OsyUWH3SUvXAd5HJx3PhRU3PyzH0uCy7bTlzoSfw8Ew= +github.com/kong/go-database-reconciler v1.14.2 h1:AWS8FjO+qhpjZ0hn26pdSNNwweDFa1pOkiQCL36/KXY= +github.com/kong/go-database-reconciler v1.14.2/go.mod h1:OsyUWH3SUvXAd5HJx3PhRU3PyzH0uCy7bTlzoSfw8Ew= github.com/kong/go-kong v0.55.0 h1:lonKRzsDGk12dh9E+y+pWnY2ThXhKuMHjzBHSpCvQLw= github.com/kong/go-kong v0.55.0/go.mod h1:i1cMgTu6RYPHSyMpviShddRnc+DML/vlpgKC00hr8kU= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= From aca781ac296242cdd4378e7866343f974882752f Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Thu, 1 Aug 2024 13:49:06 +0530 Subject: [PATCH 13/43] chore: changelog and readme update for release (#1352) --- CHANGELOG.md | 12 ++++++++++++ README.md | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea7159df2..cdc625a89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.39.4](#v1394) - [v1.39.3](#v1393) - [v1.39.2](#v1392) - [v1.39.1](#v1391) @@ -89,6 +90,16 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.39.4] +> Release date: 2024/08/01 + +### Fixes + +- Correct --no-color flag behaviour in non-tty environments +The changes retain the default behaviour of showing colors in tty and no colors in non-tty if no flag is passed. However, on passing the --no-color=false, non-tty environments can also get colored output.[#1339](https://github.com/Kong/deck/pull/1339) +- Add validation on `deck file patch` to avoid confusing behaviour. The command intends to patch input files either via selector-value flags or command arguments. The change ensures that at least one of these is present, but not both at the same time.[#1342](https://github.com/Kong/deck/pull/1342) +- Fix rendering for expression routes, keeping kong gateway version in consideration. [go-database-reconciler #118](https://github.com/Kong/go-database-reconciler/pull/118) [#1351](https://github.com/Kong/deck/pull/1351) + ## [v1.39.3] > Release date: 2024/07/16 @@ -1746,6 +1757,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.39.4]: https://github.com/Kong/deck/compare/v1.39.3...v1.39.4 [v1.39.3]: https://github.com/Kong/deck/compare/v1.39.2...v1.39.3 [v1.39.2]: https://github.com/kong/deck/compare/v1.39.1...v1.39.2 [v1.39.1]: https://github.com/kong/deck/compare/v1.39.0...v1.39.1 diff --git a/README.md b/README.md index 78121a5cd..d59d37672 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.39.3/deck_1.39.3_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.39.4/deck_1.39.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.39.3/deck_1.39.3_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.39.4/deck_1.39.4_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ``` From 8e0dc3ed4c0654041965182bd6b11efaedb01fb3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 12:42:16 +0530 Subject: [PATCH 14/43] chore(deps): bump github.com/hashicorp/go-retryablehttp from 0.7.5 to 0.7.7 (#1323) * chore(deps): bump github.com/hashicorp/go-retryablehttp Bumps [github.com/hashicorp/go-retryablehttp](https://github.com/hashicorp/go-retryablehttp) from 0.7.5 to 0.7.7. - [Changelog](https://github.com/hashicorp/go-retryablehttp/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/go-retryablehttp/compare/v0.7.5...v0.7.7) --- updated-dependencies: - dependency-name: github.com/hashicorp/go-retryablehttp dependency-type: indirect ... Signed-off-by: dependabot[bot] * chore: bump github.com/fatih/color to v1.17.0 --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Gabriele Gerbino --- go.mod | 7 +++---- go.sum | 29 ++++++++--------------------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index 3f3af0650..a2f9be903 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d github.com/blang/semver/v4 v4.0.0 github.com/daveshanley/vacuum v0.9.15 - github.com/fatih/color v1.15.0 + github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.33 github.com/kong/go-database-reconciler v1.14.2 @@ -33,9 +33,8 @@ require ( github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-hclog v1.6.2 // indirect github.com/hashicorp/go-memdb v1.3.4 // indirect - github.com/hashicorp/go-retryablehttp v0.7.5 // indirect + github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/imdario/mergo v0.3.16 // indirect @@ -136,7 +135,7 @@ require ( golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.22.0 // indirect + golang.org/x/sys v0.23.0 // indirect golang.org/x/term v0.22.0 // indirect golang.org/x/text v0.15.0 // indirect golang.org/x/tools v0.21.0 // indirect diff --git a/go.sum b/go.sum index fca6eb041..eb7bd86b1 100644 --- a/go.sum +++ b/go.sum @@ -64,9 +64,8 @@ github.com/dop251/goja_nodejs v0.0.0-20240418154818-2aae10d4cbcf/go.mod h1:bhGPm github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 h1:PRxIJD8XjimM5aTknUK9w6DHLDox2r2M3DI4i2pnd3w= github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936/go.mod h1:ttYvX5qlB+mlV1okblJqcSMtR4c52UKxDiX9GRBS8+Q= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -143,16 +142,15 @@ github.com/gosimple/unidecode v1.0.1 h1:hZzFTMMqSswvf0LBJZCZgThIZrpDHFXux9KeGmn6 github.com/gosimple/unidecode v1.0.1/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= -github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-memdb v1.3.4 h1:XSL3NR682X/cVk2IeV0d70N4DZ9ljI885xAEU8IoK3c= github.com/hashicorp/go-memdb v1.3.4/go.mod h1:uBTr1oQbtuMgd1SSGoR8YV27eT3sBHbYiNm53bMpgSg= -github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= -github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= +github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -215,12 +213,8 @@ github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= @@ -320,14 +314,12 @@ github.com/ssgelm/cookiejarparser v1.0.1/go.mod h1:DUfC0mpjIzlDN7DzKjXpHj0qMI5m9 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -415,8 +407,6 @@ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -426,13 +416,10 @@ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -440,8 +427,8 @@ 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.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.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= From e66ed5ee0bbff86182f6cf728f12724fbcd26ece Mon Sep 17 00:00:00 2001 From: Gabriele Date: Mon, 19 Aug 2024 11:28:25 +0200 Subject: [PATCH 15/43] chore: bump go-apiops to v0.1.35 (#1355) * chore: bump go-apiops to v0.1.35 Ref: https://github.com/Kong/go-apiops/pull/186 * chore: downgrade kin-openapi to v0.108.0 to maintain compatibility with go-apiops * chore: go sum added for dprtaso/go-yit --------- Co-authored-by: Prashansa Kulshrestha --- go.mod | 13 ++++++------- go.sum | 33 +++++++++++++++++---------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/go.mod b/go.mod index a2f9be903..c2dfde902 100644 --- a/go.mod +++ b/go.mod @@ -10,11 +10,11 @@ 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.33 + github.com/kong/go-apiops v0.1.35 github.com/kong/go-database-reconciler v1.14.2 github.com/kong/go-kong v0.55.0 github.com/mitchellh/go-homedir v1.1.0 - github.com/spf13/cobra v1.8.0 + github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 @@ -43,7 +43,6 @@ require ( github.com/pb33f/doctor v0.0.6 // indirect github.com/pb33f/libopenapi v0.16.1 // indirect github.com/pb33f/libopenapi-validator v0.0.49 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/shirou/gopsutil/v3 v3.24.5 // indirect github.com/ssgelm/cookiejarparser v1.0.1 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect @@ -65,16 +64,16 @@ require ( github.com/dlclark/regexp2 v1.10.0 // indirect github.com/dop251/goja v0.0.0-20240220182346-e401ed450204 // indirect github.com/dop251/goja_nodejs v0.0.0-20240418154818-2aae10d4cbcf // indirect - github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect + github.com/dprotaso/go-yit v0.0.0-20240618133044-5a0af90af097 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getkin/kin-openapi v0.108.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-openapi/jsonpointer v0.20.2 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.4 // indirect - github.com/go-openapi/swag v0.22.7 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect @@ -89,7 +88,7 @@ require ( github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.1-vault-5 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/invopop/yaml v0.1.0 // indirect + github.com/invopop/yaml v0.3.1 // indirect 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 diff --git a/go.sum b/go.sum index eb7bd86b1..0289d52f5 100644 --- a/go.sum +++ b/go.sum @@ -42,7 +42,7 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -62,8 +62,8 @@ github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8 github.com/dop251/goja_nodejs v0.0.0-20240418154818-2aae10d4cbcf h1:2JoVYP9iko8uuIW33BQafzaylDixXbdXCRw/vCoxL+s= github.com/dop251/goja_nodejs v0.0.0-20240418154818-2aae10d4cbcf/go.mod h1:bhGPmCgCCTSRfiMYWjpS46IDo9EUZXlsuUaPXSWGbv0= github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= -github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 h1:PRxIJD8XjimM5aTknUK9w6DHLDox2r2M3DI4i2pnd3w= -github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936/go.mod h1:ttYvX5qlB+mlV1okblJqcSMtR4c52UKxDiX9GRBS8+Q= +github.com/dprotaso/go-yit v0.0.0-20240618133044-5a0af90af097 h1:f5nA5Ys8RXqFXtKc0XofVRiuwNTuJzPIwTmbjLz9vj8= +github.com/dprotaso/go-yit v0.0.0-20240618133044-5a0af90af097/go.mod h1:FTAVyH6t+SlS97rv6EXRVuBDLkQqcIe/xQw9f4IFUI4= github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -84,13 +84,13 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= -github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.22.7 h1:JWrc1uc/P9cSomxfnsFSVWoE1FW6bNbrVPmpQYpCcR8= -github.com/go-openapi/swag v0.22.7/go.mod h1:Gl91UqO+btAM0plGGxHqJcQZ1ZTy6jbmridBTsDy8A0= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +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/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= @@ -169,8 +169,9 @@ github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/invopop/yaml v0.1.0 h1:YW3WGUoJEXYfzWBjn00zIlrw7brGVD0fUKRYDPAPhrc= github.com/invopop/yaml v0.1.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= +github.com/invopop/yaml v0.3.1 h1:f0+ZpmhfBSS4MhG+4HYseMdJhoeeopbSKbq5Rpeelso= +github.com/invopop/yaml v0.3.1/go.mod h1:PMOp3nn4/12yEZUFfmOuNHJsZToEEOwoWsT+D81KkeA= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -182,8 +183,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.33 h1:Y7IVksHPdHcXM6C+gPc25JiY4KRgYDAOn/jTx3sDU1k= -github.com/kong/go-apiops v0.1.33/go.mod h1:o8lzBtbCLSXCMKzzqR8dcBhB7yzPs+9csAMZ1T1hsL0= +github.com/kong/go-apiops v0.1.35 h1:k7nVPKdv4BR6vENRMAQNy97vX8otGlL22D7IKZd2A2Q= +github.com/kong/go-apiops v0.1.35/go.mod h1:l2gaaaLdMGtYQDbhj9XgpqH0TsydO4905NcjiuLKgsY= github.com/kong/go-database-reconciler v1.14.2 h1:AWS8FjO+qhpjZ0hn26pdSNNwweDFa1pOkiQCL36/KXY= github.com/kong/go-database-reconciler v1.14.2/go.mod h1:OsyUWH3SUvXAd5HJx3PhRU3PyzH0uCy7bTlzoSfw8Ew= github.com/kong/go-kong v0.55.0 h1:lonKRzsDGk12dh9E+y+pWnY2ThXhKuMHjzBHSpCvQLw= @@ -244,8 +245,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.18.0 h1:W9Y7IWXxPUpAit9ieMOLI7PJZGaW22DTKgiVAuhDTLc= -github.com/onsi/ginkgo/v2 v2.18.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= 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= @@ -279,8 +280,8 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= @@ -303,8 +304,8 @@ github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= From bbe779d29a287f8cbe394c1b71ddb6cd663a43c2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:32:30 +0000 Subject: [PATCH 16/43] chore(deps): bump golang from 1.22.4 to 1.23.0 (#1359) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): bump golang from 1.22.4 to 1.23.0 Bumps golang from 1.22.4 to 1.23.0. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * chore: fix linter issues --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Patryk Małek --- .golangci.yml | 6 +- Dockerfile | 2 +- cmd/common.go | 8 +- convert/convert_test.go | 3 +- kong2kic/route.go | 6 +- kong2kic/service.go | 8 +- kong2kic/writer.go | 2 +- tests/integration/lint_test.go | 2 +- tests/integration/reset_test.go | 12 +- tests/integration/sync_test.go | 254 ++++++++------------------------ tests/integration/test_utils.go | 12 +- 11 files changed, 91 insertions(+), 224 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 2eafaa9ee..5e40286e3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,7 +8,7 @@ linters: - dogsled - durationcheck - exhaustive - - exportloopref + - copyloopvar - gci - goconst - gofmt @@ -19,7 +19,9 @@ linters: - govet - importas - lll - - megacheck + - gosimple + - staticcheck + - unused - misspell - nakedret - nilerr diff --git a/Dockerfile b/Dockerfile index 81e32d9bb..ee9c51cb8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.4 AS build +FROM golang:1.23.0 AS build WORKDIR /deck COPY go.mod ./ COPY go.sum ./ diff --git a/cmd/common.go b/cmd/common.go index 60988ed1c..deba570d5 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -515,11 +515,11 @@ func checkForRBACResources(content reconcilerUtils.KongRawState, common := "At a time, state file(s) must entirely consist of either proxy " + "configuration or RBAC configuration." if rbacResourcesOnly { - return fmt.Errorf("When --rbac-resources-only is used, state file(s) " + - "cannot contain any resources other than RBAC resources. " + common) + return fmt.Errorf("when --rbac-resources-only is used, state file(s) "+ + "cannot contain any resources other than RBAC resources. %s", common) } - return fmt.Errorf("State file(s) contains RBAC resources. " + - "Please use --rbac-resources-only flag to manage these resources. " + common) + return fmt.Errorf("state file(s) contains RBAC resources. "+ + "Please use --rbac-resources-only flag to manage these resources. %s", common) } return nil } diff --git a/convert/convert_test.go b/convert/convert_test.go index 93a95a693..e6e955cb2 100644 --- a/convert/convert_test.go +++ b/convert/convert_test.go @@ -367,9 +367,8 @@ func Test_Convert(t *testing.T) { func wipeServiceID(content *file.Content) *file.Content { result := content.DeepCopy() - result.ServicePackages = nil + result.ServicePackages = make([]file.FServicePackage, 0, len(content.ServicePackages)) for _, sp := range content.ServicePackages { - sp := sp sp = zeroOutID(sp) result.ServicePackages = append(result.ServicePackages, sp) } diff --git a/kong2kic/route.go b/kong2kic/route.go index be21861ed..f9e797dca 100644 --- a/kong2kic/route.go +++ b/kong2kic/route.go @@ -154,7 +154,7 @@ func populateKICIngressesWithAnnotations(content *file.Content, kicContent *KICC Service: &k8snetv1.IngressServiceBackend{ Name: *service.Name, Port: k8snetv1.ServiceBackendPort{ - Number: int32(*service.Port), + Number: int32(*service.Port), //nolint:gosec }, }, }, @@ -203,7 +203,7 @@ func populateKICIngressesWithAnnotations(content *file.Content, kicContent *KICC Service: &k8snetv1.IngressServiceBackend{ Name: *service.Name, Port: k8snetv1.ServiceBackendPort{ - Number: int32(*service.Port), + Number: int32(*service.Port), //nolint:gosec }, }, }, @@ -394,7 +394,7 @@ func populateKICIngressesWithGatewayAPI(content *file.Content, kicContent *KICCo }, } if service.Port != nil { - portNumber := k8sgwapiv1.PortNumber(*service.Port) + portNumber := k8sgwapiv1.PortNumber(*service.Port) //nolint:gosec backendRef.Port = &portNumber } diff --git a/kong2kic/service.go b/kong2kic/service.go index a5303ae6a..7ce9a06e0 100644 --- a/kong2kic/service.go +++ b/kong2kic/service.go @@ -44,9 +44,11 @@ func populateKICServicesWithAnnotations(content *file.Content, kicContent *KICCo if service.Port != nil { sPort := k8scorev1.ServicePort{ - Protocol: protocol, - Port: int32(*service.Port), - TargetPort: intstr.IntOrString{IntVal: int32(*service.Port)}, + Protocol: protocol, + Port: int32(*service.Port), //nolint:gosec + TargetPort: intstr.IntOrString{ + IntVal: int32(*service.Port), //nolint:gosec + }, } k8sService.Spec.Ports = append(k8sService.Spec.Ports, sPort) } diff --git a/kong2kic/writer.go b/kong2kic/writer.go index da74ada68..69ffb724e 100644 --- a/kong2kic/writer.go +++ b/kong2kic/writer.go @@ -36,7 +36,7 @@ func WriteContentToFile(content *file.Content, filename string, format file.Form return err } default: - return fmt.Errorf("unknown file format: " + string(format)) + return fmt.Errorf("unknown file format: %s", format) } if filename == "-" { diff --git a/tests/integration/lint_test.go b/tests/integration/lint_test.go index 4f2b5c4ca..914813a6b 100644 --- a/tests/integration/lint_test.go +++ b/tests/integration/lint_test.go @@ -157,7 +157,7 @@ func Test_LintStructured(t *testing.T) { cmpopts.EquateEmpty(), } if diff := cmp.Diff(outputErrors, expectedErrors, cmpOpts...); diff != "" { - t.Errorf(diff) + t.Errorf("got unexpected diff\n:%s", diff) } }) } diff --git a/tests/integration/reset_test.go b/tests/integration/reset_test.go index 47aa5b28c..521c16721 100644 --- a/tests/integration/reset_test.go +++ b/tests/integration/reset_test.go @@ -39,9 +39,7 @@ u8S6yNlu2Q== func Test_Reset_SkipCACert_2x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Errorf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -75,9 +73,7 @@ func Test_Reset_SkipCACert_2x(t *testing.T) { func Test_Reset_SkipCACert_3x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Errorf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -113,9 +109,7 @@ func Test_Reset_ConsumerGroupConsumersWithCustomID(t *testing.T) { setup(t) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) require.NoError(t, sync("testdata/sync/028-consumer-group-consumers-custom_id/kong.yaml")) reset(t) diff --git a/tests/integration/sync_test.go b/tests/integration/sync_test.go index bb79ade0d..93cc73c8a 100644 --- a/tests/integration/sync_test.go +++ b/tests/integration/sync_test.go @@ -1264,9 +1264,7 @@ var ( func Test_Sync_ServicesRoutes_Till_1_4_3(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) // ignore entities fields based on Kong version ignoreFields := []cmp.Option{ @@ -1311,9 +1309,7 @@ func Test_Sync_ServicesRoutes_Till_1_4_3(t *testing.T) { func Test_Sync_ServicesRoutes_Till_1_5_1(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1353,9 +1349,7 @@ func Test_Sync_ServicesRoutes_Till_1_5_1(t *testing.T) { func Test_Sync_ServicesRoutes_From_2_0_5_To_2_1_4(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1402,9 +1396,7 @@ func Test_Sync_ServicesRoutes_From_2_0_5_To_2_1_4(t *testing.T) { func Test_Sync_ServicesRoutes_From_2_2_1_to_2_6_0(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1446,9 +1438,7 @@ func Test_Sync_ServicesRoutes_From_2_2_1_to_2_6_0(t *testing.T) { func Test_Sync_ServicesRoutes_From_2_6_9_Till_2_8_0(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1487,9 +1477,7 @@ func Test_Sync_ServicesRoutes_From_2_6_9_Till_2_8_0(t *testing.T) { func Test_Sync_ServicesRoutes_From_3x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1528,9 +1516,7 @@ func Test_Sync_ServicesRoutes_From_3x(t *testing.T) { func Test_Sync_ServicesRoutes_Konnect(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1569,9 +1555,7 @@ func Test_Sync_ServicesRoutes_Konnect(t *testing.T) { func Test_Sync_BasicAuth_Plugin_1_4_3(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1603,9 +1587,7 @@ func Test_Sync_BasicAuth_Plugin_1_4_3(t *testing.T) { func Test_Sync_BasicAuth_Plugin_Earlier_Than_1_5_1(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1637,9 +1619,7 @@ func Test_Sync_BasicAuth_Plugin_Earlier_Than_1_5_1(t *testing.T) { func Test_Sync_BasicAuth_Plugin_1_5_1(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1686,9 +1666,7 @@ func Test_Sync_BasicAuth_Plugin_1_5_1(t *testing.T) { func Test_Sync_BasicAuth_Plugin_From_2_0_5_Till_2_8_0(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1720,9 +1698,7 @@ func Test_Sync_BasicAuth_Plugin_From_2_0_5_Till_2_8_0(t *testing.T) { func Test_Sync_BasicAuth_Plugin_From_3x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1754,9 +1730,7 @@ func Test_Sync_BasicAuth_Plugin_From_3x(t *testing.T) { func Test_Sync_BasicAuth_Plugin_From_36(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1790,9 +1764,7 @@ func Test_Sync_BasicAuth_Plugin_From_36(t *testing.T) { func Test_Sync_Upstream_Target_Till_1_5_2(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) // ignore entities fields based on Kong version ignoreFields := []cmp.Option{ @@ -1845,9 +1817,7 @@ func Test_Sync_Upstream_Target_Till_1_5_2(t *testing.T) { func Test_Sync_Upstream_Target_From_2x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1880,9 +1850,7 @@ func Test_Sync_Upstream_Target_From_2x(t *testing.T) { func Test_Sync_Upstream_Target_From_30(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1915,9 +1883,7 @@ func Test_Sync_Upstream_Target_From_30(t *testing.T) { func Test_Sync_Upstream_Target_From_3x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1950,9 +1916,7 @@ func Test_Sync_Upstream_Target_From_3x(t *testing.T) { func Test_Sync_Upstream_Target_Konnect(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -1993,9 +1957,7 @@ func Test_Sync_Upstream_Target_Konnect(t *testing.T) { func Test_Sync_Upstreams_Target_ZeroWeight_2x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2028,9 +1990,7 @@ func Test_Sync_Upstreams_Target_ZeroWeight_2x(t *testing.T) { func Test_Sync_Upstreams_Target_ZeroWeight_30(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2063,9 +2023,7 @@ func Test_Sync_Upstreams_Target_ZeroWeight_30(t *testing.T) { func Test_Sync_Upstreams_Target_ZeroWeight_3x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2098,9 +2056,7 @@ func Test_Sync_Upstreams_Target_ZeroWeight_3x(t *testing.T) { func Test_Sync_Upstreams_Target_ZeroWeight_Konnect(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2131,9 +2087,7 @@ func Test_Sync_Upstreams_Target_ZeroWeight_Konnect(t *testing.T) { func Test_Sync_RateLimitingPlugin(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2172,9 +2126,7 @@ func Test_Sync_RateLimitingPlugin(t *testing.T) { func Test_Sync_FillDefaults_Earlier_Than_1_5_1(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) // ignore entities fields based on Kong version ignoreFields := []cmp.Option{ @@ -2216,9 +2168,7 @@ func Test_Sync_FillDefaults_Earlier_Than_1_5_1(t *testing.T) { func Test_Sync_FillDefaults_From_2_0_5_To_2_1_4(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2261,9 +2211,7 @@ func Test_Sync_FillDefaults_From_2_0_5_To_2_1_4(t *testing.T) { func Test_Sync_FillDefaults_From_2_2_1_to_2_6_0(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2301,9 +2249,7 @@ func Test_Sync_FillDefaults_From_2_2_1_to_2_6_0(t *testing.T) { func Test_Sync_FillDefaults_From_2_6_9(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2336,9 +2282,7 @@ func Test_Sync_FillDefaults_From_2_6_9(t *testing.T) { func Test_Sync_SkipCACert_2x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2372,9 +2316,7 @@ func Test_Sync_SkipCACert_2x(t *testing.T) { func Test_Sync_SkipCACert_3x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2408,9 +2350,7 @@ func Test_Sync_SkipCACert_3x(t *testing.T) { func Test_Sync_RBAC_2x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2513,9 +2453,7 @@ func Test_Sync_RBAC_2x(t *testing.T) { func Test_Sync_RBAC_3x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2618,9 +2556,7 @@ func Test_Sync_RBAC_3x(t *testing.T) { func Test_Sync_Create_Route_With_Service_Name_Reference_2x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2651,9 +2587,7 @@ func Test_Sync_Create_Route_With_Service_Name_Reference_2x(t *testing.T) { func Test_Sync_Create_Route_With_Service_Name_Reference_3x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2687,9 +2621,7 @@ func Test_Sync_Create_Route_With_Service_Name_Reference_3x(t *testing.T) { func Test_Sync_PluginsOnEntitiesTill_3_0_0(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2724,9 +2656,7 @@ func Test_Sync_PluginsOnEntitiesTill_3_0_0(t *testing.T) { func Test_Sync_PluginsOnEntitiesFrom_3_0_0(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2761,9 +2691,7 @@ func Test_Sync_PluginsOnEntitiesFrom_3_0_0(t *testing.T) { func Test_Sync_PluginOrdering(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -2920,9 +2848,7 @@ u8S6yNlu2Q== func Test_Sync_Vault(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -3042,9 +2968,7 @@ func Test_Sync_Vault(t *testing.T) { func Test_Sync_UpdateUsernameInConsumerWithCustomID(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -3086,9 +3010,7 @@ func Test_Sync_UpdateUsernameInConsumerWithCustomID(t *testing.T) { func Test_Sync_UpdateConsumerWithCustomID(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -3130,9 +3052,7 @@ func Test_Sync_UpdateConsumerWithCustomID(t *testing.T) { func Test_Sync_UpdateUsernameInConsumerWithCustomID_3x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -3174,9 +3094,7 @@ func Test_Sync_UpdateUsernameInConsumerWithCustomID_3x(t *testing.T) { func Test_Sync_UpdateConsumerWithCustomID_3x(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -3217,9 +3135,7 @@ func Test_Sync_UpdateConsumerWithCustomID_3x(t *testing.T) { // - 2.7+ func Test_Sync_ConsumerGroupsTill30(t *testing.T) { client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string kongFile string @@ -3257,9 +3173,7 @@ func Test_Sync_ConsumerGroupsTill30(t *testing.T) { // - 3.1 func Test_Sync_ConsumerGroups_31(t *testing.T) { client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string kongFile string @@ -3333,9 +3247,8 @@ func Test_Sync_ConsumerGroupsRLAFrom31(t *testing.T) { maxRegularRequestsNumber = 5 ) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) + require.NoError(t, err) tests := []struct { name string kongFile string @@ -3442,9 +3355,7 @@ func Test_Sync_ConsumerGroupsRLAFrom31(t *testing.T) { // - konnect func Test_Sync_ConsumerGroupsKonnect(t *testing.T) { client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string kongFile string @@ -3481,9 +3392,7 @@ func Test_Sync_ConsumerGroupsKonnect(t *testing.T) { func Test_Sync_PluginInstanceName(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -3562,9 +3471,7 @@ func Test_Sync_PluginInstanceName(t *testing.T) { func Test_Sync_SkipConsumers(t *testing.T) { // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -3612,9 +3519,7 @@ func Test_Sync_SkipConsumers_34x(t *testing.T) { runWhen(t, "enterprise", ">=3.4.0 <3.5.0") // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -3784,9 +3689,7 @@ func Test_Sync_SkipConsumers_Konnect(t *testing.T) { runWhenKonnect(t) // setup stage client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string @@ -3994,9 +3897,7 @@ func Test_Sync_ChangingIDsWhileKeepingNames(t *testing.T) { runWhenKongOrKonnect(t, ">=3.0.0") client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) // These are the IDs that should be present in Kong after the second sync in all cases. var ( @@ -4096,9 +3997,7 @@ func Test_Sync_UpdateWithExplicitIDs(t *testing.T) { setup(t) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) const ( beforeConfig = "testdata/sync/021-update-with-explicit-ids/before.yaml" @@ -4149,9 +4048,7 @@ func Test_Sync_UpdateWithExplicitIDsWithNoNames(t *testing.T) { setup(t) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) const ( beforeConfig = "testdata/sync/022-update-with-explicit-ids-with-no-names/before.yaml" @@ -4194,9 +4091,7 @@ func Test_Sync_CreateCertificateWithSNIs(t *testing.T) { setup(t) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) err = sync("testdata/sync/023-create-and-update-certificate-with-snis/initial.yaml") require.NoError(t, err) @@ -4256,9 +4151,7 @@ func Test_Sync_ConsumersWithCustomIDAndOrUsername(t *testing.T) { setup(t) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) err = sync("testdata/sync/024-consumers-with-custom_id-and-username/kong3x.yaml") require.NoError(t, err) @@ -4334,9 +4227,7 @@ func Test_Sync_ConsumerGroupsScopedPlugins(t *testing.T) { maxRegularRequestsNumber = 5 ) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) tests := []struct { name string kongFile string @@ -4847,9 +4738,8 @@ func Test_Sync_KonnectRename(t *testing.T) { }) } client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) + sync(tc.kongFile, tc.flags...) testKongState(t, client, true, tc.expectedState, nil) }) @@ -4907,9 +4797,7 @@ func Test_Sync_DoNotUpdateCreatedAt(t *testing.T) { setup(t) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) const ( oldConfig = "testdata/sync/027-created-at/old.yaml" @@ -4922,9 +4810,7 @@ func Test_Sync_DoNotUpdateCreatedAt(t *testing.T) { // get the current state ctx := context.Background() oldKongState, err := deckDump.Get(ctx, client, deckDump.Config{}) - if err != nil { - t.Errorf(err.Error()) - } + require.NoError(t, err) // update entities time.Sleep(time.Second) @@ -4932,9 +4818,7 @@ func Test_Sync_DoNotUpdateCreatedAt(t *testing.T) { // get the new state newKongState, err := deckDump.Get(ctx, client, deckDump.Config{}) - if err != nil { - t.Errorf(err.Error()) - } + require.NoError(t, err) // verify that the created_at have not changed across deployments require.Equal(t, oldKongState.Services[0].CreatedAt, newKongState.Services[0].CreatedAt) @@ -4996,9 +4880,7 @@ func Test_Sync_ConsumerGroupConsumersWithCustomID(t *testing.T) { setup(t) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) expectedState := utils.KongRawState{ ConsumerGroups: []*kong.ConsumerGroupObject{ @@ -5107,9 +4989,7 @@ func Test_Sync_ConsumerGroupConsumerFromUpstream(t *testing.T) { setup(t) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) expectedState := utils.KongRawState{ ConsumerGroups: []*kong.ConsumerGroupObject{ @@ -5157,9 +5037,7 @@ func Test_Sync_ConsumerGroupConsumerWithTags(t *testing.T) { setup(t) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) expectedState := utils.KongRawState{ ConsumerGroups: []*kong.ConsumerGroupObject{ @@ -5218,9 +5096,7 @@ func Test_Sync_FilterChains(t *testing.T) { setup(t) client, err := getTestClient() - if err != nil { - t.Fatalf(err.Error()) - } + require.NoError(t, err) service := kong.Service{ ID: kong.String("58076db2-28b6-423b-ba39-a797193017f7"), diff --git a/tests/integration/test_utils.go b/tests/integration/test_utils.go index 83d5a8677..210c84273 100644 --- a/tests/integration/test_utils.go +++ b/tests/integration/test_utils.go @@ -15,13 +15,9 @@ import ( deckDump "github.com/kong/go-database-reconciler/pkg/dump" "github.com/kong/go-database-reconciler/pkg/utils" "github.com/kong/go-kong/kong" + "github.com/stretchr/testify/require" ) -func int32p(i int) *int32 { - p := int32(i) - return &p -} - func getKongAddress() string { address := os.Getenv("DECK_KONG_ADDR") if address != "" { @@ -206,9 +202,7 @@ func testKongState(t *testing.T, client *kong.Client, isKonnect bool, } } kongState, err := deckDump.Get(ctx, client, dumpConfig) - if err != nil { - t.Errorf(err.Error()) - } + require.NoError(t, err) opt := []cmp.Option{ cmpopts.IgnoreFields(kong.Service{}, "CreatedAt", "UpdatedAt"), @@ -234,7 +228,7 @@ func testKongState(t *testing.T, client *kong.Client, isKonnect bool, opt = append(opt, ignoreFields...) if diff := cmp.Diff(kongState, &expectedState, opt...); diff != "" { - t.Errorf(diff) + t.Errorf("unexpected diff:\n%s", diff) } } From a9fa808e91641ac4f9826bf910f196dbd49f4366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Wed, 21 Aug 2024 14:10:28 +0200 Subject: [PATCH 17/43] ci: test, lint and build concurrently (#1362) --- .github/workflows/test.yaml | 27 +++++++++++++++++++++------ tests/integration/test_utils.go | 4 +--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 06e402047..c1dd1fd0a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,14 +17,10 @@ jobs: timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }} runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Setup go - uses: actions/setup-go@v5 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version-file: go.mod - - name: Setup golangci-lint - uses: golangci/golangci-lint-action@v6.1.0 - name: Run tests with Coverage run: make coverage - name: Upload Code Coverage @@ -33,5 +29,24 @@ jobs: name: codecov-deck token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true + + lint: + timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - uses: golangci/golangci-lint-action@v6.1.0 + + build: + timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod - name: Build run: make build diff --git a/tests/integration/test_utils.go b/tests/integration/test_utils.go index 210c84273..d20600359 100644 --- a/tests/integration/test_utils.go +++ b/tests/integration/test_utils.go @@ -241,9 +241,7 @@ func reset(t *testing.T, opts ...string) { args = append(args, opts...) } deckCmd.SetArgs(args) - if err := deckCmd.Execute(); err != nil { - t.Fatalf(err.Error(), "failed to reset Kong's state") - } + require.NoError(t, deckCmd.Execute(), "failed to reset Kong's state") } func readFile(filepath string) (string, error) { From 5449d8e9ed0922a81b8bd1860dfa99276848a8b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:29:56 +0200 Subject: [PATCH 18/43] chore(deps): bump golang.org/x/sync from 0.7.0 to 0.8.0 (#1356) Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.7.0 to 0.8.0. - [Commits](https://github.com/golang/sync/compare/v0.7.0...v0.8.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 c2dfde902..72f39f84c 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 - golang.org/x/sync v0.7.0 + golang.org/x/sync v0.8.0 k8s.io/api v0.30.3 k8s.io/apiextensions-apiserver v0.30.3 k8s.io/apimachinery v0.30.3 diff --git a/go.sum b/go.sum index 0289d52f5..3b1013a6a 100644 --- a/go.sum +++ b/go.sum @@ -398,8 +398,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.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 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= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From 0913629225e999926c201a900325109948e9b1b0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:41:37 +0200 Subject: [PATCH 19/43] chore(deps): bump k8s.io/apimachinery from 0.30.3 to 0.31.0 (#1366) Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.30.3 to 0.31.0. - [Commits](https://github.com/kubernetes/apimachinery/compare/v0.30.3...v0.31.0) --- updated-dependencies: - dependency-name: k8s.io/apimachinery 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 | 18 ++++++++++-------- go.sum | 40 ++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/go.mod b/go.mod index 72f39f84c..a6cbeb122 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( golang.org/x/sync v0.8.0 k8s.io/api v0.30.3 k8s.io/apiextensions-apiserver v0.30.3 - k8s.io/apimachinery v0.30.3 + k8s.io/apimachinery v0.31.0 k8s.io/code-generator v0.30.3 sigs.k8s.io/gateway-api v1.0.0 sigs.k8s.io/yaml v1.4.0 @@ -31,6 +31,7 @@ require ( 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/fxamacker/cbor/v2 v2.7.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-memdb v1.3.4 // indirect @@ -46,6 +47,7 @@ require ( github.com/shirou/gopsutil/v3 v3.24.5 // indirect github.com/ssgelm/cookiejarparser v1.0.1 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect + github.com/x448/float16 v0.8.4 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect @@ -79,7 +81,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-20240424215950-a892ee059fd6 // indirect + github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af // indirect github.com/gookit/color v1.5.4 // indirect github.com/gosimple/slug v1.14.0 github.com/gosimple/unidecode v1.0.1 // indirect @@ -133,18 +135,18 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.25.0 // indirect + golang.org/x/net v0.26.0 // indirect golang.org/x/sys v0.23.0 // indirect golang.org/x/term v0.22.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/tools v0.21.0 // indirect - google.golang.org/protobuf v1.33.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // 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 gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/klog/v2 v2.120.1 // indirect + k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect sigs.k8s.io/controller-runtime v0.17.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 3b1013a6a..16afb5ab7 100644 --- a/go.sum +++ b/go.sum @@ -72,6 +72,8 @@ 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/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/getkin/kin-openapi v0.108.0 h1:EYf0GtsKa4hQNIlplGS+Au7NEfGQ1F7MoHD2kcVevPQ= github.com/getkin/kin-openapi v0.108.0/go.mod h1:QtwUNt0PAAgIIBEvFWYfB7dfngxtAaqCX1zYHMZDeK8= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -127,8 +129,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-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= @@ -280,8 +282,8 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= @@ -343,6 +345,8 @@ github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9N github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -390,8 +394,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.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -444,8 +448,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.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -453,8 +457,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.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= -golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= 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= @@ -467,8 +471,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 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.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= 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= @@ -499,18 +503,18 @@ k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= k8s.io/apiextensions-apiserver v0.30.3 h1:oChu5li2vsZHx2IvnGP3ah8Nj3KyqG3kRSaKmijhB9U= k8s.io/apiextensions-apiserver v0.30.3/go.mod h1:uhXxYDkMAvl6CJw4lrDN4CPbONkF3+XL9cacCT44kV4= -k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc= -k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= +k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= +k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= k8s.io/code-generator v0.30.3 h1:bmtnLJKagDS5f5uOEpLyJiDfIMKXGMKgOLBdde+w0Mc= k8s.io/code-generator v0.30.3/go.mod h1:PFgBiv+miFV7TZYp+RXgROkhA+sWYZ+mtpbMLofMke8= 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.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= -k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +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-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= -k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= -k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +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.17.0 h1:fjJQf8Ukya+VjogLO6/bNX9HE6Y2xpsO5+fyS26ur/s= sigs.k8s.io/controller-runtime v0.17.0/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= sigs.k8s.io/gateway-api v1.0.0 h1:iPTStSv41+d9p0xFydll6d7f7MOBGuqXM6p2/zVYMAs= From 8e4909549310a9e944585a570ae050d8d1e5fa07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:14:28 +0200 Subject: [PATCH 20/43] chore(deps): bump github.com/kong/kubernetes-ingress-controller/v3 (#1360) Bumps [github.com/kong/kubernetes-ingress-controller/v3](https://github.com/kong/kubernetes-ingress-controller) from 3.1.2 to 3.2.4. - [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.1.2...v3.2.4) --- 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 | 16 ++++++++-------- go.sum | 34 +++++++++++++++++----------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index a6cbeb122..046dcb1f8 100644 --- a/go.mod +++ b/go.mod @@ -11,8 +11,8 @@ require ( github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.35 - github.com/kong/go-database-reconciler v1.14.2 - github.com/kong/go-kong v0.55.0 + github.com/kong/go-database-reconciler v1.14.3 + github.com/kong/go-kong v0.56.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 @@ -23,7 +23,7 @@ require ( k8s.io/apiextensions-apiserver v0.30.3 k8s.io/apimachinery v0.31.0 k8s.io/code-generator v0.30.3 - sigs.k8s.io/gateway-api v1.0.0 + sigs.k8s.io/gateway-api v1.1.0 sigs.k8s.io/yaml v1.4.0 ) @@ -74,7 +74,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect - github.com/go-openapi/jsonreference v0.20.4 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -94,7 +94,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.1.2 + github.com/kong/kubernetes-ingress-controller/v3 v3.2.4 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 @@ -133,7 +133,7 @@ require ( github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sys v0.23.0 // indirect @@ -145,9 +145,9 @@ require ( 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-20240228011516-70dd3763d340 // 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.17.0 // indirect + sigs.k8s.io/controller-runtime v0.18.4 // 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 16afb5ab7..f4318ef68 100644 --- a/go.sum +++ b/go.sum @@ -88,15 +88,15 @@ github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiU github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= -github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= -github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= 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/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/go-task/slim-sprig v2.20.0+incompatible h1:4Xh3bDzO29j4TWNOI+24ubc0vbVFMg2PMnXKxK54/CA= +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= @@ -187,14 +187,14 @@ 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.35 h1:k7nVPKdv4BR6vENRMAQNy97vX8otGlL22D7IKZd2A2Q= github.com/kong/go-apiops v0.1.35/go.mod h1:l2gaaaLdMGtYQDbhj9XgpqH0TsydO4905NcjiuLKgsY= -github.com/kong/go-database-reconciler v1.14.2 h1:AWS8FjO+qhpjZ0hn26pdSNNwweDFa1pOkiQCL36/KXY= -github.com/kong/go-database-reconciler v1.14.2/go.mod h1:OsyUWH3SUvXAd5HJx3PhRU3PyzH0uCy7bTlzoSfw8Ew= -github.com/kong/go-kong v0.55.0 h1:lonKRzsDGk12dh9E+y+pWnY2ThXhKuMHjzBHSpCvQLw= -github.com/kong/go-kong v0.55.0/go.mod h1:i1cMgTu6RYPHSyMpviShddRnc+DML/vlpgKC00hr8kU= +github.com/kong/go-database-reconciler v1.14.3 h1:Vmw5NNePkr2mc9r+As87dPRIsrOduM4b0zpPi9ci1mA= +github.com/kong/go-database-reconciler v1.14.3/go.mod h1:OsyUWH3SUvXAd5HJx3PhRU3PyzH0uCy7bTlzoSfw8Ew= +github.com/kong/go-kong v0.56.0 h1:/9qbnQJWAgrSAKzL2RViBhHMTYOEyG8N4ClkKnUwEW4= +github.com/kong/go-kong v0.56.0/go.mod h1:gyNwyP1fzztT6sX/0/ygMQ30OiRMIQ51b2jSfstMrcU= 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.1.2 h1:Ikj7Aj9kT6YKBvMCtX74XOQ7Y9v0eyQtdMvGvFjCLt4= -github.com/kong/kubernetes-ingress-controller/v3 v3.1.2/go.mod h1:CeyKo9s+y2RdTfeKby6Ov2hYq6UfRVVmFWKTXIq9GeU= +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/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= @@ -374,8 +374,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= -golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= 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= @@ -511,14 +511,14 @@ k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1 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= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= +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/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.17.0 h1:fjJQf8Ukya+VjogLO6/bNX9HE6Y2xpsO5+fyS26ur/s= -sigs.k8s.io/controller-runtime v0.17.0/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= -sigs.k8s.io/gateway-api v1.0.0 h1:iPTStSv41+d9p0xFydll6d7f7MOBGuqXM6p2/zVYMAs= -sigs.k8s.io/gateway-api v1.0.0/go.mod h1:4cUgr0Lnp5FZ0Cdq8FdRwCvpiWws7LVhLHGIudLlf4c= +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/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/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= From 37e1e73de25f93bbbea2a22649223acfadea5938 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:57:19 +0200 Subject: [PATCH 21/43] chore(deps): bump k8s.io/api from 0.30.3 to 0.31.0 (#1368) Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.30.3 to 0.31.0. - [Commits](https://github.com/kubernetes/api/compare/v0.30.3...v0.31.0) --- updated-dependencies: - dependency-name: k8s.io/api 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 046dcb1f8..1c760a842 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 golang.org/x/sync v0.8.0 - k8s.io/api v0.30.3 + k8s.io/api v0.31.0 k8s.io/apiextensions-apiserver v0.30.3 k8s.io/apimachinery v0.31.0 k8s.io/code-generator v0.30.3 diff --git a/go.sum b/go.sum index f4318ef68..915c75e06 100644 --- a/go.sum +++ b/go.sum @@ -499,8 +499,8 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= -k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= +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.30.3 h1:oChu5li2vsZHx2IvnGP3ah8Nj3KyqG3kRSaKmijhB9U= k8s.io/apiextensions-apiserver v0.30.3/go.mod h1:uhXxYDkMAvl6CJw4lrDN4CPbONkF3+XL9cacCT44kV4= k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= From 4393578427459ec92d9e7421fd5f98809fb1c4ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:14:04 +0200 Subject: [PATCH 22/43] chore(deps): bump k8s.io/apiextensions-apiserver from 0.30.3 to 0.31.0 (#1371) Bumps [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) from 0.30.3 to 0.31.0. - [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases) - [Commits](https://github.com/kubernetes/apiextensions-apiserver/compare/v0.30.3...v0.31.0) --- updated-dependencies: - dependency-name: k8s.io/apiextensions-apiserver 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 | 5 +++-- go.sum | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 1c760a842..65b8fe57e 100644 --- a/go.mod +++ b/go.mod @@ -20,9 +20,9 @@ require ( github.com/stretchr/testify v1.9.0 golang.org/x/sync v0.8.0 k8s.io/api v0.31.0 - k8s.io/apiextensions-apiserver v0.30.3 + k8s.io/apiextensions-apiserver v0.31.0 k8s.io/apimachinery v0.31.0 - k8s.io/code-generator v0.30.3 + k8s.io/code-generator v0.31.0 sigs.k8s.io/gateway-api v1.1.0 sigs.k8s.io/yaml v1.4.0 ) @@ -31,6 +31,7 @@ require ( 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/emicklei/go-restful/v3 v3.12.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/uuid v1.6.0 // indirect diff --git a/go.sum b/go.sum index 915c75e06..6917faa5a 100644 --- a/go.sum +++ b/go.sum @@ -64,6 +64,8 @@ github.com/dop251/goja_nodejs v0.0.0-20240418154818-2aae10d4cbcf/go.mod h1:bhGPm github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= github.com/dprotaso/go-yit v0.0.0-20240618133044-5a0af90af097 h1:f5nA5Ys8RXqFXtKc0XofVRiuwNTuJzPIwTmbjLz9vj8= github.com/dprotaso/go-yit v0.0.0-20240618133044-5a0af90af097/go.mod h1:FTAVyH6t+SlS97rv6EXRVuBDLkQqcIe/xQw9f4IFUI4= +github.com/emicklei/go-restful/v3 v3.12.0 h1:y2DdzBAURM29NFF94q6RaY4vjIH1rtwDapwQtU84iWk= +github.com/emicklei/go-restful/v3 v3.12.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -501,12 +503,12 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 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.30.3 h1:oChu5li2vsZHx2IvnGP3ah8Nj3KyqG3kRSaKmijhB9U= -k8s.io/apiextensions-apiserver v0.30.3/go.mod h1:uhXxYDkMAvl6CJw4lrDN4CPbONkF3+XL9cacCT44kV4= +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/code-generator v0.30.3 h1:bmtnLJKagDS5f5uOEpLyJiDfIMKXGMKgOLBdde+w0Mc= -k8s.io/code-generator v0.30.3/go.mod h1:PFgBiv+miFV7TZYp+RXgROkhA+sWYZ+mtpbMLofMke8= +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/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= From 326ac99a08f2df6c0d5aa073a5f3f45df1c22a21 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:34:44 +0200 Subject: [PATCH 23/43] chore(deps): bump github.com/kong/go-database-reconciler (#1369) Bumps [github.com/kong/go-database-reconciler](https://github.com/kong/go-database-reconciler) from 1.14.3 to 1.14.4. - [Release notes](https://github.com/kong/go-database-reconciler/releases) - [Commits](https://github.com/kong/go-database-reconciler/compare/v1.14.3...v1.14.4) --- updated-dependencies: - dependency-name: github.com/kong/go-database-reconciler 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 | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 65b8fe57e..ec8566513 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.35 - github.com/kong/go-database-reconciler v1.14.3 + github.com/kong/go-database-reconciler v1.14.4 github.com/kong/go-kong v0.56.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.1 @@ -58,7 +58,7 @@ require ( atomicgo.dev/cursor v0.2.0 // indirect atomicgo.dev/keyboard v0.2.9 // indirect atomicgo.dev/schedule v0.1.0 // indirect - dario.cat/mergo v1.0.0 // indirect + dario.cat/mergo v1.0.1 // indirect github.com/Kong/go-diff v1.2.2 // indirect github.com/Kong/gojsondiff v1.3.2 // indirect github.com/adrg/strutil v0.3.0 // indirect @@ -138,7 +138,7 @@ require ( golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sys v0.23.0 // indirect - golang.org/x/term v0.22.0 // indirect + golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/go.sum b/go.sum index 6917faa5a..4bdbae1d3 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ atomicgo.dev/keyboard v0.2.9 h1:tOsIid3nlPLZ3lwgG8KZMp/SFmr7P0ssEN5JUsm78K8= atomicgo.dev/keyboard v0.2.9/go.mod h1:BC4w9g00XkxH/f1HXhW2sXmJFOCWbKn9xrOunSFtExQ= atomicgo.dev/schedule v0.1.0 h1:nTthAbhZS5YZmgYbb2+DH8uQIZcTlIrd4eYr3UQxEjs= atomicgo.dev/schedule v0.1.0/go.mod h1:xeUa3oAkiuHYh8bKiQBRojqAMq3PXXbJujjb0hw8pEU= -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +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/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= @@ -189,8 +189,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.35 h1:k7nVPKdv4BR6vENRMAQNy97vX8otGlL22D7IKZd2A2Q= github.com/kong/go-apiops v0.1.35/go.mod h1:l2gaaaLdMGtYQDbhj9XgpqH0TsydO4905NcjiuLKgsY= -github.com/kong/go-database-reconciler v1.14.3 h1:Vmw5NNePkr2mc9r+As87dPRIsrOduM4b0zpPi9ci1mA= -github.com/kong/go-database-reconciler v1.14.3/go.mod h1:OsyUWH3SUvXAd5HJx3PhRU3PyzH0uCy7bTlzoSfw8Ew= +github.com/kong/go-database-reconciler v1.14.4 h1:UTUTQu681VtwSgIvy28oyv5OveP8ksr1zKkLJyWitaw= +github.com/kong/go-database-reconciler v1.14.4/go.mod h1:IA7iVZ7F7UZXABXdYPw1oJaMEvBYQ0Vq6/RfCjxhM4g= github.com/kong/go-kong v0.56.0 h1:/9qbnQJWAgrSAKzL2RViBhHMTYOEyG8N4ClkKnUwEW4= github.com/kong/go-kong v0.56.0/go.mod h1:gyNwyP1fzztT6sX/0/ygMQ30OiRMIQ51b2jSfstMrcU= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= @@ -441,8 +441,8 @@ golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9sn 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.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= -golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= 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 42514597e9849a669672cbca9d48c10e3e80dc77 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Thu, 22 Aug 2024 16:05:23 +0530 Subject: [PATCH 24/43] chore: updated go-apiops to latest version (#1373) This version of go-apiops has replaced kin-openapi with libopenapi to add further support of OpenAPI 3.1 Refer: https://github.com/Kong/go-apiops/pull/194 This change would not affect users using OpenAPI 3.0 spec with deck command. Fix for #1324: https://github.com/Kong/deck/issues/1324 --- go.mod | 19 ++++++++----------- go.sum | 53 ++++++++++++++++++++--------------------------------- 2 files changed, 28 insertions(+), 44 deletions(-) diff --git a/go.mod b/go.mod index ec8566513..8b1b10e04 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,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.35 + github.com/kong/go-apiops v0.1.36 github.com/kong/go-database-reconciler v1.14.4 github.com/kong/go-kong v0.56.0 github.com/mitchellh/go-homedir v1.1.0 @@ -43,7 +43,7 @@ require ( github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/onsi/ginkgo v1.16.5 // indirect github.com/pb33f/doctor v0.0.6 // indirect - github.com/pb33f/libopenapi v0.16.1 // indirect + github.com/pb33f/libopenapi v0.16.13 // indirect github.com/pb33f/libopenapi-validator v0.0.49 // indirect github.com/shirou/gopsutil/v3 v3.24.5 // indirect github.com/ssgelm/cookiejarparser v1.0.1 // indirect @@ -69,7 +69,6 @@ require ( github.com/dop251/goja_nodejs v0.0.0-20240418154818-2aae10d4cbcf // indirect github.com/dprotaso/go-yit v0.0.0-20240618133044-5a0af90af097 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/getkin/kin-openapi v0.108.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -82,7 +81,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-20240525223248-4bfdf5a9a2af // indirect + github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect github.com/gookit/color v1.5.4 // indirect github.com/gosimple/slug v1.14.0 github.com/gosimple/unidecode v1.0.1 // indirect @@ -91,7 +90,6 @@ require ( github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.1-vault-5 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/invopop/yaml v0.3.1 // indirect 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 @@ -107,7 +105,6 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/mozillazg/go-unidecode v0.2.0 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -134,13 +131,13 @@ require ( github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.26.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.23.0 // indirect golang.org/x/term v0.23.0 // indirect - golang.org/x/text v0.16.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/text v0.17.0 // indirect + golang.org/x/tools v0.24.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 4bdbae1d3..bf949b862 100644 --- a/go.sum +++ b/go.sum @@ -76,8 +76,6 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= -github.com/getkin/kin-openapi v0.108.0 h1:EYf0GtsKa4hQNIlplGS+Au7NEfGQ1F7MoHD2kcVevPQ= -github.com/getkin/kin-openapi v0.108.0/go.mod h1:QtwUNt0PAAgIIBEvFWYfB7dfngxtAaqCX1zYHMZDeK8= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -87,12 +85,10 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= @@ -131,15 +127,14 @@ 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-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= -github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +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/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= 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= @@ -173,9 +168,6 @@ github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/invopop/yaml v0.1.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= -github.com/invopop/yaml v0.3.1 h1:f0+ZpmhfBSS4MhG+4HYseMdJhoeeopbSKbq5Rpeelso= -github.com/invopop/yaml v0.3.1/go.mod h1:PMOp3nn4/12yEZUFfmOuNHJsZToEEOwoWsT+D81KkeA= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -187,8 +179,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.35 h1:k7nVPKdv4BR6vENRMAQNy97vX8otGlL22D7IKZd2A2Q= -github.com/kong/go-apiops v0.1.35/go.mod h1:l2gaaaLdMGtYQDbhj9XgpqH0TsydO4905NcjiuLKgsY= +github.com/kong/go-apiops v0.1.36 h1:WejXoJZXAI8ZdwrCUyx1ONOfBw0e2GeopqW1/rjy7Wk= +github.com/kong/go-apiops v0.1.36/go.mod h1:B0WFsqonn+xnHgHg0x063fADFC21mhNOsOXsbKdZTpM= github.com/kong/go-database-reconciler v1.14.4 h1:UTUTQu681VtwSgIvy28oyv5OveP8ksr1zKkLJyWitaw= github.com/kong/go-database-reconciler v1.14.4/go.mod h1:IA7iVZ7F7UZXABXdYPw1oJaMEvBYQ0Vq6/RfCjxhM4g= github.com/kong/go-kong v0.56.0 h1:/9qbnQJWAgrSAKzL2RViBhHMTYOEyG8N4ClkKnUwEW4= @@ -214,8 +206,6 @@ github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a h1:N9zuLhTvBSRt0g github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a/go.mod h1:JKx41uQRwqlTZabZc+kILPrO/3jlKnQ2Z8b7YiVw5cE= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -235,8 +225,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/mozillazg/go-unidecode v0.2.0 h1:vFGEzAH9KSwyWmXCOblazEWDh7fOkpmy/Z4ArmamSUc= github.com/mozillazg/go-unidecode v0.2.0/go.mod h1:zB48+/Z5toiRolOZy9ksLryJ976VIwmDmpQ2quyt1aA= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -249,19 +237,19 @@ 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.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= -github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +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/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.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= +github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/pb33f/doctor v0.0.6 h1:su/mIujJy0rB8KsdpTl7cC4RAHZdTyB7V5SjXu+xVWE= github.com/pb33f/doctor v0.0.6/go.mod h1:yBs5hFHAoo/eeFvKN9sWwmHmgEPJ2SaotYOJc05GdMU= -github.com/pb33f/libopenapi v0.16.1 h1:R2rmjiDiyX/cQKMKDbCiDFKOpt8kB0VYFtvH16tQHfA= -github.com/pb33f/libopenapi v0.16.1/go.mod h1:PEXNwvtT4KNdjrwudp5OYnD1ryqK6uJ68aMNyWvoMuc= +github.com/pb33f/libopenapi v0.16.13 h1:uR/W3Rit/yxRWG5DWal26PdEnEq4mu/3cYjbkK6LHm0= +github.com/pb33f/libopenapi v0.16.13/go.mod h1:8/lZGTZmxybpTPOggS6LefdrYvsQ5kbirD364TceyQo= github.com/pb33f/libopenapi-validator v0.0.49 h1:oJ4Jukib2pCvW0ccdVVyIyK/s5LCNvAuNt1U+PnGgEs= github.com/pb33f/libopenapi-validator v0.0.49/go.mod h1:kU1JYyXIRlpmsWx3NkL+drNNttLADMgdaNzJgXDhec0= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= @@ -326,7 +314,6 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 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= @@ -376,14 +363,14 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= 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.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +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/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -396,8 +383,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.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +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/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -450,8 +437,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.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +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/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -459,8 +446,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.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= 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 a1f658f9fcddbaa16d6de55b3e13184502c296c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Thu, 22 Aug 2024 13:13:29 +0200 Subject: [PATCH 25/43] ci: add Kong 3.7 to CI (#1363) --- .github/workflows/integration-enterprise.yaml | 13 +------------ .github/workflows/integration.yaml | 15 +-------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/.github/workflows/integration-enterprise.yaml b/.github/workflows/integration-enterprise.yaml index 8c6c48907..e64d87e06 100644 --- a/.github/workflows/integration-enterprise.yaml +++ b/.github/workflows/integration-enterprise.yaml @@ -18,22 +18,11 @@ jobs: strategy: matrix: kong_image: - - 'kong/kong-gateway:1.5.0.11' - - 'kong/kong-gateway:2.1.4.6' - - 'kong/kong-gateway:2.2.1.3' - - 'kong/kong-gateway:2.3.3.4' - - 'kong/kong-gateway:2.4.1.3' - - 'kong/kong-gateway:2.5.1.2' - - 'kong/kong-gateway:2.6.0.2' - - 'kong/kong-gateway:2.7' - 'kong/kong-gateway:2.8' - - 'kong/kong-gateway:3.0' - - 'kong/kong-gateway:3.1' - - 'kong/kong-gateway:3.2' - - 'kong/kong-gateway:3.3' - 'kong/kong-gateway:3.4' - 'kong/kong-gateway:3.5' - 'kong/kong-gateway:3.6' + - 'kong/kong-gateway:3.7' - 'kong/kong-gateway-dev:latest' env: KONG_ANONYMOUS_REPORTS: "off" diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index ceabcc380..7786e2b09 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -18,24 +18,11 @@ jobs: strategy: matrix: kong_image: - - 'kong:1.4.3' - - 'kong:1.5.1' - - 'kong:2.0.5' - - 'kong:2.1.4' - - 'kong:2.2.2' - - 'kong:2.3.3' - - 'kong:2.4.1' - - 'kong:2.5.1' - - 'kong:2.6.0' - - 'kong:2.7' - 'kong:2.8' - - 'kong:3.0' - - 'kong:3.1' - - 'kong:3.2' - - 'kong:3.3' - 'kong:3.4' - 'kong:3.5' - 'kong:3.6' + - 'kong:3.7' - 'kong/kong:master' env: KONG_ANONYMOUS_REPORTS: "off" From e23136a39e12eb45c8c7077944532f65df46d2ef Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Thu, 22 Aug 2024 17:01:02 +0530 Subject: [PATCH 26/43] chore: changelog update for v1.39.5 release (#1374) --- CHANGELOG.md | 9 +++++++++ README.md | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdc625a89..e23674160 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.39.5](#v1395) - [v1.39.4](#v1394) - [v1.39.3](#v1393) - [v1.39.2](#v1392) @@ -90,6 +91,13 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.39.5] +> Release date: 2024/08/22 + +### Fixes + +- Fixed `deck file openapi2kong` command where parameter schema wasn't getting generated properly. [#1355](https://github.com/Kong/deck/pull/1355) [go-apiops #186](https://github.com/Kong/go-apiops/pull/186) + ## [v1.39.4] > Release date: 2024/08/01 @@ -1757,6 +1765,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.39.5]: https://github.com/Kong/deck/compare/v1.39.4...v1.39.5 [v1.39.4]: https://github.com/Kong/deck/compare/v1.39.3...v1.39.4 [v1.39.3]: https://github.com/Kong/deck/compare/v1.39.2...v1.39.3 [v1.39.2]: https://github.com/kong/deck/compare/v1.39.1...v1.39.2 diff --git a/README.md b/README.md index d59d37672..8f5257f2e 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.39.4/deck_1.39.4_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.39.5/deck_1.39.5_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.39.4/deck_1.39.4_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.39.5/deck_1.39.5_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ``` From f61fd275a2105b5450507fd53118f326183ca96e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Fri, 23 Aug 2024 04:37:09 +0200 Subject: [PATCH 27/43] chore(ci): don't use deprecated password field with kong-license action (#1361) --- .github/workflows/integration-enterprise.yaml | 1 - .github/workflows/validate-kong-release.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/integration-enterprise.yaml b/.github/workflows/integration-enterprise.yaml index e64d87e06..fbce80e50 100644 --- a/.github/workflows/integration-enterprise.yaml +++ b/.github/workflows/integration-enterprise.yaml @@ -44,7 +44,6 @@ jobs: - uses: Kong/kong-license@master id: license with: - password: ${{ secrets.PULP_PASSWORD }} op-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - name: Setup Kong env: diff --git a/.github/workflows/validate-kong-release.yaml b/.github/workflows/validate-kong-release.yaml index eb4478127..418ed15b7 100644 --- a/.github/workflows/validate-kong-release.yaml +++ b/.github/workflows/validate-kong-release.yaml @@ -36,7 +36,6 @@ jobs: - uses: Kong/kong-license@master id: license with: - password: ${{ secrets.PULP_PASSWORD }} op-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - name: Setup Kong env: From 21ea0506c338a85cb49e4078e755f0b95b8f43a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:04:45 +0530 Subject: [PATCH 28/43] chore(deps): bump goreleaser/goreleaser-action from 5 to 6 (#1314) Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 5 to 6. - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](https://github.com/goreleaser/goreleaser-action/compare/v5...v6) --- updated-dependencies: - dependency-name: goreleaser/goreleaser-action 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> Co-authored-by: Prashansa Kulshrestha --- .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 fea95a8e2..404cac8bf 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,7 +19,7 @@ jobs: with: go-version-file: go.mod - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v5 + uses: goreleaser/goreleaser-action@v6 with: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser From 1e5bbf66e58f8974b4c791660e6276f253565aea Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 28 Aug 2024 19:29:24 +0530 Subject: [PATCH 29/43] chore: updated go-database-reconciler to v1.14.5 (#1380) This version of go-database-reconciler has the fix that ensures that plugins are not shown as global if they have a consumer group attached. Earlier, they were wrongly shown as global, despite the actual associations working fine. Fixes #1005 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8b1b10e04..eb841b81f 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.36 - github.com/kong/go-database-reconciler v1.14.4 + github.com/kong/go-database-reconciler v1.14.5 github.com/kong/go-kong v0.56.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 bf949b862..e15bfbe1a 100644 --- a/go.sum +++ b/go.sum @@ -181,8 +181,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.36 h1:WejXoJZXAI8ZdwrCUyx1ONOfBw0e2GeopqW1/rjy7Wk= github.com/kong/go-apiops v0.1.36/go.mod h1:B0WFsqonn+xnHgHg0x063fADFC21mhNOsOXsbKdZTpM= -github.com/kong/go-database-reconciler v1.14.4 h1:UTUTQu681VtwSgIvy28oyv5OveP8ksr1zKkLJyWitaw= -github.com/kong/go-database-reconciler v1.14.4/go.mod h1:IA7iVZ7F7UZXABXdYPw1oJaMEvBYQ0Vq6/RfCjxhM4g= +github.com/kong/go-database-reconciler v1.14.5 h1:XBvHpO/nabgbziU1KmD3yZgbWWHXPZl0vUzIqrdbz6Q= +github.com/kong/go-database-reconciler v1.14.5/go.mod h1:IA7iVZ7F7UZXABXdYPw1oJaMEvBYQ0Vq6/RfCjxhM4g= github.com/kong/go-kong v0.56.0 h1:/9qbnQJWAgrSAKzL2RViBhHMTYOEyG8N4ClkKnUwEW4= github.com/kong/go-kong v0.56.0/go.mod h1:gyNwyP1fzztT6sX/0/ygMQ30OiRMIQ51b2jSfstMrcU= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= From e44d6c491dad25b48b381fd1835bfa8da6cd76b2 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 4 Sep 2024 11:30:40 +0530 Subject: [PATCH 30/43] chore: releasing v1.39.6 (#1388) --- CHANGELOG.md | 10 ++++++++++ README.md | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e23674160..075ea219f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.39.6](#v1396) - [v1.39.5](#v1395) - [v1.39.4](#v1394) - [v1.39.3](#v1393) @@ -91,6 +92,14 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.39.6] +> Release date: 2024/08/22 + +### Fixes + +- Fixed the issue where plugins scoped to consumer-groups were shown as global by deck. [#1380](https://github.com/Kong/deck/pull/1380) +[go-database-reconciler #134](https://github.com/Kong/go-database-reconciler/pull/134) + ## [v1.39.5] > Release date: 2024/08/22 @@ -1765,6 +1774,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.39.6]: https://github.com/Kong/deck/compare/v1.39.5...v1.39.6 [v1.39.5]: https://github.com/Kong/deck/compare/v1.39.4...v1.39.5 [v1.39.4]: https://github.com/Kong/deck/compare/v1.39.3...v1.39.4 [v1.39.3]: https://github.com/Kong/deck/compare/v1.39.2...v1.39.3 diff --git a/README.md b/README.md index 8f5257f2e..923acfb9b 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.39.5/deck_1.39.5_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.39.6/deck_1.39.6_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.39.5/deck_1.39.5_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.39.6/deck_1.39.6_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ``` From 18831e955e947c88ab9b5e19816f5f00b5b211d6 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 4 Sep 2024 11:43:06 +0530 Subject: [PATCH 31/43] fix: creating a retryable kong client for tests and retry logic in konnect authentication for CI rate-limit errors (#1381) * fix: added retry and backoff in konnect authenticate for 429 errors * chore: removed stray comments from authenticate code --- cmd/common_konnect.go | 29 +++++++++++++++++++++++++++-- tests/integration/test_utils.go | 5 +++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/cmd/common_konnect.go b/cmd/common_konnect.go index 16dcde56e..83ab7d283 100644 --- a/cmd/common_konnect.go +++ b/cmd/common_konnect.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "strings" + "time" "github.com/kong/go-database-reconciler/pkg/diff" "github.com/kong/go-database-reconciler/pkg/dump" @@ -16,12 +17,36 @@ import ( "golang.org/x/sync/errgroup" ) -const defaultControlPlaneName = "default" +const ( + defaultControlPlaneName = "default" + maxRetriesForAuth = 5 + apiRateLimitExceededErrorString = "API rate limit exceeded" +) func authenticate( ctx context.Context, client *konnect.Client, konnectConfig utils.KonnectConfig, ) (konnect.AuthResponse, error) { - return client.Auth.LoginV2(ctx, konnectConfig.Email, konnectConfig.Password, konnectConfig.Token) + attempts := 0 + backoff := 200 * time.Millisecond + + for { + authResponse, err := client.Auth.LoginV2(ctx, konnectConfig.Email, konnectConfig.Password, konnectConfig.Token) + if err == nil { + return authResponse, nil + } + + if !strings.Contains(err.Error(), apiRateLimitExceededErrorString) { + return authResponse, err + } + + attempts++ + if attempts > maxRetriesForAuth { + return authResponse, fmt.Errorf("maximum retries (%d) exceeded for authentication", maxRetriesForAuth) + } + + time.Sleep(backoff) + backoff *= 2 + } } // GetKongClientForKonnectMode abstracts the different cloud environments users diff --git a/tests/integration/test_utils.go b/tests/integration/test_utils.go index d20600359..d1d37f676 100644 --- a/tests/integration/test_utils.go +++ b/tests/integration/test_utils.go @@ -43,7 +43,8 @@ func getTestClient() (*kong.Client, error) { return cmd.GetKongClientForKonnectMode(ctx, &konnectConfig) } return utils.GetKongClient(utils.KongClientConfig{ - Address: getKongAddress(), + Address: getKongAddress(), + Retryable: true, }) } @@ -236,7 +237,7 @@ func reset(t *testing.T, opts ...string) { t.Helper() deckCmd := cmd.NewRootCmd() - args := []string{"reset", "--force"} + args := []string{"gateway", "reset", "--force"} if len(opts) > 0 { args = append(args, opts...) } From ea0983eb56bb4763e07bdce29d1f39b1c0ecfb91 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Mon, 9 Sep 2024 19:19:50 +0530 Subject: [PATCH 32/43] chore: update go-database-reconciler to 1.14.7 (#1394) This version has two fixes. 1) auto fields are sent as nil to CP 2) More than one consumer group can be associated with one consumer. --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index eb841b81f..626632de5 100644 --- a/go.mod +++ b/go.mod @@ -11,8 +11,8 @@ require ( github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.36 - github.com/kong/go-database-reconciler v1.14.5 - github.com/kong/go-kong v0.56.0 + github.com/kong/go-database-reconciler v1.14.7 + github.com/kong/go-kong v0.59.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 @@ -119,7 +119,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.1 // indirect + github.com/tidwall/gjson v1.17.3 // 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 @@ -134,8 +134,8 @@ require ( 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.23.0 // indirect - golang.org/x/term v0.23.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 google.golang.org/protobuf v1.34.2 // indirect diff --git a/go.sum b/go.sum index e15bfbe1a..9b2a4448b 100644 --- a/go.sum +++ b/go.sum @@ -181,10 +181,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.36 h1:WejXoJZXAI8ZdwrCUyx1ONOfBw0e2GeopqW1/rjy7Wk= github.com/kong/go-apiops v0.1.36/go.mod h1:B0WFsqonn+xnHgHg0x063fADFC21mhNOsOXsbKdZTpM= -github.com/kong/go-database-reconciler v1.14.5 h1:XBvHpO/nabgbziU1KmD3yZgbWWHXPZl0vUzIqrdbz6Q= -github.com/kong/go-database-reconciler v1.14.5/go.mod h1:IA7iVZ7F7UZXABXdYPw1oJaMEvBYQ0Vq6/RfCjxhM4g= -github.com/kong/go-kong v0.56.0 h1:/9qbnQJWAgrSAKzL2RViBhHMTYOEyG8N4ClkKnUwEW4= -github.com/kong/go-kong v0.56.0/go.mod h1:gyNwyP1fzztT6sX/0/ygMQ30OiRMIQ51b2jSfstMrcU= +github.com/kong/go-database-reconciler v1.14.7 h1:U8VnKYFz8oBnAgDxipBHNR9KCOxexffQlmCyfWhafV4= +github.com/kong/go-database-reconciler v1.14.7/go.mod h1:T5BkBw13PZWub3y2jKAoM7fYD+UmXp2iNqj1YqD0L90= +github.com/kong/go-kong v0.59.0 h1:U6dE2sqb8E8j0kESW/RCW9TkXH8Y3W0EtNDXJVsDNuM= +github.com/kong/go-kong v0.59.0/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= @@ -319,8 +319,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.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= -github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +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/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= @@ -421,15 +421,15 @@ 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.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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/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.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= -golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= +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/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 fb795ad17b923d691b824ea5113a607628601dc1 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Tue, 10 Sep 2024 15:03:23 +0530 Subject: [PATCH 33/43] fix: fixing Konnect integration test errors (#1396) Added Konnect related redis changes in dump file Ignored redis configs from sync Separated a kong and Konnect specific test --- tests/integration/sync_test.go | 115 +++++++++++++++++- .../expected-no-skip_konnect.yaml | 14 ++- 2 files changed, 122 insertions(+), 7 deletions(-) diff --git a/tests/integration/sync_test.go b/tests/integration/sync_test.go index 93cc73c8a..4e9434995 100644 --- a/tests/integration/sync_test.go +++ b/tests/integration/sync_test.go @@ -327,6 +327,72 @@ var ( }, } + plugin_on_entitiesKonnect = []*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"), + }, + }, + } + upstream_pre31 = []*kong.Upstream{ //nolint:revive,stylecheck { Name: kong.String("upstream1"), @@ -2677,7 +2743,42 @@ func Test_Sync_PluginsOnEntitiesFrom_3_0_0(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - runWhenKongOrKonnect(t, ">=3.0.0") + runWhen(t, "kong", ">=3.0.0") + setup(t) + + sync(tc.kongFile) + testKongState(t, client, false, tc.expectedState, nil) + }) + } +} + +// test scope: +// - konnect +func Test_Sync_PluginsOnEntities_Konnect(t *testing.T) { + // setup stage + client, err := getTestClient() + require.NoError(t, err) + + tests := []struct { + name string + kongFile string + expectedState utils.KongRawState + }{ + { + name: "create plugins on services, routes and consumers", + kongFile: "testdata/sync/xxx-plugins-on-entities/kong.yaml", + expectedState: utils.KongRawState{ + Services: svc1_207, + Routes: route1_20x, + Plugins: plugin_on_entitiesKonnect, + Consumers: consumer, + }, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + runWhenKonnect(t) setup(t) sync(tc.kongFile) @@ -4576,6 +4677,16 @@ func Test_Sync_ConsumerGroupsScopedPluginsKonnect(t *testing.T) { client, err := getTestClient() require.NoError(t, err) + ignoreFields := []cmp.Option{ + cmp.FilterValues(func(x, y interface{}) bool { + _, okX := x.(map[string]interface{}) + _, okY := y.(map[string]interface{}) + return okX && okY + }, cmpopts.IgnoreMapEntries(func(key string, _ interface{}) bool { + return key == "redis" + })), + } + tests := []struct { name string kongFile string @@ -4640,7 +4751,7 @@ func Test_Sync_ConsumerGroupsScopedPluginsKonnect(t *testing.T) { setup(t) require.NoError(t, sync(tc.kongFile)) - testKongState(t, client, true, tc.expectedState, nil) + testKongState(t, client, true, tc.expectedState, ignoreFields) }) } } 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 82903df45..428ccf1d9 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 @@ -20,17 +20,21 @@ consumer_groups: path: null redis: cluster_addresses: null - connect_timeout: null + cluster_max_redirections: 5 + cluster_nodes: null + connect_timeout: 2000 + connection_is_proxied: false database: 0 - host: null + host: 127.0.0.1 keepalive_backlog: null keepalive_pool_size: 256 password: null - port: null - read_timeout: null - send_timeout: 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 From a084b3c7362807c15c37ee6d50c70498fa29d61e Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Tue, 10 Sep 2024 11:29:41 +0100 Subject: [PATCH 34/43] Add `kong2tf` command (#1391) * feat: Add new command for Kong to Terraform conversion * Granular testing * fix plugin route reference * feat(kong2tf): PROTOTYPE kong2tf with import blocks and lifecycle-ignore blocks, plus appropriate switches; patches "route ID is read only field" bug * Replace templated kong2tf with recursive implementation * fix: linting issues --------- Co-authored-by: battlebyte Co-authored-by: Jack Tysoe Co-authored-by: Prashansa Kulshrestha --- .gitignore | 2 + cmd/file_kong2tf.go | 95 ++++ cmd/root.go | 1 + go.mod | 1 + go.sum | 2 + kong2tf/builder.go | 51 ++ kong2tf/builder_default_terraform.go | 441 +++++++++++++++ kong2tf/generate_resource.go | 393 +++++++++++++ kong2tf/generate_resource_test.go | 205 +++++++ kong2tf/kong2tf.go | 13 + kong2tf/kong2tf_test.go | 205 +++++++ kong2tf/testdata/ca-certificate-input.yaml | 16 + .../ca-certificate-output-expected.tf | 24 + kong2tf/testdata/certificate-sni-input.yaml | 60 ++ .../certificate-sni-output-expected.tf | 77 +++ kong2tf/testdata/consumer-acl-input.yaml | 6 + .../testdata/consumer-acl-output-expected.tf | 20 + .../testdata/consumer-basic-auth-input.yaml | 7 + .../consumer-basic-auth-output-expected.tf | 21 + kong2tf/testdata/consumer-group-input.yaml | 4 + .../consumer-group-output-expected.tf | 17 + .../testdata/consumer-group-plugin-input.yaml | 16 + .../consumer-group-plugin-output-expected.tf | 31 ++ .../testdata/consumer-hmac-auth-input.yaml | 5 + .../consumer-hmac-auth-output-expected.tf | 20 + kong2tf/testdata/consumer-jwt-input.yaml | 8 + .../testdata/consumer-jwt-output-expected.tf | 22 + ...nsumer-jwt-output-with-imports-expected.tf | 29 + kong2tf/testdata/consumer-key-auth-input.yaml | 6 + .../consumer-key-auth-output-expected.tf | 20 + kong2tf/testdata/consumer-no-auth-input.yaml | 5 + .../consumer-no-auth-output-expected.tf | 13 + kong2tf/testdata/consumer-plugin-input.yaml | 14 + .../consumer-plugin-output-expected.tf | 29 + .../testdata/global-plugin-oidc-input.yaml | 14 + .../global-plugin-oidc-output-expected.tf | 19 + .../global-plugin-rate-limiting-input.yaml | 7 + ...al-plugin-rate-limiting-output-expected.tf | 16 + kong2tf/testdata/input.yaml | 517 ++++++++++++++++++ kong2tf/testdata/route-input.yaml | 48 ++ kong2tf/testdata/route-output-expected.tf | 67 +++ kong2tf/testdata/route-plugin-input.yaml | 21 + .../testdata/route-plugin-output-expected.tf | 42 ++ kong2tf/testdata/service-input.yaml | 18 + kong2tf/testdata/service-output-expected.tf | 24 + kong2tf/testdata/service-plugin-input.yaml | 22 + .../service-plugin-output-expected.tf | 40 ++ kong2tf/testdata/upstream-target-input.yaml | 84 +++ .../upstream-target-output-expected.tf | 77 +++ kong2tf/testdata/vault-input.yaml | 8 + kong2tf/testdata/vault-output-expected.tf | 17 + 51 files changed, 2920 insertions(+) create mode 100644 cmd/file_kong2tf.go create mode 100644 kong2tf/builder.go create mode 100644 kong2tf/builder_default_terraform.go create mode 100644 kong2tf/generate_resource.go create mode 100644 kong2tf/generate_resource_test.go create mode 100644 kong2tf/kong2tf.go create mode 100644 kong2tf/kong2tf_test.go create mode 100644 kong2tf/testdata/ca-certificate-input.yaml create mode 100644 kong2tf/testdata/ca-certificate-output-expected.tf create mode 100644 kong2tf/testdata/certificate-sni-input.yaml create mode 100644 kong2tf/testdata/certificate-sni-output-expected.tf create mode 100644 kong2tf/testdata/consumer-acl-input.yaml create mode 100644 kong2tf/testdata/consumer-acl-output-expected.tf create mode 100644 kong2tf/testdata/consumer-basic-auth-input.yaml create mode 100644 kong2tf/testdata/consumer-basic-auth-output-expected.tf create mode 100644 kong2tf/testdata/consumer-group-input.yaml create mode 100644 kong2tf/testdata/consumer-group-output-expected.tf create mode 100644 kong2tf/testdata/consumer-group-plugin-input.yaml create mode 100644 kong2tf/testdata/consumer-group-plugin-output-expected.tf create mode 100644 kong2tf/testdata/consumer-hmac-auth-input.yaml create mode 100644 kong2tf/testdata/consumer-hmac-auth-output-expected.tf create mode 100644 kong2tf/testdata/consumer-jwt-input.yaml create mode 100644 kong2tf/testdata/consumer-jwt-output-expected.tf create mode 100644 kong2tf/testdata/consumer-jwt-output-with-imports-expected.tf create mode 100644 kong2tf/testdata/consumer-key-auth-input.yaml create mode 100644 kong2tf/testdata/consumer-key-auth-output-expected.tf create mode 100644 kong2tf/testdata/consumer-no-auth-input.yaml create mode 100644 kong2tf/testdata/consumer-no-auth-output-expected.tf create mode 100644 kong2tf/testdata/consumer-plugin-input.yaml create mode 100644 kong2tf/testdata/consumer-plugin-output-expected.tf create mode 100644 kong2tf/testdata/global-plugin-oidc-input.yaml create mode 100644 kong2tf/testdata/global-plugin-oidc-output-expected.tf create mode 100644 kong2tf/testdata/global-plugin-rate-limiting-input.yaml create mode 100644 kong2tf/testdata/global-plugin-rate-limiting-output-expected.tf create mode 100644 kong2tf/testdata/input.yaml create mode 100644 kong2tf/testdata/route-input.yaml create mode 100644 kong2tf/testdata/route-output-expected.tf create mode 100644 kong2tf/testdata/route-plugin-input.yaml create mode 100644 kong2tf/testdata/route-plugin-output-expected.tf create mode 100644 kong2tf/testdata/service-input.yaml create mode 100644 kong2tf/testdata/service-output-expected.tf create mode 100644 kong2tf/testdata/service-plugin-input.yaml create mode 100644 kong2tf/testdata/service-plugin-output-expected.tf create mode 100644 kong2tf/testdata/upstream-target-input.yaml create mode 100644 kong2tf/testdata/upstream-target-output-expected.tf create mode 100644 kong2tf/testdata/vault-input.yaml create mode 100644 kong2tf/testdata/vault-output-expected.tf diff --git a/.gitignore b/.gitignore index cd75da4de..7a1f1d585 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,5 @@ docs/cli-docs/ # generated test 'actuals' kong2kic/testdata/**/*-actual.* +kong2tf/testdata/**/*-actual.* +kong2tf/terraform diff --git a/cmd/file_kong2tf.go b/cmd/file_kong2tf.go new file mode 100644 index 000000000..5fbae1c15 --- /dev/null +++ b/cmd/file_kong2tf.go @@ -0,0 +1,95 @@ +package cmd + +import ( + "fmt" + "log" + + "github.com/kong/deck/kong2tf" + "github.com/kong/go-apiops/filebasics" + "github.com/kong/go-apiops/logbasics" + "github.com/kong/go-database-reconciler/pkg/file" + "github.com/spf13/cobra" +) + +var ( + cmdKong2TfInputFilename string + cmdKong2TfOutputFilename string + cmdKong2TfGenerateImportsForControlPlaneID string + cmdKong2TfIgnoreCredentialChanges bool +) + +// Executes the CLI command "kong2Tf" +func executeKong2Tf(cmd *cobra.Command, _ []string) error { + _ = sendAnalytics("file-kong2Tf", "", modeLocal) + var ( + result string + err error + ) + + verbosity, _ := cmd.Flags().GetInt("verbose") + logbasics.Initialize(log.LstdFlags, verbosity) + + logbasics.Info("Starting execution of executeKong2Tf") + + inputContent, err := file.GetContentFromFiles([]string{cmdKong2TfInputFilename}, false) + if err != nil { + log.Printf("Error reading input file '%s'; %v", cmdKong2TfInputFilename, err) + return fmt.Errorf("failed reading input file '%s'; %w", cmdKong2TfInputFilename, err) + } + logbasics.Info("Successfully read input file '%s'", cmdKong2TfInputFilename) + + logbasics.Info("Converting Kong configuration to Terraform") + + var generateImportsForControlPlaneID *string + if cmdKong2TfGenerateImportsForControlPlaneID != "" { + generateImportsForControlPlaneID = &cmdKong2TfGenerateImportsForControlPlaneID + } + result, err = kong2tf.Convert(inputContent, generateImportsForControlPlaneID, cmdKong2TfIgnoreCredentialChanges) + if err != nil { + log.Printf("Error converting Kong configuration to Terraform; %v", err) + return fmt.Errorf("failed converting Kong configuration to Terraform; %w", err) + } + logbasics.Info("Successfully converted Kong configuration to Terraform") + + logbasics.Info("Writing output to file '%s'", cmdKong2TfOutputFilename) + err = filebasics.WriteFile(cmdKong2TfOutputFilename, []byte(result)) + if err != nil { + log.Printf("Error writing output to file '%s'; %v", cmdKong2TfOutputFilename, err) + return err + } + logbasics.Info("Successfully wrote output to file '%s'", cmdKong2TfOutputFilename) + + logbasics.Info("Finished execution of executeKong2Tf") + return nil +} + +// +// +// Define the CLI data for the kong2Tf command +// +// + +func newKong2TfCmd() *cobra.Command { + kong2TfCmd := &cobra.Command{ + Use: "kong2tf", + Short: "Convert Kong configuration files to Terraform resources", + Long: `Convert Kong configuration files to Terraform resources. + +The kong2tf subcommand transforms Kong Gateway entities in deck format, +into Terraform resources.`, + RunE: executeKong2Tf, + Args: cobra.NoArgs, + } + + kong2TfCmd.Flags().StringVarP(&cmdKong2TfInputFilename, "state", "s", "-", + "decK file to process. Use - to read from stdin.") + 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.") + 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.") + + return kong2TfCmd +} diff --git a/cmd/root.go b/cmd/root.go index fee3bef69..6db964918 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -253,6 +253,7 @@ It can be used to export, import, or sync entities to Kong.`, fileCmd.AddCommand(newConvertCmd(false)) fileCmd.AddCommand(newValidateCmd(false, false)) // file-based validation fileCmd.AddCommand(newKong2KicCmd()) + fileCmd.AddCommand(newKong2TfCmd()) } return rootCmd } diff --git a/go.mod b/go.mod index 626632de5..9d92585ad 100644 --- a/go.mod +++ b/go.mod @@ -102,6 +102,7 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mitchellh/hashstructure v1.1.0 github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect diff --git a/go.sum b/go.sum index 9b2a4448b..12b83d268 100644 --- a/go.sum +++ b/go.sum @@ -218,6 +218,8 @@ github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZ github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/hashstructure v1.1.0 h1:P6P1hdjqAAknpY/M1CGipelZgp+4y9ja9kmUZPXP+H0= +github.com/mitchellh/hashstructure v1.1.0/go.mod h1:xUDAozZz0Wmdiufv0uyhnHkUTN6/6d8ulp4AwfLKrmA= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= diff --git a/kong2tf/builder.go b/kong2tf/builder.go new file mode 100644 index 000000000..7f4666cb9 --- /dev/null +++ b/kong2tf/builder.go @@ -0,0 +1,51 @@ +package kong2tf + +import ( + "github.com/kong/go-database-reconciler/pkg/file" +) + +type ITerraformBuilder interface { + buildControlPlaneVar(*string) + buildServices(*file.Content, *string) + buildRoutes(*file.Content, *string) + buildGlobalPlugins(*file.Content, *string) + buildConsumers(*file.Content, *string, bool) + buildConsumerGroups(*file.Content, *string) + buildUpstreams(*file.Content, *string) + buildCACertificates(*file.Content, *string) + buildCertificates(*file.Content, *string) + buildVaults(*file.Content, *string) + getContent() string +} + +func getTerraformBuilder() ITerraformBuilder { + return newDefaultTerraformBuilder() +} + +type Director struct { + builder ITerraformBuilder +} + +func newDirector(builder ITerraformBuilder) *Director { + return &Director{ + builder: builder, + } +} + +func (d *Director) builTerraformResources( + content *file.Content, + generateImportsForControlPlaneID *string, + ignoreCredentialChanges bool, +) string { + d.builder.buildControlPlaneVar(generateImportsForControlPlaneID) + d.builder.buildGlobalPlugins(content, generateImportsForControlPlaneID) + d.builder.buildServices(content, generateImportsForControlPlaneID) + d.builder.buildUpstreams(content, generateImportsForControlPlaneID) + d.builder.buildRoutes(content, generateImportsForControlPlaneID) + d.builder.buildConsumers(content, generateImportsForControlPlaneID, ignoreCredentialChanges) + d.builder.buildConsumerGroups(content, generateImportsForControlPlaneID) + d.builder.buildCACertificates(content, generateImportsForControlPlaneID) + d.builder.buildCertificates(content, generateImportsForControlPlaneID) + d.builder.buildVaults(content, generateImportsForControlPlaneID) + return d.builder.getContent() +} diff --git a/kong2tf/builder_default_terraform.go b/kong2tf/builder_default_terraform.go new file mode 100644 index 000000000..fb11d791f --- /dev/null +++ b/kong2tf/builder_default_terraform.go @@ -0,0 +1,441 @@ +package kong2tf + +import ( + "crypto/md5" //nolint:gosec + "encoding/json" + "fmt" + "log" + "strings" + + "github.com/kong/go-database-reconciler/pkg/file" +) + +type DefaultTerraformBuider struct { + content string +} + +func newDefaultTerraformBuilder() *DefaultTerraformBuider { + return &DefaultTerraformBuider{} +} + +// Generic function that takes type T and returns map[string]any using JSON marshalling +func toMapAny(resource any) map[string]any { + resourceMap := make(map[string]interface{}) + resourceJSON, err := json.Marshal(resource) + if err != nil { + log.Fatal(err, "Failed to marshal resource") + return resourceMap + } + err = json.Unmarshal(resourceJSON, &resourceMap) + if err != nil { + log.Fatal(err, "Failed to unmarshal resource") + return resourceMap + } + return resourceMap +} + +func (b *DefaultTerraformBuider) buildControlPlaneVar(controlPlaneID *string) { + cpID := "YOUR_CONTROL_PLANE_ID" + if controlPlaneID != nil { + cpID = *controlPlaneID + } + b.content += fmt.Sprintf(`variable "control_plane_id" { + type = "string" + default = "%s" +}`, cpID) + "\n\n" +} + +func (b *DefaultTerraformBuider) buildServices(content *file.Content, controlPlaneID *string) { + for _, service := range content.Services { + parentResourceName := strings.ReplaceAll(*service.Name, "-", "_") + b.content += generateResource( + "gateway_service", + parentResourceName, + toMapAny(service), + map[string]string{}, + importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": service.ID, + }, + }, + []string{}, + ) + + for _, route := range service.Routes { + resourceName := strings.ReplaceAll(*route.Name, "-", "_") + b.content += generateResource("gateway_route", resourceName, toMapAny(route), map[string]string{ + "service": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": route.ID, + }, + }, []string{}) + + for _, plugin := range route.Plugins { + pluginName := strings.ReplaceAll(*plugin.Name, "-", "_") + b.content += generateResource("gateway_plugin", pluginName, toMapAny(plugin), map[string]string{ + "route": resourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": plugin.ID, + }, + }, []string{}) + } + } + + for _, plugin := range service.Plugins { + resourceName := strings.ReplaceAll(*plugin.Name, "-", "_") + b.content += generateResource("gateway_plugin", resourceName, toMapAny(plugin), map[string]string{ + "service": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": plugin.ID, + }, + }, []string{}) + } + } +} + +func (b *DefaultTerraformBuider) buildRoutes(content *file.Content, controlPlaneID *string) { + for _, route := range content.Routes { + parentResourceName := strings.ReplaceAll(*route.Name, "-", "_") + parents := map[string]string{} + if route.Service != nil { + parents["service"] = strings.ReplaceAll(*route.Service.Name, "-", "_") + } + b.content += generateResource("gateway_route", parentResourceName, toMapAny(route), parents, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": route.ID, + }, + }, []string{}) + + for _, plugin := range route.Plugins { + resourceName := strings.ReplaceAll(*plugin.Name, "-", "_") + b.content += generateResource("gateway_plugin", resourceName, toMapAny(plugin), map[string]string{ + "route": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": plugin.ID, + }, + }, []string{}) + } + } +} + +func (b *DefaultTerraformBuider) buildGlobalPlugins(content *file.Content, controlPlaneID *string) { + for _, globalPlugin := range content.Plugins { + resourceName := strings.ReplaceAll(*globalPlugin.Name, "-", "_") + b.content += generateResource( + "gateway_plugin", + resourceName, + toMapAny(globalPlugin), + map[string]string{}, + importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": globalPlugin.ID, + }, + }, + []string{}, + ) + } +} + +func (b *DefaultTerraformBuider) buildConsumers( + content *file.Content, + controlPlaneID *string, + ignoreCredentialChanges bool, +) { + for _, consumer := range content.Consumers { + parentResourceName := strings.ReplaceAll(*consumer.Username, "-", "_") + b.content += generateResource( + "gateway_consumer", + parentResourceName, + toMapAny(consumer), + map[string]string{}, + importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": consumer.ID, + }, + }, + []string{}, + ) + + for _, cg := range consumer.Groups { + resourceName := strings.ReplaceAll(*cg.Name, "-", "_") + + b.content += generateRelationship( + "gateway_consumer_group_member", + resourceName+"_"+parentResourceName, + map[string]string{ + "consumer": parentResourceName, + "consumer_group": resourceName, + }, + toMapAny(consumer), + importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "consumer_id": consumer.ID, + "consumer_group_id": cg.ID, + }, + }, + ) + } + + for _, acl := range consumer.ACLGroups { + resourceName := "acl_" + strings.ReplaceAll(*acl.Group, "-", "_") + b.content += generateResource("gateway_acl", resourceName, toMapAny(acl), map[string]string{ + "consumer_id": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": acl.ID, + "consumer_id": consumer.ID, + }, + }, []string{}) + } + + for _, basicauth := range consumer.BasicAuths { + lifecycle := []string{} + + if ignoreCredentialChanges { + lifecycle = []string{ + "password", + } + } + + resourceName := "basic_auth_" + strings.ReplaceAll(*basicauth.Username, "-", "_") + b.content += generateResource("gateway_basic_auth", resourceName, toMapAny(basicauth), map[string]string{ + "consumer_id": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": basicauth.ID, + "consumer_id": consumer.ID, + }, + }, lifecycle) + } + + for _, keyauth := range consumer.KeyAuths { + resourceName := "key_auth_" + strings.ReplaceAll(*keyauth.Key, "-", "_") + b.content += generateResource("gateway_key_auth", resourceName, toMapAny(keyauth), map[string]string{ + "consumer_id": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": keyauth.ID, + "consumer_id": consumer.ID, + }, + }, []string{}) + } + + for _, jwt := range consumer.JWTAuths { + lifecycle := []string{} + + if ignoreCredentialChanges { + lifecycle = []string{ + "secret", "key", + } + } + resourceName := "jwt_" + strings.ReplaceAll(*jwt.Key, "-", "_") + b.content += generateResource("gateway_jwt", resourceName, toMapAny(jwt), map[string]string{ + "consumer_id": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": jwt.ID, + "consumer_id": consumer.ID, + }, + }, lifecycle) + } + + for _, hmacauth := range consumer.HMACAuths { + resourceName := "hmac_auth_" + strings.ReplaceAll(*hmacauth.Username, "-", "_") + b.content += generateResource("gateway_hmac_auth", resourceName, toMapAny(hmacauth), map[string]string{ + "consumer_id": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": hmacauth.ID, + "consumer_id": consumer.ID, + }, + }, []string{}) + } + + for _, plugin := range consumer.Plugins { + pluginName := strings.ReplaceAll(*plugin.Name, "-", "_") + b.content += generateResource("gateway_plugin", pluginName, toMapAny(plugin), map[string]string{ + "consumer": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": plugin.ID, + }, + }, []string{}) + } + + } +} + +func (b *DefaultTerraformBuider) buildConsumerGroups(content *file.Content, controlPlaneID *string) { + for _, cg := range content.ConsumerGroups { + parentResourceName := strings.ReplaceAll(*cg.Name, "-", "_") + parents := map[string]string{} + b.content += generateResource("gateway_consumer_group", parentResourceName, toMapAny(cg), parents, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": cg.ID, + }, + }, []string{}) + + // We intentionally don't generate consumers here. Consumers is a FK reference, not a definition. + for _, consumer := range cg.Consumers { + resourceName := strings.ReplaceAll(*consumer.Username, "-", "_") + + b.content += generateRelationship( + "gateway_consumer_group_member", + parentResourceName+"_"+resourceName, + map[string]string{ + "consumer": resourceName, + "consumer_group": parentResourceName, + }, + toMapAny(consumer), + importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "consumer_id": consumer.ID, + "consumer_group_id": cg.ID, + }, + }, + ) + } + + for _, plugin := range cg.Plugins { + resourceName := strings.ReplaceAll(*plugin.Name, "-", "_") + b.content += generateResource("gateway_plugin", resourceName, toMapAny(plugin), map[string]string{ + "consumer_group": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": plugin.ID, + }, + }, []string{}) + } + } +} + +func (b *DefaultTerraformBuider) buildUpstreams(content *file.Content, controlPlaneID *string) { + for _, upstream := range content.Upstreams { + parentResourceName := strings.ReplaceAll(*upstream.Name, "-", "_") + parentResourceName = "upstream_" + strings.ReplaceAll(parentResourceName, ".", "_") + parents := map[string]string{} + b.content += generateResource("gateway_upstream", parentResourceName, toMapAny(upstream), parents, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": upstream.ID, + }, + }, []string{}) + + for _, target := range upstream.Targets { + resourceName := strings.ReplaceAll(*target.Target.Target, ".", "_") + resourceName = "target_" + strings.ReplaceAll(resourceName, ":", "_") + b.content += generateResource("gateway_target", resourceName, toMapAny(target), map[string]string{ + "upstream_id": parentResourceName, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": target.ID, + "upstream_id": upstream.ID, + }, + }, []string{}) + } + } +} + +func (b *DefaultTerraformBuider) buildCACertificates(content *file.Content, controlPlaneID *string) { + idx := 0 + for _, caCertificate := range content.CACertificates { + hashedCert := fmt.Sprintf("%x", md5.Sum([]byte(*caCertificate.Cert))) //nolint:gosec + resourceName := "ca_cert_" + hashedCert + idx++ + b.content += generateResource( + "gateway_ca_certificate", + resourceName, + toMapAny(caCertificate), + map[string]string{}, + importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": caCertificate.ID, + }, + }, + []string{}, + ) + } +} + +func (b *DefaultTerraformBuider) buildCertificates(content *file.Content, controlPlaneID *string) { + for _, certificate := range content.Certificates { + hashedCert := fmt.Sprintf("%x", md5.Sum([]byte(*certificate.Cert))) //nolint:gosec + resourceName := "cert_" + hashedCert + b.content += generateResource( + "gateway_certificate", + resourceName, + toMapAny(certificate), + map[string]string{}, + importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": certificate.ID, + }, + }, + []string{}, + ) + + for _, sni := range certificate.SNIs { + resourceName := "sni_" + strings.ReplaceAll(*sni.Name, ".", "_") + b.content += generateResource("gateway_sni", resourceName, toMapAny(sni), map[string]string{ + "certificate": "cert_" + hashedCert, + }, importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": sni.ID, + }, + }, []string{}) + } + } +} + +func (b *DefaultTerraformBuider) buildVaults(content *file.Content, controlPlaneID *string) { + for _, vault := range content.Vaults { + parentResourceName := strings.ReplaceAll(*vault.Name, "-", "_") + parents := map[string]string{} + b.content += generateResourceWithCustomizations( + "gateway_vault", + parentResourceName, + toMapAny(vault), + parents, + map[string]string{ + "config": "jsonencode", + }, + importConfig{ + controlPlaneID: controlPlaneID, + importValues: map[string]*string{ + "id": vault.ID, + }, + }, + []string{}, + ) + } +} + +func (b *DefaultTerraformBuider) getContent() string { + return b.content +} diff --git a/kong2tf/generate_resource.go b/kong2tf/generate_resource.go new file mode 100644 index 000000000..07295ee57 --- /dev/null +++ b/kong2tf/generate_resource.go @@ -0,0 +1,393 @@ +package kong2tf + +import ( + "fmt" + "sort" + "strings" +) + +type importConfig struct { + controlPlaneID *string + importValues map[string]*string +} + +func generateResource( + entityType, + name string, + entity map[string]any, + parents map[string]string, + imports importConfig, + lifecycle []string, +) string { + return generateResourceWithCustomizations(entityType, name, entity, parents, map[string]string{}, imports, lifecycle) +} + +func generateResourceWithCustomizations( + entityType, + name string, + entity map[string]any, + parents map[string]string, + customizations map[string]string, + imports importConfig, + lifecycle []string, +) string { + // Cache ID in case we need to use it for imports + entityID := "" + if entity["id"] != nil { + entityID = entity["id"].(string) + } + + // Populate parents with foreign keys as needed + parentKeys := []string{"service", "route", "consumer", "upstream", "certificate", "consumer_group"} + + // Populate parents with foreign keys as needed + for _, key := range parentKeys { + if entity[key] != nil { + // Switch on type of parent + switch entity[key].(type) { + case string: + parents[key] = entity[key].(string) + case map[string]interface{}: + parents[key] = entity[key].(map[string]interface{})["name"].(string) + default: + panic(fmt.Sprintf("Unknown type for parent %s", key)) + } + } + } + + // List of keys to remove + removeKeys := []string{ + "id", + } + + // Build a map of entity types to keys + entityTypeToKeys := map[string][]string{ + "gateway_service": {"routes", "plugins"}, + "gateway_route": {"plugins", "service"}, + "gateway_plugin": {"service", "route", "consumer"}, + "gateway_consumer": { + "groups", "acls", "basicauth_credentials", "keyauth_credentials", + "jwt_secrets", "hmacauth_credentials", "basicauth_credentials", "plugins", + }, + "gateway_upstream": {"targets"}, + "gateway_consumer_group": {"consumers", "plugins"}, + "gateway_certificate": {"snis"}, + } + + if additionalKeys := entityTypeToKeys[entityType]; additionalKeys != nil { + removeKeys = append(removeKeys, additionalKeys...) + } + + // Remove keys that are not needed + for _, k := range removeKeys { + delete(entity, k) + } + + if entityType == "gateway_plugin" { + entityType = fmt.Sprintf("%s_%s", entityType, name) + delete(entity, "name") + } + + // We don't need to prefix SNIs with the Cert name + // Or routes with the service name + if entityType != "gateway_sni" && entityType != "gateway_route" { + for k := range parents { + name = fmt.Sprintf("%s_%s", strings.ReplaceAll(parents[k], "-", "_"), name) + } + } + + s := fmt.Sprintf(` +resource "konnect_%s" "%s" { +%s + +%s control_plane_id = var.control_plane_id%s +} +`, + entityType, name, + strings.TrimRight(output(entityType, entity, 1, true, "\n", customizations), "\n"), + generateParents(parents), + generateLifecycle(lifecycle)) + + // Generate imports + if imports.controlPlaneID != nil && entityID != "" { + entity["id"] = entityID + s += generateImports(entityType, name, imports.importValues, imports.controlPlaneID) + } + + return strings.TrimSpace(s) + "\n\n" +} + +func generateRelationship( + entityType string, + name string, + relations map[string]string, + _ map[string]any, // 'entity' when TODO is resolved + _ importConfig, // 'imports' when TODO is resolved +) string { + // TODO: We don't support relationship importing in the provider yet + // entityID := entity["id"].(string) + + s := fmt.Sprintf(`resource "konnect_%s" "%s" {`, entityType, name) + + // Extract keys to iterate in a deterministic order + keys := make([]string, 0) + for k := range relations { + keys = append(keys, k) + } + + sort.Strings(keys) + + // Output each item in the relationship + for _, k := range keys { + s += fmt.Sprintf("\n"+` %s_id = konnect_gateway_%s.%s.id`, k, k, relations[k]) + } + s += "\n control_plane_id = var.control_plane_id" + s += "\n}\n\n" + + // TODO: We don't support relationship importing in the provider yet + /* + │ Error: Not Implemented + │ + │ No available import state operation is available for resource gateway_consumer_group_member. + */ + //if imports.controlPlaneID != nil { + // entity["id"] = entityID + // s += generateImports(entityType, name, entity, imports.importValues, imports.controlPlaneID) + "\n\n" + //} + + return s +} + +func generateImports( + entityType string, + name string, + keysFromEntity map[string]*string, + cpID *string, +) string { + if len(keysFromEntity) == 0 { + return "" + } + + return fmt.Sprintf("\n"+`import { + to = konnect_%s.%s + id = "%s" +}`, entityType, name, generateImportKeys(keysFromEntity, cpID)) +} + +func generateImportKeys(keys map[string]*string, cpID *string) string { + if len(keys) == 0 { + return "" + } + + s := "{" + for k, val := range keys { + s += fmt.Sprintf(`\"%s\": \"%s\", `, k, *val) + } + + s += fmt.Sprintf(`\"control_plane_id\": \"%s\", `, *cpID) + + s = strings.TrimRight(s, ", ") + + s += "}" + + return s +} + +func generateLifecycle(lifecycle []string) string { + if len(lifecycle) == 0 { + return "" + } + + s := ` + lifecycle { + ignore_changes = [` + for _, l := range lifecycle { + s += "\n " + l + "," + } + s = strings.TrimRight(s, ",") + + s += ` + ] + } +` + + return s +} + +func generateParents(parents map[string]string) string { + if len(parents) == 0 { + return "" + } + + var result []string + for k, v := range parents { + v = strings.ReplaceAll(v, "-", "_") + // if parent ends with _id, use it as-is + if strings.HasSuffix(k, "_id") { + result = append(result, fmt.Sprintf(` %s = konnect_gateway_%s.%s.id`, k, strings.TrimSuffix(k, "_id"), v)+"\n") + continue + } + result = append(result, fmt.Sprintf(` %s = { + id = konnect_gateway_%s.%s.id + }`+"\n", k, k, v)) + } + + return strings.Join(result, "\n") + "\n" +} + +// Output function that handles the dynamic data +func output( + entityType string, + object map[string]interface{}, + depth int, + isRoot bool, + eol string, + customizations map[string]string, +) string { + var result []string + + // Loop through object in order of keys + keys := make([]string, 0) + for k := range object { + keys = append(keys, k) + } + + sort.Strings(keys) + + // Move the most common keys to the front + var prioritizedKeys []string + for _, k := range []string{"enabled", "name", "username"} { + if _, exists := object[k]; exists { + prioritizedKeys = append(prioritizedKeys, k) + } + } + + // Append the rest of the keys + for _, k := range keys { + if contains(prioritizedKeys, k) { + continue + } + if k != "name" && k != "enabled" { + prioritizedKeys = append(prioritizedKeys, k) + } + } + keys = prioritizedKeys + + for _, k := range keys { + v := object[k] + + // TODO: Remove this once deck dump doesn't export nil values + if v == nil { + continue + } + + switch v := v.(type) { + case map[string]interface{}: + result = append(result, outputHash(entityType, k, v, depth, isRoot, eol, customizations)) + case []interface{}: + result = append(result, outputList(entityType, k, v, depth)) + default: + result = append(result, line(fmt.Sprintf("%s = %s", k, quote(v)), depth, eol)) + } + } + return strings.Join(result, "") +} + +// Handles rendering a map (hash) in Go +func outputHash( + entityType string, + key string, + input map[string]interface{}, + depth int, + isRoot bool, + eol string, + customizations map[string]string, +) string { + s := "" + if !isRoot { + s += "\n" + } + + custom := customizations[key] + + if custom != "" { + s += line(fmt.Sprintf("%s = %s({", key, custom), depth, eol) + } else { + s += line(fmt.Sprintf("%s = {", key), depth, eol) + } + + s += output(entityType, input, depth+1, true, eol, customizations) + + if custom != "" { + s += line("})", depth, eol) + } else { + s += line("}", depth, eol) + } + return s +} + +// Handles rendering a map within a list in Go +func outputHashInList(entityType string, input map[string]interface{}, depth int) string { + s := "\n" + s += line("{", depth+1, "\n") + s += output(entityType, input, depth+2, false, "\n", map[string]string{}) + s += line("},", depth+1, "\n") + return s +} + +// Handles rendering a list (array) in Go +func outputList(entityType string, key string, input []interface{}, depth int) string { + s := line(fmt.Sprintf("%s = [", key), depth, "") + for _, v := range input { + switch v := v.(type) { + case map[string]interface{}: + s += outputHashInList(entityType, v, depth) + default: + s += fmt.Sprintf("%s, ", quote(v)) + } + } + s = strings.TrimRight(s, ", ") + s += endList(input, depth) + return s +} + +// Ends a list rendering in Go +func endList(input []interface{}, depth int) string { + lastLine := line("]", depth, "\n") + if _, ok := input[len(input)-1].(map[string]interface{}); ok { + return lastLine + } + return strings.TrimLeft(lastLine, " ") +} + +// Formats a line with proper indentation and end-of-line characters +func line(input string, depth int, eol string) string { + return strings.Repeat(" ", depth) + input + eol +} + +// Properly quotes a value based on its type +func quote(input interface{}) string { + switch v := input.(type) { + case nil: + return "" + case bool, int, float64: + return fmt.Sprintf("%v", v) + case string: + if strings.Contains(v, "\n") { + return fmt.Sprintf("<" + client_secret: + - "" + session_secret: "" + response_mode: form_post diff --git a/kong2tf/testdata/global-plugin-oidc-output-expected.tf b/kong2tf/testdata/global-plugin-oidc-output-expected.tf new file mode 100644 index 000000000..0b402b1f4 --- /dev/null +++ b/kong2tf/testdata/global-plugin-oidc-output-expected.tf @@ -0,0 +1,19 @@ +variable "control_plane_id" { + type = "string" + default = "YOUR_CONTROL_PLANE_ID" +} + +resource "konnect_gateway_plugin_openid_connect" "openid_connect" { + enabled = true + config = { + auth_methods = ["authorization_code", "session"] + client_id = [""] + client_secret = [""] + issuer = "http://example.org" + response_mode = "form_post" + session_secret = "" + } + + control_plane_id = var.control_plane_id +} + diff --git a/kong2tf/testdata/global-plugin-rate-limiting-input.yaml b/kong2tf/testdata/global-plugin-rate-limiting-input.yaml new file mode 100644 index 000000000..121a06a1e --- /dev/null +++ b/kong2tf/testdata/global-plugin-rate-limiting-input.yaml @@ -0,0 +1,7 @@ +plugins: + - name: rate-limiting + enabled: false + config: + second: 5 + hour: 10000 + policy: local diff --git a/kong2tf/testdata/global-plugin-rate-limiting-output-expected.tf b/kong2tf/testdata/global-plugin-rate-limiting-output-expected.tf new file mode 100644 index 000000000..5a19a1acb --- /dev/null +++ b/kong2tf/testdata/global-plugin-rate-limiting-output-expected.tf @@ -0,0 +1,16 @@ +variable "control_plane_id" { + type = "string" + default = "YOUR_CONTROL_PLANE_ID" +} + +resource "konnect_gateway_plugin_rate_limiting" "rate_limiting" { + enabled = false + config = { + hour = 10000 + policy = "local" + second = 5 + } + + control_plane_id = var.control_plane_id +} + diff --git a/kong2tf/testdata/input.yaml b/kong2tf/testdata/input.yaml new file mode 100644 index 000000000..4e5421e74 --- /dev/null +++ b/kong2tf/testdata/input.yaml @@ -0,0 +1,517 @@ +vaults: +- config: + prefix: MY_SECRET_ + description: ENV vault for secrets + name: env + prefix: my-env-vault + tags: + - env-vault +ca_certificates: +- cert: | + -----BEGIN CERTIFICATE----- + MIIBfDCCASKgAwIBAgIRAJqcZC1VSvSQLMN1+7yAeswwCgYIKoZIzj0EAwIwHDEa + MBgGA1UEAxMRRGVtbyBLb25nIFJvb3QgQ0EwHhcNMjIwNjEzMTMzNzMzWhcNMjcw + NjEzMTkzNzMzWjAcMRowGAYDVQQDExFEZW1vIEtvbmcgUm9vdCBDQTBZMBMGByqG + SM49AgEGCCqGSM49AwEHA0IABOGR89IyhreSHRAi6wp9a5DBIDp4YYSdWzuEdlNx + 7pX1G4T7x68xUXJZXRUPFyT8Xzn5KwCJm8RVT+nAhrsUx6SjRTBDMA4GA1UdDwEB + /wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgECMB0GA1UdDgQWBBQ9CUiOPhjp7KD2 + ScRDxX4IzDOrNzAKBggqhkjOPQQDAgNIADBFAiEAw6Dov0c0L++1W9VufAfSMdNR + PSDfPU0MiUiG59/VIBICIEFn/6c5eQc3hUUBL74/RmNT2b1zxBmp7RiPXJAnAAwJ + -----END CERTIFICATE----- + cert_digest: f1baffe9fe9cf8497e38a4271d67fab44423678b7e7c0f677a50f37c113d81b5 + id: 8ccca140-aff4-411d-8e1c-fcfb3f932a8e + tags: + - root-ca +- cert: | + -----BEGIN CERTIFICATE----- + MIIBqTCCAVCgAwIBAgIQb5LqGa9gS3+Mc2ntWfSoJjAKBggqhkjOPQQDAjAcMRow + GAYDVQQDExFEZW1vIEtvbmcgUm9vdCBDQTAeFw0yMjA2MTMxMzM5MTVaFw0yMzA2 + MTMxOTM5MTVaMCoxKDAmBgNVBAMTH0RlbW8gS29uZyBSb290IEludGVybWVkaWF0 + ZTEgQ0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQImvnSuvXkGy88lvx8a7of + e0MEMRI2siVvybvWXNpeXXlixgaq7weJ7pewf3HywfO68Va6kn8ehWh7s0D7SLHM + o2YwZDAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBATAdBgNVHQ4E + FgQUhuxCKmCSvZWf95+iZ+Wsz9DJJVMwHwYDVR0jBBgwFoAUPQlIjj4Y6eyg9knE + Q8V+CMwzqzcwCgYIKoZIzj0EAwIDRwAwRAIgNZ+JPA1OqF5DsPapAZ2YsUOgIpn3 + ZbQuYKCAV0SD4EcCIFnfA5rWrc1AgtUw5inJQqJQRNgoPuC14vACqI48BiRl + -----END CERTIFICATE----- + cert_digest: dbef7ed285fb292e24f84ffba93c48d92fa322387d85469c460c655abedd5308 + id: 2e5f8ad1-21ca-47f5-8af7-899486e82731 + tags: + - intermediate_ca1 +- cert: | + -----BEGIN CERTIFICATE----- + MIIBujCCAV+gAwIBAgIRAMkGpj7WZf+2RFE/q7ZhejEwCgYIKoZIzj0EAwIwKjEo + MCYGA1UEAxMfRGVtbyBLb25nIFJvb3QgSW50ZXJtZWRpYXRlMSBDQTAeFw0yMjA2 + MTMxMzQwNTFaFw0yMjEyMTMwNDQwNTFaMCoxKDAmBgNVBAMTH0RlbW8gS29uZyBS + b290IEludGVybWVkaWF0ZTIgQ0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQB + my/zhZ3F2HvHFqtQzuD3lXX8SeYakxiBQvaGkGSLKD67N3vh7iC2rTSdj/vAs8ws + Y9X+mXzS6GDKC8PbSX6xo2YwZDAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgw + BgEB/wIBADAdBgNVHQ4EFgQURwCm53YPStZoAMfnVyknH4IgZa4wHwYDVR0jBBgw + FoAUhuxCKmCSvZWf95+iZ+Wsz9DJJVMwCgYIKoZIzj0EAwIDSQAwRgIhAN1pkUKc + azM4PiXOnkILB2KBDIF4XpHf+4ThDMODzXP8AiEA45KXA3qMrRPQV1oBfWZ3hLgX + gxUhveuHBXMWnzUbn6U= + -----END CERTIFICATE----- + cert_digest: 45b2b6dd9d4102955b1b1e4b540e677f140521462ed4f22fa5a713863ca84600 + id: cab2565d-fed6-4a07-b25c-bab76fdfe071 + tags: + - intermediate_ca2 +certificates: +- cert: |- + -----BEGIN CERTIFICATE----- + MIIECTCCAvGgAwIBAgIUAusYGP9BwoLFFAJdB/jY6eUzUyAwDQYJKoZIhvcNAQEL + BQAwgZIxCzAJBgNVBAYTAlVLMRIwEAYDVQQIDAlIYW1wc2hpcmUxEjAQBgNVBAcM + CUFsZGVyc2hvdDEQMA4GA1UECgwHS29uZyBVSzEQMA4GA1UECwwHU3VwcG9ydDEY + MBYGA1UEAwwPU3VwcG9ydCBSb290IENBMR0wGwYJKoZIhvcNAQkBFg5zdHVAa29u + Z2hxLmNvbTAeFw0yMTAxMTUxMTE5NDNaFw0yMjA1MzAxMTE5NDNaMIGRMQswCQYD + VQQGEwJVSzESMBAGA1UECAwJSGFtcHNoaXJlMRIwEAYDVQQHDAlBbGRlcnNob3Qx + EDAOBgNVBAoMB0tvbmcgVUsxEDAOBgNVBAsMB1N1cHBvcnQxFzAVBgNVBAMMDnBy + b3h5LmtvbmcubGFuMR0wGwYJKoZIhvcNAQkBFg5zdHVAa29uZ2hxLmNvbTCCASIw + DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJUbKiqoCK1BTNk/7l42n6ukyTEu + eLyB23e/90PzT/oz8wZzgwTodzbFAS2VtFr1EKqFzor0DrXp9CLnebOdiAR3I6LD + /WY/x0KW3lx3F35fGiUOSLPTH8zeiDTMx11CcKDxesA+M2/s5q0igkOQ4z4w3voz + m5a52IcQTSA8K5knNU1qUZBLpc+khxFcaheEK1jsISJJhcdizZBfGdk8S1vpyj5F + uCZ7oaRvNA6imHjSJwpgo36zd84TgrIgVj9R4QtJysWy/X+bbaKUiKBWwAtd4+DT + EP90l/ny9szu2fijk4/6k1ntXufGTyvM+J0/qJ13e99TVYOVanITnpTO+6cCAwEA + AaNWMFQwHwYDVR0jBBgwFoAUdskpf0wJRQxjtzQFZciWmUfl2bcwCQYDVR0TBAIw + ADALBgNVHQ8EBAMCBPAwGQYDVR0RBBIwEIIOcHJveHkua29uZy5sYW4wDQYJKoZI + hvcNAQELBQADggEBAJVrTWQRQzNtypa9OXFYADm8Fay1VMop3BY2kh0tfYgQEJ/4 + pJUj6CaszQZ/Aix6LaPnXFcoPCDqqv00mgju86PMamr/zA9USXk8eTmzJkp5RklS + GdqiXboqESiQVvaNz3kdW7wgNz4FwaGCzkEi/dcc2LdtzLpWizx+TlxMMqjonUUM + ovZgZo+OlhWRsDVT/qy5SFtA0vlVNtdBr2egXb1H7J8UDC+fax/iKa7+fBUHZOO9 + Fk9U8bxgfQ+jPIVVL8CfAtR68Sos7NpWH0S2emqZRnQvf0MSNdkTQKWn4qR9sckj + Ewxs5FbrMmgCOgwk1PtgRmdP3RME0HwK/B03saQ= + -----END CERTIFICATE----- + id: 507cc555-5b92-496d-9e89-bfc78dfcddbe + key: |- + -----BEGIN PRIVATE KEY----- + MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCVGyoqqAitQUzZ + P+5eNp+rpMkxLni8gdt3v/dD80/6M/MGc4ME6Hc2xQEtlbRa9RCqhc6K9A616fQi + 53mznYgEdyOiw/1mP8dClt5cdxd+XxolDkiz0x/M3og0zMddQnCg8XrAPjNv7Oat + IoJDkOM+MN76M5uWudiHEE0gPCuZJzVNalGQS6XPpIcRXGoXhCtY7CEiSYXHYs2Q + XxnZPEtb6co+Rbgme6GkbzQOoph40icKYKN+s3fOE4KyIFY/UeELScrFsv1/m22i + lIigVsALXePg0xD/dJf58vbM7tn4o5OP+pNZ7V7nxk8rzPidP6idd3vfU1WDlWpy + E56UzvunAgMBAAECggEAcq7lHNAHdHLgT8yrY41x/AwPryNGO/9JNW7SGVKAdjoU + tyaLZHAEmXynLk+R28/YFMA8H4Yd9m9OlrYhVjRZFM4p+5vxP/7YHPB7cPUsfcda + DZxR8PX25JVYf/vtb16V0ERLnKd62qCEwC/lr2A2WHQwXJLrHeAtmZzBJYUCJ5Xj + Dv1ZhyFjknswaV0vGXe6njTI6CzMQDTGysoagpCCo7RWgzjLREg2BGWd2UQpY4AW + nYAP4QNt82UMQbgIqsEMj64mzS9Q+o1P84J1naSP5sCI22LeFRp6iezZc+D8EH/5 + RNONGSNWl3g6bsvN1VywYwjWn+waD3XAjXUu+peUgQKBgQDDu1QP28oSMKivHdfo + kQ1HrTNBRc9eWeAMZFuIbbPLN8rdEibpOm3DwTqithnahqS0NLOsBnXNtuLw1Qr/ + zmOzn0yDO5XG8dlKr9vqWeBLdcRydLJBZwqEzWf4JwwwgfK3rItRaIbnAxnGUTS5 + SrrhNfBAIGS9jx5X2kvLC7hFQQKBgQDDBIrpLTIjRDloWZcu03z9Bhb8jQCyGb5C + 4MYs+duCnQIdNq/+maPspJzbVmF4b6S1zIPweI3fMvMeqRTbuf+drpElst1buFTO + P0UMMn4V+4qGIOOkIy5JIKwR8sJD9tNDUPtxuDEotTB9IyWx6pdmCFz5v/bggDCu + reoqflL+5wKBgQCDvb+L2QS+j4/KJk0flRoaJ2K7SVCVEesyjA3r2uLMImZhvAkC + rDgbLSDZSbZHFp8fR+WzILoD11gSf2Ki4PjMeqkWH3HlcP0vPwTHTO0h/UdXPmKI + kOFMl7CmHyoeMCj9JZ60EaXTMYwUpq3VFY6JbTOjBeqoh/8FZMHlDaNewQKBgCHg + ECEg8KyflTlDFrfTlMp+3E9STuShBCOp18LIRBEUJOHeNgQLvCXHElgnURcSjZHm + zKRgzIQQ3Zpd1Hm2fWhuglgCEeF0y4ZoBx5vRueaoh1aaTCBy/B39GvJt2UG4vu2 + fXbrf96KWrnh+RJGpbXbjgr0BXZJzisJmrt25gPRAoGBAI3c+INpQXwrE+LBzCPu + LwIVvkm5NpeIlKQtDNrqG1QvUhqyZ2/Xitc4FyiccW7WHxkGKGZyj7GbmpqEOnyY + iVku0LSftZgycet2uMdp0HaVAgi5S6aVf5yN0U/8R5ToxcbuEfqwrBIyRgse8lx3 + NNSvLxPAempmiFPSk9AtobYV + -----END PRIVATE KEY----- + snis: + - name: proxy.kong.lan + tags: + - proxy.kong.lan +- cert: |- + -----BEGIN CERTIFICATE----- + MIIFeDCCBGCgAwIBAgIUAusYGP9BwoLFFAJdB/jY6eUzUyQwDQYJKoZIhvcNAQEL + BQAwgZIxCzAJBgNVBAYTAlVLMRIwEAYDVQQIDAlIYW1wc2hpcmUxEjAQBgNVBAcM + CUFsZGVyc2hvdDEQMA4GA1UECgwHS29uZyBVSzEQMA4GA1UECwwHU3VwcG9ydDEY + MBYGA1UEAwwPU3VwcG9ydCBSb290IENBMR0wGwYJKoZIhvcNAQkBFg5zdHVAa29u + Z2hxLmNvbTAeFw0yMTAxMjAxNTA0NDVaFw0yMjAxMjAxNTA0NDVaMIGQMQswCQYD + VQQGEwJVSzESMBAGA1UECAwJSGFtcHNoaXJlMRIwEAYDVQQHDAlBbGRlcnNob3Qx + EDAOBgNVBAoMB0tvbmcgVUsxEDAOBgNVBAsMB1N1cHBvcnQxFjAUBgNVBAMMDW10 + bHMtY29uc3VtZXIxHTAbBgkqhkiG9w0BCQEWDnN0dUBrb25naHEuY29tMIICIjAN + BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1/+83/YNiEVKYvcuVwYGve6afsg1 + BYCn1+E9Uwgh0uwAenT/DKB8NhqoVxc7cZ2HaTI146IGmFICmctlTWvLPLglHmTo + byOUV6tIJAjvzyEOpC458hLGgbv8mhGXJWPxBVu7Wy6Hapz2bk0cEscfL7PHKaRu + 3D6r8/zbhhWAqe4EIt+NVYT6baaYBs7bPZQXs/sluKI+DNYuDeaAmoSuCc4ein6z + 0xDqCSMmPebzjns03ttB29vWL3eYY9dvgoCd+CPhXT/C4CHtvKbH+hOQYDtVF6MO + 1mmABAQTQWMR/00+QI0xtvuXtEPurla5dA0TN6ddCTOOcILKx62z5oc3Kqr+nHHa + 71zNzARUVaZ2vy1pRVr0DZgB7KqcFXhy/oy8IpmxUR1ASBDZl6B6RKrdQwvgLgmn + 3M/roNLAU+3nz4itpt/zf+X0suwdthrflic1R68z1SlYbyoGARWkZ/pOl6kLNVK2 + OsqQuICaajnW7t1oDd7z1+3hm+uoryDwvG6f3T9ZvWjKXYcKg7b+BjbFdahbDywD + PgnhSz9AaoVWhR+GHIPrjRClMpEkra/yGJFvH3UpXhgg9d0DrLZE51Z75a9SvnAj + vdLuNhx4bJbwLBgNGsJMkupzBrw4iCfbKFcBbP8o0Xjtarj7T/mkWuQ1GjWqfyrD + 55NecBPNw5C9BR0CAwEAAaOBxTCBwjAJBgNVHRMEAjAAMBEGCWCGSAGG+EIBAQQE + AwIFoDAzBglghkgBhvhCAQ0EJhYkT3BlblNTTCBHZW5lcmF0ZWQgQ2xpZW50IENl + cnRpZmljYXRlMB0GA1UdDgQWBBSV3F+eicU8SVT4LcDJ6eMzP0todzAfBgNVHSME + GDAWgBR2ySl/TAlFDGO3NAVlyJaZR+XZtzAOBgNVHQ8BAf8EBAMCBeAwHQYDVR0l + BBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMEMA0GCSqGSIb3DQEBCwUAA4IBAQB5L0OZ + WELG9Pw6Ol1BsZYgpLR4PGNBB9dKm/9dd+q+ohZVFCfXcjZ3YOU1vh/HHQrALRNY + I58JxcVCOx/qIW2uA0iSCqIT0sNb9cJLxfZf7X+BzPPPnu0ugUJp7GzLNnHitrLC + Xb1nmmefwgraNzp+a5IrR8RcQG1mYDuS+2HK/rybo22XcCxhob8OiDEn8+ytkKyQ + Ipmrf9D+/68/ih6az0w1aakASMmFe8z/p6VgVQkCySCWWFG525BRdGmSImqVZ4xa + aQFN3L+oN+JJcCFTthLOAYo32JH+xLMz7PokzSL84g3b68h59hXDoMSwB10GthL5 + T8tqV6i5miKWwvfZ + -----END CERTIFICATE----- + id: f3ae1bb2-ea6a-4caf-a7a7-2f078b7842db + key: |- + -----BEGIN RSA PRIVATE KEY----- + MIIJKQIBAAKCAgEA1/+83/YNiEVKYvcuVwYGve6afsg1BYCn1+E9Uwgh0uwAenT/ + DKB8NhqoVxc7cZ2HaTI146IGmFICmctlTWvLPLglHmTobyOUV6tIJAjvzyEOpC45 + 8hLGgbv8mhGXJWPxBVu7Wy6Hapz2bk0cEscfL7PHKaRu3D6r8/zbhhWAqe4EIt+N + VYT6baaYBs7bPZQXs/sluKI+DNYuDeaAmoSuCc4ein6z0xDqCSMmPebzjns03ttB + 29vWL3eYY9dvgoCd+CPhXT/C4CHtvKbH+hOQYDtVF6MO1mmABAQTQWMR/00+QI0x + tvuXtEPurla5dA0TN6ddCTOOcILKx62z5oc3Kqr+nHHa71zNzARUVaZ2vy1pRVr0 + DZgB7KqcFXhy/oy8IpmxUR1ASBDZl6B6RKrdQwvgLgmn3M/roNLAU+3nz4itpt/z + f+X0suwdthrflic1R68z1SlYbyoGARWkZ/pOl6kLNVK2OsqQuICaajnW7t1oDd7z + 1+3hm+uoryDwvG6f3T9ZvWjKXYcKg7b+BjbFdahbDywDPgnhSz9AaoVWhR+GHIPr + jRClMpEkra/yGJFvH3UpXhgg9d0DrLZE51Z75a9SvnAjvdLuNhx4bJbwLBgNGsJM + kupzBrw4iCfbKFcBbP8o0Xjtarj7T/mkWuQ1GjWqfyrD55NecBPNw5C9BR0CAwEA + AQKCAgEAymuOrG/hJKiS2oX8tm8eWFZIELI9BigYozYhCzQexpSGqjwEXOf1H5sB + 0YQjIAlZwhrc57OK7KpGZ6x2BgUT1JZZqs80CBtWxIXuuF5rpje7id8MTLCNuTzb + r+L2O4Mad0QNI5lKLH5mbt3yhiJ3NnQLHBpODjbpXGDFtTVne1hkJe5MfC1/psyt + wguO6HllcTTWl93ruonpZPtz39qhYuz4MCAnE5DRUrjO+Mn7y7XoyUS+xnSRl7BD + bqWRicJQyB+P7px3WyZQri+6TsCQ164iw2D64bLC1oCfLvLSBeh0g3gOdAX5mGTl + RBpf98LdFJXSmXHodcYMlO5THqHu7mOE8zvPDbOzpwKftE11PS+lhuq/fREJnrAx + pbvTkv2c1nu90gkracv6PhRC8YhBIa2gqhoxY7rH7UpYa1c5QaJzg5ibiteTLRKC + e9ZmfoPWaY2ksY4gBWZ/p2wokJ8U6ZHEsEfQS9WibMpqRsdINWQ9JnIBLKnTuqB0 + B29E9jHAl8rwMT2/DiIiVjHcdwpP37MxotKvYDFw+yDcZDeKTIh133XZNWyO/TcH + aDrNB0dymqunuNmfPts566AYErym0ndcmmLuGIKKE+l1h1+5CWjdsTdrkkXZK/w1 + i/krfLruQqQcW3Bpng8JAKirvGfYJxIEaCLqtepb7YaHhaI3gz0CggEBAPO0UQ6e + oPzMYmEegp2LjAfHZhwGV0fpiC6nxEWKoEE7Tb5zyB8rlkFIpQlXmljQvf3xDmq/ + Ta3JlkaY290oFc0ypp9zUY/sUGyc3pvltxl0gLKOPnIkoP3ma2HzBxQRrGRdcFhH + AHom80Bm9APm29L0MFuOuhGGxkGvQCxH+KmmohvZMUEqNIuWi8XB7maDXcAmSJ7x + YdQAgLspRJ+kkZM+59XijyvYvg04xCu1FSop+Lol+xBwWAR5OaKnbZ9L+jKtzbxC + IS7ERTlhsham2dYIm7SFcD/OcLV6luqreR0svS6HQis1kGxnNxkBAbrB1QZ+wLKp + QztnOk70H/eWP5sCggEBAOLllCHuRloqEyzDT5sVbflCMTVsXmHGJ4/qI4An+etI + 3DComNLPAIBKYAiNgqWAm/wfLy5rHu2ZGzcPn7cQF/xKp00uDGKncQz3Z9JDofI1 + rpLH+t3LJ9l/EzQv1tpzwOU5rhFNmqrJnwy17BtOmlCKAQnVmyDkLyR9AhWkCTi8 + BLDq6mx1X61K6P11GAxAd70NFNzD8868Ddq2XInwEwXzf/FHQW/JVYZEAa7dn4KF + wQ/tPSspP0vGzDfgNI64PtNePnZ/e00XXqA7la2OScro+SDSyXGlDKX4XhwwTDD1 + +u3VbUmjInpEJL3bU8c/qe36UhoseF1G0cm22sHqhacCggEAY3A+5r05KQ1oUwJ0 + /z2ybHYjJuo7cN9MLuVLg6iVzSgah8yMapOJYqf2l0JEe1rpOxXB8TKPyoqHo9S5 + WZsCklDJhiQysowVIMw9VNU9ichsvu6lckOZ4R/Ezxmv2LOBaQ5rScnm2vDLroqT + pIftSD1VAfbR21bnzGNqxuazAt44JS7RFyrWd+J8s7t2wCN3/HBij2Akr7Fo1XV4 + R7+JmtA/HpmsG5L7sT9pZAAmW6b2k1XuBH4im+iu6LxyUV5Z/5XFbbx597AkIs7H + MNDx75BhoB4WeCKPAK29qJFBAPOBWdvc1u6rOGBBLhWoFAEFH/pWPFAuW626L/8S + kB6hYwKCAQB3/JIec2Pu0Gs9c7eIOofilXdyWfF7YQ+Q0m+dmQZXvzr53F6ctGz+ + atZoD3V0UhOq+063DFzZpuq2bmO2qiMU/uGENgLEtOlawwa7MZrVfD/qTSjD22gi + Y0njghzrfuUWEy+S5OgSwvaCAT5vnlyKlMBB1BzqAuFPOXA9w3ZA82TDribz3goP + mRqm1iI2cG0ho2ZR7KnkvJvS+jbrlvJoZkFVdaoMFHtOum3tbDOrEVJsOrfrOC/J + wcJDFiSVCKfonOEJRxcMSHx43amkkydAz3zXN8DhgTe0GSijXYMdLSdaWFAn7cYQ + xDJt2CtwpaEWQRbj0nqAUTAlrLX4cC3nAoIBAQCl1cV86bYw8CKrCuf9TF0Kk5pd + REdilDpks4Z1RH4MpBDWLtvMeQqlNsN+/RugKQExO0HTdZIyn7cBRRloD2xcNcJA + G/rUMel/x4fhaEOE7Uw9rmTefvpcgWmtXw64sMA8KFA4oCXIcgbwL5Q+szqNNWAN + abpgl0DnU06YyBDoK/7D0B8Kt3qS1N6XX+Z5wtPvglbD2HCYy6rdkqi8IbQ/6OeS + wG7p/7g3JlOEyotMq9Cl2T0wTNDSLlma+mwc9mILITDXznWiLQSznE69mebWBUr3 + Sbt91efH30inRx85H0pNJrpZsH0A6ayL0gTJSuUc0eJXYR5Po1gRQMOSIEWh + -----END RSA PRIVATE KEY----- +plugins: +- name: openid-connect + config: + auth_methods: + - authorization_code + - session + issuer: http://example.org + client_id: + - "" + client_secret: + - "" + session_secret: "" + response_mode: form_post +services: + - name: example-service + url: http://example-api.com + protocol: http + host: example-api.com + port: 80 + path: /v1 + retries: 5 + connect_timeout: 5000 + write_timeout: 60000 + read_timeout: 60000 + enabled: true + client_certificate: 4e3ad2e4-0bc4-4638-8e34-c84a417ba39b + plugins: + - name: rate-limiting-advanced + config: + limit: + - 5 + window_size: + - 30 + identifier: consumer + sync_rate: -1 + namespace: example_namespace + strategy: local + hide_client_headers: false + ordering: + before: + access: + - another-plugin + after: + access: + - yet-another-plugin + tags: + - example + - api + routes: + - name: example-route + methods: + - GET + - POST + hosts: + - example.com + - another-example.com + - yet-another-example.com + paths: + - ~/v1/example/?$ + - /v1/another-example + - /v1/yet-another-example + protocols: + - http + - https + headers: + x-my-header: + - ~*foos?bar$ + x-another-header: + - first-header-value + - second-header-value + regex_priority: 1 + strip_path: false + preserve_host: true + tags: + - version:v1 + https_redirect_status_code: 302 + snis: + - example.com + plugins: + - name: aws-lambda + config: + aws_key: my_key + aws_secret: my_secret + function_name: my_function + aws_region: us-west-2 + - name: cors + config: + origins: + - example.com + methods: + - GET + - POST + headers: + - Authorization + exposed_headers: + - X-My-Header + max_age: 3600 + credentials: true + - name: file-log + config: + path: /var/log/kong/kong.log + reopen: true + - name: http-log + config: + http_endpoint: http://example.com/logs + method: POST + content_type: application/json + timeout: 10000 + keepalive: 60000 + retry_count: 10 + queue_size: 1000 + - name: ip-restriction + config: + allow: + - 192.168.0.1/24 + deny: + - 192.168.0.2/32 + - name: rate-limiting-advanced + config: + limit: + - 5 + window_size: + - 30 + identifier: consumer + sync_rate: -1 + namespace: example_namespace + strategy: local + hide_client_headers: false + - name: request-termination + config: + status_code: 403 + message: Forbidden + - name: response-ratelimiting + config: + limits: + limit_name: + minute: 10 + policy: local + - name: tcp-log + config: + host: example.com + port: 1234 + - name: basic-auth + config: + hide_credentials: false + - name: jwt + config: + uri_param_names: + - token + claims_to_verify: + - exp + - nbf + key_claim_name: kid + secret_is_base64: false + anonymous: null + run_on_preflight: true + maximum_expiration: 3600 + header_names: + - Authorization + - name: key-auth + config: + hide_credentials: false + key_names: + - apikey + key_in_body: false + run_on_preflight: true + - name: acl + config: + allow: + - admin +upstreams: + - name: example-api.com + algorithm: round-robin + hash_on: none + hash_fallback: none + hash_on_cookie_path: "/" + slots: 10000 + healthchecks: + passive: + type: http + healthy: + http_statuses: + - 200 + - 201 + - 202 + - 203 + - 204 + - 205 + - 206 + - 207 + - 208 + - 226 + - 300 + - 301 + - 302 + - 303 + - 304 + - 305 + - 306 + - 307 + - 308 + successes: 0 + unhealthy: + http_statuses: + - 429 + - 500 + - 503 + timeouts: 0 + http_failures: 0 + tcp_failures: 0 + active: + https_verify_certificate: true + healthy: + http_statuses: + - 200 + - 302 + successes: 0 + interval: 0 + unhealthy: + http_failures: 0 + http_statuses: + - 429 + - 404 + - 500 + - 501 + - 502 + - 503 + - 504 + - 505 + timeouts: 0 + tcp_failures: 0 + interval: 0 + type: http + concurrency: 10 + headers: + x-my-header: + - foo + - bar + x-another-header: + - bla + timeout: 1 + http_path: "/" + https_sni: example.com + threshold: 0 + tags: + - user-level + - low-priority + host_header: example.com + use_srv_name: false + targets: + - target: 10.10.10.10:8000 + weight: 100 + - target: 10.10.10.11:8000 + weight: 100 +consumers: + - username: example-user + custom_id: "1234567890" + tags: + - internal + acls: + - group: acl_group + tags: + - internal + basicauth_credentials: + - username: my_basic_user + password: my_basic_password + tags: + - internal + jwt_secrets: + - key: my_jwt_secret + algorithm: HS256 + secret: my_secret_key + tags: + - internal + keyauth_credentials: + - key: my_api_key + tags: + - internal + mtls_auth_credentials: + - id: cce8c384-721f-4f58-85dd-50834e3e733a + subject_name: example-user@example.com + plugins: + - name: rate-limiting-advanced + config: + limit: + - 5 + window_size: + - 30 + identifier: consumer + sync_rate: -1 + namespace: example_namespace + strategy: local + hide_client_headers: false +consumer_groups: + - name: example-consumer-group + consumers: + - username: example-user + plugins: + - name: rate-limiting-advanced + config: + limit: + - 5 + window_size: + - 30 + identifier: consumer + sync_rate: -1 + namespace: example_namespace + strategy: local + hide_client_headers: false + window_type: sliding + retry_after_jitter_max: 0 + + + \ No newline at end of file diff --git a/kong2tf/testdata/route-input.yaml b/kong2tf/testdata/route-input.yaml new file mode 100644 index 000000000..b4c32430c --- /dev/null +++ b/kong2tf/testdata/route-input.yaml @@ -0,0 +1,48 @@ +services: + - name: example-service + url: http://example-api.com + routes: + - name: example-route + methods: + - GET + - POST + hosts: + - example.com + - another-example.com + - yet-another-example.com + paths: + - ~/v1/example/?$ + - /v1/another-example + - /v1/yet-another-example + protocols: + - http + - https + headers: + x-my-header: + - ~*foos?bar$ + x-another-header: + - first-header-value + - second-header-value + regex_priority: 1 + strip_path: false + preserve_host: true + tags: + - version:v1 + https_redirect_status_code: 302 + snis: + - example.com + sources: + - ip: 192.168.0.1 + destinations: + - ip: 10.10.10.10 + port: 8080 + +routes: + - name: top-level-route + hosts: + - top-level.example.com + - name: top-level-with-service-route + service: + name: example-service + hosts: + - top-level-with-service.example.com diff --git a/kong2tf/testdata/route-output-expected.tf b/kong2tf/testdata/route-output-expected.tf new file mode 100644 index 000000000..bc879c61d --- /dev/null +++ b/kong2tf/testdata/route-output-expected.tf @@ -0,0 +1,67 @@ +variable "control_plane_id" { + type = "string" + default = "YOUR_CONTROL_PLANE_ID" +} + +resource "konnect_gateway_service" "example_service" { + name = "example-service" + host = "example-api.com" + port = 80 + protocol = "http" + + control_plane_id = var.control_plane_id +} + +resource "konnect_gateway_route" "example_route" { + name = "example-route" + destinations = [ + { + ip = "10.10.10.10" + port = 8080 + }, + ] + headers = { + x-another-header = ["first-header-value", "second-header-value"] + x-my-header = ["~*foos?bar$"] + } + hosts = ["example.com", "another-example.com", "yet-another-example.com"] + https_redirect_status_code = 302 + methods = ["GET", "POST"] + paths = ["~/v1/example/?$", "/v1/another-example", "/v1/yet-another-example"] + preserve_host = true + protocols = ["http", "https"] + regex_priority = 1 + snis = ["example.com"] + sources = [ + { + ip = "192.168.0.1" + }, + ] + strip_path = false + tags = ["version:v1"] + + service = { + id = konnect_gateway_service.example_service.id + } + + control_plane_id = var.control_plane_id +} + +resource "konnect_gateway_route" "top_level_route" { + name = "top-level-route" + hosts = ["top-level.example.com"] + + control_plane_id = var.control_plane_id +} + +resource "konnect_gateway_route" "top_level_with_service_route" { + name = "top-level-with-service-route" + hosts = ["top-level-with-service.example.com"] + + service = { + id = konnect_gateway_service.example_service.id + } + + control_plane_id = var.control_plane_id +} + diff --git a/kong2tf/testdata/route-plugin-input.yaml b/kong2tf/testdata/route-plugin-input.yaml new file mode 100644 index 000000000..59d47b0c1 --- /dev/null +++ b/kong2tf/testdata/route-plugin-input.yaml @@ -0,0 +1,21 @@ +services: + - name: example-service + url: http://example-api.com + routes: + - name: example-route + paths: + - ~/v1/example/?$ + plugins: + - name: cors + config: + origins: + - example.com + methods: + - GET + - POST + headers: + - Authorization + exposed_headers: + - X-My-Header + max_age: 3600 + credentials: true \ No newline at end of file diff --git a/kong2tf/testdata/route-plugin-output-expected.tf b/kong2tf/testdata/route-plugin-output-expected.tf new file mode 100644 index 000000000..662d8b4ea --- /dev/null +++ b/kong2tf/testdata/route-plugin-output-expected.tf @@ -0,0 +1,42 @@ +variable "control_plane_id" { + type = "string" + default = "YOUR_CONTROL_PLANE_ID" +} + +resource "konnect_gateway_service" "example_service" { + name = "example-service" + host = "example-api.com" + port = 80 + protocol = "http" + + control_plane_id = var.control_plane_id +} + +resource "konnect_gateway_route" "example_route" { + name = "example-route" + paths = ["~/v1/example/?$"] + + service = { + id = konnect_gateway_service.example_service.id + } + + control_plane_id = var.control_plane_id +} + +resource "konnect_gateway_plugin_cors" "example_route_cors" { + config = { + credentials = true + exposed_headers = ["X-My-Header"] + headers = ["Authorization"] + max_age = 3600 + methods = ["GET", "POST"] + origins = ["example.com"] + } + + route = { + id = konnect_gateway_route.example_route.id + } + + control_plane_id = var.control_plane_id +} + diff --git a/kong2tf/testdata/service-input.yaml b/kong2tf/testdata/service-input.yaml new file mode 100644 index 000000000..c25edb3dc --- /dev/null +++ b/kong2tf/testdata/service-input.yaml @@ -0,0 +1,18 @@ +services: + - name: example-service + url: http://example-api.com + protocol: http + host: example-api.com + port: 80 + path: /v1 + retries: 5 + connect_timeout: 5000 + write_timeout: 60000 + read_timeout: 60000 + enabled: true + client_certificate: 4e3ad2e4-0bc4-4638-8e34-c84a417ba39b + tls_verify: true + tls_verify_depth: 1 + tags: + - example + - api \ No newline at end of file diff --git a/kong2tf/testdata/service-output-expected.tf b/kong2tf/testdata/service-output-expected.tf new file mode 100644 index 000000000..59128051e --- /dev/null +++ b/kong2tf/testdata/service-output-expected.tf @@ -0,0 +1,24 @@ +variable "control_plane_id" { + type = "string" + default = "YOUR_CONTROL_PLANE_ID" +} + +resource "konnect_gateway_service" "example_service" { + enabled = true + name = "example-service" + client_certificate = "4e3ad2e4-0bc4-4638-8e34-c84a417ba39b" + connect_timeout = 5000 + host = "example-api.com" + path = "/v1" + port = 80 + protocol = "http" + read_timeout = 60000 + retries = 5 + tags = ["example", "api"] + tls_verify = true + tls_verify_depth = 1 + write_timeout = 60000 + + control_plane_id = var.control_plane_id +} + diff --git a/kong2tf/testdata/service-plugin-input.yaml b/kong2tf/testdata/service-plugin-input.yaml new file mode 100644 index 000000000..b0656dd41 --- /dev/null +++ b/kong2tf/testdata/service-plugin-input.yaml @@ -0,0 +1,22 @@ +services: + - name: example-service + url: http://example-api.com + plugins: + - name: rate-limiting-advanced + config: + limit: + - 5 + window_size: + - 30 + identifier: consumer + sync_rate: -1 + namespace: example_namespace + strategy: local + hide_client_headers: false + ordering: + before: + access: + - another-plugin + after: + access: + - yet-another-plugin \ No newline at end of file diff --git a/kong2tf/testdata/service-plugin-output-expected.tf b/kong2tf/testdata/service-plugin-output-expected.tf new file mode 100644 index 000000000..ea871a4f1 --- /dev/null +++ b/kong2tf/testdata/service-plugin-output-expected.tf @@ -0,0 +1,40 @@ +variable "control_plane_id" { + type = "string" + default = "YOUR_CONTROL_PLANE_ID" +} + +resource "konnect_gateway_service" "example_service" { + name = "example-service" + host = "example-api.com" + port = 80 + protocol = "http" + + control_plane_id = var.control_plane_id +} + +resource "konnect_gateway_plugin_rate_limiting_advanced" "example_service_rate_limiting_advanced" { + config = { + hide_client_headers = false + identifier = "consumer" + limit = [5] + namespace = "example_namespace" + strategy = "local" + sync_rate = -1 + window_size = [30] + } + ordering = { + after = { + access = ["yet-another-plugin"] + } + before = { + access = ["another-plugin"] + } + } + + service = { + id = konnect_gateway_service.example_service.id + } + + control_plane_id = var.control_plane_id +} + diff --git a/kong2tf/testdata/upstream-target-input.yaml b/kong2tf/testdata/upstream-target-input.yaml new file mode 100644 index 000000000..285ca28f8 --- /dev/null +++ b/kong2tf/testdata/upstream-target-input.yaml @@ -0,0 +1,84 @@ +upstreams: + - name: example-api.com + algorithm: round-robin + hash_on: none + hash_fallback: none + hash_on_cookie_path: "/" + slots: 10000 + healthchecks: + passive: + type: http + healthy: + http_statuses: + - 200 + - 201 + - 202 + - 203 + - 204 + - 205 + - 206 + - 207 + - 208 + - 226 + - 300 + - 301 + - 302 + - 303 + - 304 + - 305 + - 306 + - 307 + - 308 + successes: 0 + unhealthy: + http_statuses: + - 429 + - 500 + - 503 + timeouts: 0 + http_failures: 0 + tcp_failures: 0 + active: + https_verify_certificate: true + healthy: + http_statuses: + - 200 + - 302 + successes: 0 + interval: 0 + unhealthy: + http_failures: 0 + http_statuses: + - 429 + - 404 + - 500 + - 501 + - 502 + - 503 + - 504 + - 505 + timeouts: 0 + tcp_failures: 0 + interval: 0 + type: http + concurrency: 10 + headers: + x-my-header: + - foo + - bar + x-another-header: + - bla + timeout: 1 + http_path: "/" + https_sni: example.com + threshold: 0 + tags: + - user-level + - low-priority + host_header: example.com + use_srv_name: false + targets: + - target: 10.10.10.10:8000 + weight: 100 + - target: 10.10.10.11:8000 + weight: 200 \ No newline at end of file diff --git a/kong2tf/testdata/upstream-target-output-expected.tf b/kong2tf/testdata/upstream-target-output-expected.tf new file mode 100644 index 000000000..fdb9eb0a1 --- /dev/null +++ b/kong2tf/testdata/upstream-target-output-expected.tf @@ -0,0 +1,77 @@ +variable "control_plane_id" { + type = "string" + default = "YOUR_CONTROL_PLANE_ID" +} + +resource "konnect_gateway_upstream" "upstream_example_api_com" { + name = "example-api.com" + algorithm = "round-robin" + hash_fallback = "none" + hash_on = "none" + hash_on_cookie_path = "/" + healthchecks = { + active = { + concurrency = 10 + headers = { + x-another-header = ["bla"] + x-my-header = ["foo", "bar"] + } + healthy = { + http_statuses = [200, 302] + interval = 0 + successes = 0 + } + http_path = "/" + https_sni = "example.com" + 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 + } + host_header = "example.com" + slots = 10000 + tags = ["user-level", "low-priority"] + use_srv_name = false + + control_plane_id = var.control_plane_id +} + +resource "konnect_gateway_target" "upstream_example_api_com_target_10_10_10_10_8000" { + target = "10.10.10.10:8000" + weight = 100 + + upstream_id = konnect_gateway_upstream.upstream_example_api_com.id + + control_plane_id = var.control_plane_id +} + +resource "konnect_gateway_target" "upstream_example_api_com_target_10_10_10_11_8000" { + target = "10.10.10.11:8000" + weight = 200 + + upstream_id = konnect_gateway_upstream.upstream_example_api_com.id + + control_plane_id = var.control_plane_id +} + diff --git a/kong2tf/testdata/vault-input.yaml b/kong2tf/testdata/vault-input.yaml new file mode 100644 index 000000000..ec9fa862d --- /dev/null +++ b/kong2tf/testdata/vault-input.yaml @@ -0,0 +1,8 @@ +vaults: +- config: + prefix: MY_SECRET_ + description: ENV vault for secrets + name: env + prefix: my-env-vault + tags: + - env-vault \ No newline at end of file diff --git a/kong2tf/testdata/vault-output-expected.tf b/kong2tf/testdata/vault-output-expected.tf new file mode 100644 index 000000000..1c1af8d8b --- /dev/null +++ b/kong2tf/testdata/vault-output-expected.tf @@ -0,0 +1,17 @@ +variable "control_plane_id" { + type = "string" + default = "YOUR_CONTROL_PLANE_ID" +} + +resource "konnect_gateway_vault" "env" { + name = "env" + config = jsonencode({ + prefix = "MY_SECRET_" + }) + description = "ENV vault for secrets" + prefix = "my-env-vault" + tags = ["env-vault"] + + control_plane_id = var.control_plane_id +} + From cd7cdf77046f497f2c6f0156a8b0a9a83a40ebc6 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Tue, 10 Sep 2024 16:43:18 +0530 Subject: [PATCH 35/43] chore: changelog update for v1.40.0 (#1397) --- CHANGELOG.md | 20 ++++++++++++++++++++ README.md | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 075ea219f..83a7b422a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.40.0](#v1400) - [v1.39.6](#v1396) - [v1.39.5](#v1395) - [v1.39.4](#v1394) @@ -92,6 +93,24 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.40.0] +> Release date: 2024/09/10 + +### Added +- Added a new `file kong2tf` command to convert a deck file to Terraform configuration [#1391](https://github.com/Kong/deck/pull/1391), along with two command line flags: + - `--generate-imports-for-control-plane-id`: If this is provided, import blocks will be added to Terraform to adopt existing resources. + - `--ignore-credential-changes`: If this is provided, any credentials will be ignored until they are destroyed and recreated. + +### Fixes + +- Fixed the issue that was preventing a consumer to be in more than one consumer-groups [#1394](https://github.com/Kong/deck/pull/1394) +[go-database-reconciler #140](https://github.com/Kong/go-database-reconciler/pull/140) +- Fields marked as auto in schema are filled with nil in the config sent to the Control Plane. In case a field is marked as auto and is a required field, deck would throw an error if the user doesn't fill it in the declarative configuration file. +[#1394](https://github.com/Kong/deck/pull/1394) [go-database-reconciler #139](https://github.com/Kong/go-database-reconciler/pull/139) +- Defaults are no longer filled by deck. They will only be used for computing a diff, but not sent to the Control Plane. +[#1394](https://github.com/Kong/deck/pull/1394) [go-database-reconciler #133](https://github.com/Kong/go-database-reconciler/pull/133) + + ## [v1.39.6] > Release date: 2024/08/22 @@ -1774,6 +1793,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.40.0]: https://github.com/Kong/deck/compare/v1.39.6...v1.40.0 [v1.39.6]: https://github.com/Kong/deck/compare/v1.39.5...v1.39.6 [v1.39.5]: https://github.com/Kong/deck/compare/v1.39.4...v1.39.5 [v1.39.4]: https://github.com/Kong/deck/compare/v1.39.3...v1.39.4 diff --git a/README.md b/README.md index 923acfb9b..cfb08fad5 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.39.6/deck_1.39.6_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.40.0/deck_1.40.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.39.6/deck_1.39.6_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.40.0/deck_1.40.0_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ``` From 5f3068be2cef706bc040174ecf73e4887cf4209c Mon Sep 17 00:00:00 2001 From: Jordi Fernandez Date: Thu, 12 Sep 2024 14:41:53 +0200 Subject: [PATCH 36/43] Fix panic when field is an empty list (#1399) --- kong2tf/generate_resource.go | 3 +++ kong2tf/generate_resource_test.go | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/kong2tf/generate_resource.go b/kong2tf/generate_resource.go index 07295ee57..1e293cfca 100644 --- a/kong2tf/generate_resource.go +++ b/kong2tf/generate_resource.go @@ -353,6 +353,9 @@ func outputList(entityType string, key string, input []interface{}, depth int) s // Ends a list rendering in Go func endList(input []interface{}, depth int) string { + if len(input) == 0 { + return "]\n" + } lastLine := line("]", depth, "\n") if _, ok := input[len(input)-1].(map[string]interface{}); ok { return lastLine diff --git a/kong2tf/generate_resource_test.go b/kong2tf/generate_resource_test.go index c5cf122d3..146c83aaa 100644 --- a/kong2tf/generate_resource_test.go +++ b/kong2tf/generate_resource_test.go @@ -22,7 +22,8 @@ func TestGenerateComplexLayout(t *testing.T) { "nested_nested_nested_field1": "nested_nested_nested_string" } } - } + }, + "field4": [] }` var entity map[string]any @@ -43,6 +44,7 @@ func TestGenerateComplexLayout(t *testing.T) { } } } + field4 = [] service = { id = konnect_gateway_service.some_service.id From 6798b9176d4dc9bc4fd54dfc83394140830f8d6e Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Thu, 12 Sep 2024 18:33:10 +0530 Subject: [PATCH 37/43] fix: bumping up go-apiops lib (#1400) The updated lib has a fix for openapi2kong command where parameters.required fieldw was coming as null, if not passed by user. Fixes: https://github.com/Kong/go-apiops/issues/203 --- go.mod | 3 +-- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 9d92585ad..3cc25bfd9 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,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.36 + github.com/kong/go-apiops v0.1.37 github.com/kong/go-database-reconciler v1.14.7 github.com/kong/go-kong v0.59.0 github.com/mitchellh/go-homedir v1.1.0 @@ -102,7 +102,6 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/mitchellh/hashstructure v1.1.0 github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect diff --git a/go.sum b/go.sum index 12b83d268..79202236d 100644 --- a/go.sum +++ b/go.sum @@ -179,8 +179,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.36 h1:WejXoJZXAI8ZdwrCUyx1ONOfBw0e2GeopqW1/rjy7Wk= -github.com/kong/go-apiops v0.1.36/go.mod h1:B0WFsqonn+xnHgHg0x063fADFC21mhNOsOXsbKdZTpM= +github.com/kong/go-apiops v0.1.37 h1:AwIslsbnx9JAFdPy8UI6NF/I+X2ypi7TJmdDNwKe/bY= +github.com/kong/go-apiops v0.1.37/go.mod h1:B0WFsqonn+xnHgHg0x063fADFC21mhNOsOXsbKdZTpM= github.com/kong/go-database-reconciler v1.14.7 h1:U8VnKYFz8oBnAgDxipBHNR9KCOxexffQlmCyfWhafV4= github.com/kong/go-database-reconciler v1.14.7/go.mod h1:T5BkBw13PZWub3y2jKAoM7fYD+UmXp2iNqj1YqD0L90= github.com/kong/go-kong v0.59.0 h1:U6dE2sqb8E8j0kESW/RCW9TkXH8Y3W0EtNDXJVsDNuM= @@ -218,8 +218,6 @@ github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZ github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/hashstructure v1.1.0 h1:P6P1hdjqAAknpY/M1CGipelZgp+4y9ja9kmUZPXP+H0= -github.com/mitchellh/hashstructure v1.1.0/go.mod h1:xUDAozZz0Wmdiufv0uyhnHkUTN6/6d8ulp4AwfLKrmA= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= From 74b1859493eeb8e90ac79446841a3cf2e5893caf Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Thu, 12 Sep 2024 21:21:47 +0530 Subject: [PATCH 38/43] chore: bumped up go-kong and added changelog updates (#1401) * chore: bumped up go-kong and added changelog updates * corrected PR link * corrected changelog link in summary --- CHANGELOG.md | 12 ++++++++++++ go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83a7b422a..1f0b8d16a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.40.1](#v1401) - [v1.40.0](#v1400) - [v1.39.6](#v1396) - [v1.39.5](#v1395) @@ -93,6 +94,16 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.40.1] +> Release date: 2024/09/12 + +### Fixes +- Fixed the issue in `deck file kong2tf` command where users were facing a panic error with using jwt plugins when passing an empty list to cookie_names field. [#1399](https://github.com/Kong/deck/pull/1399) +- Bumped up go-apiops library. The updated lib has a fix for `deck file openapi2kong` command where parameters.required field was coming as null, if not passed by user. [#1400](https://github.com/Kong/deck/pull/1400) [go-apiops #205](https://github.com/Kong/go-apiops/pull/205) +- Bumped up go-kong library. The updated lib prevents unset plugin's configuration "record" fields to be filled with empty tables: {} +for deck files. Since, deck doesn't fill defaults anymore, this fix ensures that deck doesn't pass empty record fields while syncing plugin configurations. +[#1401](https://github.com/Kong/deck/pull/1401) [go-kong #467](https://github.com/Kong/go-kong/pull/467) + ## [v1.40.0] > Release date: 2024/09/10 @@ -1793,6 +1804,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.40.1]: https://github.com/Kong/deck/compare/v1.40.0...v1.40.1 [v1.40.0]: https://github.com/Kong/deck/compare/v1.39.6...v1.40.0 [v1.39.6]: https://github.com/Kong/deck/compare/v1.39.5...v1.39.6 [v1.39.5]: https://github.com/Kong/deck/compare/v1.39.4...v1.39.5 diff --git a/go.mod b/go.mod index 3cc25bfd9..0c9dd31a9 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.37 github.com/kong/go-database-reconciler v1.14.7 - github.com/kong/go-kong v0.59.0 + github.com/kong/go-kong v0.59.1 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 79202236d..c4747b042 100644 --- a/go.sum +++ b/go.sum @@ -183,8 +183,8 @@ github.com/kong/go-apiops v0.1.37 h1:AwIslsbnx9JAFdPy8UI6NF/I+X2ypi7TJmdDNwKe/bY github.com/kong/go-apiops v0.1.37/go.mod h1:B0WFsqonn+xnHgHg0x063fADFC21mhNOsOXsbKdZTpM= github.com/kong/go-database-reconciler v1.14.7 h1:U8VnKYFz8oBnAgDxipBHNR9KCOxexffQlmCyfWhafV4= github.com/kong/go-database-reconciler v1.14.7/go.mod h1:T5BkBw13PZWub3y2jKAoM7fYD+UmXp2iNqj1YqD0L90= -github.com/kong/go-kong v0.59.0 h1:U6dE2sqb8E8j0kESW/RCW9TkXH8Y3W0EtNDXJVsDNuM= -github.com/kong/go-kong v0.59.0/go.mod h1:8Vt6HmtgLNgL/7bSwAlz3DIWqBtzG7qEt9+OnMiQOa0= +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= From a50b6957b37bba39a34de2fcd438e029c6beca78 Mon Sep 17 00:00:00 2001 From: Antoine Jacquemin Date: Thu, 19 Sep 2024 11:27:56 +0200 Subject: [PATCH 39/43] Add Default Lookup Services (#1367) --- cmd/common.go | 79 +++++++++ cmd/gateway_validate.go | 39 ++++ go.mod | 2 +- go.sum | 4 +- tests/integration/sync_test.go | 167 +++++++++++++++++- .../sync/019-skip-consumers/kong34.yaml | 14 +- .../sync/019-skip-consumers/kong3x.yaml | 13 ++ .../global_consumers.yaml | 0 .../plugins_and_consumers.yaml | 0 .../plugins_lookup.yaml | 0 .../plugins_no_lookup.yaml | 0 .../global_entities_consumerGroups.yaml | 13 ++ .../plugins_and_entities_consumerGroups.yaml | 31 ++++ .../plugins_no_lookup_consumerGroup.yaml | 22 +++ .../plugins_no_lookup_route.yaml | 15 ++ .../plugins_no_lookup_service.yaml | 15 ++ .../plugins_route_lookup.yaml | 20 +++ .../plugins_service_lookup.yaml | 20 +++ .../global_services.yaml | 7 + .../plugins_and_services.yaml | 14 ++ .../plugins_lookup.yaml | 17 ++ .../plugins_no_lookup.yaml | 14 ++ 22 files changed, 498 insertions(+), 8 deletions(-) rename tests/integration/testdata/sync/{029-lookup-tags => 029-lookup-tags-consumers}/global_consumers.yaml (100%) rename tests/integration/testdata/sync/{029-lookup-tags => 029-lookup-tags-consumers}/plugins_and_consumers.yaml (100%) rename tests/integration/testdata/sync/{029-lookup-tags => 029-lookup-tags-consumers}/plugins_lookup.yaml (100%) rename tests/integration/testdata/sync/{029-lookup-tags => 029-lookup-tags-consumers}/plugins_no_lookup.yaml (100%) create mode 100644 tests/integration/testdata/sync/034-lookup-tags-consumerGroups/global_entities_consumerGroups.yaml create mode 100644 tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_and_entities_consumerGroups.yaml create mode 100644 tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_consumerGroup.yaml create mode 100644 tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_route.yaml create mode 100644 tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_service.yaml create mode 100644 tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_route_lookup.yaml create mode 100644 tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_service_lookup.yaml create mode 100644 tests/integration/testdata/sync/035-lookup-tags-services/global_services.yaml create mode 100644 tests/integration/testdata/sync/035-lookup-tags-services/plugins_and_services.yaml create mode 100644 tests/integration/testdata/sync/035-lookup-tags-services/plugins_lookup.yaml create mode 100644 tests/integration/testdata/sync/035-lookup-tags-services/plugins_no_lookup.yaml diff --git a/cmd/common.go b/cmd/common.go index deba570d5..ca19022d2 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -119,6 +119,17 @@ func evaluateTargetRuntimeGroupOrControlPlaneName(targetContent *file.Content) e return nil } +func RemoveConsumerPlugins(targetContentPlugins []file.FPlugin) []file.FPlugin { + filteredPlugins := []file.FPlugin{} + + for _, plugin := range targetContentPlugins { + if plugin.Consumer == nil && plugin.ConsumerGroup == nil { + filteredPlugins = append(filteredPlugins, plugin) + } + } + return filteredPlugins +} + func syncMain(ctx context.Context, filenames []string, dry bool, parallelism, delay int, workspace string, enableJSONOutput bool, ) error { @@ -139,6 +150,7 @@ func syncMain(ctx context.Context, filenames []string, dry bool, parallelism, if dumpConfig.SkipConsumers { targetContent.Consumers = []file.FConsumer{} targetContent.ConsumerGroups = []file.FConsumerGroupObject{} + targetContent.Plugins = RemoveConsumerPlugins(targetContent.Plugins) } if dumpConfig.SkipCACerts { targetContent.CACertificates = []file.FCACertificate{} @@ -236,6 +248,25 @@ func syncMain(ctx context.Context, filenames []string, dry bool, parallelism, return err } + dumpConfig.LookUpSelectorTagsConsumerGroups, err = determineLookUpSelectorTagsConsumerGroups(*targetContent) + if err != nil { + return fmt.Errorf("error determining lookup selector tags for consumer groups: %w", err) + } + + if dumpConfig.LookUpSelectorTagsConsumerGroups != nil { + consumerGroupsGlobal, err := dump.GetAllConsumerGroups(ctx, kongClient, dumpConfig.LookUpSelectorTagsConsumerGroups) + if err != nil { + return fmt.Errorf("error retrieving global consumer groups via lookup selector tags: %w", err) + } + for _, c := range consumerGroupsGlobal { + targetContent.ConsumerGroups = append(targetContent.ConsumerGroups, + file.FConsumerGroupObject{ConsumerGroup: *c.ConsumerGroup}) + if err != nil { + return fmt.Errorf("error adding global consumer group %v: %w", *c.ConsumerGroup.Name, err) + } + } + } + dumpConfig.LookUpSelectorTagsConsumers, err = determineLookUpSelectorTagsConsumers(*targetContent) if err != nil { return fmt.Errorf("error determining lookup selector tags for consumers: %w", err) @@ -272,6 +303,24 @@ func syncMain(ctx context.Context, filenames []string, dry bool, parallelism, } } + dumpConfig.LookUpSelectorTagsServices, err = determineLookUpSelectorTagsServices(*targetContent) + if err != nil { + return fmt.Errorf("error determining lookup selector tags for services: %w", err) + } + + if dumpConfig.LookUpSelectorTagsServices != nil { + servicesGlobal, err := dump.GetAllServices(ctx, kongClient, dumpConfig.LookUpSelectorTagsServices) + if err != nil { + return fmt.Errorf("error retrieving global services via lookup selector tags: %w", err) + } + for _, r := range servicesGlobal { + targetContent.Services = append(targetContent.Services, file.FService{Service: *r}) + if err != nil { + return fmt.Errorf("error adding global service %v: %w", r.FriendlyName(), err) + } + } + } + if reconcilerUtils.Kong340Version.LTE(parsedKongVersion) { dumpConfig.IsConsumerGroupScopedPluginSupported = true } @@ -355,6 +404,21 @@ func syncMain(ctx context.Context, filenames []string, dry bool, parallelism, return nil } +func determineLookUpSelectorTagsConsumerGroups(targetContent file.Content) ([]string, error) { + if targetContent.Info != nil && + targetContent.Info.LookUpSelectorTags != nil && + targetContent.Info.LookUpSelectorTags.ConsumerGroups != nil { + if len(targetContent.Info.LookUpSelectorTags.ConsumerGroups) == 0 { + return nil, fmt.Errorf("global consumer groups specified but no global tags") + } + reconcilerUtils.RemoveDuplicates(&targetContent.Info.LookUpSelectorTags.ConsumerGroups) + sort.Strings(targetContent.Info.LookUpSelectorTags.ConsumerGroups) + return targetContent.Info.LookUpSelectorTags.ConsumerGroups, nil + + } + return nil, nil +} + func determineLookUpSelectorTagsConsumers(targetContent file.Content) ([]string, error) { if targetContent.Info != nil && targetContent.Info.LookUpSelectorTags != nil && @@ -385,6 +449,21 @@ func determineLookUpSelectorTagsRoutes(targetContent file.Content) ([]string, er return nil, nil } +func determineLookUpSelectorTagsServices(targetContent file.Content) ([]string, error) { + if targetContent.Info != nil && + targetContent.Info.LookUpSelectorTags != nil && + targetContent.Info.LookUpSelectorTags.Services != nil { + if len(targetContent.Info.LookUpSelectorTags.Services) == 0 { + return nil, fmt.Errorf("global services specified but no global tags") + } + reconcilerUtils.RemoveDuplicates(&targetContent.Info.LookUpSelectorTags.Services) + sort.Strings(targetContent.Info.LookUpSelectorTags.Services) + return targetContent.Info.LookUpSelectorTags.Services, nil + + } + return nil, nil +} + func determineSelectorTag(targetContent file.Content, config dump.Config) ([]string, error) { if targetContent.Info != nil { if len(targetContent.Info.SelectorTags) > 0 { diff --git a/cmd/gateway_validate.go b/cmd/gateway_validate.go index 558bbb9f7..271f2463d 100644 --- a/cmd/gateway_validate.go +++ b/cmd/gateway_validate.go @@ -50,6 +50,26 @@ func executeValidate(cmd *cobra.Command, _ []string) error { return err } + // if this is an online validation, we need to look up upstream consumers if required. + lookUpSelectorTagsConsumerGroups, err := determineLookUpSelectorTagsConsumerGroups(*targetContent) + if err != nil { + return fmt.Errorf("error determining lookup selector tags for consumer grous: %w", err) + } + + if lookUpSelectorTagsConsumerGroups != nil { + consumerGroupsGlobal, err := dump.GetAllConsumerGroups(ctx, kongClient, lookUpSelectorTagsConsumerGroups) + if err != nil { + return fmt.Errorf("error retrieving global consumer groups via lookup selector tags: %w", err) + } + for _, c := range consumerGroupsGlobal { + targetContent.ConsumerGroups = append(targetContent.ConsumerGroups, + file.FConsumerGroupObject{ConsumerGroup: *c.ConsumerGroup}) + if err != nil { + return fmt.Errorf("error adding global consumer group %v: %w", *c.ConsumerGroup.Name, err) + } + } + } + // if this is an online validation, we need to look up upstream consumers if required. lookUpSelectorTagsConsumers, err := determineLookUpSelectorTagsConsumers(*targetContent) if err != nil { @@ -87,6 +107,25 @@ func executeValidate(cmd *cobra.Command, _ []string) error { } } } + + // if this is an online validation, we need to look up upstream services if required. + lookUpSelectorTagsServices, err := determineLookUpSelectorTagsServices(*targetContent) + if err != nil { + return fmt.Errorf("error determining lookup selector tags for services: %w", err) + } + + if lookUpSelectorTagsServices != nil { + servicesGlobal, err := dump.GetAllServices(ctx, kongClient, lookUpSelectorTagsServices) + if err != nil { + return fmt.Errorf("error retrieving global services via lookup selector tags: %w", err) + } + for _, r := range servicesGlobal { + targetContent.Services = append(targetContent.Services, file.FService{Service: *r}) + if err != nil { + return fmt.Errorf("error adding global service %v: %w", r.FriendlyName(), err) + } + } + } } rawState, err := file.Get(ctx, targetContent, file.RenderConfig{ diff --git a/go.mod b/go.mod index 0c9dd31a9..c4c79df14 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/fatih/color v1.17.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.37 - github.com/kong/go-database-reconciler v1.14.7 + 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 github.com/spf13/cobra v1.8.1 diff --git a/go.sum b/go.sum index c4747b042..a9feafd47 100644 --- a/go.sum +++ b/go.sum @@ -181,8 +181,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.37 h1:AwIslsbnx9JAFdPy8UI6NF/I+X2ypi7TJmdDNwKe/bY= github.com/kong/go-apiops v0.1.37/go.mod h1:B0WFsqonn+xnHgHg0x063fADFC21mhNOsOXsbKdZTpM= -github.com/kong/go-database-reconciler v1.14.7 h1:U8VnKYFz8oBnAgDxipBHNR9KCOxexffQlmCyfWhafV4= -github.com/kong/go-database-reconciler v1.14.7/go.mod h1:T5BkBw13PZWub3y2jKAoM7fYD+UmXp2iNqj1YqD0L90= +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-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= diff --git a/tests/integration/sync_test.go b/tests/integration/sync_test.go index 4e9434995..173f7f9d1 100644 --- a/tests/integration/sync_test.go +++ b/tests/integration/sync_test.go @@ -3765,6 +3765,55 @@ func Test_Sync_SkipConsumers_34x(t *testing.T) { Enabled: kong.Bool(true), Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")}, }, + { + Name: kong.String("rate-limiting-advanced"), + Consumer: &kong.Consumer{ + ID: kong.String("416b038a-fd00-45fd-a5a2-a74bf70017fa"), + }, + 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("foo"), + "path": nil, + "redis": map[string]any{ + "cluster_addresses": nil, + "connect_timeout": nil, + "database": float64(0), + "host": nil, + "keepalive_backlog": nil, + "keepalive_pool_size": float64(30), + "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")}, + }, }, }, skipConsumers: false, @@ -4959,21 +5008,21 @@ func Test_Sync_LookupConsumerTags(t *testing.T) { setup(t) // test that reference to non-existing consumer fails. - pluginsNoLookupStateFile := "testdata/sync/029-lookup-tags/plugins_no_lookup.yaml" + pluginsNoLookupStateFile := "testdata/sync/029-lookup-tags-consumers/plugins_no_lookup.yaml" err := sync(pluginsNoLookupStateFile) require.Error(t, err) require.EqualError(t, err, "building state: consumer foo for plugin rate-limiting-advanced: entity not found") // test that reference to existing local consumer succeeds. - pluginsAndConsumersStateFile := "testdata/sync/029-lookup-tags/plugins_and_consumers.yaml" + pluginsAndConsumersStateFile := "testdata/sync/029-lookup-tags-consumers/plugins_and_consumers.yaml" require.NoError(t, sync(pluginsAndConsumersStateFile)) reset(t) // test that reference to existing global consumer succeeds via lookup tags. - globalConsumersStateFile := "testdata/sync/029-lookup-tags/global_consumers.yaml" + globalConsumersStateFile := "testdata/sync/029-lookup-tags-consumers/global_consumers.yaml" require.NoError(t, sync(globalConsumersStateFile)) // sync plugins with lookup reference to global consumers. - pluginsLookupStateFile := "testdata/sync/029-lookup-tags/plugins_lookup.yaml" + pluginsLookupStateFile := "testdata/sync/029-lookup-tags-consumers/plugins_lookup.yaml" require.NoError(t, sync(pluginsLookupStateFile)) reset(t) @@ -5053,6 +5102,45 @@ func Test_Sync_ConsumerGroupConsumersWithCustomID(t *testing.T) { testKongState(t, client, false, expectedState, nil) } +// Test_Sync_LookupServicesTags tests that existing behavior when referencing +// services from plugins is preserved: +// - if a referenced service is not present in the state file, the sync fails +// - if a referenced service is present in the state file, the sync succeeds +// +// This test also tests that the new behavior is implemented correctly: +// - if a referenced service is not present in the state file, but is present +// in Kong when using the new lookup selector tags, the sync succeeds +// - if a referenced service is not present in the state file and neither in +// Kong when using the new lookup selector tags, the sync fails +func Test_Sync_LookupServicesTags(t *testing.T) { + runWhen(t, "enterprise", ">=3.0.0") + setup(t) + + // test that reference to non-existing service fails. + pluginsNoLookupServiceStateFile := "testdata/sync/035-lookup-tags-services/plugins_no_lookup.yaml" + err := sync(pluginsNoLookupServiceStateFile) + require.Error(t, err) + require.EqualError(t, err, "building state: service foo for plugin rate-limiting-advanced: entity not found") + + // test that reference to existing local service succeeds. + pluginsAndServicesStateFile := "testdata/sync/035-lookup-tags-services/plugins_and_services.yaml" + require.NoError(t, sync(pluginsAndServicesStateFile)) + reset(t) + + // test that reference to existing global service succeeds via lookup tags. + globalServicesStateFile := "testdata/sync/035-lookup-tags-services/global_services.yaml" + require.NoError(t, sync(globalServicesStateFile)) + + // sync plugins with lookup reference to global services. + pluginsLookupServiceStateFile := "testdata/sync/035-lookup-tags-services/plugins_lookup.yaml" + require.NoError(t, sync(pluginsLookupServiceStateFile)) + reset(t) + + // test that reference to non-existing global service fails via lookup tags. + require.Error(t, sync(pluginsLookupServiceStateFile)) + require.EqualError(t, err, "building state: service foo for plugin rate-limiting-advanced: entity not found") +} + // Test_Sync_LookupRoutesTags tests that existing behavior when referencing // routes from plugins is preserved: // - if a referenced route is not present in the state file, the sync fails @@ -5091,6 +5179,77 @@ func Test_Sync_LookupRoutesTags(t *testing.T) { require.EqualError(t, err, "building state: route foo for plugin rate-limiting-advanced: entity not found") } +// Test_Sync_LookupConsumerGroupsTags tests that existing behavior when referencing +// consumer groups from plugins is preserved: +// - if a referenced service/route and consumer group are not present in the state file, the sync fails +// - if a referenced service/route and consumer group are present in the state file, the sync succeeds +// +// This test also tests that the new behavior is implemented correctly: +// - if a referenced service/route/consumer or consumer group is not present in the state file, but is present +// in Kong when using the new lookup selector tags, the sync succeeds +// - if a referenced service/route or consumer group is not present in the state file and neither in +// Kong when using the new lookup selector tags, the sync fails +func Test_Sync_LookupConsumerGroupsTags(t *testing.T) { + runWhen(t, "enterprise", ">=3.0.0") + setup(t) + + // test that reference to non-existing service fails. + pluginsNoLookupServiceStateFile := "testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_service.yaml" + errNoService := sync(pluginsNoLookupServiceStateFile) + require.Error(t, errNoService) + require.EqualError(t, errNoService, "building state: service foo for plugin rate-limiting-advanced: entity not found") + + // test that reference to non-existing route fails. + pluginsNoLookupRouteStateFile := "testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_route.yaml" + errNoRoute := sync(pluginsNoLookupRouteStateFile) + require.Error(t, errNoRoute) + require.EqualError(t, errNoRoute, "building state: route bar for plugin rate-limiting-advanced: entity not found") + + // test that reference to non-existing consumer group fails. + pluginsNoLookupConsumergroupStateFile := "testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_consumerGroup.yaml" //nolint:lll + errNoConsumerGroup := sync(pluginsNoLookupConsumergroupStateFile) + require.Error(t, errNoConsumerGroup) + require.EqualError( + t, + errNoConsumerGroup, + "building state: consumer-group foo2 for plugin rate-limiting-advanced: entity not found", + ) + + // test that reference to existing local service and consumer group succeeds. + pluginsAndEntitiesConsumersGroupsStateFile := "testdata/sync/034-lookup-tags-consumerGroups/plugins_and_entities_consumerGroups.yaml" //nolint:lll + require.NoError(t, sync(pluginsAndEntitiesConsumersGroupsStateFile)) + reset(t) + + // test that reference to existing global service and consumer group succeeds via lookup tags. + globalEntitiesConsumerGroupsStateFile := "testdata/sync/034-lookup-tags-consumerGroups/global_entities_consumerGroups.yaml" //nolint:lll + require.NoError(t, sync(globalEntitiesConsumerGroupsStateFile)) + // sync plugins with lookup reference to global service. + pluginsServiceLookupStateFile := "testdata/sync/034-lookup-tags-consumerGroups/plugins_service_lookup.yaml" + require.NoError(t, sync(pluginsServiceLookupStateFile)) + // sync plugins with lookup reference to global route. + pluginsRouteLookupStateFile := "testdata/sync/034-lookup-tags-consumerGroups/plugins_route_lookup.yaml" + require.NoError(t, sync(pluginsRouteLookupStateFile)) + reset(t) + + // test that reference to non-existing global service or consumer groups fails via lookup tags. + errServiceNoReference := sync(pluginsServiceLookupStateFile) + require.Error(t, errServiceNoReference) + require.EqualError( + t, + errServiceNoReference, + "building state: service foo for plugin rate-limiting-advanced: entity not found", + ) + + // test that reference to non-existing global route or consumer groups fails via lookup tags. + errRouteNoReference := sync(pluginsRouteLookupStateFile) + require.Error(t, errRouteNoReference) + require.EqualError( + t, + errRouteNoReference, + "building state: route bar for plugin rate-limiting-advanced: entity not found", + ) +} + // test scope: // - 3.5.0+ // - konnect diff --git a/tests/integration/testdata/sync/019-skip-consumers/kong34.yaml b/tests/integration/testdata/sync/019-skip-consumers/kong34.yaml index 433ef4290..cb91c4160 100644 --- a/tests/integration/testdata/sync/019-skip-consumers/kong34.yaml +++ b/tests/integration/testdata/sync/019-skip-consumers/kong34.yaml @@ -31,7 +31,8 @@ consumer_groups: - 60 window_type: sliding consumers: -- groups: +- id: 416b038a-fd00-45fd-a5a2-a74bf70017fa + groups: - name: silver username: bar - username: baz @@ -47,3 +48,14 @@ services: protocol: http read_timeout: 60000 retries: 5 +plugins: + - name: rate-limiting-advanced + config: + namespace: foo + limit: + - 10 + retry_after_jitter_max: 1 + window_size: + - 60 + window_type: sliding + consumer: bar diff --git a/tests/integration/testdata/sync/019-skip-consumers/kong3x.yaml b/tests/integration/testdata/sync/019-skip-consumers/kong3x.yaml index f6ff84a5d..04d62b044 100644 --- a/tests/integration/testdata/sync/019-skip-consumers/kong3x.yaml +++ b/tests/integration/testdata/sync/019-skip-consumers/kong3x.yaml @@ -7,6 +7,7 @@ consumer_groups: plugins: - name: rate-limiting-advanced config: + namespace: foo limit: - 10 retry_after_jitter_max: 1 @@ -20,6 +21,7 @@ consumer_groups: plugins: - name: rate-limiting-advanced config: + namespace: foo limit: - 7 retry_after_jitter_max: 1 @@ -43,3 +45,14 @@ services: protocol: http read_timeout: 60000 retries: 5 +plugins: + - name: rate-limiting-advanced + config: + namespace: foo + limit: + - 10 + retry_after_jitter_max: 1 + window_size: + - 60 + window_type: sliding + consumer: bar diff --git a/tests/integration/testdata/sync/029-lookup-tags/global_consumers.yaml b/tests/integration/testdata/sync/029-lookup-tags-consumers/global_consumers.yaml similarity index 100% rename from tests/integration/testdata/sync/029-lookup-tags/global_consumers.yaml rename to tests/integration/testdata/sync/029-lookup-tags-consumers/global_consumers.yaml diff --git a/tests/integration/testdata/sync/029-lookup-tags/plugins_and_consumers.yaml b/tests/integration/testdata/sync/029-lookup-tags-consumers/plugins_and_consumers.yaml similarity index 100% rename from tests/integration/testdata/sync/029-lookup-tags/plugins_and_consumers.yaml rename to tests/integration/testdata/sync/029-lookup-tags-consumers/plugins_and_consumers.yaml diff --git a/tests/integration/testdata/sync/029-lookup-tags/plugins_lookup.yaml b/tests/integration/testdata/sync/029-lookup-tags-consumers/plugins_lookup.yaml similarity index 100% rename from tests/integration/testdata/sync/029-lookup-tags/plugins_lookup.yaml rename to tests/integration/testdata/sync/029-lookup-tags-consumers/plugins_lookup.yaml diff --git a/tests/integration/testdata/sync/029-lookup-tags/plugins_no_lookup.yaml b/tests/integration/testdata/sync/029-lookup-tags-consumers/plugins_no_lookup.yaml similarity index 100% rename from tests/integration/testdata/sync/029-lookup-tags/plugins_no_lookup.yaml rename to tests/integration/testdata/sync/029-lookup-tags-consumers/plugins_no_lookup.yaml diff --git a/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/global_entities_consumerGroups.yaml b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/global_entities_consumerGroups.yaml new file mode 100644 index 000000000..0ba680b57 --- /dev/null +++ b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/global_entities_consumerGroups.yaml @@ -0,0 +1,13 @@ +_format_version: "3.0" +_info: + select_tags: + - global-entities-consumerGroups +services: +- name: foo + host: test.com +routes: +- name: bar + paths: + - /test +consumer_groups: +- name: foo2 diff --git a/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_and_entities_consumerGroups.yaml b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_and_entities_consumerGroups.yaml new file mode 100644 index 000000000..6f2ad898c --- /dev/null +++ b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_and_entities_consumerGroups.yaml @@ -0,0 +1,31 @@ +_format_version: "3.0" +plugins: +- name: rate-limiting-advanced + config: + limit: + - 10 + window_size: + - 60 + namespace: foo + sync_rate: -1 + service: foo + consumer_group: foo2 +- name: rate-limiting-advanced + config: + limit: + - 10 + window_size: + - 60 + namespace: foo + sync_rate: -1 + route: bar + consumer_group: foo2 +services: +- name: foo + host: test.com +routes: +- name: bar + paths: + - /test +consumer_groups: +- name: foo2 diff --git a/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_consumerGroup.yaml b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_consumerGroup.yaml new file mode 100644 index 000000000..0e959c588 --- /dev/null +++ b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_consumerGroup.yaml @@ -0,0 +1,22 @@ +_format_version: "3.0" +_info: + select_tags: + - managed-by-deck +plugins: +- name: rate-limiting-advanced + config: + limit: + - 10 + window_size: + - 60 + namespace: foo + sync_rate: -1 + service: foo + consumer_group: foo2 +services: +- name: foo + host: test.com +routes: +- name: bar + paths: + - /test diff --git a/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_route.yaml b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_route.yaml new file mode 100644 index 000000000..7db815822 --- /dev/null +++ b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_route.yaml @@ -0,0 +1,15 @@ +_format_version: "3.0" +_info: + select_tags: + - managed-by-deck +plugins: +- name: rate-limiting-advanced + config: + limit: + - 10 + window_size: + - 60 + namespace: foo + sync_rate: -1 + route: bar + consumer_group: foo2 diff --git a/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_service.yaml b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_service.yaml new file mode 100644 index 000000000..96a4cfa50 --- /dev/null +++ b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_no_lookup_service.yaml @@ -0,0 +1,15 @@ +_format_version: "3.0" +_info: + select_tags: + - managed-by-deck +plugins: +- name: rate-limiting-advanced + config: + limit: + - 10 + window_size: + - 60 + namespace: foo + sync_rate: -1 + service: foo + consumer_group: foo2 diff --git a/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_route_lookup.yaml b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_route_lookup.yaml new file mode 100644 index 000000000..1d12428d2 --- /dev/null +++ b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_route_lookup.yaml @@ -0,0 +1,20 @@ +_format_version: "3.0" +_info: + select_tags: + - managed-by-deck + default_lookup_tags: + routes: + - global-entities-consumerGroups + consumer_groups: + - global-entities-consumerGroups +plugins: +- name: rate-limiting-advanced + config: + limit: + - 10 + window_size: + - 60 + namespace: foo + sync_rate: -1 + route: bar + consumer_group: foo2 diff --git a/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_service_lookup.yaml b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_service_lookup.yaml new file mode 100644 index 000000000..d4272b106 --- /dev/null +++ b/tests/integration/testdata/sync/034-lookup-tags-consumerGroups/plugins_service_lookup.yaml @@ -0,0 +1,20 @@ +_format_version: "3.0" +_info: + select_tags: + - managed-by-deck + default_lookup_tags: + services: + - global-entities-consumerGroups + consumer_groups: + - global-entities-consumerGroups +plugins: +- name: rate-limiting-advanced + config: + limit: + - 10 + window_size: + - 60 + namespace: foo + sync_rate: -1 + service: foo + consumer_group: foo2 diff --git a/tests/integration/testdata/sync/035-lookup-tags-services/global_services.yaml b/tests/integration/testdata/sync/035-lookup-tags-services/global_services.yaml new file mode 100644 index 000000000..b9a6a0bd9 --- /dev/null +++ b/tests/integration/testdata/sync/035-lookup-tags-services/global_services.yaml @@ -0,0 +1,7 @@ +_format_version: "3.0" +_info: + select_tags: + - global-services +services: +- name: foo + host: test.com diff --git a/tests/integration/testdata/sync/035-lookup-tags-services/plugins_and_services.yaml b/tests/integration/testdata/sync/035-lookup-tags-services/plugins_and_services.yaml new file mode 100644 index 000000000..4b9aa673a --- /dev/null +++ b/tests/integration/testdata/sync/035-lookup-tags-services/plugins_and_services.yaml @@ -0,0 +1,14 @@ +_format_version: "3.0" +plugins: +- name: rate-limiting-advanced + config: + limit: + - 10 + window_size: + - 60 + namespace: foo + sync_rate: -1 + service: foo +services: +- name: foo + host: test.com diff --git a/tests/integration/testdata/sync/035-lookup-tags-services/plugins_lookup.yaml b/tests/integration/testdata/sync/035-lookup-tags-services/plugins_lookup.yaml new file mode 100644 index 000000000..5dec7cc01 --- /dev/null +++ b/tests/integration/testdata/sync/035-lookup-tags-services/plugins_lookup.yaml @@ -0,0 +1,17 @@ +_format_version: "3.0" +_info: + select_tags: + - managed-by-deck + default_lookup_tags: + services: + - global-services +plugins: +- name: rate-limiting-advanced + config: + limit: + - 10 + window_size: + - 60 + namespace: foo + sync_rate: -1 + service: foo diff --git a/tests/integration/testdata/sync/035-lookup-tags-services/plugins_no_lookup.yaml b/tests/integration/testdata/sync/035-lookup-tags-services/plugins_no_lookup.yaml new file mode 100644 index 000000000..188c1b77f --- /dev/null +++ b/tests/integration/testdata/sync/035-lookup-tags-services/plugins_no_lookup.yaml @@ -0,0 +1,14 @@ +_format_version: "3.0" +_info: + select_tags: + - managed-by-deck +plugins: +- name: rate-limiting-advanced + config: + limit: + - 10 + window_size: + - 60 + namespace: foo + sync_rate: -1 + service: foo From fd1fec7efb9ba3a3483497757e1bc6f6aca8e5ed Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 25 Sep 2024 14:06:46 +0530 Subject: [PATCH 40/43] fix: default konnect url with konnect addr flag not accounted for. (#1398) Previously, if a deck command was issued with --konnect-addr flag but with the default konnectUrl https://us.api.konghq.com, the flag value was getting ignored as deck could not figure out if it was passed by flag or not. This change ensures that if the flag is set, deck commands are issued against Konnect. Fixes: https://github.com/Kong/deck/issues/1385 --- cmd/common.go | 2 ++ cmd/root.go | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/common.go b/cmd/common.go index ca19022d2..483fa8302 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -645,6 +645,8 @@ func inKonnectMode(targetContent *file.Content) bool { konnectConfig.Password != "" || konnectConfig.Token != "" { return true + } else if konnectConnectionDesired { + return true } return false } diff --git a/cmd/root.go b/cmd/root.go index 6db964918..fe3ab6c64 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -26,7 +26,8 @@ var ( rootConfig utils.KongClientConfig konnectConfig utils.KonnectConfig - disableAnalytics bool + disableAnalytics bool + konnectConnectionDesired bool konnectRuntimeGroup string konnectControlPlane string @@ -378,6 +379,10 @@ func initConfig() { color.NoColor = viper.GetBool("no-color") } + if viper.IsSet("konnect-addr") { + konnectConnectionDesired = true + } + if err := initKonnectConfig(); err != nil { fmt.Println(err) os.Exit(1) From 97db28c626fb80850a9ebcfe8819597deaaf2d39 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 25 Sep 2024 15:54:52 +0530 Subject: [PATCH 41/43] chore: updated go-apiops lib and replaced yaml with own fork (#1405) This change allows deck commands to process OAS files with path lengths > 128 characters which was a limitation from an underlying library. This is fixed in the fork created in Kong git account. Fixes: https://github.com/Kong/go-apiops/issues/198 --- go.mod | 6 ++++-- go.sum | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index c4c79df14..05c05f8c1 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,18 @@ module github.com/kong/deck -go 1.22.4 +go 1.23.0 replace github.com/yudai/gojsondiff v1.0.0 => github.com/Kong/gojsondiff v1.3.0 +replace gopkg.in/yaml.v3 v3.0.1 => github.com/Kong/yaml v1.0.0 + require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d github.com/blang/semver/v4 v4.0.0 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.37 + github.com/kong/go-apiops v0.1.38 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 diff --git a/go.sum b/go.sum index a9feafd47..53dee8c78 100644 --- a/go.sum +++ b/go.sum @@ -12,6 +12,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/yaml v1.0.0 h1:OWOxtLEamLYKZzcrfoH76imAwSi9FgSZapxg1Kh6IBA= +github.com/Kong/yaml v1.0.0/go.mod h1:gVzJ3lyC0UdO7kZxmCpwn0Vj20y/02cFnDpHBirGrSQ= github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs= github.com/MarvinJWendt/testza v0.2.1/go.mod h1:God7bhG8n6uQxwdScay+gjm9/LnO4D3kkcZX4hv9Rp8= github.com/MarvinJWendt/testza v0.2.8/go.mod h1:nwIcjmr0Zz+Rcwfh3/4UhBp7ePKVhuBExvZqnKYWlII= @@ -179,8 +181,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.37 h1:AwIslsbnx9JAFdPy8UI6NF/I+X2ypi7TJmdDNwKe/bY= -github.com/kong/go-apiops v0.1.37/go.mod h1:B0WFsqonn+xnHgHg0x063fADFC21mhNOsOXsbKdZTpM= +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-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= @@ -486,8 +488,6 @@ 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= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 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= From 56e5661e3bd850cd16fe42f20740e355c1d20758 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Thu, 26 Sep 2024 11:45:12 +0530 Subject: [PATCH 42/43] chore: added missing changelog entry for v1.40.2 release (#1406) --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f0b8d16a..bd718e4a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.40.2](#v1402) - [v1.40.1](#v1401) - [v1.40.0](#v1400) - [v1.39.6](#v1396) @@ -94,6 +95,13 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.40.2] +> Release date: 2024/09/19 + +### Added +- Add support for default lookup services. [#1367](https://github.com/Kong/deck/pull/1367) +[go-database-reconciler #130](https://github.com/Kong/go-database-reconciler/pull/130) + ## [v1.40.1] > Release date: 2024/09/12 @@ -1804,6 +1812,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.40.2]: https://github.com/Kong/deck/compare/v1.40.1...v1.40.2 [v1.40.1]: https://github.com/Kong/deck/compare/v1.40.0...v1.40.1 [v1.40.0]: https://github.com/Kong/deck/compare/v1.39.6...v1.40.0 [v1.39.6]: https://github.com/Kong/deck/compare/v1.39.5...v1.39.6 From cd165de706bf5e7b546177bb5f04538514227cba Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Fri, 27 Sep 2024 13:10:53 +0530 Subject: [PATCH 43/43] chore: release prep for v1.40.3 (#1407) --- CHANGELOG.md | 11 +++++++++++ README.md | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd718e4a4..0727db81e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +- [v1.40.3](#v1403) - [v1.40.2](#v1402) - [v1.40.1](#v1401) - [v1.40.0](#v1400) @@ -95,6 +96,15 @@ - [v0.2.0](#v020) - [v0.1.0](#v010) +## [v1.40.3] +> Release date: 2024/09/26 + +### Fixes +- Fixed the behaviour of --konnect-addr flag in case default Konnect URL is used with it. +Earlier, using the default URL with the said flag ran the command against the gateway. +[#1398](https://github.com/Kong/deck/pull/1398) +- Bumped up go-apiops to `v0.1.38` and replaced yaml/v3 package with [Kong's own fork](https://github.com/Kong/yaml). This change allows deck commands to process OAS files with path lengths > 128 characters which was a limitation from the original yaml library.[#1405](https://github.com/Kong/deck/pull/1405) [go-apiops #208](https://github.com/Kong/go-apiops/pull/208) [Kong/yaml #1](https://github.com/Kong/yaml/pull/1) + ## [v1.40.2] > Release date: 2024/09/19 @@ -1812,6 +1822,7 @@ No breaking changes have been introduced in this release. Debut release of decK +[v1.40.3]: https://github.com/Kong/deck/compare/v1.40.2...v1.40.3 [v1.40.2]: https://github.com/Kong/deck/compare/v1.40.1...v1.40.2 [v1.40.1]: https://github.com/Kong/deck/compare/v1.40.0...v1.40.1 [v1.40.0]: https://github.com/Kong/deck/compare/v1.39.6...v1.40.0 diff --git a/README.md b/README.md index cfb08fad5..d3ea79ec0 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.40.0/deck_1.40.0_linux_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.40.3/deck_1.40.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.40.0/deck_1.40.0_windows_amd64.tar.gz -o deck.tar.gz +$ curl -sL https://github.com/kong/deck/releases/download/v1.40.3/deck_1.40.3_windows_amd64.tar.gz -o deck.tar.gz $ tar -xzvf deck.tar.gz ```