Ejemplo n.º 1
0
func GetTemplateData(config *conf.Configuration, conn *zk.Conn) interface{} {

	apps, _ := marathon.FetchApps(config.Marathon.Endpoint)
	services, _ := service.All(conn, config.Bamboo.Zookeeper)

	return templateData{apps, services}
}
Ejemplo n.º 2
0
func GetTemplateData(config *conf.Configuration, conn *zk.Conn) interface{} {
	log.Println("Enter>> GetTemplateData")
	apps, _ := marathon.FetchApps(config.Marathon)
	services, _ := service.All(conn, config.Bamboo.Zookeeper)
	log.Println("EXIT<< GetTemplateData")
	return templateData{apps, services}
}
Ejemplo n.º 3
0
func GetTemplateData(config *conf.Configuration, storage service.Storage, appStorage application.Storage) (*templateData, error) {
	apps, err := marathon.FetchApps(config.Marathon, config)
	if err != nil {
		return nil, err
	}

	//services, err := storage.All()
	//if err != nil {
	//return nil, err
	//}

	zkWeights, err := appStorage.All()
	if err != nil {
		return nil, err
	}
	apps = handleCanary(apps, zkWeights)
	frontends := formFrontends(apps)
	weightMap := formWeightMap(zkWeights)

	//byName := make(map[string]service.Service)
	//for _, service := range services {
	//byName[service.Id] = service
	//}

	cores := runtime.NumCPU()
	if cores > 64 {
		cores = 64
	}
	return &templateData{frontends, weightMap, nil, cores}, nil
}
Ejemplo n.º 4
0
func GetTemplateData(config *conf.Configuration, conn *zk.Conn) (*templateData, error) {

	apps, err := marathon.FetchApps(config.Marathon, config)

	if err != nil {
		return nil, err
	}

	services, err := service.All(conn, config.Bamboo.Zookeeper)

	if err != nil {
		return nil, err
	}

	return &templateData{apps, services}, nil
}
Ejemplo n.º 5
0
func GetTemplateData(config *conf.Configuration, storage service.Storage) (*templateData, error) {

	apps, err := marathon.FetchApps(config.Marathon, config)

	if err != nil {
		return nil, err
	}

	services, err := storage.All()
	if err != nil {
		return nil, err
	}

	byName := make(map[string]service.Service)
	for _, service := range services {
		byName[service.Id] = service
	}

	return &templateData{apps, byName}, nil
}
Ejemplo n.º 6
0
func GetTemplateData(config *conf.Configuration, conn *zk.Conn) (interface{}, error) {

	apps, err := marathon.FetchApps(config.Marathon)

	if err != nil {
		return nil, err
	}

	services, err := service.All(conn, config.Bamboo.Zookeeper)

	if err != nil {
		return nil, err
	}

	env := make(map[string]string)
	for _, i := range os.Environ() {
		sep := strings.Index(i, "=")
		env[i[0:sep]] = i[sep+1:]
	}

	return templateData{apps, services, env}, nil
}