pipecd icon indicating copy to clipboard operation
pipecd copied to clipboard

livestate.loadManifests ignores per-target KustomizeVersion and KustomizeOptions

Open CodeWith-sakib opened this issue 4 months ago • 3 comments

What happened

The multicluster livestate plugin ignores per-target KustomizeVersion and KustomizeOptions overrides defined in multiTargets.

While the deployment plugin applies these per-target overrides before constructing provider.LoaderInput, the livestate implementation always uses the top-level values from spec.Input.

As a result, deployment and livestate may render manifests using different Kustomize versions or options for the same target, which can lead to inconsistent manifest rendering and potentially incorrect drift/sync calculations.

This appears to be another divergence between the deployment and livestate implementations. PR #6783 already addressed kustomizeDir and tracking labels, but KustomizeVersion and KustomizeOptions are still not handled in the same way.


What you expected to happen

livestate.loadManifests() should apply the same precedence as the deployment implementation:

  1. Use the top-level KustomizeVersion and KustomizeOptions by default.
  2. Override them with multiTarget.KustomizeVersion when specified.
  3. Override them with multiTarget.KustomizeOptions when specified.

This would ensure that deployment and livestate render manifests consistently for the same target.


How to reproduce it

  1. Create a Kubernetes Multicluster application.
  2. Configure a top-level kustomizeVersion (or kustomizeOptions).
  3. Configure one multiTarget with different kustomizeVersion and/or kustomizeOptions.
  4. Run a deployment and observe that the deployment path uses the per-target overrides.
  5. Run livestate for the same application.
  6. Observe that the livestate path still uses the top-level values instead of the per-target overrides.

From the current implementation:

  • deployment/loadManifests() applies multiTarget.KustomizeVersion and multiTarget.KustomizeOptions.
  • livestate/loadManifests() always passes spec.Input.KustomizeVersion and spec.Input.KustomizeOptions directly to provider.LoaderInput.

Environment

  • piped version: master (current HEAD)

  • control-plane version: N/A

  • Others:

    • Related PR: #6783 ("fix(kubernetes_multicluster): stamp tracking labels and honour kustomizeDir in livestate loadManifests"), which fixed kustomizeDir parity but does not apply the same per-target precedence for KustomizeVersion and KustomizeOptions.

CodeWith-sakib avatar Aug 02 '26 08:08 CodeWith-sakib

/assign

CodeWith-sakib avatar Aug 02 '26 08:08 CodeWith-sakib

hi, #7107 was closed as stale. is it ok if i work on this? i have a fix and a test ready.

srinivasr avatar Oct 18 '26 16:10 srinivasr

@srinivasr yeah sure

CodeWith-sakib avatar Oct 18 '26 20:10 CodeWith-sakib