Skip to content

Commit 02755dd

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request #45322 from gyliu513/podantiaffinity
Automatic merge from submit-queue (batch tested with PRs 45322, 44770, 45411) Put podAntiAffinity in PodSpec. **What this PR does / why we need it**: **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: In 1.6, we moved the `affinity` from `annotations` to `PodSpec`, but the `annotations` still works with `AffinityInAnnotations=true`. Please check https://docs.google.com/document/d/1YP3OJTKMpXkWAhipPjx9-bDMxJ87JZ6AcVak7c3SGos/edit for detail. **Release note**: ```release-note ``` Fixed #45318
2 parents 4879679 + a3ba071 commit 02755dd

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

cockroachdb/cockroachdb-statefulset.yaml

+12-16
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,6 @@ spec:
7878
labels:
7979
app: cockroachdb
8080
annotations:
81-
scheduler.alpha.kubernetes.io/affinity: >
82-
{
83-
"podAntiAffinity": {
84-
"preferredDuringSchedulingIgnoredDuringExecution": [{
85-
"weight": 100,
86-
"labelSelector": {
87-
"matchExpressions": [{
88-
"key": "app",
89-
"operator": "In",
90-
"values": ["cockroachdb"]
91-
}]
92-
},
93-
"topologyKey": "kubernetes.io/hostname"
94-
}]
95-
}
96-
}
9781
# Init containers are run only once in the lifetime of a pod, before
9882
# it's started up for the first time. It has to exit successfully
9983
# before the pod's main containers are allowed to start.
@@ -133,6 +117,18 @@ spec:
133117
}
134118
]'
135119
spec:
120+
affinity:
121+
podAntiAffinity:
122+
preferredDuringSchedulingIgnoredDuringExecution:
123+
- weight: 100
124+
podAffinityTerm:
125+
labelSelector:
126+
matchExpress:
127+
- key: app
128+
operator: In
129+
values:
130+
- cockroachdb
131+
topologyKey: kubernetes.io/hostname
136132
containers:
137133
- name: cockroachdb
138134
# Runs the master branch. Not recommended for production, but since

0 commit comments

Comments
 (0)