Support for namespaces
tesharp opened this issue · 2 comments
Would be nice with support for defining namespace in config file. Prefer using kubectl --namespace
and not define namespace in templates and using variables. Something like below example where it would append namespace to kubectl command.
---
context: k8s.prod.mydomain.com
global:
globalVar: lizards
include:
- name: some-api
namespace: default
values:
version: 1.0-0e6884d
importantFeature: true
apiPort: 4567
By configuration your context in your kube config file, you can apply the entire config to a given name space. e.g.
contexts:
- context:
cluster: development
namespace: frontend
user: developer
name: dev-frontend
- context:
cluster: development
namespace: storage
user: developer
name: dev-storage
This gives you two contexts which are identical, except for the namespace. I am using this for my qa and prod contexts, which are both on the same cluster.
There is now as of version 1.6.0 an alternative way to do this from the CLI.
You can add something like namespace: {{ .namespace }}
to your resources metadata
and override it using --var namespace=foobar
when executing kontemplate.
You can use all the other default ways to provide variables to set default namespaces etc.