From 309902ef64dac7348a0aeec43bfe6dfd124747c8 Mon Sep 17 00:00:00 2001 From: Guangya Liu Date: Thu, 4 May 2017 10:11:24 +0800 Subject: [PATCH] Put podAntiAffinity in PodSpec. --- .../cockroachdb/cockroachdb-statefulset.yaml | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/examples/cockroachdb/cockroachdb-statefulset.yaml b/examples/cockroachdb/cockroachdb-statefulset.yaml index 739d7710529..6e1ab97c025 100644 --- a/examples/cockroachdb/cockroachdb-statefulset.yaml +++ b/examples/cockroachdb/cockroachdb-statefulset.yaml @@ -78,22 +78,6 @@ spec: labels: app: cockroachdb annotations: - scheduler.alpha.kubernetes.io/affinity: > - { - "podAntiAffinity": { - "preferredDuringSchedulingIgnoredDuringExecution": [{ - "weight": 100, - "labelSelector": { - "matchExpressions": [{ - "key": "app", - "operator": "In", - "values": ["cockroachdb"] - }] - }, - "topologyKey": "kubernetes.io/hostname" - }] - } - } # 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. @@ -133,6 +117,18 @@ spec: } ]' spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpress: + - key: app + operator: In + values: + - cockroachdb + topologyKey: kubernetes.io/hostname containers: - name: cockroachdb # Runs the master branch. Not recommended for production, but since