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

Local reference to temporary directory fails build on Mac #5752

Open
Stef16Robbe opened this issue Aug 20, 2024 · 2 comments
Open

Local reference to temporary directory fails build on Mac #5752

Stef16Robbe opened this issue Aug 20, 2024 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@Stef16Robbe
Copy link

Stef16Robbe commented Aug 20, 2024

What happened?

I added this local reference in my Kustomize file (MacOS):

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../../var/folders/2b/ryb_dw7j1gg183b46_ppt5sr0000gn/T/folder

It is a relative path towards /var/folders/2b/ryb_dw7j1gg183b46_ppt5sr0000gn/T/folder, which exists, and contains a Kustomize file that builds successfully on it's own (using kustomize build "../../../../../var/folders/2b/ryb_dw7j1gg183b46_ppt5sr0000gn/T/folder" works fine)

But when I try to refer to it in a Kustomize file (shown above), I get an error:

Error: accumulating resources: accumulation err='accumulating resources from '../../../../../var/folders/2b/ryb_dw7j1gg183b46_ppt5sr0000gn/T/folder': evalsymlink failure on '/Users/var/folders/2b/ryb_dw7j1gg183b46_ppt5sr0000gn/T/folder' : lstat /Users/var: no such file or directory': must build at directory: not a valid directory: evalsymlink failure on '/Users/var/folders/2b/ryb_dw7j1gg183b46_ppt5sr0000gn/T/folder' : lstat /Users/var: no such file or directory

The problem is that, for some reason, now all the sudden, Kustomize is looking in /Users? /Users/var/folders/2b/ryb_dw7j1gg183b46_ppt5sr0000gn/T/folder does indeed not exist, but it's not the path I've given to Kustomize.

It probably has something to do with symlinking on Mac, but I'm confused as to why it does work when building the file directly, but not when it's referred to in another Kustomize file.

What did you expect to happen?

A successful build

How can we reproduce it (as minimally and precisely as possible)?

  1. Create a temp dir on MacOS, I did it in Go with os.TempDir()
  2. Add a Kustomize file in it
  3. Refer to it from somewhere else on the filesystem

Expected output

N/A

Actual output

An error

Kustomize version

v5.4.3

Operating system

MacOS

@Stef16Robbe Stef16Robbe added the kind/bug Categorizes issue or PR as related to a bug. label Aug 20, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Aug 20, 2024
@leonardj78
Copy link

leonardj78 commented Aug 30, 2024

This happens on linux as well.

We ran into the same issue. If you have nested kustomizations, it will break.

Previous structure that worked prior to this version.

kubernetes/qualityenv/kustomization.yaml
kubernetes/qualityenv/build-test/kustomization.yaml

Running "kustomize localize qualityenv/build-test localized/qualityenv-build-test --scope ." breaks.

If you flatten the folder structure it will work.

basically we had to work around by changing our structure to

kubernetes/qualityenv/kustomization.yaml
kubernetes/qualityenv-build-test/kustomization.yaml

and run kustomize localize qualityenv-build-test localized/qualityenv-build-test --scope .

@stormqueen1990
Copy link
Member

Hi there, @Stef16Robbe! Thanks for reporting this issue.

I was unable to reproduce it on MacOS, even with a latest head build. Would you be able to provide a minimal example that replicates the problem described?

/triage needs-information

@k8s-ci-robot k8s-ci-robot added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

4 participants