Skip to content

Commit

Permalink
fix: --kubeconfig parameter was being ignored in init and delete comm…
Browse files Browse the repository at this point in the history
…ands (#1363)
  • Loading branch information
pjuarezd authored Dec 7, 2022
1 parent 45f9a70 commit 0914eda
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
11 changes: 10 additions & 1 deletion kubectl-minio/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,17 @@ func (o *deleteCmd) run(writer io.Writer) error {
return err
}

path, _ := rootCmd.Flags().GetString(kubeconfig)

var parameters []string
if path != "" {
parameters = append(parameters, "--kubeconfig", path, "delete", "-f", "-")
} else {
parameters = append(parameters, "delete", "-f", "-")
}

// do kubectl apply
cmd := exec.Command("kubectl", "delete", "-f", "-")
cmd := exec.Command("kubectl", parameters...)

cmd.Stdin = strings.NewReader(string(yml))

Expand Down
10 changes: 9 additions & 1 deletion kubectl-minio/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,16 @@ func (o *operatorInitCmd) run(writer io.Writer) error {
return err
}

path, _ := rootCmd.Flags().GetString(kubeconfig)

var parameters []string
if path != "" {
parameters = append(parameters, "--kubeconfig", path, "apply", "-f", "-")
} else {
parameters = append(parameters, "apply", "-f", "-")
}
// do kubectl apply
cmd := exec.Command("kubectl", "apply", "-f", "-")
cmd := exec.Command("kubectl", parameters...)

cmd.Stdin = strings.NewReader(string(yml))

Expand Down

0 comments on commit 0914eda

Please sign in to comment.