Skip to content
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

fix: handle empty kustomize bases #4035

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

cbodonnell
Copy link
Contributor

@cbodonnell cbodonnell commented Sep 12, 2023

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 the rendered directory was added. This can occur because previous application archives that don't contain the rendered directory are rendered on-the-fly when diffing. It's possible that some of these older application archives contain kustomization.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 the kots.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

  1. Install KOTS 1.95 or earlier (pre rendered directory)
  2. Deploy an application that results in empty kustomize bases. Bitnami helm charts containing the common dependency can result in this.
  3. Upgrade KOTS to the latest version
  4. Try to deploy a new version or diff between new and old versions

Does this PR introduce a user-facing change?

Fixes an issue where deployments or diffing could fail after upgrading from KOTS 1.95 or earlier if versions contained empty Kustomize bases

Does this PR require documentation?

NONE

@cbodonnell cbodonnell added type::bug Something isn't working bug::regression labels Sep 12, 2023
@cbodonnell cbodonnell force-pushed the cbo/sc-88587/handle-empty-kustomizations branch from c9d9d2a to 421bae2 Compare September 13, 2023 14:11
@cbodonnell cbodonnell changed the title handle empty kustomize bases fix: handle empty kustomize bases Sep 13, 2023
@cbodonnell cbodonnell force-pushed the cbo/sc-88587/handle-empty-kustomizations branch from 421bae2 to 712b62f Compare September 13, 2023 17:49
@cbodonnell cbodonnell requested a review from divolgin September 14, 2023 17:50
@cbodonnell cbodonnell merged commit 28eceeb into main Sep 14, 2023
78 checks passed
@cbodonnell cbodonnell deleted the cbo/sc-88587/handle-empty-kustomizations branch September 14, 2023 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug::regression type::bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants