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

Flux Kustomization diff fails with local kustomization file that has multiple resources with the same name #4132

Closed
1 task done
mraerino opened this issue Aug 5, 2023 · 1 comment · Fixed by #4131
Closed
1 task done
Labels
area/diff Diff related issues and pull requests bug Something isn't working

Comments

@mraerino
Copy link
Contributor

mraerino commented Aug 5, 2023

Describe the bug

When using flux diff kustomization with a local Kustomization yaml, the server diff fails with not found errors when the local kustomization yaml has another resource with the same name.

Steps to reproduce

when i run flux diff kustomization --path <manifests> --kustomize-file <yaml-file>

with this <yaml-file>:

apiVersion: v1
kind: Namespace
metadata:
  name: podinfo

---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: podinfo
spec:
  interval: 5m0s
  path: ./kustomize
  force: true
  prune: true
  sourceRef:
    kind: GitRepository
    name: podinfo

i get these failures:

[Deployment/podinfo namespace not specified: the server could not find the requested resource, HorizontalPodAutoscaler/podinfo namespace not specified: the server could not find the requested resource, Service/podinfo namespace not specified: the server could not find the requested resource, Secret/docker-secret namespace not specified: the server could not find the requested resource, Secret/secret-basic-auth-stringdata namespace not specified: the server could not find the requested resource, Secret/podinfo-token-77t89m9b67 namespace not specified: the server could not find the requested resource, Secret/db-user-pass-bkbd782d2c namespace not specified: the server could not find the requested resource]

Expected behavior

I expect the diff to show me the resources that are changing.

Screenshots and recordings

No response

OS / Distro

macOS 13.5 (22G74)

Flux version

v2.0.1

Flux check

► checking prerequisites
✔ Kubernetes 1.26.7+k3s1 >=1.24.0-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.35.0
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v1.0.0
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v1.0.0
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v1.0.0
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta2
✔ buckets.source.toolkit.fluxcd.io/v1beta2
✔ gitrepositories.source.toolkit.fluxcd.io/v1
✔ helmcharts.source.toolkit.fluxcd.io/v1beta2
✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1
✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta2
✔ receivers.notification.toolkit.fluxcd.io/v1
✔ all checks passed

Git provider

No response

Container Registry provider

No response

Additional context

I put a minimal reproduction into a unit test here: #4131

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mraerino
Copy link
Contributor Author

mraerino commented Aug 5, 2023

Fix is here: #4131

@stefanprodan stefanprodan added bug Something isn't working area/diff Diff related issues and pull requests labels Aug 7, 2023
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 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants