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:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user