Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/docker/golang-1.23.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashansa-K authored Oct 29, 2024
2 parents 084f694 + 947e349 commit 850977a
Show file tree
Hide file tree
Showing 82 changed files with 11,049 additions and 9,520 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Table of Contents

- [v1.41.1](#v1411)
- [v1.41.0](#v1410)
- [v1.40.3](#v1403)
- [v1.40.2](#v1402)
- [v1.40.1](#v1401)
Expand Down Expand Up @@ -96,6 +98,25 @@
- [v0.2.0](#v020)
- [v0.1.0](#v010)

## [v1.41.1]
> Release date: 2024/10/22
### Fixes
- `deck gateway validate` for Konnect supports Konnect configs passed by CLI flags now.
Earlier, the validation was failing if control plane information was passed via CLI flags.

## [v1.41.0]
> Release date: 2024/10/21
### Added
- `deck gateway validate` command now supports Konnect. Konnect entities can be validated online with this change.
[#1335](https://github.com/Kong/deck/pull/1335)

### Fixes
- Quoted type constraints are removed for Terraform. Type constraints in quotes were required in Terraform <= 0.11,
It is now deprecated and will be removed in a future Terraform versions. Thus, removed them from kong2tf generation, so as
to avoid potential errors in `terraform apply`. [#1412](https://github.com/Kong/deck/pull/1412)

## [v1.40.3]
> Release date: 2024/09/26
Expand Down Expand Up @@ -1822,6 +1843,8 @@ No breaking changes have been introduced in this release.

Debut release of decK

[v1.41.1]: https://github.com/Kong/deck/compare/v1.40.0...v1.41.1
[v1.41.0]: https://github.com/Kong/deck/compare/v1.40.3...v1.41.0
[v1.40.3]: https://github.com/Kong/deck/compare/v1.40.2...v1.40.3
[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
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.40.3/deck_1.40.3_linux_amd64.tar.gz -o deck.tar.gz
$ curl -sL https://github.com/kong/deck/releases/download/v1.41.1/deck_1.41.1_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.40.3/deck_1.40.3_windows_amd64.tar.gz -o deck.tar.gz
$ curl -sL https://github.com/kong/deck/releases/download/v1.41.1/deck_1.41.1_windows_amd64.tar.gz -o deck.tar.gz
$ tar -xzvf deck.tar.gz
```

Expand Down
45 changes: 33 additions & 12 deletions cmd/gateway_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ var (

func executeValidate(cmd *cobra.Command, _ []string) error {
mode := getMode(nil)
if validateOnline && mode == modeKonnect {
return fmt.Errorf("online validation not yet supported in konnect mode")
}
_ = sendAnalytics("validate", "", mode)
// read target file
// this does json schema validation as well
Expand All @@ -45,7 +42,7 @@ func executeValidate(cmd *cobra.Command, _ []string) error {
ctx := cmd.Context()
var kongClient *kong.Client
if validateOnline {
kongClient, err = getKongClient(ctx, targetContent)
kongClient, err = getKongClient(ctx, targetContent, mode)
if err != nil {
return err
}
Expand Down Expand Up @@ -143,10 +140,14 @@ func executeValidate(cmd *cobra.Command, _ []string) error {
return err
}

if validateKonnectCompatibility {
if errs := validate.KonnectCompatibility(targetContent); len(errs) != 0 {
if validateKonnectCompatibility || (mode == modeKonnect && validateOnline) {
if errs := validate.KonnectCompatibility(targetContent, dumpConfig); len(errs) != 0 {
return validate.ErrorsWrapper{Errors: errs}
}

if validateCmdRBACResourcesOnly {
return fmt.Errorf("[rbac] not yet supported by konnect")
}
}

if validateOnline {
Expand Down Expand Up @@ -212,7 +213,7 @@ this command unless --online flag is used.
return preRunSilenceEventsFlag()
}

if validateOnline {
if online {
short = short + " (online)"
long = long + "Validates against the Kong API, via communication with Kong. This increases the\n" +
"time for validation but catches significant errors. No resource is created in Kong.\n" +
Expand Down Expand Up @@ -255,6 +256,9 @@ this command unless --online flag is used.
validateCmd.Flags().BoolVar(&validateKonnectCompatibility, "konnect-compatibility",
false, "validate that the state file(s) are ready to be deployed to Konnect")

validateCmd.MarkFlagsMutuallyExclusive("konnect-compatibility", "workspace")
validateCmd.MarkFlagsMutuallyExclusive("konnect-compatibility", "rbac-resources-only")

if err := ensureGetAllMethods(); err != nil {
panic(err.Error())
}
Expand Down Expand Up @@ -285,9 +289,14 @@ func validateWithKong(
return validator.Validate(parsedFormatVersion)
}

func getKongClient(ctx context.Context, targetContent *file.Content) (*kong.Client, error) {
func getKongClient(
ctx context.Context, targetContent *file.Content, mode mode,
) (*kong.Client, error) {
workspaceName := validateWorkspace
if validateWorkspace != "" {
if mode == modeKonnect {
return nil, fmt.Errorf("[workspaces] not supported by Konnect - use control planes instead")
}
// check if workspace exists
workspaceName := getWorkspaceName(validateWorkspace, targetContent, false)
workspaceExists, err := workspaceExists(ctx, rootConfig, workspaceName)
Expand All @@ -299,10 +308,22 @@ func getKongClient(ctx context.Context, targetContent *file.Content) (*kong.Clie
}
}

wsConfig := rootConfig.ForWorkspace(workspaceName)
kongClient, err := reconcilerUtils.GetKongClient(wsConfig)
if err != nil {
return nil, err
var (
kongClient *kong.Client
err error
)
if mode == modeKonnect {
kongClient, err = GetKongClientForKonnectMode(ctx, &konnectConfig)
if err != nil {
return nil, err
}
dumpConfig.KonnectControlPlane = konnectControlPlane
} else {
wsConfig := rootConfig.ForWorkspace(workspaceName)
kongClient, err = reconcilerUtils.GetKongClient(wsConfig)
if err != nil {
return nil, err
}
}
return kongClient, nil
}
Expand Down
57 changes: 55 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,94 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
golang.org/x/sync v0.8.0
k8s.io/api v0.31.0
k8s.io/apiextensions-apiserver v0.31.0
k8s.io/apimachinery v0.31.0
k8s.io/client-go v0.31.0
k8s.io/code-generator v0.31.0
sigs.k8s.io/gateway-api v1.1.0
sigs.k8s.io/yaml v1.4.0
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/avast/retry-go/v4 v4.6.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/docker v26.1.4+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fatih/camelcase v1.0.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/hashicorp/go-memdb v1.3.4 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/spdystream v0.4.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/pb33f/doctor v0.0.6 // indirect
github.com/pb33f/libopenapi v0.16.13 // indirect
github.com/pb33f/libopenapi-validator v0.0.49 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sethvargo/go-password v0.3.0 // indirect
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
github.com/sirupsen/logrus v1.9.3 // 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
github.com/xlab/treeprint v1.2.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go4.org/netipx v0.0.0-20230728184502-ec4c8b891b28 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/time v0.5.0 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/cli-runtime v0.30.1 // indirect
k8s.io/component-base v0.31.0 // indirect
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
k8s.io/kubectl v0.30.1 // indirect
sigs.k8s.io/kind v0.23.0 // indirect
sigs.k8s.io/kustomize/api v0.17.2 // indirect
sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect
)

require (
Expand Down Expand Up @@ -96,6 +148,7 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/kong/go-slugify v1.0.0 // indirect
github.com/kong/kubernetes-ingress-controller/v3 v3.2.4
github.com/kong/kubernetes-testing-framework v0.47.1
github.com/kong/semver/v4 v4.0.1 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect
Expand All @@ -108,7 +161,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mozillazg/go-unidecode v0.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
github.com/pterm/pterm v0.12.79 // indirect
Expand Down
Loading

0 comments on commit 850977a

Please sign in to comment.