While trying to model all my cluster infrastructure resources, I ran into #38. As a workaround, I wrote the output of several kustomizations into YAML files and used them as resources in another kustomization. That did not work either, because the resource names are still duplicates, although they are in different namespaces.
Minimal reproduction for that:
kustomization.yaml:
resources:
- service_a.yaml
- service_b.yaml
service_a.yaml:
apiVersion: v1
kind: Service
metadata:
name: ingress-controller
namespace: a
spec: {}
service_b.yaml:
apiVersion: v1
kind: Service
metadata:
name: ingress-controller
namespace: b
spec: {}
kustomize build:
Error: loadResMapFromBasesAndResources: rawResources failed to read Resources: id '"v1_Service_ingress-controller.yaml"' already used
In kustomize, objects are identified by Group, Version, Kind, Name. Can you change the two service to different names?
@Liujingfang1 I can work around it, but should it be like that?
I have the same issue. This is a deal breaker for us unfortunately.
@mxey @simonwahlgren Can you restructure the layout of the configuration? Put different namespaces into different kustomizations.
@Liujingfang1 yes, that works for me in this case.
This issue can be avoided by different layout of the configuration. More thoughts, please refer #126
I'm also wondering why namespace isn't taken into consideration. For example, two applications sharing vhost as a name but with different namespaces are different.
We have a centralized kubernetes repository that we use for a bunch of misc. stuff that we don't have application specific repositories for.
Most helpful comment
I'm also wondering why namespace isn't taken into consideration. For example, two applications sharing
vhostas a name but with different namespaces are different.We have a centralized kubernetes repository that we use for a bunch of misc. stuff that we don't have application specific repositories for.