Put podAntiAffinity in PodSpec.

pull/6/head
Guangya Liu 2017-05-04 10:11:24 +08:00
parent e537cec9b0
commit 309902ef64
1 changed files with 12 additions and 16 deletions

View File

@ -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