Skip to content

Commit

Permalink
fix: clarify validate konnect behaviors
Browse files Browse the repository at this point in the history
Signed-off-by: John Harris <[email protected]>
  • Loading branch information
johnharris85 committed Aug 22, 2024
1 parent e23136a commit 20f5690
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
14 changes: 8 additions & 6 deletions cmd/gateway_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,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 @@ -211,11 +211,13 @@ this command unless --online flag is used.
"", "validate configuration of a specific workspace "+
"(Kong Enterprise only).\n"+
"This takes precedence over _workspace fields in state files.")
validateCmd.Flags().IntVar(&validateParallelism, "parallelism",
10, "Maximum number of concurrent requests to Kong.")
validateCmd.Flags().BoolVar(&validateKonnectCompatibility, "konnect-compatibility",
false, "validate that the state file(s) are ready to be deployed to Konnect")

if online {
validateCmd.Flags().IntVar(&validateParallelism, "parallelism",
10, "Maximum number of concurrent requests to Kong.")
} else {
validateCmd.Flags().BoolVar(&validateKonnectCompatibility, "konnect-compatibility",
false, "validate that the state file(s) are ready to be deployed to Konnect")
}
if err := ensureGetAllMethods(); err != nil {
panic(err.Error())
}
Expand Down
5 changes: 3 additions & 2 deletions validate/konnect_compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"fmt"
"strconv"

"github.com/kong/go-database-reconciler/pkg/cprint"
"github.com/kong/go-database-reconciler/pkg/file"
"github.com/kong/go-kong/kong"
)

var (
errKonnect = "[konnect] section not specified - ensure details are set via cli flags"
errKonnect = "[konnect] section not specified - ensure details are set via cli flags when executing live commands against Konnect"
errWorkspace = "[workspaces] not supported by Konnect - use control planes instead"
errNoVersion = "[version] unable to determine decK file version"
errBadVersion = fmt.Sprintf("[version] decK file version must be '%.1f' or greater", supportedVersion)
Expand Down Expand Up @@ -47,7 +48,7 @@ func KonnectCompatibility(targetContent *file.Content) []error {
}

if targetContent.Konnect == nil {
errs = append(errs, errors.New(errKonnect))
cprint.UpdatePrintf("Warning: " + errKonnect + "\n")
}

versionNumber, err := strconv.ParseFloat(targetContent.FormatVersion, 32)
Expand Down

0 comments on commit 20f5690

Please sign in to comment.