-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
scheduler-is-deployed
executable file
·33 lines (28 loc) · 1.21 KB
/
scheduler-is-deployed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/scheduler-kubernetes/internal-functions"
scheduler-kubernetes-scheduler-is-deployed() {
declare desc="scheduler-kubernetes scheduler-is-deployed plugin trigger"
declare trigger="scheduler-kubernetes scheduler-is-deployed"
declare DOKKU_SCHEDULER="$1" APP="$2"
local KUBE_OUTPUT
if [[ "$DOKKU_SCHEDULER" != "kubernetes" ]]; then
return
fi
export KUBECONFIG="${DOKKU_ROOT}/.kube/config"
export KUBEDOG_KUBE_CONFIG="${DOKKU_ROOT}/.kube/config"
KUBE_ARGS=()
NAMESPACE="$(fn-plugin-property-get "scheduler-kubernetes" "$APP" "namespace" "")"
NAMESPACE="$(fn-plugin-property-get "scheduler-kubernetes" "$APP" "namespace" "default")"
KUBE_ARGS+=("--namespace=$NAMESPACE")
fn-scheduler-kubernetes-ensure-namespace "$NAMESPACE" >/dev/null
KUBE_OUTPUT="$("${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubectl" "${KUBE_ARGS[@]}" get pods --selector app="$APP" -o name 2>/dev/null || true)"
if [[ -n "$KUBE_OUTPUT" ]]; then
return 0
fi
return 1
}
scheduler-kubernetes-scheduler-is-deployed "$@"