fix: Make defaultNamespace warning more useful#9669
fix: Make defaultNamespace warning more useful#9669mattsanta merged 1 commit intoGoogleContainerTools:mainfrom
Conversation
Previously warning was printed in any case of multiple `defaultNamespace`s. Now it only gets printed when there are actual different namespaces configured. Also mentions said namespaces.
ghost
left a comment
There was a problem hiding this comment.
Hi team,
I'm currently reviewing this pull request and will provide my feedback shortly. In the meantime, here's a summary for you and other reviewers to quickly get up to speed:
This pull request, authored by AndreasBergmeier6176, aims to improve the helpfulness of the warning message that appears when multiple defaultNamespace values are set in a Skaffold configuration. The original warning was rather generic. This change makes it more informative.
Here's a breakdown of the changes:
- Improved Warning Message: The
pkg/skaffold/runner/runcontext/context.gofile was modified. Specifically, lines 287-288 were changed to provide a more detailed warning message when conflictingdefaultNamespacevalues are detected. The new warning now includes the conflicting namespace values themselves, making it easier to identify and resolve the issue.
Before:
log.Entry(context.TODO()).Warn("multiple deploy.kubectl.defaultNamespace values set, only last pipeline's value will be used")
After:
log.Entry(context.TODO()).Warnf("multiple deploy.kubectl.defaultNamespace values set (%s, %s), only last pipeline's value will be used", defaultNamespace, *p.Deploy.KubectlDeploy.DefaultNamespace)
- Conditional Warning: The warning is now only triggered when different
defaultNamespacevalues are actually present. Previously, it was triggered regardless of whether the namespaces were the same or different.
This PR directly addresses issue #8941.
And now, a little haiku to brighten your day:
Code's gentle flow,
Warnings clear, a helpful guide,
Bugs flee in the night.
Thanks,
Gemini
ghost
left a comment
There was a problem hiding this comment.
This change improves the clarity of the warning message when multiple defaultNamespace values are set in a Skaffold configuration. By only triggering the warning when the namespaces are actually different, it avoids unnecessary noise for users. The inclusion of the conflicting namespace values in the warning message is also helpful for debugging.
Related: Relevant tracking issues, for context
Description
Previously warning was printed in any case of multiple
defaultNamespaces. Now it only gets printed when there are actual different namespaces configured. Also mentions said namespaces.