Example #1
0
func addMantlLabels(app *marathon.App, pkgDef *packageDefinition) error {
	if app.Labels == nil {
		app.Labels = make(map[string]string)
	}
	app.Labels[packageNameKey] = pkgDef.name
	app.Labels[packageVersionKey] = pkgDef.version
	app.Labels[packageIndexKey] = pkgDef.release
	app.Labels[packageIsFrameworkKey] = strconv.FormatBool(pkgDef.framework)

	uninstallJson, err := pkgDef.UninstallJson()
	if err != nil {
		return err
	}
	app.Labels[packageUninstallKey] = base64.StdEncoding.EncodeToString([]byte(uninstallJson))

	if pkgDef.frameworkName != "" {
		app.Labels[packageFrameworkNameKey] = pkgDef.frameworkName
	}

	// copy DCOS_PACKAGE_FRAMEWORK_NAME if it exists
	if fwName, ok := app.Labels[dcosPackageFrameworkNameKey]; ok {
		app.Labels[packageFrameworkNameKey] = fwName
	}

	lb, err := pkgDef.LoadBalancer()
	if err == nil {
		app.Labels[traefikEnableKey] = strconv.FormatBool(lb == "external")
	} else {
		log.Warnf("Unable to retrieve load balancer configuration: %s", err.Error())
	}

	return nil
}
Example #2
0
func addMantlLabels(app *marathon.App, pkgDef *packageDefinition) {
	if app.Labels == nil {
		app.Labels = make(map[string]string)
	}
	app.Labels[packageNameKey] = pkgDef.name
	app.Labels[packageVersionKey] = pkgDef.version
	app.Labels[packageIndexKey] = pkgDef.release
	app.Labels[packageIsFrameworkKey] = strconv.FormatBool(pkgDef.framework)

	if pkgDef.frameworkName != "" {
		app.Labels[packageFrameworkNameKey] = pkgDef.frameworkName
	}

	// copy DCOS_PACKAGE_FRAMEWORK_NAME if it exists
	if fwName, ok := app.Labels[dcosPackageFrameworkNameKey]; ok {
		app.Labels[packageFrameworkNameKey] = fwName
	}
}