feat: k8s:// ClusterIP claim env + complete payload target_repo
Resolve llm-connect / actcore-api / edge-relay without port-forward. Include target_repo on FI and Binky complete payloads for ops UI artefacts.
This commit is contained in:
parent
6383944939
commit
94a15d67aa
7 changed files with 207 additions and 8 deletions
59
deploy/scripts/refresh-claim-loop-k8s-urls.sh
Executable file
59
deploy/scripts/refresh-claim-loop-k8s-urls.sh
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/env bash
|
||||
# Rewrite claim-loop.env URL keys to live k8s:// or concrete ClusterIP forms.
|
||||
# Usage:
|
||||
# ./deploy/scripts/refresh-claim-loop-k8s-urls.sh # write k8s:// pseudo-URLs
|
||||
# ./deploy/scripts/refresh-claim-loop-k8s-urls.sh --concrete # write http://ClusterIP:port
|
||||
set -euo pipefail
|
||||
|
||||
ENV_FILE="${HOME}/.config/rein-aharness/claim-loop.env"
|
||||
KUBECONFIG="${KUBECONFIG:-/etc/rancher/k3s/k3s.yaml}"
|
||||
MODE=k8s
|
||||
if [[ "${1:-}" == "--concrete" ]]; then
|
||||
MODE=concrete
|
||||
fi
|
||||
|
||||
if [[ ! -f "${ENV_FILE}" ]]; then
|
||||
echo "missing ${ENV_FILE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
resolve_ip() {
|
||||
local ns="$1" svc="$2"
|
||||
kubectl --kubeconfig="${KUBECONFIG}" -n "${ns}" get svc "${svc}" \
|
||||
-o jsonpath='{.spec.clusterIP}'
|
||||
}
|
||||
|
||||
url_for() {
|
||||
local ns="$1" svc="$2" port="$3"
|
||||
if [[ "${MODE}" == "k8s" ]]; then
|
||||
echo "k8s://${ns}/${svc}:${port}"
|
||||
else
|
||||
local ip
|
||||
ip="$(resolve_ip "${ns}" "${svc}")"
|
||||
echo "http://${ip}:${port}"
|
||||
fi
|
||||
}
|
||||
|
||||
ACTIVITY_CORE_URL="$(url_for activity-core actcore-api 8010)"
|
||||
LLM_CONNECT_URL="$(url_for activity-core llm-connect 8080)"
|
||||
STATE_HUB_URL="$(url_for activity-core actcore-statehub-edge-relay 8000)"
|
||||
|
||||
tmp="$(mktemp)"
|
||||
# shellcheck disable=SC2016
|
||||
awk -v ac="${ACTIVITY_CORE_URL}" -v llm="${LLM_CONNECT_URL}" -v sh="${STATE_HUB_URL}" '
|
||||
BEGIN { seen_ac=0; seen_llm=0; seen_sh=0 }
|
||||
/^ACTIVITY_CORE_URL=/ { print "ACTIVITY_CORE_URL=" ac; seen_ac=1; next }
|
||||
/^LLM_CONNECT_URL=/ { print "LLM_CONNECT_URL=" llm; seen_llm=1; next }
|
||||
/^STATE_HUB_URL=/ { print "STATE_HUB_URL=" sh; seen_sh=1; next }
|
||||
{ print }
|
||||
END {
|
||||
if (!seen_ac) print "ACTIVITY_CORE_URL=" ac
|
||||
if (!seen_llm) print "LLM_CONNECT_URL=" llm
|
||||
if (!seen_sh) print "STATE_HUB_URL=" sh
|
||||
}
|
||||
' "${ENV_FILE}" > "${tmp}"
|
||||
chmod 600 "${tmp}"
|
||||
mv "${tmp}" "${ENV_FILE}"
|
||||
|
||||
echo "Updated ${ENV_FILE} (${MODE}):"
|
||||
grep -E '^(ACTIVITY_CORE_URL|LLM_CONNECT_URL|STATE_HUB_URL)=' "${ENV_FILE}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue