bitnami / charts

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

bitnami/mongodb-sharded - _helpers.tpl incorrect validation #1759

Closed Hosk32 closed 4 years ago

Hosk32 commented 4 years ago

Description

/}}
{{- define "mongodb-sharded.validateValues.replicas" -}}
{{- if (int .Values.shards) le 0 }}
mongodb: invalidShardNumber
    You specified an invalid number of shards. Please set shards with a positive number
{{- end -}}
{{- if (int .Values.shardsvr.dataNode.replicas) le 0 }}
mongodb: invalidShardSvrReplicas
    You specified an invalid number of replicas per shard. Please set shardsvr.dataNode.replicas with a positive number
{{- end -}}
{{- if (int .Values.shardsvr.arbiter.replicas) lt 0 }}
mongodb: invalidShardSvrArbiters
    You specified an invalid number of arbiters per shard. Please set shardsvr.arbiter.replicas with a number greater or equal than 0
{{- end -}}
{{- if (int .Values.configsvr.replicas) le 0 }}

The validation for example - {{- if (int .Values.shards) le 0 }} previously was {{- if le (int .Values.shards) 0 }} and therefore throwing an error on the validation.

Steps to reproduce the issue:

  1. Attempt to start chart
    helm install --name mongodb stable/mongodb-sharded

    Describe the results you received:

Each of the errors are reported

mongodb: invalidShardNumber
    You specified an invalid number of shards. Please set shards with a positive number
carrodher commented 4 years ago

I am sorry but I am not able to reproduce the issue. I am installing it by running this command:

$ helm install bitnami/mongodb-sharded 

and the installation finish successfully

NAME: mongodb-sharded-1577098856
LAST DEPLOYED: Mon Dec 23 11:00:57 2019
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **

The MongoDB Sharded cluster can be accessed via the Mongos instances in port 27017 on the following DNS name from within your cluster:

    mongodb-sharded-1577098856.default.svc.cluster.local

To get the root password run:

    export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace default mongodb-sharded-1577098856 -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run --namespace default mongodb-sharded-1577098856-client --rm --tty -i --restart='Never' --image bitnami/mongodb --command -- mongo admin --host mongodb-sharded-1577098856

To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/mongodb-sharded-1577098856 27017:27017 &
    mongo --host 127.0.0.1 --authenticationDatabase admin -p $MONGODB_ROOT_PASSWORD
$ kubectl get pods
NAME                                                READY   STATUS             RESTARTS   AGE
mongodb-sharded-1577098856-configsvr-0              1/1     Running            0          4m13s
mongodb-sharded-1577098856-mongos-658cb8886-l9tsc   1/1     Running            0          4m12s
mongodb-sharded-1577098856-shard0-data-0            1/1     Running            0          4m12s
mongodb-sharded-1577098856-shard1-data-0            1/1     Running            0          4m13s

Please note that the mongodb-sharded chart is hosted in the bitnami repository, not in the stable one.

carrodher commented 4 years ago

What is the chart version you are using? It is weird because the _helpers.tpl was not modified since the chart was created.

Did you modify it locally? In the same way, are you changing the values.yaml or using some parameters in the helm install command?

stale[bot] commented 4 years ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

stale[bot] commented 4 years ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.