示例#1
0
func (sv *supervisor) tagWorker(provider, region, size string) {
	if sv.provider != provider || sv.region != region || sv.size != size {
		sv.Remove(QuiltTag)
	}
	tags := map[string]string{
		docker.SystemLabel("provider"): provider,
		docker.SystemLabel("region"):   region,
		docker.SystemLabel("size"):     size,
	}

	ro := docker.RunOptions{
		Name:        QuiltTag,
		Image:       images[QuiltTag],
		Labels:      tags,
		NetworkMode: "host",
	}
	if err := sv.dk.Run(ro); err != nil {
		log.WithError(err).Warn("Failed to tag minion.")
	}
}
示例#2
0
// AffinityStr is passed to Docker Swarm to implement the MachineRule.
func (mr MachineRule) AffinityStr() string {
	return toAffinity(docker.SystemLabel(mr.Attribute), !mr.Exclusive, mr.Value)
}