Helm charts unification
Problem:
At the moment we have a helm charts per each module stored in one repository folio-helm. It is a set of charts which duplicates each other and it is hard to manage any changes if it is needed to be done for all modules.
Idea:
According to the Helm best practices and documentation do refactoring and rebuilding of this approach to do it more flexible and configurable.
Possible solution:
Because all our modules has the same approach to deploy (no significant differences), I propose to create common (library) chart which describes all required Kubernetes resources:
- Deployment
- Service
- Ingress
- Service account
- Config Map
- Volumes
- Labels
Each module (service) chart will only include the common templates required for the service and supply service-specific values. After this implementation we will be able to do PoC about umbrella chart usage.
We’re going to leverage Helm’s templating engine to define common resource yamls to our charts. As I previously mentioned, the common templates will lay in the common chart.
I won’t dive into the templating syntax, but in a sentence, it allows each chart depending on the common chart to override the common’s values.yaml values with it is own values defined in it is values.yaml file.
After implementation of common chart, re-using the resource in service chart is quite simple:
- Add the Common chart as a dependency of the service chart.
Create the following file:
deployment.yaml{{- template "common.deployment" . -}}
That’s it. Next time the service chart will be installed, it will take all it is resources from the common chart, while private values will override common values of the common chart.