Skip to content

Commit

Permalink
Allow agent to run rootless
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Davidson <[email protected]>
  • Loading branch information
brandond committed Nov 15, 2022
1 parent b221534 commit b09dea2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/cli/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func Run(ctx *cli.Context) error {
return err
}

if os.Getuid() != 0 && runtime.GOOS != "windows" {
return fmt.Errorf("agent must be ran as root")
if runtime.GOOS != "windows" && os.Getuid() != 0 && !cmds.AgentConfig.Rootless {
return fmt.Errorf("agent must be run as root, or with --rootless")
}

if cmds.AgentConfig.TokenFile != "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
}

if !cfg.DisableAgent && os.Getuid() != 0 && !cfg.Rootless {
return fmt.Errorf("must run as root unless --disable-agent is specified")
return fmt.Errorf("server must run as root, or with --rootless and/or --disable-agent")
}

if cfg.Rootless {
Expand Down

0 comments on commit b09dea2

Please sign in to comment.