resolve PR: include the service info in the log message

This commit is contained in:
Moritz 2023-01-31 16:05:46 +01:00
parent c4560023d1
commit 5a77ff4e55
1 changed files with 3 additions and 2 deletions

View File

@ -478,11 +478,12 @@ func SetRecipeLabel(compose *composetypes.Config, stackName string, recipe strin
} }
} }
// add a label to signal that a deploy is a chaos deploy // SetChaosLabel adds the label 'coop-cloud.${STACK_NAME}.chaos=true/false' to the app container
// to signal if the app is deployed in chaos mode
func SetChaosLabel(compose *composetypes.Config, stackName string, chaos bool) { func SetChaosLabel(compose *composetypes.Config, stackName string, chaos bool) {
for _, service := range compose.Services { for _, service := range compose.Services {
if service.Name == "app" { if service.Name == "app" {
logrus.Debugf("set chaos label to %s", chaos) logrus.Debugf("set label 'coop-cloud.%s.chaos' to %s for %s", stackName, chaos, stackName)
labelKey := fmt.Sprintf("coop-cloud.%s.chaos", stackName) labelKey := fmt.Sprintf("coop-cloud.%s.chaos", stackName)
service.Deploy.Labels[labelKey] = strconv.FormatBool(chaos) service.Deploy.Labels[labelKey] = strconv.FormatBool(chaos)
} }