diff --git a/cockroachdb/cockroachdb-statefulset.yaml b/cockroachdb/cockroachdb-statefulset.yaml index 6e1ab97c..7bb06e7d 100644 --- a/cockroachdb/cockroachdb-statefulset.yaml +++ b/cockroachdb/cockroachdb-statefulset.yaml @@ -77,46 +77,33 @@ spec: metadata: labels: 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: + # 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: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: