1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-13 05:34:11 +00:00

Refactor reconcilation

Add role based add/delete for services

Use pointers for hosts

Consistent log format
This commit is contained in:
galal-hussein
2017-12-01 01:16:45 +02:00
parent 7699c6b5f0
commit d1f78f0b40
20 changed files with 341 additions and 202 deletions

View File

@@ -11,17 +11,17 @@ import (
"github.com/rancher/types/apis/cluster.cattle.io/v1"
)
func runKubeAPI(host hosts.Host, etcdHosts []hosts.Host, kubeAPIService v1.KubeAPIService) error {
func runKubeAPI(host *hosts.Host, etcdHosts []*hosts.Host, kubeAPIService v1.KubeAPIService) error {
etcdConnString := GetEtcdConnString(etcdHosts)
imageCfg, hostCfg := buildKubeAPIConfig(host, kubeAPIService, etcdConnString)
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, KubeAPIContainerName, host.Address, ControlRole)
}
func removeKubeAPI(host hosts.Host) error {
func removeKubeAPI(host *hosts.Host) error {
return docker.DoRemoveContainer(host.DClient, KubeAPIContainerName, host.Address)
}
func buildKubeAPIConfig(host hosts.Host, kubeAPIService v1.KubeAPIService, etcdConnString string) (*container.Config, *container.HostConfig) {
func buildKubeAPIConfig(host *hosts.Host, kubeAPIService v1.KubeAPIService, etcdConnString string) (*container.Config, *container.HostConfig) {
imageCfg := &container.Config{
Image: kubeAPIService.Image,
Entrypoint: []string{"kube-apiserver",
@@ -61,7 +61,7 @@ func buildKubeAPIConfig(host hosts.Host, kubeAPIService v1.KubeAPIService, etcdC
for arg, value := range kubeAPIService.ExtraArgs {
cmd := fmt.Sprintf("--%s=%s", arg, value)
imageCfg.Cmd = append(imageCfg.Cmd, cmd)
imageCfg.Entrypoint = append(imageCfg.Entrypoint, cmd)
}
return imageCfg, hostCfg
}