Skip to content

Commit

Permalink
changing way to determig if runAsUser was set
Browse files Browse the repository at this point in the history
Signed-off-by: wejdross <lukaszwidera1993@gmail.com>
  • Loading branch information
wejdross committed Mar 30, 2023
1 parent 4fa05af commit 984d914
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ var (
Destination: &restore.Cfg.RunAsUser,
Required: false,
Name: "runAsUser",
Value: -1,
Usage: "Optional ; Set user UID, via cli or via env: ",
EnvVars: []string{
"RUNASUSER",
Expand Down Expand Up @@ -342,7 +341,7 @@ func RunRestore(ctx *cli.Context) error {
},
},
}
if restore.Cfg.RunAsUser != -1 {
if ctx.IsSet("runAsUser") {
restoreObject.Spec.PodSecurityContext = &corev1.PodSecurityContext{
RunAsUser: &restore.Cfg.RunAsUser,
}
Expand Down Expand Up @@ -376,3 +375,10 @@ func RunRestore(ctx *cli.Context) error {
logger.Info(fmt.Sprintf("To access logs please run:\tkubectl -n %s logs jobs/restore-%s", restore.Cfg.Namespace, restoreName))
return nil
}

func CheckIfFlagWasSet(flagName string) {
for _, val := range Command.Flags {
fmt.Println(val.Names(), val.IsSet())
}
log.Fatal("done")
}

0 comments on commit 984d914

Please sign in to comment.