From 5903dfc6276113c93940f26a4ab94623fe18481d Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 19 Feb 2021 11:30:09 +0100 Subject: [PATCH] Include prerelease data in k8s version constraints This ensures the advertised version from e.g. GKE or EKS (for example `v1.17.15-gke.800`) do not trigger a false warning. Signed-off-by: Hidde Beydals --- cmd/flux/check.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/flux/check.go b/cmd/flux/check.go index 83fec660..5e1a24f3 100644 --- a/cmd/flux/check.go +++ b/cmd/flux/check.go @@ -81,11 +81,11 @@ func runCheckCmd(cmd *cobra.Command, args []string) error { fluxCheck() - if !kubectlCheck(ctx, ">=1.18.0") { + if !kubectlCheck(ctx, ">=1.18.0-0") { checkFailed = true } - if !kubernetesCheck(">=1.16.0") { + if !kubernetesCheck(">=1.16.0-0") { checkFailed = true } @@ -158,7 +158,7 @@ func kubectlCheck(ctx context.Context, constraint string) bool { c, _ := semver.NewConstraint(constraint) if !c.Check(v) { - logger.Failuref("kubectl version must be %s", constraint) + logger.Failuref("kubectl version %s < %s", v.Original(), constraint) return false } @@ -193,7 +193,7 @@ func kubernetesCheck(constraint string) bool { c, _ := semver.NewConstraint(constraint) if !c.Check(v) { - logger.Failuref("Kubernetes version must be %s", constraint) + logger.Failuref("Kubernetes version %s < %s", v.Original(), constraint) return false }