From d4bea3e801cd8b5699549e35c3adf2ef372ea09d Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Sun, 20 Oct 2019 19:40:45 +0100 Subject: [PATCH] Fix issues with PR for cert-manager Corrects the order of the arguments for the apply command which stopped the CRD from working. Also adds app to the list of available. Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- Gopkg.lock | 6 +++--- Gopkg.toml | 2 +- README.md | 3 +++ pkg/cmd/certmanager_app.go | 13 +++++++++---- pkg/cmd/kubernetes_exec.go | 6 ++++++ vendor/github.com/alexellis/go-execute/exec.go | 7 ++++++- 6 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 08fd58ac..b112663d 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -2,12 +2,12 @@ [[projects]] - digest = "1:7366cf6efe9415e6a2d2cda509ca9b2b5e79cbae6a92c47b1b55d447ceaf7386" + digest = "1:5f3df16029b0602205733ba18f315ef0980c6d50cb83a5e033a18f5e25b21b88" name = "github.com/alexellis/go-execute" packages = ["."] pruneopts = "UT" - revision = "08963d2869bc81bfe270848dccd5b97a20f3b2fd" - version = "0.1.0" + revision = "f43ca01b248ab8a3302c50770c30945d18546851" + version = "0.1.1" [[projects]] digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be" diff --git a/Gopkg.toml b/Gopkg.toml index 291c9677..cdaea86a 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -8,5 +8,5 @@ [[constraint]] - version = "0.1.0" + version = "0.1.1" name = "github.com/alexellis/go-execute" diff --git a/README.md b/README.md index 6072d649..a269d159 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,9 @@ k3sup app install metrics-server # PC only # Get a public IP / Service LoadBalancer via DigitalOcean # or Packet.com k3sup app install inlets-operator # PC only + +# cert-manager - obtain free TLS certificates from LetsEncrypt +k3sup app install cert-manager ``` Find out more: diff --git a/pkg/cmd/certmanager_app.go b/pkg/cmd/certmanager_app.go index dc088e8d..8bde8eef 100644 --- a/pkg/cmd/certmanager_app.go +++ b/pkg/cmd/certmanager_app.go @@ -14,8 +14,8 @@ func makeInstallCertManager() *cobra.Command { var certManager = &cobra.Command{ Use: "cert-manager", Short: "Install cert-manager", - Long: "Install Cert-Manager", - Example: "k3sup install cert-manager --namespace cert-manager", + Long: "Install cert-manager for obtaining TLS certificates from LetsEncrypt", + Example: "k3sup install cert-manager", SilenceUsage: true, } @@ -86,12 +86,17 @@ func makeInstallCertManager() *cobra.Command { return err } - err = kubectl("apply", "-f", "--validate", "false", "https://raw.githubusercontent.com/jetstack/cert-manager/release-0.11/deploy/manifests/00-crds.yaml") + log.Printf("Applying CRD\n") + + res, err := kubectlTask("apply", "--validate=false", "-f", "https://raw.githubusercontent.com/jetstack/cert-manager/release-0.11/deploy/manifests/00-crds.yaml") if err != nil { return err } + if len(res.Stderr) > 0 { + return fmt.Errorf("Error applying CRD: %s", res.Stderr) + } - err = kubectl("apply", "-n", namespace, "-R", "-f", outputPath) + err = kubectl("apply", "-R", "-f", outputPath) if err != nil { return err } diff --git a/pkg/cmd/kubernetes_exec.go b/pkg/cmd/kubernetes_exec.go index 6ee138b4..8510e370 100644 --- a/pkg/cmd/kubernetes_exec.go +++ b/pkg/cmd/kubernetes_exec.go @@ -43,6 +43,12 @@ func getArchitecture() string { func templateChart(basePath, chart, namespace, outputPath, values string, overrides map[string]string) error { + rmErr := os.RemoveAll(outputPath) + + if rmErr != nil { + log.Printf("Error cleaning up: %s, %s\n", outputPath, rmErr.Error()) + } + mkErr := os.MkdirAll(outputPath, 0700) if mkErr != nil { return mkErr diff --git a/vendor/github.com/alexellis/go-execute/exec.go b/vendor/github.com/alexellis/go-execute/exec.go index e4b96efe..85f9cbe1 100644 --- a/vendor/github.com/alexellis/go-execute/exec.go +++ b/vendor/github.com/alexellis/go-execute/exec.go @@ -23,7 +23,12 @@ type ExecResult struct { } func (et ExecTask) Execute() (ExecResult, error) { - fmt.Println("exec: ", et.Command) + argsSt := "" + if len(et.Args) > 0 { + argsSt = strings.Join(et.Args, " ") + } + + fmt.Println("exec: ", et.Command, argsSt) var cmd *exec.Cmd