-
Notifications
You must be signed in to change notification settings - Fork 12
Add more warning for service name replacement #541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
! service "bad-service": missing compose directive: restart; assuming 'unless-stopped' (add 'restart' to silence) | ||
! service "bad-service": missing memory reservation; specify deploy.resources.reservations.memory to avoid out-of-memory errors | ||
! service "env-in-config": environment variable "CONFIG1" overridden by config | ||
! service "env-in-config": environment variable "CONFIG1" with value "http://Mistral:8000" contains a service name needs to be normalized, but it will be repalced by an existing config. service names in a config will not be normalized. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning about overridden env var contains a service name replacement
! service "ui": service names were replaced in environment variable "API_URL": "http://mock-mistral:8000" | ||
! service "use-bad-service": missing compose directive: restart; assuming 'unless-stopped' (add 'restart' to silence) | ||
! service "use-bad-service": missing memory reservation; specify deploy.resources.reservations.memory to avoid out-of-memory errors | ||
! service "use-bad-service": service names were NOT replaced in environment variable "DB_URL": "bad-service:5432", only service with port mode host will be replaced |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning about service name NOT being replaced.
I rather we fix #396 |
src/pkg/cli/compose/convert.go
Outdated
@@ -130,7 +137,11 @@ func ConvertServices(ctx context.Context, c client.Client, serviceConfigs compos | |||
|
|||
// Check if the environment variable is an existing config; if so, mark it as such | |||
if _, ok := slices.BinarySearch(config.Names, key); ok { | |||
term.Warnf("service %q: environment variable %q overridden by config", svccfg.Name, key) | |||
if serviceNameRegex != nil && serviceNameRegex.MatchString(*value) { | |||
term.Warnf("service %q: The environment variable %q, with the value %q, contains a service name that needs to be normalized. however, it will be replaced by an existing configuration. service names within a configuration will not be normalized.", svccfg.Name, key, *value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capitalization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Printf("service %q: environment variable %q needs service name fix-up, but is overridden by config, which will not be fixed up.", svccfg.Name, key)
src/pkg/cli/compose/convert.go
Outdated
@@ -130,7 +137,11 @@ func ConvertServices(ctx context.Context, c client.Client, serviceConfigs compos | |||
|
|||
// Check if the environment variable is an existing config; if so, mark it as such | |||
if _, ok := slices.BinarySearch(config.Names, key); ok { | |||
term.Warnf("service %q: environment variable %q overridden by config", svccfg.Name, key) | |||
if serviceNameRegex != nil && serviceNameRegex.MatchString(*value) { | |||
term.Warnf("service %q: The environment variable %q, with the value %q, contains a service name that needs to be normalized. however, it will be replaced by an existing configuration. service names within a configuration will not be normalized.", svccfg.Name, key, *value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Printf("service %q: environment variable %q needs service name fix-up, but is overridden by config, which will not be fixed up.", svccfg.Name, key)
src/pkg/cli/compose/convert.go
Outdated
@@ -143,6 +154,8 @@ func ConvertServices(ctx context.Context, c client.Client, serviceConfigs compos | |||
}) | |||
if val != *value { | |||
term.Warnf("service %q: service names were replaced in environment variable %q: %q", svccfg.Name, key, val) | |||
} else if nonReplaceServiceNameRegex != nil && nonReplaceServiceNameRegex.MatchString(*value) { | |||
term.Warnf("service %q: service names in the environment variable %q (%q) were not replaced. only services with port mode set to host will be replaced.", svccfg.Name, key, val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use "fix up"
src/pkg/cli/compose/convert.go
Outdated
@@ -143,6 +154,8 @@ func ConvertServices(ctx context.Context, c client.Client, serviceConfigs compos | |||
}) | |||
if val != *value { | |||
term.Warnf("service %q: service names were replaced in environment variable %q: %q", svccfg.Name, key, val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"service names were fixed up"
4e64473
to
45a7467
Compare
The following questions has been repeatedly pop up when a service name replacement is needed, which prevents a successful deployment: