Use new kubectl var everywhere

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2019-01-31 22:48:19 +00:00
parent b16484e95d
commit f9a228c86e
3 changed files with 13 additions and 4 deletions

View File

@ -51,6 +51,7 @@ type Details struct {
}
func (p *Certmanager) Setup(cfg *config.Config) error {
p.config = cfg
if p.Name == "" {
return fmt.Errorf("Name field must be set on Certmanager addon")
}
@ -62,12 +63,14 @@ func (p *Certmanager) Setup(cfg *config.Config) error {
if p.Tiller == nil {
return fmt.Errorf("Tiller field must be set on Certmanager addon")
}
if p.config.Kubectl == "" {
return fmt.Errorf("path to kubectl must be provided")
}
var err error
p.tillerDetails, err = p.Tiller.Details()
if err != nil {
return err
}
p.config = cfg
p.chart = &chart.Chart{
Tiller: p.Tiller,
ReleaseName: "chart-certmanager-" + p.Name,
@ -88,7 +91,7 @@ func (p *Certmanager) Setup(cfg *config.Config) error {
// Provision will actually deploy this instance of Pebble-ingress to the cluster.
func (p *Certmanager) Provision() error {
if err := exec.Command("kubectl", "apply", "-f", p.config.RepoRoot+"/deploy/manifests/00-crds.yaml").Run(); err != nil {
if err := exec.Command(p.config.Kubectl, "apply", "-f", p.config.RepoRoot+"/deploy/manifests/00-crds.yaml").Run(); err != nil {
return fmt.Errorf("Error install cert-manager CRD manifests: %v", err)
}

View File

@ -74,7 +74,7 @@ func (v *VaultInitializer) Init() error {
// Currently, it's possible that the connection gets dropped causing later
// init commands to fail.
args := []string{"port-forward", "-n", v.Details.Namespace, v.Details.PodName, fmt.Sprintf("%d:8200", listenPort)}
cmd := exec.Command("kubectl", args...)
cmd := exec.Command(v.Details.Kubectl, args...)
err := cmd.Start()
if err != nil {
return fmt.Errorf("Error starting port-forward: %s", err.Error())

View File

@ -57,6 +57,9 @@ type Vault struct {
}
type Details struct {
// Kubectl is the path to kubectl
Kubectl string
// Host is the hostname that can be used to connect to Pebble
Host string
@ -98,7 +101,10 @@ func (v *Vault) Setup(cfg *config.Config) error {
if err != nil {
return err
}
if cfg.Kubectl == "" {
return fmt.Errorf("path to kubectl must be set")
}
v.details.Kubectl = cfg.Kubectl
v.tillerDetails, err = v.Tiller.Details()
if err != nil {
return err