bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
8.97k stars 9.2k forks source link

[bitnami/mongodb-sharded] sidecar container definitions are ignored #2228

Closed thomasgafner closed 4 years ago

thomasgafner commented 4 years ago

Which chart: bitnami/mongodb-sharded

Describe the bug When defining sidecar containers in the helm yaml for any mongodb pod (configsrv, mongos, shardsvr.arbiter or shardsvr.dataNode) that definitions are ignored. No additional containers appear in the output yaml nor are any containers created in kubernetes.

To Reproduce Steps to reproduce the behavior:

git clone https://github.com/bitnami/charts.git
cp charts/bitnami/mongodb-sharded/values.yaml myValues.yaml
.. edit ..
configsvr:
  ..
  sidecars:
    - name: mytest
      image: bitnami/node
      imagePullPolicy: IfNotPresent
.. and save.
helm install --dry-run --debug my-test -n my-test-space -f myValues.yaml charts/bitnami/mongodb-sharded | grep bitnami/node -C10

You see bitnami/node right after sidecars: two times - each time it is just the definition of the myValues.yaml. But there is no image 'bitnami/node' added in the containers section of any output *-statefulset.yaml. If I do not do a dry run, but a real deploy, when I do kubectl get pods -n my-test-space

NAME                                              READY   STATUS    RESTARTS   AGE
my-test-mongodb-sharded-configsvr-0               1/1     Running   1          3m10s
my-test-mongodb-sharded-mongos-547dcdccf5-k46xk   1/1     Running   0          3m10s
my-test-mongodb-sharded-shard0-data-0             1/1     Running   3          3m10s
my-test-mongodb-sharded-shard1-data-0             1/1     Running   3          3m10s

Expected behavior When defining a sidecar like above, there should be an additional entry in the containers section of

# Source: mongodb-sharded/templates/config-server/config-server-statefulset.yaml
..
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: mongodb-sharded
      app.kubernetes.io/instance: my-test
      app.kubernetes.io/component: configsvr
  ..
  template:
    ..
    spec:
      ..
      containers:
        - name: mongodb
          ..
        - name: mytest
          image: bitnami/node
          imagePullPolicy: IfNotPresent
Additionally I would expect certain mongo settings like the root password also be available in those sidecars:
          env:
            - name: MONGODB_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: my-test-mongodb-sharded
                  key: mongodb-root-password

If I do not do a dry run, but a real deploy, when I do kubectl get pods -n my-test-space I exprect to see:

NAME                                              READY   STATUS    RESTARTS   AGE
my-test-mongodb-sharded-configsvr-0               2/2     Running   1          3m10s
my-test-mongodb-sharded-mongos-547dcdccf5-k46xk   1/1     Running   0          3m10s
my-test-mongodb-sharded-shard0-data-0             1/1     Running   3          3m10s
my-test-mongodb-sharded-shard1-data-0             1/1     Running   3          3m10s

There is an additional container running. - configsvr-0 2/2

Version of Helm and Kubernetes:

version.BuildInfo{Version:"v3.1.2", GitCommit:"d878d4d45863e42fd5cff6743294a11d28a9abce", GitTreeState:"clean", GoVersion:"go1.13.8"}
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:58:59Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.3", GitCommit:"06ad960bfd03b39c8310aaf92d1e7c12ce618213", GitTreeState:"clean", BuildDate:"2020-02-11T18:07:13Z", GoVersion:"go1.13.6", Compiler:"gc", Platform:"linux/amd64"}

Additional context N/A

dani8art commented 4 years ago

@thomasgafner thank you so much for your feedback, let's move the discussion to the PR #2229