Example #1
0
func (u *UniqueScheduler) Schedule(c *citadel.Image, e *citadel.Engine) (bool, error) {
	containers, err := e.ListContainers(false, false, "")
	if err != nil {
		return false, err
	}

	if u.hasImage(c, containers) {
		return false, nil
	}

	return true, nil
}
Example #2
0
func (s *PortScheduler) Schedule(i *citadel.Image, e *citadel.Engine) (bool, error) {
	containers, err := e.ListContainers(false, false, "")
	if err != nil {
		return false, err
	}

	if s.hasConflictingPorts(i.BindPorts, containers) {
		return false, nil
	}

	return true, nil
}
Example #3
0
func setEngineClient(docker *citadel.Engine, tlsConfig *tls.Config) error {
	var tc *tls.Config
	u, err := url.Parse(docker.Addr)
	if err != nil {
		return err
	}

	if u.Scheme == "https" {
		tc = tlsConfig
	}

	return docker.Connect(tc)
}
Example #4
0
func (i *ImageScheduler) Schedule(c *citadel.Image, e *citadel.Engine) (bool, error) {
	fullImage := c.Name

	if !strings.Contains(fullImage, ":") {
		fullImage = fmt.Sprintf("%s:latest", fullImage)
	}

	images, err := e.ListImages()
	if err != nil {
		return false, err
	}

	if i.containsImage(fullImage, images) {
		return true, nil
	}

	return false, nil
}
Example #5
0
func setEngineClientAuth(docker *citadel.Engine, username, password, email string) {
	docker.SetClientAuth(username, password, email)
}