Skip to content

Commit

Permalink
Fix: First look whether kubectl exists or not
Browse files Browse the repository at this point in the history
Signed-off-by: GLVS Kiriti <[email protected]>
  • Loading branch information
GLVSKiriti authored and poiana committed Apr 2, 2024
1 parent 1a0b4ac commit d96836b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ var _ = events.Register(

func kubernetesClientToolLaunchedInContainer(h events.Helper) error {
if h.InContainer() {
cmd := exec.Command("kubectl")
kubectl, err := exec.LookPath("kubectl")
if err != nil {
h.Log().Warnf("kubectl is needed to launch this action")
return err
}

cmd := exec.Command(kubectl)
h.Log().Infof("Kubernetes Client Tool Launched In Container")
return cmd.Run()
}
return nil
Expand Down

0 comments on commit d96836b

Please sign in to comment.