[stable/mongodb-replicaset] Fix regression when using passwords with spaces (#8668)

* Fix regression when using passwords with spaces

Signed-off-by: Steven Sheehy <ssheehy@firescope.com>

* Changes from code review

Signed-off-by: Steven Sheehy <ssheehy@firescope.com>

* Add terminationGracePeriodSeconds to README

Signed-off-by: Steven Sheehy <ssheehy@firescope.com>
This commit is contained in:
Steven Sheehy
2018-10-26 09:34:45 -07:00
committed by k8s-ci-robot
parent 721f05e193
commit 4e5edc4f95
5 changed files with 16 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
name: mongodb-replicaset
home: https://github.com/mongodb/mongo
version: 3.6.2
version: 3.6.3
appVersion: 3.6
description: NoSQL document-oriented database that stores JSON-like documents with
dynamic schemas, simplifying the integration of data in content-driven applications.
+7
View File
@@ -51,6 +51,7 @@ The following table lists the configurable parameters of the mongodb chart and t
| `persistentVolume.accessMode` | Persistent volume access modes | `[ReadWriteOnce]` |
| `persistentVolume.size` | Persistent volume size | `10Gi` |
| `persistentVolume.annotations` | Persistent volume annotations | `{}` |
| `terminationGracePeriodSeconds` | Duration in seconds the pod needs to terminate gracefully | `30` |
| `tls.enabled` | Enable MongoDB TLS support including authentication | `false` |
| `tls.cacert` | The CA certificate used for the members | Our self signed CA certificate |
| `tls.cakey` | The CA key used for the members | Our key for the self signed CA certificate |
@@ -117,6 +118,12 @@ keys `user` and `password`, that for the key file must contain `key.txt`. The u
full `root` permissions but is restricted to the `admin` database for security purposes. It can be
used to create additional users with more specific permissions.
To connect to the mongo shell with authentication enabled, use a command similar to the following (substituting values as appropriate):
```shell
kubectl exec -it mongodb-replicaset-0 -- mongo mydb -u admin -p password --authenticationDatabase admin
```
## TLS support
To enable full TLS encryption set `tls.enabled` to `true`. It is recommended to create your own CA by executing:
+5 -4
View File
@@ -43,15 +43,14 @@ retry_until() {
local host="${1}"
local command="${2}"
local expected="${3}"
local creds="${admin_creds[@]}"
local creds=("${admin_creds[@]}")
# Don't need credentials for admin user creation and pings that run on localhost
if [[ "${host}" =~ ^localhost ]]; then
creds=
creds=()
fi
until [[ $(mongo admin --host "${host}" ${creds} "${ssl_args[@]}" --quiet --eval "${command}") == "${expected}" ]]; do
log "Retrying ${command}"
until [[ $(mongo admin --host "${host}" "${creds[@]}" "${ssl_args[@]}" --quiet --eval "${command}") == "${expected}" ]]; do
sleep 1
if (! ps "${pid}" &>/dev/null); then
@@ -62,6 +61,8 @@ retry_until() {
log "Timed out after ${timeout}s attempting to bootstrap mongod"
exit 1
fi
log "Retrying ${command} on ${host}"
done
}
@@ -38,6 +38,7 @@ spec:
spec:
securityContext:
{{ toYaml .Values.securityContext | indent 8 }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
initContainers:
- name: copy-config
image: busybox
+2
View File
@@ -93,6 +93,8 @@ persistentVolume:
# Annotations to be added to the service
serviceAnnotations: {}
terminationGracePeriodSeconds: 30
tls:
# Enable or disable MongoDB TLS support
enabled: false