Skip to content

Commit 199d30b

Browse files
authored
Merge pull request #2934 from artsy/artsyjian/cron-protect
feat: protect cronjobs from eviction by cluster-autoscaler, and general true-up.
2 parents ee0687d + 60190f7 commit 199d30b

File tree

2 files changed

+46
-28
lines changed

2 files changed

+46
-28
lines changed

hokusai/production.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ spec:
6565
lifecycle:
6666
preStop:
6767
exec:
68-
command: ["sh", "-c", "sleep 10"]
68+
command: ["sh", "-c", "sleep 5"]
6969
dnsPolicy: ClusterFirst
7070
dnsConfig:
7171
options:
@@ -106,7 +106,11 @@ spec:
106106
concurrencyPolicy: Forbid
107107
jobTemplate:
108108
spec:
109+
backoffLimit: 0
109110
template:
111+
metadata:
112+
annotations:
113+
"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"
110114
spec:
111115
containers:
112116
- name: positron-scheduled-posts-cron
@@ -119,10 +123,9 @@ spec:
119123
restartPolicy: Never
120124
affinity:
121125
nodeAffinity:
122-
preferredDuringSchedulingIgnoredDuringExecution:
123-
- weight: 1
124-
preference:
125-
matchExpressions:
126+
requiredDuringSchedulingIgnoredDuringExecution:
127+
nodeSelectorTerms:
128+
- matchExpressions:
126129
- key: tier
127130
operator: In
128131
values:
@@ -138,7 +141,11 @@ spec:
138141
concurrencyPolicy: Forbid
139142
jobTemplate:
140143
spec:
144+
backoffLimit: 3
141145
template:
146+
metadata:
147+
annotations:
148+
"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"
142149
spec:
143150
containers:
144151
- name: positron-unqueue-cron
@@ -151,10 +158,9 @@ spec:
151158
restartPolicy: Never
152159
affinity:
153160
nodeAffinity:
154-
preferredDuringSchedulingIgnoredDuringExecution:
155-
- weight: 1
156-
preference:
157-
matchExpressions:
161+
requiredDuringSchedulingIgnoredDuringExecution:
162+
nodeSelectorTerms:
163+
- matchExpressions:
158164
- key: tier
159165
operator: In
160166
values:
@@ -170,7 +176,11 @@ spec:
170176
concurrencyPolicy: Forbid
171177
jobTemplate:
172178
spec:
179+
backoffLimit: 3
173180
template:
181+
metadata:
182+
annotations:
183+
"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"
174184
spec:
175185
containers:
176186
- name: positron-data-export-cron
@@ -186,10 +196,9 @@ spec:
186196
restartPolicy: Never
187197
affinity:
188198
nodeAffinity:
189-
preferredDuringSchedulingIgnoredDuringExecution:
190-
- weight: 1
191-
preference:
192-
matchExpressions:
199+
requiredDuringSchedulingIgnoredDuringExecution:
200+
nodeSelectorTerms:
201+
- matchExpressions:
193202
- key: tier
194203
operator: In
195204
values:
@@ -210,7 +219,7 @@ spec:
210219
- port: 8080
211220
protocol: TCP
212221
name: http
213-
targetPort: 8080
222+
targetPort: positron-http
214223
selector:
215224
app: positron
216225
layer: application

hokusai/staging.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ spec:
6565
lifecycle:
6666
preStop:
6767
exec:
68-
command: ["sh", "-c", "sleep 10"]
68+
command: ["sh", "-c", "sleep 5"]
6969
dnsPolicy: ClusterFirst
7070
dnsConfig:
7171
options:
@@ -106,7 +106,11 @@ spec:
106106
concurrencyPolicy: Forbid
107107
jobTemplate:
108108
spec:
109+
backoffLimit: 0
109110
template:
111+
metadata:
112+
annotations:
113+
"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"
110114
spec:
111115
containers:
112116
- name: positron-scheduled-posts-cron
@@ -119,10 +123,9 @@ spec:
119123
restartPolicy: Never
120124
affinity:
121125
nodeAffinity:
122-
preferredDuringSchedulingIgnoredDuringExecution:
123-
- weight: 1
124-
preference:
125-
matchExpressions:
126+
requiredDuringSchedulingIgnoredDuringExecution:
127+
nodeSelectorTerms:
128+
- matchExpressions:
126129
- key: tier
127130
operator: In
128131
values:
@@ -138,7 +141,11 @@ spec:
138141
concurrencyPolicy: Forbid
139142
jobTemplate:
140143
spec:
144+
backoffLimit: 3
141145
template:
146+
metadata:
147+
annotations:
148+
"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"
142149
spec:
143150
containers:
144151
- name: positron-unqueue-cron
@@ -151,10 +158,9 @@ spec:
151158
restartPolicy: Never
152159
affinity:
153160
nodeAffinity:
154-
preferredDuringSchedulingIgnoredDuringExecution:
155-
- weight: 1
156-
preference:
157-
matchExpressions:
161+
requiredDuringSchedulingIgnoredDuringExecution:
162+
nodeSelectorTerms:
163+
- matchExpressions:
158164
- key: tier
159165
operator: In
160166
values:
@@ -170,7 +176,11 @@ spec:
170176
concurrencyPolicy: Forbid
171177
jobTemplate:
172178
spec:
179+
backoffLimit: 3
173180
template:
181+
metadata:
182+
annotations:
183+
"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"
174184
spec:
175185
containers:
176186
- name: positron-data-import-cron
@@ -186,10 +196,9 @@ spec:
186196
restartPolicy: Never
187197
affinity:
188198
nodeAffinity:
189-
preferredDuringSchedulingIgnoredDuringExecution:
190-
- weight: 1
191-
preference:
192-
matchExpressions:
199+
requiredDuringSchedulingIgnoredDuringExecution:
200+
nodeSelectorTerms:
201+
- matchExpressions:
193202
- key: tier
194203
operator: In
195204
values:
@@ -210,7 +219,7 @@ spec:
210219
- port: 8080
211220
protocol: TCP
212221
name: http
213-
targetPort: 8080
222+
targetPort: positron-http
214223
selector:
215224
app: positron
216225
layer: application

0 commit comments

Comments
 (0)