Browse Source

Allow agent to run rootless

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/6517/head
Brad Davidson 2 years ago committed by Brad Davidson
parent
commit
56bf7d6ad3
  1. 4
      pkg/cli/agent/agent.go
  2. 2
      pkg/cli/server/server.go

4
pkg/cli/agent/agent.go

@ -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 != "" {

2
pkg/cli/server/server.go

@ -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 {

Loading…
Cancel
Save