mirror of
https://github.com/rancher/rke.git
synced 2025-09-25 14:48:06 +00:00
Structure and config changes
This commit is contained in:
@@ -16,7 +16,7 @@ func RunEtcdPlane(etcdHosts []hosts.Host, etcdService v1.ETCDService) error {
|
||||
initCluster := getEtcdInitialCluster(etcdHosts)
|
||||
for _, host := range etcdHosts {
|
||||
imageCfg, hostCfg := buildEtcdConfig(host, etcdService, initCluster)
|
||||
err := docker.DoRunContainer(host.DClient, imageCfg, hostCfg, EtcdContainerName, host.AdvertisedHostname, ETCDRole)
|
||||
err := docker.DoRunContainer(host.DClient, imageCfg, hostCfg, EtcdContainerName, host.Address, ETCDRole)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -28,7 +28,7 @@ func RunEtcdPlane(etcdHosts []hosts.Host, etcdService v1.ETCDService) error {
|
||||
func RemoveEtcdPlane(etcdHosts []hosts.Host) error {
|
||||
logrus.Infof("[%s] Tearing down Etcd Plane..", ETCDRole)
|
||||
for _, host := range etcdHosts {
|
||||
err := docker.DoRemoveContainer(host.DClient, EtcdContainerName, host.AdvertisedHostname)
|
||||
err := docker.DoRemoveContainer(host.DClient, EtcdContainerName, host.Address)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -41,11 +41,11 @@ func buildEtcdConfig(host hosts.Host, etcdService v1.ETCDService, initCluster st
|
||||
imageCfg := &container.Config{
|
||||
Image: etcdService.Image,
|
||||
Cmd: []string{"/usr/local/bin/etcd",
|
||||
"--name=etcd-" + host.AdvertisedHostname,
|
||||
"--name=etcd-" + host.HostnameOverride,
|
||||
"--data-dir=/etcd-data",
|
||||
"--advertise-client-urls=http://" + host.AdvertiseAddress + ":2379,http://" + host.AdvertiseAddress + ":4001",
|
||||
"--advertise-client-urls=http://" + host.InternalAddress + ":2379,http://" + host.InternalAddress + ":4001",
|
||||
"--listen-client-urls=http://0.0.0.0:2379",
|
||||
"--initial-advertise-peer-urls=http://" + host.AdvertiseAddress + ":2380",
|
||||
"--initial-advertise-peer-urls=http://" + host.InternalAddress + ":2380",
|
||||
"--listen-peer-urls=http://0.0.0.0:2380",
|
||||
"--initial-cluster-token=etcd-cluster-1",
|
||||
"--initial-cluster=" + initCluster,
|
||||
@@ -81,7 +81,7 @@ func buildEtcdConfig(host hosts.Host, etcdService v1.ETCDService, initCluster st
|
||||
func GetEtcdConnString(hosts []hosts.Host) string {
|
||||
connString := ""
|
||||
for i, host := range hosts {
|
||||
connString += "http://" + host.AdvertiseAddress + ":2379"
|
||||
connString += "http://" + host.InternalAddress + ":2379"
|
||||
if i < (len(hosts) - 1) {
|
||||
connString += ","
|
||||
}
|
||||
@@ -92,7 +92,7 @@ func GetEtcdConnString(hosts []hosts.Host) string {
|
||||
func getEtcdInitialCluster(hosts []hosts.Host) string {
|
||||
initialCluster := ""
|
||||
for i, host := range hosts {
|
||||
initialCluster += fmt.Sprintf("etcd-%s=http://%s:2380", host.AdvertisedHostname, host.AdvertiseAddress)
|
||||
initialCluster += fmt.Sprintf("etcd-%s=http://%s:2380", host.HostnameOverride, host.InternalAddress)
|
||||
if i < (len(hosts) - 1) {
|
||||
initialCluster += ","
|
||||
}
|
||||
|
Reference in New Issue
Block a user