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: skip remote Kustomizations on recursive diff #5071

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

milas
Copy link
Contributor

@milas milas commented Nov 12, 2024

When recursively diffing Kustomization objects on a cluster, each Kustomization is built and then a server-side dry-run apply is performed. This isn't practical to perform if the Kustomization references a remote cluster via kubeConfig.secretRef.

Currently, because it's not skipped, it's treated as though it's being applied to the context cluster, not the remote cluster, which results in an incorrect diff.

Instead, write out special message / warnings indicating that it has been skipped:

► Kustomization/my-ns/my-kst skipped: diff not supported for remote clusters

See also:

@milas
Copy link
Contributor Author

milas commented Nov 12, 2024

FYI I did not make this return an error code. I think there's three reasonable options:

  • Leave as-is in this PR -> it's a warning only, no change to exit code
  • Overload createdOrDrifted to be "created or drifted or skipped"
  • Make it a hard error -> personally, I'd want a CLI flag to then ignore it 🫤

@milas milas force-pushed the diff-kustomization-recursive-remote branch from 74aabc7 to d7a2ffc Compare November 13, 2024 15:13
@stefanprodan stefanprodan added the area/diff Diff related issues and pull requests label Nov 14, 2024
@stefanprodan
Copy link
Member

@milas can you please rebase with upstream main and force push. Thanks

When recursively diffing Kustomization objects on a cluster, each
Kustomization is built and then a server-side dry-run apply is
performed. This isn't practical to perform if the Kustomization
references a remote cluster via `kubeConfig.secretRef`.

Currently, because it's not skipped, it's treated as though it's
being applied to the context cluster, not the remote cluter, which
results in an incorrect diff.

Instead, write out special message / warnings indicating that it
has been skipped:
```
► Kustomization/my-ns/my-kst skipped: diff not supported for remote clusters
```

Signed-off-by: Milas Bowman <[email protected]>
@milas milas force-pushed the diff-kustomization-recursive-remote branch from d7a2ffc to 7697699 Compare November 14, 2024 13:33
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @milas 🏅

@stefanprodan stefanprodan merged commit f42a17d into fluxcd:main Nov 14, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/diff Diff related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants