[stable/mongodb-replicaset] Migrate init containers to new 1.6+ syntax (#1619)

This commit is contained in:
Reinhard Nägele
2017-08-07 19:43:55 +02:00
committed by GitHub
parent 4f1e2ea355
commit d00fff7e3c
4 changed files with 73 additions and 103 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
name: mongodb-replicaset
home: https://github.com/mongodb/mongo
version: 1.2.0
version: 1.3.0
description: NoSQL document-oriented database that stores JSON-like documents with dynamic schemas, simplifying the integration of data in content-driven applications.
icon: https://webassets.mongodb.com/_com_assets/cms/mongodb-logo-rgb-j6w271g1xn.jpg
sources:
+1 -1
View File
@@ -1,7 +1,7 @@
# MongoDB Helm Chart
## Prerequisites Details
* Kubernetes 1.5+ with Beta APIs enabled.
* Kubernetes 1.6+ with Beta APIs enabled.
* PV support on the underlying infrastructure.
## StatefulSet Details
@@ -4,25 +4,27 @@ metadata:
name: {{ template "fullname" . }}-test
annotations:
"helm.sh/hook": test-success
"pod.beta.kubernetes.io/init-containers": '[
{
"name": "test-framework",
"image": "dduportal/bats:0.4.0",
"command": ["bash", "-c", "
set -ex\n
# copy bats to tools dir\n
cp -R /usr/local/libexec/ /tools/bats/\n
"],
"volumeMounts": [
{"name": "tools", "mountPath": "/tools"}
]
}
]'
spec:
initContainers:
- name: test-framework
image: dduportal/bats:0.4.0
command:
- bash
- -c
- |
set -ex
# copy bats to tools dir
cp -R /usr/local/libexec/ /tools/bats/
volumeMounts:
- name: tools
mountPath: /tools
containers:
- name: mongo
image: "{{ .Values.image.name }}:{{ .Values.image.tag }}"
command: ["/tools/bats/bats", "-t", "/tests/mongo-up-test.sh"]
command:
- /tools/bats/bats
- -t
- /tests/mongo-up-test.sh
volumeMounts:
- name: tools
mountPath: /tools
@@ -19,92 +19,60 @@ spec:
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
pod.alpha.kubernetes.io/init-containers: '[
{
"name": "install",
"image": "{{ .Values.installImage.name }}:{{ .Values.installImage.tag }}",
"args": ["--work-dir=/work-dir"],
"imagePullPolicy": "{{ .Values.installImage.pullPolicy }}",
"volumeMounts": [
{
"name": "workdir",
"mountPath": "/work-dir"
},
{
"name": "config",
"mountPath": "/config"
}
]
},
{
"name": "bootstrap",
"image": "{{ .Values.image.name }}:{{ .Values.image.tag }}",
"command": ["/work-dir/peer-finder"],
"args": ["-on-start=/work-dir/on-start.sh", "-service={{ template "fullname" . }}"],
"imagePullPolicy": "{{ .Values.image.pullPolicy }}",
"env": [
{
"name": "POD_NAMESPACE",
"valueFrom": {
"fieldRef": {
"apiVersion": "v1",
"fieldPath": "metadata.namespace"
}
}
},
{
"name": "REPLICA_SET",
"value": "{{ .Values.replicaSet }}"
}
{{- if .Values.auth.enabled }},
{
"name": "AUTH",
"value": "true"
},
{
"name": "ADMIN_USER",
"valueFrom": {
"secretKeyRef": {
"name": "{{ template "adminSecret" . }}",
"key": "user"
}
}
},
{
"name": "ADMIN_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"name": "{{ template "adminSecret" . }}",
"key": "password"
}
}
}
{{- end }}
],
"volumeMounts": [
{
"name": "workdir",
"mountPath": "/work-dir"
},
{
"name": "config",
"mountPath": "/config"
},
{
"name": "datadir",
"mountPath": "/data/db"
}
{{- if .Values.auth.enabled }},
{
"name": "keydir",
"mountPath": "/keydir",
"readOnly": true
}
{{- end }}
]
}
]'
spec:
initContainers:
- name: install
image: "{{ .Values.installImage.name }}:{{ .Values.installImage.tag }}"
args:
- --work-dir=/work-dir
imagePullPolicy: "{{ .Values.installImage.pullPolicy }}"
volumeMounts:
- name: workdir
mountPath: /work-dir
- name: config
mountPath: /config
- name: bootstrap
image: "{{ .Values.image.name }}:{{ .Values.image.tag }}"
command:
- /work-dir/peer-finder
args:
- -on-start=/work-dir/on-start.sh
- "-service={{ template "fullname" . }}"
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: REPLICA_SET
value: {{ .Values.replicaSet }}
{{- if .Values.auth.enabled }}
- name: AUTH
value: "true"
- name: ADMIN_USER
valueFrom:
secretKeyRef:
name: "{{ template "adminSecret" . }}"
key: user
- name: ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: "{{ template "adminSecret" . }}"
key: password
{{- end }}
volumeMounts:
- name: workdir
mountPath: /work-dir
- name: config
mountPath: /config
- name: datadir
mountPath: /data/db
{{- if .Values.auth.enabled }}
- name: keydir
mountPath: /keydir
readOnly: true
{{- end }}
containers:
- name: {{ template "name" . }}
image: "{{ .Values.image.name }}:{{ .Values.image.tag }}"
@@ -131,7 +99,7 @@ spec:
secretKeyRef:
name: "{{ template "adminSecret" . }}"
key: password
{{- end }}
{{- end }}
livenessProbe:
exec:
command: