fix: handle empty kustomize bases #4035
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:
Follow-up to #3996
This PR fixes an issue where
kustomize build
could fail for KOTS instances that were upgraded from older versions before therendered
directory was added. This can occur because previous application archives that don't contain therendered
directory are rendered on-the-fly when diffing. It's possible that some of these older application archives containkustomization.yaml
files that are considered "empty", which is no longer supported by the latest kustomize version (>= 5.1.x).This PR introduces a logic before
kustomize build
is run to check if a base kustomization is empty. If it's empty, it will be modified to include thekots.io/kustomization=base
label, which causes kustomize to no longer interpret it as empty according to this check.Which issue(s) this PR fixes:
SC-88587
Special notes for your reviewer:
Considered skipping
kustomize build
all together if the base was empty, but then any midstream or downstream resources would not be added (pull secrets for example).Steps to reproduce
rendered
directory)common
dependency can result in this.Does this PR introduce a user-facing change?
Does this PR require documentation?
NONE