How to structure Helm chart with different environments?

Viewed 1193

I plan to use Helm for deploying purposes. I have three applications/pods p1,p2,p3 and each of these has 2 enivronments dev, prod and in each environment there is a configmap.yml and deployment.yml.

I plan on using helm, however how can I structure these. Do I need three helm charts?, one per application or is it possible to pack everything in one helm, considering the constraints.

I thought of the following structure.

+-- charts
|   \-- my-chart
|       +-- Chart.yaml        # Helm chart metadata
|       +-- templates
        |   \-- p1
             +-- configmap1.yml
             +-- dep1.yaml
............................ similiary for p2,p3

|       +-- values.yaml       # default values
|       +-- values.dev.p1.yaml   # development override values
|       +-- values.dev.p2.yaml 
|       +-- values.dev.p3.yaml  
|       +-- values.prod.p1.yaml   # production override values
|       +-- values.prod.p2.yaml  
|       +-- values.prod.p3.yaml  

Now if I want to deploy p1 in prod , then I simply

helm install -f values.prod.p1.yaml helm-app 

Would this work is this the general convention?

1 Answers

You can use the single helm chart to manage all the deployment and config map.

Create the tpl for deployment and service so this single tpl (template) will use to generate the multiple deployment YAML configs.

So you will get the 3 YAML deployment file as output while you will be managing a single template file.

For configmap also you can follow same and keep in single helm chart is it's working fine for you.

For different environment you can mange the different values into values.yaml file like dev-values.yaml & prod-values.yaml

helm install -f values.prod.p1.yaml helm-app 
Related