Skip to content
This repository has been archived by the owner on Dec 21, 2019. It is now read-only.

Commit

Permalink
feat(main): Add CLI flag for setting kubectl executable
Browse files Browse the repository at this point in the history
This lets users choose the executable (either by full path or via a
$PATH-entry) to be used when executing `kubectl`.

This is useful in, for example, OpenShift based setups.

This fixes #143
  • Loading branch information
tazjin authored and Vincent Ambo committed Jun 26, 2018
1 parent 92c5c84 commit bd5980a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ var (
app = kingpin.New("kontemplate", "simple Kubernetes resource templating")

// Global flags
includes = app.Flag("include", "Resource sets to include explicitly").Short('i').Strings()
excludes = app.Flag("exclude", "Resource sets to exclude explicitly").Short('e').Strings()
variables = app.Flag("var", "Provide variables to templates explicitly").Strings()
includes = app.Flag("include", "Resource sets to include explicitly").Short('i').Strings()
excludes = app.Flag("exclude", "Resource sets to exclude explicitly").Short('e').Strings()
variables = app.Flag("var", "Provide variables to templates explicitly").Strings()
kubectlBin = app.Flag("kubectl", "Path to the kubectl binary (default 'kubectl')").Default("kubectl").String()

// Commands
template = app.Command("template", "Template resource sets and print them")
Expand Down Expand Up @@ -206,7 +207,7 @@ func runKubectlWithResources(c *context.Context, kubectlArgs *[]string, resource
continue
}

kubectl := exec.Command("kubectl", args...)
kubectl := exec.Command(*kubectlBin, args...)

stdin, err := kubectl.StdinPipe()
if err != nil {
Expand Down

0 comments on commit bd5980a

Please sign in to comment.