Put initContainers to PodSpec for some statefulset examples.

This commit is contained in:
Guangya Liu 2017-05-06 17:55:09 +08:00
parent 02755dd8f9
commit b2743e2a0b
1 changed files with 26 additions and 39 deletions

View File

@ -77,7 +77,7 @@ spec:
metadata: metadata:
labels: labels:
app: cockroachdb app: cockroachdb
annotations: spec:
# Init containers are run only once in the lifetime of a pod, before # Init containers are run only once in the lifetime of a pod, before
# it's started up for the first time. It has to exit successfully # it's started up for the first time. It has to exit successfully
# before the pod's main containers are allowed to start. # before the pod's main containers are allowed to start.
@ -88,35 +88,22 @@ spec:
# has to decide what command-line flags to use when starting CockroachDB. # has to decide what command-line flags to use when starting CockroachDB.
# This only matters when a pod's persistent volume is empty - if it has # This only matters when a pod's persistent volume is empty - if it has
# data from a previous execution, that data will always be used. # data from a previous execution, that data will always be used.
pod.alpha.kubernetes.io/init-containers: '[ initContainers:
{ - name: bootstrap
"name": "bootstrap", image: cockroachdb/cockroach-k8s-init:0.1
"image": "cockroachdb/cockroach-k8s-init:0.1", imagePullPolicy: IfNotPresent
"imagePullPolicy": "IfNotPresent", args:
"args": [ - "-on-start=/on-start.sh"
"-on-start=/on-start.sh", - "-service=cockroachdb"
"-service=cockroachdb" env:
], - name: POD_NAMESPACE
"env": [ valueFrom:
{ fieldRef:
"name": "POD_NAMESPACE", apiVersion: v1
"valueFrom": { fieldPath: metadata.namespace
"fieldRef": { volumeMounts:
"apiVersion": "v1", - name: datadir
"fieldPath": "metadata.namespace" mountPath: "/cockroach/cockroach-data"
}
}
}
],
"volumeMounts": [
{
"name": "datadir",
"mountPath": "/cockroach/cockroach-data"
}
]
}
]'
spec:
affinity: affinity:
podAntiAffinity: podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution: preferredDuringSchedulingIgnoredDuringExecution: