Create same subfolder structure from inventory folder in compiled folder
gburiola opened this issue · comments
More details in this slack conversation
We manage multiple k8s clusters (prod, test, etc) and each team can have one or more namespaces.
Namespaces will usually be the same on all clusters. For example, team1
has a namespace called team1-backend
and team1-frontend
on both the test and the prod cluster.
In our kapitan configuration, each k8s namespace in a cluster would be a target.
Ideally we would like to have an inventory
structure like this:
inventory/
├── prod
│ ├── team1
│ │ ├── team1-backend.yaml
│ │ └── team1-frontend.yaml
│ └── team2
│ ├── team2-backend.yaml
│ └── team2-frontend.yaml
└── test
├── team1
│ ├── team1-backend.yaml
│ └── team1-frontend.yaml
└── team2
├── team2-backend.yaml
└── team2-frontend.yaml
and a compiled
folder like this:
compiled/
├── prod
│ ├── team1
│ │ ├── team1-backend
│ │ │ ├── k8s-configmap.yaml
│ │ │ └── k8s-deployment.yaml
│ │ └── team1-frontend
│ │ ├── k8s-configmap.yaml
│ │ └── k8s-deployment.yaml
│ └── team2
│ ├── team2-backend
│ │ ├── k8s-configmap.yaml
│ │ └── k8s-deployment.yaml
│ └── team2-frontend
│ ├── k8s-configmap.yaml
│ └── k8s-deployment.yaml
└── test
├── team1
│ ├── team1-backend
│ │ ├── k8s-configmap.yaml
│ │ └── k8s-deployment.yaml
│ └── team1-frontend
│ ├── k8s-configmap.yaml
│ └── k8s-deployment.yaml
└── team2
├── team2-backend
│ ├── k8s-configmap.yaml
│ └── k8s-deployment.yaml
└── team2-frontend
├── k8s-configmap.yaml
└── k8s-deployment.yaml
this way each team has their own configs in a subfolder they care about
It's also clear if something is for prod or test cluster.
And then when it comes to deploy everything to a cluster, I can just kubectl apply
everything inside compiled/test
or compiled/prod
I'm aware of the kapitan output_path
config. However, that applies to paths AFTER the target folder.
What I want to do is to have a structure BEFORE the target folder. Between compiled folder and target folder.
This should also be combined with inventory/reclass-config.yaml
option:
compose_node_name: true
More info about this flag here.