Skip to content

Commit

Permalink
Merge branch 'main' into fix-konnect-checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashansa-K authored Sep 6, 2024
2 parents 20f5690 + 18831e9 commit 5929287
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 12 deletions.
1 change: 0 additions & 1 deletion .github/workflows/integration-enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/validate-kong-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Table of Contents

- [v1.39.6](#v1396)
- [v1.39.5](#v1395)
- [v1.39.4](#v1394)
- [v1.39.3](#v1393)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
```
Expand All @@ -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
```

Expand Down
29 changes: 27 additions & 2 deletions cmd/common_konnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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...)
}
Expand Down

0 comments on commit 5929287

Please sign in to comment.