From 4288ced2233d2eb5da8b4676e26a17dfa064ef07 Mon Sep 17 00:00:00 2001 From: dihu Date: Mon, 28 Sep 2020 14:15:08 +0800 Subject: [PATCH] feat(platform): add etcd config --- pkg/platform/provider/baremetal/cluster/kubeadm.go | 13 ++++--------- pkg/platform/provider/baremetal/config/config.go | 5 +++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/platform/provider/baremetal/cluster/kubeadm.go b/pkg/platform/provider/baremetal/cluster/kubeadm.go index 7784ac855..1cd68f2dc 100644 --- a/pkg/platform/provider/baremetal/cluster/kubeadm.go +++ b/pkg/platform/provider/baremetal/cluster/kubeadm.go @@ -156,6 +156,10 @@ func (p *Provider) getClusterConfiguration(c *v1.Cluster) *kubeadmv1beta2.Cluste utilruntime.Must(json.Merge(&config.Etcd, &c.Spec.Etcd)) if config.Etcd.Local != nil { config.Etcd.Local.ImageTag = images.Get().ETCD.Tag + + if config.Etcd.Local.ExtraArgs != nil && p.config.Etcd.ExtraArgs != nil { + utilruntime.Must(mergo.Merge(&config.Etcd.Local.ExtraArgs, p.config.Etcd.ExtraArgs)) + } } return config @@ -198,9 +202,6 @@ func (p *Provider) getAPIServerExtraArgs(c *v1.Cluster) map[string]string { args["authorization-webhook-config-file"] = constants.KubernetesAuthzWebhookConfigFile args["authorization-mode"] = "Node,RBAC,Webhook" } - for k, v := range c.Spec.APIServerExtraArgs { - args[k] = v - } utilruntime.Must(mergo.Merge(&args, c.Spec.APIServerExtraArgs)) utilruntime.Must(mergo.Merge(&args, p.config.APIServer.ExtraArgs)) @@ -215,9 +216,6 @@ func (p *Provider) getControllerManagerExtraArgs(c *v1.Cluster) map[string]strin "cluster-cidr": c.Spec.ClusterCIDR, "service-cluster-ip-range": c.Status.ServiceCIDR, } - for k, v := range c.Spec.ControllerManagerExtraArgs { - args[k] = v - } utilruntime.Must(mergo.Merge(&args, c.Spec.ControllerManagerExtraArgs)) utilruntime.Must(mergo.Merge(&args, p.config.ControllerManager.ExtraArgs)) @@ -230,9 +228,6 @@ func (p *Provider) getSchedulerExtraArgs(c *v1.Cluster) map[string]string { "use-legacy-policy-config": "true", "policy-config-file": constants.KuberentesSchedulerPolicyConfigFile, } - for k, v := range c.Spec.SchedulerExtraArgs { - args[k] = v - } utilruntime.Must(mergo.Merge(&args, c.Spec.SchedulerExtraArgs)) utilruntime.Must(mergo.Merge(&args, p.config.Scheduler.ExtraArgs)) diff --git a/pkg/platform/provider/baremetal/config/config.go b/pkg/platform/provider/baremetal/config/config.go index 5a3b4a3dc..0f2851d73 100644 --- a/pkg/platform/provider/baremetal/config/config.go +++ b/pkg/platform/provider/baremetal/config/config.go @@ -56,6 +56,7 @@ type Config struct { Scheduler Scheduler `yaml:"scheduler"` AuthzWebhook AuthzWebhook `yaml:"authzWebhook"` Business Business `yaml:"business"` + Etcd Etcd `yaml:"etcd"` } func (c *Config) Save(filename string) error { @@ -122,3 +123,7 @@ type AuthzWebhook struct { type Business struct { Enabled bool `yaml:"enabled"` } + +type Etcd struct { + ExtraArgs map[string]string `yaml:"extraArgs"` +}