check_endpoints.sh
Shell command-substitution syntaxShell has multiple dynamic command targets
SHA-2565489148402c2c3560635cda6a0fe197d49b61060b42e92bf14e6fde1acc8d07a
MaleculeH₄(DbOsPo₂Ti)Md(Pa)
Evidence
1#!/bin/bash
2
3function check_endpoints {
4 slices=($("${KUBECTL}" -n "${CROSSPLANE_NAMESPACE}" get endpointslices --no-headers | grep 'provider-' | awk '{print $1}'))
5 for s in "${slices[@]}"; do
6 addresses=$(${KUBECTL} -n "${CROSSPLANE_NAMESPACE}" get endpointslice "${s}" -o go-template='{{ range .endpoints }} {{- if and (eq .conditions.serving true) (eq .conditions.terminating false) }} {{- .addresses }}{{ "\n" }}{{- end }} {{- end }}')
7 if [[ -z "${addresses}" ]]; then
8 echo "${s} - No serving addresses in endpointslice"
9 return 1
10 else
11 echo "${s} - Serving addresses ${addresses} found in endpointslice"
⋯6 lines
18while [[ $attempt -le $max_attempts ]]; do
19 if check_endpoints; then
20 exit 0
21 else
22 printf "Retrying... (%d/%d)\n" "$attempt" "$max_attempts" >&2
23 fi
24 attempt=$((attempt+1))
25 sleep 5
26done
27exit 1