Put initContainers to PodSpec for some statefulset examples.
This commit is contained in:
parent
02755dd8f9
commit
b2743e2a0b
|
|
@ -77,46 +77,33 @@ spec:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: cockroachdb
|
app: cockroachdb
|
||||||
annotations:
|
|
||||||
# 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
|
|
||||||
# before the pod's main containers are allowed to start.
|
|
||||||
# This particular init container does a DNS lookup for other pods in
|
|
||||||
# the set to help determine whether or not a cluster already exists.
|
|
||||||
# If any other pods exist, it creates a file in the cockroach-data
|
|
||||||
# directory to pass that information along to the primary container that
|
|
||||||
# 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
|
|
||||||
# data from a previous execution, that data will always be used.
|
|
||||||
pod.alpha.kubernetes.io/init-containers: '[
|
|
||||||
{
|
|
||||||
"name": "bootstrap",
|
|
||||||
"image": "cockroachdb/cockroach-k8s-init:0.1",
|
|
||||||
"imagePullPolicy": "IfNotPresent",
|
|
||||||
"args": [
|
|
||||||
"-on-start=/on-start.sh",
|
|
||||||
"-service=cockroachdb"
|
|
||||||
],
|
|
||||||
"env": [
|
|
||||||
{
|
|
||||||
"name": "POD_NAMESPACE",
|
|
||||||
"valueFrom": {
|
|
||||||
"fieldRef": {
|
|
||||||
"apiVersion": "v1",
|
|
||||||
"fieldPath": "metadata.namespace"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"volumeMounts": [
|
|
||||||
{
|
|
||||||
"name": "datadir",
|
|
||||||
"mountPath": "/cockroach/cockroach-data"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]'
|
|
||||||
spec:
|
spec:
|
||||||
|
# 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
|
||||||
|
# before the pod's main containers are allowed to start.
|
||||||
|
# This particular init container does a DNS lookup for other pods in
|
||||||
|
# the set to help determine whether or not a cluster already exists.
|
||||||
|
# If any other pods exist, it creates a file in the cockroach-data
|
||||||
|
# directory to pass that information along to the primary container that
|
||||||
|
# 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
|
||||||
|
# data from a previous execution, that data will always be used.
|
||||||
|
initContainers:
|
||||||
|
- name: bootstrap
|
||||||
|
image: cockroachdb/cockroach-k8s-init:0.1
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
args:
|
||||||
|
- "-on-start=/on-start.sh"
|
||||||
|
- "-service=cockroachdb"
|
||||||
|
env:
|
||||||
|
- name: POD_NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
apiVersion: v1
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
volumeMounts:
|
||||||
|
- name: datadir
|
||||||
|
mountPath: "/cockroach/cockroach-data"
|
||||||
affinity:
|
affinity:
|
||||||
podAntiAffinity:
|
podAntiAffinity:
|
||||||
preferredDuringSchedulingIgnoredDuringExecution:
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue