Skip to content

Fix the duplicate reference to the secretRef field of the PackageInstall object within the App object - #1860

Open
klzsysy wants to merge 1 commit into
carvel-dev:developfrom
klzsysy:fix/duplicate-values-from-secret
Open

klzsysy wants to merge 1 commit into
carvel-dev:developfrom
klzsysy:fix/duplicate-values-from-secret

Conversation

@klzsysy

@klzsysy klzsysy commented Sep 16, 2026

Copy link
Copy Markdown

What this PR does / why we need it:

If the secretRef field exists in the packageinstall object, the child app object will redundantly reference these secrets.

image image

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?

The `app` object will no longer duplicate the `secretRef` field found in the `packageInstall` object.

Additional Notes for your reviewer:

It also fixed an issue where duplicate references occurred in the app object when package and packageinstall objects referenced the same secret.

Added relevant unit test cases.

Review Checklist:
  • Follows the developer guidelines
  • Relevant tests are added or updated
  • Relevant docs in this repo added or updated
  • Relevant carvel.dev docs added or updated in a separate PR and there's
    a link to that PR
  • Code is at least as readable and maintainable as it was before this
    change

Additional documentation e.g., Proposal, usage docs, etc.:


    NewApp assigned the Package's spec to the App through a shallow copy, so the App
    spec kept pointers into the Package: AppTemplate.Ytt is a pointer, and
    AppSpec.Template shares its backing array. Appending the PackageInstall's values
    into templateStep.Ytt/HelmTemplate.ValuesFrom therefore wrote back into the
    Package that was passed in.

    reconcileAppWithPackage calls NewApp twice with the same Package - once to detect
    whether the App needs updating (packageinstall.go:225), and once inside the
    update closure (:234). Because the first call had already mutated the Package,
    the second call appended pkgInstall.spec.values a second time, so the stored App
    listed every PackageInstall values secret twice.

Signed-off-by: Sonny Yang <klzsysy@gmail.com>
@klzsysy
klzsysy force-pushed the fix/duplicate-values-from-secret branch from 4afd23d to 5b05de5 Compare September 16, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants