From f9a228c86ea3bc7d24e23f6c5ceeaec88d244d26 Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Thu, 31 Jan 2019 22:48:19 +0000 Subject: [PATCH] Use new kubectl var everywhere Signed-off-by: James Munnelly --- test/e2e/framework/addon/certmanager/addon.go | 7 +++++-- test/e2e/framework/addon/vault/setup.go | 2 +- test/e2e/framework/addon/vault/vault.go | 8 +++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/test/e2e/framework/addon/certmanager/addon.go b/test/e2e/framework/addon/certmanager/addon.go index 1bbd385ef..7fedb3a1b 100644 --- a/test/e2e/framework/addon/certmanager/addon.go +++ b/test/e2e/framework/addon/certmanager/addon.go @@ -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) } diff --git a/test/e2e/framework/addon/vault/setup.go b/test/e2e/framework/addon/vault/setup.go index 77c5d1866..419d32c10 100644 --- a/test/e2e/framework/addon/vault/setup.go +++ b/test/e2e/framework/addon/vault/setup.go @@ -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()) diff --git a/test/e2e/framework/addon/vault/vault.go b/test/e2e/framework/addon/vault/vault.go index 325335894..d8232c0de 100644 --- a/test/e2e/framework/addon/vault/vault.go +++ b/test/e2e/framework/addon/vault/vault.go @@ -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