I learning about k8s and Helm so I started to create a simple flask app which uses mongondb, I have the deployment, the service and the ingress installed with helm and are working fine. For the mongo container I am using the chart from Bitnami, but I need to insert some data on creation, as I do wih the normal deployment by adding:
```
volumeMounts:
- name: mongo-initdb
mountPath: /docker-entrypoint-initdb.d
```
In the bitnami documentation
https://artifacthub.io/packages/helm/bitnami/mongodb it says that the data can be entered through a script or a configmap with the parameters ```initdbScripts``` or ```initdbScriptsConfigMap``` but I tried adding them like this and does not work:
```
mongodb:
metrics:
enabled: true
global:
namespaceOverride: flask-app
initdbScriptsConfigMap: mongo-configmap.yaml
```
being this the configmap which works when using K8s with .yaml files:
```
apiVersion: v1
data:
init-db.js: |-
db = db.getSiblingDB("cars_db");
db.car_tb.drop();
db.car_tb.insertMany([
{
"id": 1,
"brand": "Ford",
"model": "Mustang"
},
{
"id": 2,
"brand": "Lamborghini",
"model": "Veneno"
},
{
"id": 3,
"brand": "Ferrari",
"model": "Enzo"
},
{
"id": 4,
"brand": "Mercedes",
"model": "Cls63-AMG"
},
]);
kind: ConfigMap
metadata:
name: mongo-initdb
namespace: flask-app
```