Description
Problem Description
Pull requests #5055 and #5048 added three statements that are wrong or incomplete on main:
- The GitOps section of
k8s/README.mdnames CoreDNS as the only object that k3s, not git, holds. The line above it says: "An object in the cluster that git does not hold is drift: remove it, or add it to git." The k3s server holds 12 packaged add-ons. A reader who applies the drift rule can delete metrics-server. - The CoreDNS paragraph has a sentence of 33 words. The STE rule (
src/devops_cli/ai/tasks/style_ste100.md) permits 25 words in a description. The paragraph also names dan-petty/homelab#344 as future work, and that text becomes wrong when dan-petty/homelab#344 merges. - The comment in
k8s/llm/gateway/config.yaml, the Spend logs item ofk8s/README.mdand the docstring ofcheck_the_gateway_keeps_its_spend_logs_for_30_dayssay that the gateway deletes old spend logs "once a day". LiteLLM starts the cleanup 24 hours after each start of the gateway process, and the gateway restarts more frequently than that.
Reproduction Steps
- Run
kubectl -n kube-system get addon(read only). - Read the GitOps section of
k8s/README.md. - Read
litellm/proxy/proxy_server.pyof LiteLLM v1.103.10, lines 10347 to 10388, andlitellm/proxy/common_utils/scheduled_job_stagger.py, line 4. - Query Prometheus:
max by (pod) (last_over_time(kube_pod_start_time{namespace="llm", pod=~"llm-gateway-[a-z0-9]+-[a-z0-9]{5}"}[14d])).
Expected vs Actual Behavior
Expected: the documents state the objects that k3s holds and the real time of the spend-log cleanup.
Actual:
kubectl -n kube-system get addonlists 12 add-ons:coredns,ccm,rolebindings,runtimes,gateway-api-crdand seven metrics-server add-ons (aggregated-metrics-reader,auth-delegator,auth-reader,metrics-apiservice,metrics-server-deployment,metrics-server-service,resource-reader).k8s/README.mdnames onlycoredns, andgit grep metrics-server k8s/README.mdfinds nothing.- LiteLLM adds the job
spend_log_cleanup_jobwith an"interval"trigger. The interval ismaximum_spend_logs_retention_interval(default1d) plus 0 to 60 seconds (proxy_server.pyline 10376). APScheduler sets the first run at the start time plus the interval (scheduled_job_stagger.pyline 4), and the stagger only adds an offset. A process that stops before 24 hours does not run the cleanup. - 23 gateway pods started in the 14.5 days to 2026-11-12, and 18 of them lived less than 24 hours. One more container restart occurred (
kube_pod_container_status_restarts_total). Thus the cleanup ran about 8 times, not 14. The longest time between two runs was about 73 hours.
Retention Risk
The 30-day value holds, but with a delay. One run deletes up to 500 batches of 1,000 rows (SPEND_LOG_RUN_LOOPS and SPEND_LOG_CLEANUP_BATCH_SIZE in litellm/constants.py). The table gets about 10,000 rows a day, so a late run removes all rows older than 30 days.
No limit stops a long time with no run. If each gateway process stops before 24 hours, no cleanup runs, and the database grows by about 50 MB a day. The litellm database is 315 MB now (cnpg_pg_database_size_bytes). GatewayDatabaseNearClaim warns at 80% of the 5 GiB claim. Thus the risk is low, and an alert shows it before the claim fills.
Proposed Fix
- Write the drift exception for all k3s packaged add-ons, with CoreDNS as one case, and name the command that lists them.
- Split the sentence of 33 words. Remove the reference to dan-petty/homelab#344 and keep the fact.
- In the three places, state that the cleanup runs 24 hours after each start of the gateway process, then each 24 hours while the process runs.
- This item does not set
maximum_spend_logs_cleanup_cron. A fixed schedule changes the behavior of the gateway, and the measured delay of about 3 days does not put the claim at risk.
Environment Diagnostics
Homelab k3s cluster, server v1.37.2+k3s1. Gateway image ghcr.io/berriai/litellm:v1.103.10. Data: read-only kubectl get and Prometheus through Grafana, 2026-11-12.
Acceptance Criteria
k8s/README.mdnames the k3s packaged add-ons as the exception to the drift rule, with CoreDNS as one case and the command that lists them.- No changed sentence has more than 25 words, and the CoreDNS paragraph names no open issue.
- The comment in
k8s/llm/gateway/config.yaml, the Spend logs item ofk8s/README.mdand the gate-check docstring state that the cleanup runs 24 hours after each start of the gateway process. uv run devops ci --check --only docs,k8s,openspecpasses.
Source: #5055
Activity
dan-petty commentedon Nov 12, 2026
Both fix k8s/README.md accuracy, but dan-petty/devops-cli#1648 corrects log-shipper and storage names while this candidate corrects the add-on list and spend-log cleanup timing.