@@ -40,7 +40,7 @@ show_json() {
40
40
set_status () {
41
41
dry_run=
42
42
if [[ ${DRY_RUN} == 1 ]]; then
43
- dry_run=" (dry-ryn )"
43
+ dry_run=" (dry-run )"
44
44
fi
45
45
prev_status=$( get_status)
46
46
if [[ ${prev_status} != * " Not started" * ]]; then
@@ -49,6 +49,9 @@ set_status() {
49
49
echo " $( date -Ins) ${* }${dry_run} " >> " ${SCALETEST_STATE_DIR} /status"
50
50
51
51
annotate_grafana " status" " Status: ${* } "
52
+
53
+ status_lower=$( tr ' [:upper:]' ' [:lower:]' <<< " ${*}" )
54
+ set_pod_status_annotation " ${status_lower} "
52
55
}
53
56
lock_status () {
54
57
chmod 0440 " ${SCALETEST_STATE_DIR} /status"
@@ -248,17 +251,13 @@ set_appearance() {
248
251
}
249
252
250
253
namespace () {
251
- local ns
252
- ns=$( < /var/run/secrets/kubernetes.io/serviceaccount/namespace)
253
- echo " ${ns} "
254
+ cat /var/run/secrets/kubernetes.io/serviceaccount/namespace
254
255
}
255
256
coder_pods () {
256
- local pods
257
- pods=$( kubectl get pods \
257
+ kubectl get pods \
258
258
--namespace " $( namespace) " \
259
259
--selector " app.kubernetes.io/name=coder,app.kubernetes.io/part-of=coder" \
260
- --output jsonpath=' {.items[*].metadata.name}' )
261
- echo " ${pods} "
260
+ --output jsonpath=' {.items[*].metadata.name}'
262
261
}
263
262
264
263
# fetch_coder_full fetches the full (non-slim) coder binary from one of the coder pods
@@ -271,18 +270,18 @@ fetch_coder_full() {
271
270
ns=$( namespace)
272
271
if [[ -z " ${ns} " ]]; then
273
272
log " Could not determine namespace!"
274
- exit 1
273
+ return
275
274
fi
276
275
log " Namespace from serviceaccount token is ${ns} "
277
276
pods=$( coder_pods)
278
277
if [[ -z ${pods} ]]; then
279
278
log " Could not find coder pods!"
280
- exit 1
279
+ return
281
280
fi
282
- pod=$( echo " ${pods} " | cut -d ' ' -f 1)
281
+ pod=$( cut -d ' ' -f 1 <<< " ${pods} " )
283
282
if [[ -z ${pod} ]]; then
284
283
log " Could not find coder pod!"
285
- exit 1
284
+ return
286
285
fi
287
286
log " Fetching full Coder binary from ${pod} "
288
287
# We need --retries due to https://github.com/kubernetes/kubernetes/issues/60140 :(
@@ -296,12 +295,12 @@ fetch_coder_full() {
296
295
log " Full Coder binary downloaded to ${SCALETEST_CODER_BINARY} "
297
296
}
298
297
299
- # set_status_annotation annotates the currently running pod with the key
298
+ # set_pod_status_annotation annotates the currently running pod with the key
300
299
# com.coder.scaletest.status. It will overwrite the previous status.
301
- set_status_annotation () {
300
+ set_pod_status_annotation () {
302
301
if [[ $# -ne 1 ]]; then
303
302
log " must specify an annotation value"
304
- exit 1
303
+ return
305
304
else
306
305
maybedryrun " ${DRY_RUN} " kubectl --namespace " $( namespace) " annotate pod " $( hostname) " " com.coder.scaletest.status=$2 " --overwrite
307
306
fi
0 commit comments