From d00fff7e3c938091c4b203487b408f96d00754dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20N=C3=A4gele?= Date: Mon, 7 Aug 2017 19:43:55 +0200 Subject: [PATCH] [stable/mongodb-replicaset] Migrate init containers to new 1.6+ syntax (#1619) --- stable/mongodb-replicaset/Chart.yaml | 2 +- stable/mongodb-replicaset/README.md | 2 +- .../templates/mongo-up-test.yaml | 32 ++-- .../templates/mongodb-statefulset.yaml | 140 +++++++----------- 4 files changed, 73 insertions(+), 103 deletions(-) diff --git a/stable/mongodb-replicaset/Chart.yaml b/stable/mongodb-replicaset/Chart.yaml index d61a107820..d0d2f31b9f 100644 --- a/stable/mongodb-replicaset/Chart.yaml +++ b/stable/mongodb-replicaset/Chart.yaml @@ -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: diff --git a/stable/mongodb-replicaset/README.md b/stable/mongodb-replicaset/README.md index b8141efe54..8ae7a86d80 100644 --- a/stable/mongodb-replicaset/README.md +++ b/stable/mongodb-replicaset/README.md @@ -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 diff --git a/stable/mongodb-replicaset/templates/mongo-up-test.yaml b/stable/mongodb-replicaset/templates/mongo-up-test.yaml index 8978469cc2..ad1fc57e27 100644 --- a/stable/mongodb-replicaset/templates/mongo-up-test.yaml +++ b/stable/mongodb-replicaset/templates/mongo-up-test.yaml @@ -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 diff --git a/stable/mongodb-replicaset/templates/mongodb-statefulset.yaml b/stable/mongodb-replicaset/templates/mongodb-statefulset.yaml index ca31b73b3b..f2f331f30e 100644 --- a/stable/mongodb-replicaset/templates/mongodb-statefulset.yaml +++ b/stable/mongodb-replicaset/templates/mongodb-statefulset.yaml @@ -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: