fix: keep Holmes k8s triage focused
This commit is contained in:
parent
b88545c365
commit
32562f6ac2
|
|
@ -2087,8 +2087,9 @@ doctor_k8s() {
|
|||
local holmes_combined
|
||||
local holmes_config="${LAB_HOLMES_CONFIG_FILE:-/data/homelab-ai-stack/holmes-config.yaml}"
|
||||
local holmes_api_key="${LAB_AI_GATEWAY_API_KEY:-${OPENAI_API_KEY:-sk_omniroute}}"
|
||||
local holmes_model="${LAB_HOLMES_MODEL:-${AI_STACK_AGENT_SMART_MODEL:-agent-smart-free}}"
|
||||
local holmes_model="${LAB_HOLMES_MODEL:-${AI_STACK_AGENT_FAST_MODEL:-agent-fast-free}}"
|
||||
local holmes_fast_model="${LAB_HOLMES_FAST_MODEL:-${AI_STACK_AGENT_FAST_MODEL:-agent-fast-free}}"
|
||||
local holmes_max_steps="${LAB_HOLMES_MAX_STEPS:-6}"
|
||||
local arg
|
||||
|
||||
require_debian_server "doctor-k8s"
|
||||
|
|
@ -2135,7 +2136,7 @@ EOF
|
|||
# shellcheck disable=SC1090
|
||||
. "${tools_env_file}"
|
||||
holmes_api_key="${OPENAI_API_KEY:-${LAB_AI_GATEWAY_API_KEY:-${holmes_api_key}}}"
|
||||
holmes_model="${LAB_HOLMES_MODEL:-${AI_STACK_AGENT_SMART_MODEL:-${holmes_model}}}"
|
||||
holmes_model="${LAB_HOLMES_MODEL:-${AI_STACK_AGENT_FAST_MODEL:-${holmes_model}}}"
|
||||
holmes_fast_model="${LAB_HOLMES_FAST_MODEL:-${AI_STACK_AGENT_FAST_MODEL:-${holmes_fast_model}}}"
|
||||
fi
|
||||
if [[ "${holmes_model}" != */* ]]; then
|
||||
|
|
@ -2182,6 +2183,19 @@ EOF
|
|||
failures=$((failures + 1))
|
||||
fi
|
||||
|
||||
: >"${artifact_dir}/problem-pod-details.txt"
|
||||
awk 'NR > 1 {print $1, $2}' "${artifact_dir}/problem-pods.txt" |
|
||||
while read -r pod_namespace pod_name; do
|
||||
[[ -n "${pod_namespace}" && -n "${pod_name}" ]] || continue
|
||||
{
|
||||
printf -- '---- %s/%s ----\n' "${pod_namespace}" "${pod_name}"
|
||||
kubectl --kubeconfig "${kubeconfig}" -n "${pod_namespace}" describe pod "${pod_name}" 2>&1 |
|
||||
sed -n '/Events:/,$p' |
|
||||
tail -n 35
|
||||
printf '\n'
|
||||
} >>"${artifact_dir}/problem-pod-details.txt"
|
||||
done
|
||||
|
||||
cat >"${prompt_file}" <<EOF
|
||||
You are Holmes running inside a homelab automation pipeline.
|
||||
|
||||
|
|
@ -2203,10 +2217,13 @@ Nodes:
|
|||
$(sed -n '1,40p' "${artifact_dir}/nodes.txt")
|
||||
|
||||
Problem pods:
|
||||
$(sed -n '1,80p' "${artifact_dir}/problem-pods.txt")
|
||||
$(sed -n '1,40p' "${artifact_dir}/problem-pods.txt")
|
||||
|
||||
Recent events:
|
||||
$(tail -n 80 "${artifact_dir}/events.txt")
|
||||
Problem pod details:
|
||||
$(sed -n '1,160p' "${artifact_dir}/problem-pod-details.txt")
|
||||
|
||||
Recent cluster events, last 25 lines only:
|
||||
$(tail -n 25 "${artifact_dir}/events.txt")
|
||||
EOF
|
||||
|
||||
if [[ "${run_holmes}" == "true" ]]; then
|
||||
|
|
@ -2230,6 +2247,8 @@ EOF
|
|||
--api-key "${holmes_api_key}" \
|
||||
--model "${holmes_model}" \
|
||||
--fast-model "${holmes_fast_model}" \
|
||||
--max-steps "${holmes_max_steps}" \
|
||||
--fast-mode \
|
||||
--no-interactive \
|
||||
--bash-always-deny \
|
||||
>"${holmes_stdout}" 2>"${holmes_stderr}"
|
||||
|
|
@ -2265,6 +2284,8 @@ EOF
|
|||
|
||||
$(sed -n '1,160p' "${holmes_stdout}" 2>/dev/null || true)
|
||||
|
||||
$([[ "${holmes_status}" == "124" ]] && printf 'Holmes timed out after %s seconds. The deterministic Kubernetes artifact above is still valid.\n' "${holmes_timeout}" || true)
|
||||
|
||||
## Holmes stderr
|
||||
|
||||
$(sed -n '1,120p' "${holmes_stderr}" 2>/dev/null || true)
|
||||
|
|
|
|||
|
|
@ -5477,7 +5477,7 @@ LAB_AI_GATEWAY_API_KEY=${api_key}
|
|||
LAB_AI_GATEWAY_MODEL=${smart_model}
|
||||
AI_STACK_AGENT_FAST_MODEL=${fast_model}
|
||||
AI_STACK_AGENT_SMART_MODEL=${smart_model}
|
||||
HOLMES_MODEL=openai/${smart_model}
|
||||
HOLMES_MODEL=openai/${fast_model}
|
||||
HOLMES_FAST_MODEL=openai/${fast_model}
|
||||
HERMES_OPENAI_BASE_URL=${endpoint}
|
||||
HERMES_OMNIROUTE_API_KEY=${api_key}
|
||||
|
|
|
|||
Loading…
Reference in New Issue