-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
install
executable file
·43 lines (35 loc) · 2.25 KB
/
install
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
34
35
36
37
38
39
40
41
42
43
#!/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"
scheduler-kubernetes-install() {
declare desc="scheduler-kubernetes install plugin trigger"
declare trigger="scheduler-kubernetes-install"
mkdir -p "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes"
chown -R "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes"
fn-plugin-property-setup "scheduler-kubernetes"
local KUBECTL_VENDOR_URL="${KUBECTL_VENDOR_URL:-"https://dl.k8s.io"}"
local KUBECTL_VERSION="${KUBECTL_VERSION:-v1.22.13}"
if [[ ! -f "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubectl-${KUBECTL_VERSION}" ]]; then
dokku_log_info1_quiet "Installing kubectl@${KUBECTL_VERSION}"
curl -sL "${KUBECTL_VENDOR_URL}/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" -o "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubectl-${KUBECTL_VERSION}"
cp "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubectl-${KUBECTL_VERSION}" "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubectl"
chmod +x "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubectl"
fi
local KUBEDOG_VENDOR_URL="${KUBEDOG_VENDOR_URL:-"https://dl.bintray.com"}"
local KUBEDOG_VERSION="${KUBEDOG_VERSION:-v0.3.4}"
local KUBEDOG_URL="${KUBEDOG_URL:-"${KUBEDOG_VENDOR_URL}/flant/kubedog/${KUBEDOG_VERSION}/kubedog-linux-amd64-${KUBEDOG_VERSION}"}"
# hardcode kubedog vendor for now
KUBEDOG_URL=https://github.com/dokku/dokku-scheduler-kubernetes/releases/download/0.17.6/kubedog-linux-amd64-v0.3.4
if [[ ! -f "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubedog-${KUBEDOG_VERSION}" ]]; then
dokku_log_info1_quiet "Installing kubedog@${KUBEDOG_VERSION}"
curl -sL "$KUBEDOG_URL" -o "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubedog-${KUBEDOG_VERSION}"
cp "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubedog-${KUBEDOG_VERSION}" "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubedog"
chmod +x "${DOKKU_LIB_ROOT}/data/scheduler-kubernetes/kubedog"
fi
if ! command -v jq &>/dev/null; then
dokku_log_warn "This plugin script requires jq. Please call 'sudo dokku plugin:install-dependencies' to install this package."
fi
}
scheduler-kubernetes-install "$@"