From cc6264532c1e6af8e6a8ff4b33d5233e65fb9d1a Mon Sep 17 00:00:00 2001 From: Abdul Rehman Date: Fri, 31 Aug 2018 10:04:16 +0100 Subject: [PATCH 1/4] Added print of more info to debug errors Print error as debug on new line --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index d4ae065..f2795ce 100644 --- a/main.go +++ b/main.go @@ -256,7 +256,7 @@ func runKubectl(c *cli.Context) error { }) if err != nil { return fmt.Errorf( - "problem checking if resource %s/%s exists", name, kind) + "Problem checking if resource %s/%s exists.\nDebug info: %s", name, kind, err) } if exists { log.Printf( @@ -418,7 +418,7 @@ func deploy(c *cli.Context, r *ObjectResource) error { var err error exists, err = checkResourceExist(c, r) if err != nil { - return fmt.Errorf("problem checking if resource %s/%s exists", r.Kind, r.Name) + return fmt.Errorf("problem checking if resource %s/%s exists\nDebug info: %s", r.Kind, r.Name, err) } if r.CreateOnly && exists { From c5dd73932a684ec731cbe59cca85b7613b0a2ac6 Mon Sep 17 00:00:00 2001 From: Abdul Rehman Date: Fri, 31 Aug 2018 10:17:58 +0100 Subject: [PATCH 2/4] Added bool flag to skip healthchecks Allows 'fire and forget' mode --- main.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index f2795ce..a793892 100644 --- a/main.go +++ b/main.go @@ -57,6 +57,9 @@ var ( // dryRun Defaults to false dryRun bool + // skipChecks Defaults to false + skipChecks bool + // deleteReources bool deleteResources bool @@ -108,6 +111,11 @@ func main() { Usage: "if true, the server's certificate will not be checked for validity", EnvVar: "INSECURE_SKIP_TLS_VERIFY,PLUGIN_INSECURE_SKIP_TLS_VERIFY", }, + cli.BoolFlag{ + Name: "skip-checks", + Usage: "if true, the resources will be deployed without a subsequent healthcheck", + Destination: &deleteResources, + }, cli.StringFlag{ Name: "kube-server, s", Usage: "kubernetes api server `URL`", @@ -256,7 +264,7 @@ func runKubectl(c *cli.Context) error { }) if err != nil { return fmt.Errorf( - "Problem checking if resource %s/%s exists.\nDebug info: %s", name, kind, err) + "problem checking if resource %s/%s exists", name, kind) } if exists { log.Printf( @@ -418,7 +426,7 @@ func deploy(c *cli.Context, r *ObjectResource) error { var err error exists, err = checkResourceExist(c, r) if err != nil { - return fmt.Errorf("problem checking if resource %s/%s exists\nDebug info: %s", r.Kind, r.Name, err) + return fmt.Errorf("problem checking if resource %s/%s exists", r.Kind, r.Name) } if r.CreateOnly && exists { @@ -493,7 +501,7 @@ func deploy(c *cli.Context, r *ObjectResource) error { r.Name = strings.Split(resourceName, "/")[1] } - if !c.Bool(FlagDelete) && isWatchableResouce(r) { + if !c.Bool(FlagDelete) && isWatchableResouce(r) && !skipChecks { return watchResource(c, r) } return nil From fbf2fe36eff52d12cca5366a2bee2a2871d5063d Mon Sep 17 00:00:00 2001 From: Abdul Rehman Date: Fri, 31 Aug 2018 10:18:49 +0100 Subject: [PATCH 3/4] Update main.go --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index a793892..d1b1fe5 100644 --- a/main.go +++ b/main.go @@ -114,7 +114,7 @@ func main() { cli.BoolFlag{ Name: "skip-checks", Usage: "if true, the resources will be deployed without a subsequent healthcheck", - Destination: &deleteResources, + Destination: &skipChecks, }, cli.StringFlag{ Name: "kube-server, s", From 15d868e986e19f3f42d0d6f81010acf2b311a6ab Mon Sep 17 00:00:00 2001 From: Abdul Rehman Date: Fri, 28 Sep 2018 12:48:46 +0100 Subject: [PATCH 4/4] Ran go fmt --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 89d3253..a30dd2c 100644 --- a/main.go +++ b/main.go @@ -114,8 +114,8 @@ func main() { EnvVar: "INSECURE_SKIP_TLS_VERIFY,PLUGIN_INSECURE_SKIP_TLS_VERIFY", }, cli.BoolFlag{ - Name: "skip-checks", - Usage: "if true, the resources will be deployed without a subsequent healthcheck", + Name: "skip-checks", + Usage: "if true, the resources will be deployed without a subsequent healthcheck", Destination: &skipChecks, }, cli.StringFlag{