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

feat(main): Add CLI flag for setting kubectl executable #145

Merged
merged 1 commit into from
Jun 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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