diff --git a/pkg/cli/cmds/server.go b/pkg/cli/cmds/server.go index 5d1ca1184baa..34eb21d4732c 100644 --- a/pkg/cli/cmds/server.go +++ b/pkg/cli/cmds/server.go @@ -45,6 +45,7 @@ type Server struct { DisableAgent bool KubeConfigOutput string KubeConfigMode string + HelmJobImage string TLSSan cli.StringSlice BindAddress string EnablePProf bool @@ -252,6 +253,11 @@ var ServerFlags = []cli.Flag{ Destination: &ServerConfig.KubeConfigMode, EnvVar: version.ProgramUpper + "_KUBECONFIG_MODE", }, + &cli.StringFlag{ + Name: "helm-job-image", + Usage: "(helm) Default image to use for helm jobs", + Destination: &ServerConfig.HelmJobImage, + }, ServerToken, &cli.StringFlag{ Name: "token-file", diff --git a/pkg/cli/server/server.go b/pkg/cli/server/server.go index caf86c254f9b..59e5ad0eb055 100644 --- a/pkg/cli/server/server.go +++ b/pkg/cli/server/server.go @@ -128,6 +128,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont serverConfig.ControlConfig.DataDir = cfg.DataDir serverConfig.ControlConfig.KubeConfigOutput = cfg.KubeConfigOutput serverConfig.ControlConfig.KubeConfigMode = cfg.KubeConfigMode + serverConfig.ControlConfig.HelmJobImage = cfg.HelmJobImage serverConfig.ControlConfig.Rootless = cfg.Rootless serverConfig.ControlConfig.ServiceLBNamespace = cfg.ServiceLBNamespace serverConfig.ControlConfig.SANs = util.SplitStringSlice(cfg.TLSSan) diff --git a/pkg/daemons/config/types.go b/pkg/daemons/config/types.go index feb9a444dd2a..9034b1b334be 100644 --- a/pkg/daemons/config/types.go +++ b/pkg/daemons/config/types.go @@ -167,6 +167,7 @@ type Control struct { ServiceNodePortRange *utilnet.PortRange KubeConfigOutput string KubeConfigMode string + HelmJobImage string DataDir string Datastore endpoint.Config `json:"-"` Disables map[string]bool diff --git a/pkg/server/server.go b/pkg/server/server.go index 0f8be7403c7f..45bae0cfdc4f 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -207,7 +207,9 @@ func coreControllers(ctx context.Context, sc *Context, config *Config) error { } // apply SystemDefaultRegistry setting to Helm before starting controllers - if config.ControlConfig.SystemDefaultRegistry != "" { + if config.ControlConfig.HelmJobImage != "" { + helmchart.DefaultJobImage = config.ControlConfig.HelmJobImage + } else if config.ControlConfig.SystemDefaultRegistry != "" { helmchart.DefaultJobImage = config.ControlConfig.SystemDefaultRegistry + "/" + helmchart.DefaultJobImage }