Skip to content

Apply per-target kustomize settings in the multicluster livestate - #7496

Open
srinivasr wants to merge 2 commits into
pipe-cd:masterfrom
srinivasr:fix-livestate-kustomize-overrides
Open

srinivasr wants to merge 2 commits into
pipe-cd:masterfrom
srinivasr:fix-livestate-kustomize-overrides

Conversation

@srinivasr

Copy link
Copy Markdown
Contributor

What this PR does: Makes the kubernetes_multicluster livestate plugin use a multiTarget's kustomizeVersion and kustomizeOptions when set, falling back to the top-level values, the same way the deployment plugin does.

Why we need it: Livestate always rendered with the top-level values, so for a target with its own kustomize version or options it could compute sync state from manifests rendered differently from what was deployed.

Which issue(s) this PR fixes: Fixes #7106

Does this PR introduce a user-facing change?:

  • How are users affected by this change: Livestate for multiTargets with their own kustomizeVersion/kustomizeOptions now renders the same way as the deployment.
  • Is this breaking change: No
  • How to migrate (if breaking change): N/A

Cover how loadManifests in the kubernetes_multicluster livestate
plugin resolves kustomizeVersion and kustomizeOptions from the
top-level input and a multiTarget, by capturing the LoaderInput the
loader receives.

The override cases fail on this commit: loadManifests still ignores
the multiTarget values. The fix lands in the next commit.

Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
The deployment and plan preview paths of the kubernetes_multicluster
plugin override the top-level kustomizeVersion and kustomizeOptions
with the values of the matching multiTarget, but the livestate path
always renders with the top-level values. Livestate can then compute
drift and sync status from manifests rendered with a different
kustomize version or options than the ones the deployment applied.

Give livestate loadManifests the same precedence: start from the
top-level input values and let a multiTarget override them when set,
matching the deployment and plan preview implementations.

Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
@srinivasr
srinivasr requested review from a team as code owners October 18, 2026 16:29
@srinivasr
srinivasr requested review from Warashi, armistcxy and mohammedfirdouss and a balanced review from Copilot October 18, 2026 16:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@netlify

netlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for pipecd-site ready!

Name Link
🔨 Latest commit b15749e
🔍 Latest deploy log https://app.netlify.com/projects/pipecd-site/deploys/6ad4f40504df89d685c75643
😎 Deploy Preview https://deploy-preview-7496--pipecd-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@harshrajdebug harshrajdebug left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this against master with the real loader and kustomize, in addition to the captured LoaderInput.

Setup: an app directory with shared/cm.yaml and a cluster-a/kustomization.yaml whose only resource is ../shared/cm.yaml, plus a multiTarget with kustomizeDir: cluster-a and kustomizeOptions: {load-restrictor: LoadRestrictionsNone}. The top level sets no options, so the target's option is the only thing that lets kustomize read that file. I called loadManifests with provider.NewLoader, backed by the kustomize built into kubectl (v5.7.1):

  • master: security; file '.../shared/cm.yaml' is not in or below '.../cluster-a'. GetLivestate returns this error from inside the target loop, so the application gets no livestate for any of its targets, not only this one.
  • this PR: loads ConfigMap/shared.

The new TestLoadManifests_KustomizeOverrides also catches it: with master's plugin.go, the three cases where the target sets a version or options fail. The override logic is the same as in deployment/plugin.go and buildLoaderInput in planpreview, so all three paths now render a target the same way. LGTM.

cc @Warashi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

livestate.loadManifests ignores per-target KustomizeVersion and KustomizeOptions

3 participants