my-homelab-configs/lib/jeannie/cluster-context.sh

35 lines
1.1 KiB
Bash

#!/usr/bin/env bash
cluster_context_require() {
python3 "${REPO_ROOT}/scripts/cluster-context.py" check \
--profile "${LAB_CLUSTER_PROFILE:?Missing active cluster profile}" \
--kubeconfig "${KUBECONFIG_PATH}" >/dev/null
}
cluster_runtime_require() {
python3 "${REPO_ROOT}/scripts/cluster-runtime-guard.py" check \
--profile "${LAB_CLUSTER_PROFILE:?Missing active cluster profile}" "$@" >/dev/null
}
cluster_context_require_startup() {
python3 "${REPO_ROOT}/scripts/cluster-context.py" check-startup \
--profile "${LAB_CLUSTER_PROFILE:?Missing active cluster profile}" \
--kubeconfig "${KUBECONFIG_PATH}" >/dev/null
}
retire_debian_service_hooks() {
python3 "${REPO_ROOT}/scripts/retire-debian-service-hooks.py"
}
remember_cluster_profile() {
python3 "${REPO_ROOT}/scripts/cluster_runtime_context.py" select "${LAB_CLUSTER_PROFILE}" >/dev/null
}
cluster_context_enable() {
export HOMELAB_STATE_DIR LAB_CLUSTER_PROFILE KUBECONFIG_PATH
case ":${PATH}:" in
*":${REPO_ROOT}/scripts/guarded-bin:"*) ;;
*) export PATH="${REPO_ROOT}/scripts/guarded-bin:${PATH}" ;;
esac
}