-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
What happened?
Using kustomize extensively and trying to structure the code in a way that creates independent modular blocks. Kustomize does not like this and does implicit assumptions. See Example below
Yes, I know that there are other ways to do this exact example, the problem is that this breaks the explicitness principle for Kustomize. It implicitly assumes that 'part/test' directory is part of the kustomization of 'part' and fails. Even if i specify LoadRestrictionsNone
Cycle detection is excellent, but it must be based on actual declarations.
What did you expect to happen?
That no cycle is detected since there are none in the actual declarations.
How can we reproduce it (as minimally and precisely as possible)?
** part/t.yaml **
apiVersion: builtin
kind: AnnotationsTransformer
metadata:
name: labels
annotations:
foo/cluster: ${CLUSTERNAME}
foo/commit: ${COMMIT}
fieldSpecs:
- path: metadata/annotations
create: true
** part/kustomization.yaml **
kind: Kustomization
resources:
- r.yaml
transformers:
- t.yaml
** part/r.yaml **
kind: Namespace
metadata:
name: my-namespace
---
kind: ConfigMap
metadata:
name: config
stringData:
k1: v1
k2: v2
** part/test/kustomization.yaml **
kind: Kustomization
resources:
- ..
transformers:
- validate.yaml
** part/test/validate.yaml **
kind: Validator
apiVersion: v1
metadata:
name: validate-stuff
annotations:
config.kubernetes.io/function: |
exec:
path: validate-stuff
Run with:
$ kustomize build --enable-exec --enable-alpha-plugins --load-restrictor LoadRestrictionsNone part/test
Error: accumulating resources: accumulation err='accumulating resources from '..': read part: is a directory': cycle detected: candidate root 'part' contains visited root 'part/test'
Expected output
kind: Namespace
metadata:
name: my-namespace
annotations:
foo/cluster: ${CLUSTERNAME}
foo/commit: ${COMMIT}
---
kind: ConfigMap
metadata:
name: config
annotations:
foo/cluster: ${CLUSTERNAME}
foo/commit: ${COMMIT}
stringData:
k1: v1
k2: v2
Actual output
Error: accumulating resources: accumulation err='accumulating resources from '..': read part: is a directory': cycle detected: candidate root 'part' contains visited root 'part/test'
Kustomize version
v5.7.0
Operating system
Linux