Skip to content

Commit

Permalink
Signed-off-by: Richard Nurser <richard.nurser@gmail.com>
Browse files Browse the repository at this point in the history
use KUBECONFIG if it is set
  • Loading branch information
Richard Nurser committed Aug 1, 2022
1 parent 9ddefda commit 136c627
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ var applyCmd = &cobra.Command{
opt.Namespace, _ = cmd.Flags().GetString("namespace")
opt.TargetOwner, _ = cmd.Flags().GetString("target-owner")
targetSecrets, _ := cmd.Flags().GetStringSlice("secrets")
kubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
kubeconfig := ""
if os.Getenv("KUBECONFIG") == "" {
kubeconfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
} else {
kubeconfig = os.Getenv("KUBECONFIG")
}
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
if err != nil {
log.Fatal(err)
Expand Down
7 changes: 6 additions & 1 deletion cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ var generateCmd = &cobra.Command{
if opt.SecretStore && !opt.CopySecretRefs {
log.Warnf("Warning! Backend Secret References are not being copied to the secret store namespaces! This could lead to unintended behavior (--secret-store=true --copy-secret-refs=false)")
}
kubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
kubeconfig := ""
if os.Getenv("KUBECONFIG") == "" {
kubeconfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
} else {
kubeconfig = os.Getenv("KUBECONFIG")
}
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 136c627

Please # to comment.