1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-13 21:52:08 +00:00

Use Cluster structure

Use separate cluster package

Save cluster state and certs to kubernetes

Handle Remove and sync cluster state/crts

Reuse kubernetes client and combine image and version

Separate building functions and small fixes
This commit is contained in:
galal-hussein
2017-11-02 12:07:10 +02:00
parent c4677f8ee6
commit 9974d53e57
23 changed files with 735 additions and 323 deletions

View File

@@ -8,25 +8,15 @@ import (
"github.com/rancher/rke/pki"
)
type KubeAPI struct {
Version string `yaml:"version"`
Image string `yaml:"image"`
ServiceClusterIPRange string `yaml:"service_cluster_ip_range"`
}
func runKubeAPI(host hosts.Host, etcdHosts []hosts.Host, kubeAPIService KubeAPI) error {
etcdConnString := getEtcdConnString(etcdHosts)
imageCfg, hostCfg := buildKubeAPIConfig(host, kubeAPIService, etcdConnString)
err := docker.DoRunContainer(imageCfg, hostCfg, KubeAPIContainerName, &host, ControlRole)
if err != nil {
return err
}
return nil
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, KubeAPIContainerName, host.Hostname, ControlRole)
}
func buildKubeAPIConfig(host hosts.Host, kubeAPIService KubeAPI, etcdConnString string) (*container.Config, *container.HostConfig) {
imageCfg := &container.Config{
Image: kubeAPIService.Image + ":" + kubeAPIService.Version,
Image: kubeAPIService.Image,
Cmd: []string{"/hyperkube",
"apiserver",
"--insecure-bind-address=0.0.0.0",