Skip to content

Commit

Permalink
feat(platform): add etcd config
Browse files Browse the repository at this point in the history
  • Loading branch information
dihu committed Sep 28, 2020
1 parent b0a0e46 commit 4288ced
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pkg/platform/provider/baremetal/cluster/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand All @@ -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))
Expand Down
5 changes: 5 additions & 0 deletions pkg/platform/provider/baremetal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -122,3 +123,7 @@ type AuthzWebhook struct {
type Business struct {
Enabled bool `yaml:"enabled"`
}

type Etcd struct {
ExtraArgs map[string]string `yaml:"extraArgs"`
}

0 comments on commit 4288ced

Please sign in to comment.