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

31 lines
1021 B
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"
}
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
}