fix: use release namespace in render when specified#8259
Conversation
Codecov Report
@@ Coverage Diff @@
## main #8259 +/- ##
==========================================
- Coverage 70.48% 66.09% -4.39%
==========================================
Files 515 601 +86
Lines 23150 29507 +6357
==========================================
+ Hits 16317 19503 +3186
- Misses 5776 8542 +2766
- Partials 1057 1462 +405
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
471a889 to
741d62d
Compare
| @@ -0,0 +1 @@ | |||
| {} No newline at end of file | |||
There was a problem hiding this comment.
should you delete this file?
There was a problem hiding this comment.
+1, it seems builds.out.json isn't used in the integration test -> might make sense to delete
There was a problem hiding this comment.
Done! I changed the test logic to add the --build-artifacts=builds.out.json flag conditionally and not for all the cases, and removed the builds.out.json file that I added for the new case
|
Can you add some more context in the PR description on GetNamespace vs GetKubeNamespace as well as what namespace config values are looked at currently when rendering helm templates (perhaps a tree of the priority?) as we have 2 locations that releases.namespaces can be set:
The original issue mentioned that deploy.* config wasn't respected in a |
7b2ea6e to
6dd4999
Compare
…ools#8259) * fix: use release namespace in render when specified * fix: add new method to MockConfig to comply with render.Config interface * test: integration test to validate namespace is replace in helm template * fix: address PR comments, delete build.out.json (cherry picked from commit 8b82382)
Fixes: #8185
Description
This PR changes the method called to get the namespace that is used during rendering, from
GetNamespacetoGetKubeNamespace; in skaffold v1 is read from this last one.Context:
GetNamespacereturns the namespace set in the detected cluster (even if it is the "default" namespace) when no namespace is passed with the--namespaceflag and no namespace is set in a Kubectl deployer.GetKubeNamespacereturns the namespace set with the--namespaceflagChanging the logic to use
GetKubeNamespaceinstead ofGetNamespace(as it was in v1) makes the helm renderer to use the value set in the release when no value is detected in the--namespaceflag, and don't care about what value is set as default in the active cluster.Difference between
manifests.helm.releases.namespaceanddeploy.helm.releases.namespaceBoth values do not interfere between each other. In the followin scenario:
The output from
skaffold renderwill produce two different sets of manifests:manifests.helm.releasesconfig withnamespace: helm-test-1namespace setdeploy.helm.releases.namespaceconfig withnamespace: helm-test-2namespace setBehind the scene, skaffold is creating two different renderers: one for the
manifestsand other for thedeploy, each with its corresponding configuration