-
Notifications
You must be signed in to change notification settings - Fork 658
fix: allow recursive dry-run over local sources #5219
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
Conversation
3d1e964
to
04b5ef1
Compare
Seems reasonable to me. I would just switch branches of
|
@bkreitch , thanks for the advice, I will add a test. But I'm not sure what you mean with the |
a80f266
to
6d5f7ab
Compare
@niveau0 I mean to reverse if condition so it will be like:
|
@niveau0 and for the test - I think that if you'll put my snippet from above into TestBuildLocalKustomization() instead of TestBuildKustomization() it should be enough and additional files are not needed. |
6d5f7ab
to
c0e6b98
Compare
@bkreitch ah ok got it now, I think I failed to see the 'Local' part in TestBuildLocalKustomization and got confused. |
@niveau0 can you please rebase with upstream main and force push, this PR should have a single commit. Thanks |
f4190ef
to
963db06
Compare
@stefanprodan sure, I think I did now :) |
963db06
to
2c6ac18
Compare
I'll review this today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this fix and it correctly rendered all the YAMLS in my Kustomization tree, except for the resources deployed by HelmReleases (as expected)!
This was the command I used:
./flux build kustomization matheus-test-repo \
--recursive \
--path ./flux-system \
-n flux-system \
--local-sources GitRepository/flux-system/matheus-test-repo=./ \
--dry-run \
--kustomization-file ./flux-system/root-kustomization.yaml
This was my Kustomization tree (objects deployed by HelmReleases omitted):
Kustomization/flux-system/matheus-test-repo
├── Kustomization/flux-system/matheus-test-repo-configs
│ ├── ConfigMap/monitoring/flux-grafana-dashboards-dfh45k26mg
│ ├── PodMonitor/monitoring/flux-system
│ └── ServiceMonitor/monitoring/flux-operator
├── Kustomization/flux-system/matheus-test-repo-controllers
│ ├── Namespace/monitoring
│ ├── ServiceAccount/monitoring/flux
│ ├── ClusterRoleBinding/flux-monitoring
│ ├── HelmRelease/flux-system/flux-operator
│ │ └── ...
│ ├── HelmRelease/monitoring/kube-prometheus-stack
│ │ └── ...
│ ├── HelmRelease/monitoring/metrics-server
│ │ └── ...
│ ├── Alert/flux-system/dispatch
│ ├── Provider/flux-system/github-dispatch
│ ├── HelmRepository/monitoring/metrics-server
│ ├── HelmRepository/monitoring/prometheus-community
│ └── OCIRepository/flux-system/flux-operator
├── Kustomization/flux-system/matheus-test-repo-workloads
│ └── ResourceSetInputProvider/flux-system/rsip-gh-app-token-cache-test
└── GitRepository/flux-system/matheus-test-repo
@niveau0 can you please rebase and force push |
Signed-off-by: niveau0 <[email protected]>
2c6ac18
to
1b98e16
Compare
@stefanprodan done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @niveau0 🎖️
This PR tries to fix the issue using
flux build
with dry-run and recursion.We have a setup with nested kustomizations and want to render the whole tree
as yaml files, including
postBuild
substitutions. Afterwards, this should bechecked via kube-linter.
Currently this seems not possible(?) with the flux-cli together with dry-run,
therefore I made some changes.
Since I don't know all the use cases for
flux build
, it is hard to tell if thisbreaks anything.
Maybe someone with deeper knowledge can review the changes.
The command I use is similar to this: