mizcausevic-dev/llm-cost-budget-operator

I want to build a Kubernetes operator in Go that turns monthly LLM spending limits into a cluster resource teams can watch and alert on.

The idea is a custom resource where you declare a monthly USD limit, a warning threshold percent defaulting to 80, and a pointer to a ConfigMap plus key where some other pipeline already writes the running total spend. The controller reads that number, compares it to the limit, and sets a state of UnderBudget, Warning, or OverBudget, along with the percent used. It should emit Kubernetes events when a budget crosses into warning or over budget. If the ConfigMap or key is missing, or the value isn't a number, it should report Unknown with a clear failing condition instead of guessing.

Please make the evaluation logic a small pure function with no cluster dependencies so it's easy to unit test, and also test the reconciler with a fake client. The controller should watch both the budget and the referenced ConfigMap so spend updates re-evaluate right away, with a periodic requeue as a backstop.

Add printer columns so kubectl shows limit, spend, percent, and state. Include a Helm chart installing the CRD, read only RBAC, a non root service account, and the manager deployment, plus a distroless Dockerfile, a sample resource, and a README explaining the FinOps motivation.