Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

Commit

Permalink
use k8s version parser
Browse files Browse the repository at this point in the history
Signed-off-by: Chuck Ha <chuckh@vmware.com>
  • Loading branch information
chuckha committed Jul 2, 2019
1 parent 966948d commit 453ac69
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kind/actions/cluster_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"bytes"
"fmt"
"html/template"
"strconv"
"strings"

"github.com/pkg/errors"
Expand All @@ -30,6 +29,7 @@ import (
"sigs.k8s.io/kind/pkg/cluster/nodes"
"sigs.k8s.io/kind/pkg/container/docker"
"sigs.k8s.io/kind/pkg/exec"
k8sverison "k8s.io/apimachinery/pkg/util/version"
)

// KubeadmJoinControlPlane joins a control plane to an existing Kubernetes cluster.
Expand Down Expand Up @@ -152,12 +152,12 @@ func KubeadmInit(clusterName, version string) error {
}
// Upload certs flag changed to non-experimental in >= 1.15
uploadCertsFlag := "--experimental-upload-certs"
parts := strings.Split(version, ".")
minor, err := strconv.Atoi(parts[1])
parsedVersion, err := k8sverison.ParseGeneric(version)
if err != nil {
return errors.WithStack(err)
}
if minor >= 15 {

if parsedVersion.Minor() >= 15 {
uploadCertsFlag = "--upload-certs"
}

Expand Down

0 comments on commit 453ac69

Please sign in to comment.