Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clarify validate konnect behaviors #1375

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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