From a41343e0ebb2e8609f1092d41c77a7951ed18f18 Mon Sep 17 00:00:00 2001 From: Vitor Savian Date: Wed, 28 Jun 2023 12:31:58 -0300 Subject: [PATCH] Adding cli to custom klipper helm image (#7682) Adding cli to custom klipper helm image Signed-off-by: Vitor Savian (cherry picked from commit 0809187cffc3dbdb94667b32fd6b7d2274c164bb) Signed-off-by: Brad Davidson --- pkg/cli/cmds/server.go | 6 ++++++ pkg/cli/server/server.go | 1 + pkg/daemons/config/types.go | 1 + pkg/server/server.go | 4 +++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/cli/cmds/server.go b/pkg/cli/cmds/server.go index f1eab40a8526..ea25526af710 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 @@ -246,6 +247,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 78af61d63402..b9603e12c67c 100644 --- a/pkg/cli/server/server.go +++ b/pkg/cli/server/server.go @@ -118,6 +118,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 89e0d538e28b..0a59e2f438be 100644 --- a/pkg/daemons/config/types.go +++ b/pkg/daemons/config/types.go @@ -165,6 +165,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 ab549c232359..03a0d30c5d19 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -208,7 +208,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 }