The problem is to add a file with config data into Kubernetes pod described by helm subchart developed by third party. I've read number of comments saying this can be solved easily by introducing a configMap with proper data. The problem is: it is not clear how the added data gets into the subchart in question. With the following chart structure where it is necessary to put a config map and where/how to use it? Many thanks in advance!
myChart
- charts
subChartToAddFile.tgz
- templates
configMap.yaml
Chart.yaml
values.yaml
Where configMap.yaml contains the config map with a file to be mounted like
apiVersion: v1
kind: ConfigMap
metadata:
name: init-scripts-config
data:
init-key.sh: |
sleep 10;
Chart.yaml contains the dependency
apiVersion: v2
kubeVersion: '>=1.14.4'
name: myChart
dependencies:
- name: subChartToAddFile
...
It all the depends on the content of your subchart. It looks like init-scripts-config
configMap is present in the subchart and you are just overriding it. The top level chart should override the init-scripts-config
in the subchart.
If the ConfigMap name is dynamically populated in the subchart you will likely have to include that value in the top level values.yaml
file.
Example top level values.yaml
excerpt:
subChartToAddFile: global: configmapname: myconfigmapname
You can always test it with:
helm template chart/directory ...
More info here.
✌️