fluxcd / flux2-kustomize-helm-example

A GitOps workflow example for multi-env deployments with Flux, Kustomize and Helm.
https://fluxcd.io
Apache License 2.0
933 stars 992 forks source link

question: namespace in kustomization.yaml file necessary #84

Closed chrislin22 closed 8 months ago

chrislin22 commented 1 year ago

qq: https://github.com/fluxcd/flux2-kustomize-helm-example/blob/main/apps/staging/kustomization.yaml#L3

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: podinfo
....

is namespace: podinfo here necessary? The reason that I ask is that our kustomization.yaml will cover many namespaces. Thanks -cl

stefanprodan commented 1 year ago

You can set the namespace inside each file instead of this one place

chrislin22 commented 1 year ago

so a top kustomzation.yaml file which reference each namespace's kustomization file (if they are in the same directory, then we have to use name other than kustomzation.yaml, e.g. kustomzation-ns1.yaml), more like this: https://github.com/kubernetes-sigs/kustomize/blob/master/examples/multibases/multi-namespace.md

Just curious, we tried use the kustomzation.yaml without namespace and it seems to be working as well?

stefanprodan commented 1 year ago

then we have to use name other than kustomzation.yaml, e.g. kustomzation-ns1.yaml

Kustomize only works with kustomzation.yaml

Just curious, we tried use the kustomzation.yaml without namespace and it seems to be working as well?

That's because we set the namespace in the podinfo manifests.