fix(k8s): ensure patchResources can patch namespace #5334
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
When applying K8s resources, we create a ConfigMap with metadata about the resources for faster lookup.
This metadata includes the resource namespace among other things.
Before this fix, we'd create the ConfigMap before applying the resource patch which meant that if you patched the actual resource namespace, Garden wouldn't store that information.
Later when looking up the status of the resource, Garden would use the data from the ConfigMap and basically look for the resource in the wrong namespace and return status "not-ready" (when in fact the resource could be ready, just in a different namespace).
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
waitForResources
function return the correct status?