Skip to content

Commit

Permalink
Review error messages, review todos
Browse files Browse the repository at this point in the history
  • Loading branch information
errordeveloper committed Jun 5, 2018
1 parent 34ae478 commit 63128a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cmd/eksctl/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ func doCreateCluster(cfg *eks.Config) error {

// TODO(p1): watch nodes joining

// TODO(p2): validate (like in kops)

// TODO(p2): addons

// check kubectl version, and offer install instructions if missing or old
// also check heptio-authenticator
// TODO(p2): and offer install instructions if missing
// TODO(p2): add sub-command for these checks
// TODO(p3): few more extensive checks, i.e. some basic validation
if err := utils.CheckAllCommands(kubeconfigPath); err != nil {
return err
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/utils/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ func CheckKubectlVersion() error {
kubectlPath, err := ktl.LookPath()
if err != nil {
return fmt.Errorf("kubectl not found, v1.10.0 or newever is required")
} else {
logger.Debug("kubectl: %q", kubectlPath)
}
logger.Debug("kubectl: %q", kubectlPath)

clientVersion, _, err := kubectl.GetVersionInfo(ktl)
logger.Debug("clientVersion=%#v err=%q", clientVersion, err.Error())
Expand All @@ -41,7 +40,7 @@ func CheckHeptioAuthenticatorAWS() error {
if err == nil {
logger.Debug("heptio-authenticator-aws: %q", path)
} else {
return fmt.Errorf("heptio-authenticator-aws not installed, you should install it")
return fmt.Errorf("heptio-authenticator-aws not installed")
}
return nil
}
Expand All @@ -59,19 +58,20 @@ func CheckAllCommands(kubeconfigPath string) error {
ktl := &kubectl.LocalClient{
GlobalArgs: []string{"--kubeconfig", kubeconfigPath},
}

suggestion := fmt.Sprintf("(check '%s %s version')", kubectlPath, strings.Join(ktl.GlobalArgs, " "))

_, serverVersion, err := kubectl.GetVersionInfo(ktl)
if err != nil {
suggestion := fmt.Sprintf("%s %s version", kubectlPath, strings.Join(ktl.GlobalArgs, " "))
return errors.Wrapf(err, "unable to use kubectl with the EKS cluster (check '%s')", suggestion)
return errors.Wrapf(err, "unable to use kubectl with the EKS cluster %s", suggestion)
}
version, err := semver.Parse(strings.TrimLeft(serverVersion, "v"))
if err != nil {
return errors.Wrapf(err, "parsing Kubernetes version string %q return by the EKS API server", version)
}
if version.Major == 1 && version.Minor < 10 {
return fmt.Errorf("Kubernetes version %s is unexpected with EKS, it should be v1.10.0 or newer", serverVersion)
return fmt.Errorf("Kubernetes version %s found, v1.10.0 or newer is expected with EKS %s", serverVersion, suggestion)
}
// TODO(p2): we can do a littl bit more here
} else {
logger.Debug("skipping kubectl integration ckecks, as writing kubeconfig file is disabled")
}
Expand Down

0 comments on commit 63128a9

Please sign in to comment.