You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The repo contains only plain Kubernetes manifests (i.e. no Kustomizations, just plain k8s resources). That repo follows a naming convention for resource filenames: /<metadata.namespace>/<kind>/<metadata.name>.yaml
This works flawlessly until I add a resource of Kustomization kind (the use case is that I want to manage my flux2 Kustomizations from this repo). Per my naming convention, it lands in a file called along the lines of /michals-namespace/Kustomization/michals-kustomization.yaml. Once a directory called Kustomization gets pushed to the repository, reconciliation of the Kustomization resource cluster-contents begins to fail:
Status:
Conditions:
Last Transition Time: 2020-12-23T21:04:46Z
Message: kustomize build failed: accumulating resources: 2 errors occurred:
* accumulateFile error: "accumulating resources from './gitops': read /tmp/cluster-contents240645327/gitops: is a directory"
* accumulateDirector error: "couldn't make target for path '/tmp/cluster-contents240645327/gitops': unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory '/tmp/cluster-contents240645327/gitops'"
Reason: BuildFailed
Status: False
Type: Ready
Last Applied Revision: (redacted)
Last Attempted Revision: (redacted)
Observed Generation: 1
Snapshot:
Checksum: (redacted)
Entries:
Kinds:
/v1, Kind=Namespace: Namespace
apiextensions.k8s.io/v1, Kind=CustomResourceDefinition: CustomResourceDefinition
apiextensions.k8s.io/v1beta1, Kind=CustomResourceDefinition: CustomResourceDefinition
rbac.authorization.k8s.io/v1, Kind=ClusterRoleBinding: ClusterRoleBinding
rbac.authorization.k8s.io/v1beta1, Kind=ClusterRole: ClusterRole
rbac.authorization.k8s.io/v1beta1, Kind=ClusterRoleBinding: ClusterRoleBinding
Namespace:
Kinds:
/v1, Kind=Service: Service
/v1, Kind=ServiceAccount: ServiceAccount
apps/v1, Kind=Deployment: Deployment
Namespace: (redacted)
Kinds:
/v1, Kind=Service: Service
apps/v1, Kind=Deployment: Deployment
networking.k8s.io/v1, Kind=NetworkPolicy: NetworkPolicy
rbac.authorization.k8s.io/v1, Kind=Role: Role
rbac.authorization.k8s.io/v1, Kind=RoleBinding: RoleBinding
Namespace: flux-system
Kinds:
apps/v1, Kind=Deployment: Deployment
Namespace: (redacted)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal error 49m kustomize-controller kustomize build failed: accumulating resources: 2 errors occurred:
* accumulateFile error: "accumulating resources from './michals-namespace': read /tmp/cluster-contents051013649/michals-namespace: is a directory"
* accumulateDirector error: "couldn't make target for path '/tmp/cluster-contents051013649/michals-namespace': unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory '/tmp/cluster-contents051013649/michals-namespace'"
Hi there! 👋
It seems that I have hit a corner case in Kustomization detection.
Summary
Current behavior: kustomization-controller fails if it encounters a directory called
Kustomization
in the repo.Expected behavior:
Kustomization/
's parent directoryI believe that this happens because the condition of this
if
should only fire for non-directories.Reproduction
Suppose that I have
source-controller
andkustomization-controller
running in my cluster and the following manifests applied:The repo contains only plain Kubernetes manifests (i.e. no Kustomizations, just plain k8s resources). That repo follows a naming convention for resource filenames:
/<metadata.namespace>/<kind>/<metadata.name>.yaml
This works flawlessly until I add a resource of
Kustomization
kind (the use case is that I want to manage my flux2Kustomization
s from this repo). Per my naming convention, it lands in a file called along the lines of/michals-namespace/Kustomization/michals-kustomization.yaml
. Once a directory calledKustomization
gets pushed to the repository, reconciliation of theKustomization
resourcecluster-contents
begins to fail:Proposed fix
This line in
kustomization_generator.go
should become something equivalent to
If I get a green light from maintainers I'm happy to send a PR.
The text was updated successfully, but these errors were encountered: