示例#1
0
func configureUnits(coreos *CoreOS, node types.Node, cluster types.Cluster) {
	for _, unt := range cluster.GetUnits() {
		coreUnit := unit.New(unt.UnitName())
		coreUnit.Configure(unt)
		coreos.units[unt.UnitName()] = coreUnit
	}

	for _, unt := range unit.DefaultUnits() {
		coreos.units[unt.Name()] = unt
	}

	networkUnit := unit.Network(node)
	coreos.units[networkUnit.Name()] = networkUnit
}
示例#2
0
func (etcd2 Etcd2) setInitialClusterString(cluster types.Cluster) {
	initialClusterString := ""

	for _, node := range cluster.GetNodes() {
		nodeString := ""

		if initialClusterString != "" {
			initialClusterString = initialClusterString + ","
		}

		if etcd2.useHttps {
			nodeString = node.NodeName() + "=" + httpsAddress(node.NodeIp(), etcd2.peerPort)
		} else {
			nodeString = node.NodeName() + "=" + httpAddress(node.NodeIp(), etcd2.peerPort)
		}

		initialClusterString = initialClusterString + nodeString
	}

	etcd2.parameters["initial-cluster"] = initialClusterString
}
示例#3
0
func (etcd2 Etcd2) configureCluster(cluster types.Cluster) {
	etcd2.parameters["initial-cluster-token"] = cluster.GetToken()
	etcd2.parameters["initial-cluster-state"] = cluster.GetState()

	etcd2.setInitialClusterString(cluster)
}