forked from helm/helm-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doctor.go
43 lines (35 loc) · 986 Bytes
/
doctor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package action
import (
"os/exec"
"github.com/helm/helm/log"
helm "github.com/helm/helm/util"
)
// Doctor helps you see what's wrong with your helm setup
func Doctor(home string) {
log.Info("Checking things locally...")
CheckLocalPrereqs(home)
CheckKubePrereqs()
log.Info("Everything looks good! Happy helming!")
}
// CheckAllPrereqs makes sure we have all the tools we need for overall
// helm success
func CheckAllPrereqs(home string) {
CheckLocalPrereqs(home)
CheckKubePrereqs()
}
// CheckKubePrereqs makes sure we have the tools necessary to interact
// with a kubernetes cluster
func CheckKubePrereqs() {
ensureCommand("kubectl")
}
// CheckLocalPrereqs makes sure we have all the tools we need to work with
// charts locally
func CheckLocalPrereqs(home string) {
helm.EnsureHome(home)
ensureCommand("git")
}
func ensureCommand(command string) {
if _, err := exec.LookPath(command); err != nil {
log.Die("Could not find '%s' on $PATH: %s", command, err)
}
}