Skip to content

fix: stop wiping API-key metadata ConfigMap on LLMModel reconcile - #166

Merged
jbouder merged 1 commit into
mainfrom
fix/api-key-metadata-configmap-wipe
Aug 17, 2026
Merged

fix: stop wiping API-key metadata ConfigMap on LLMModel reconcile#166
jbouder merged 1 commit into
mainfrom
fix/api-key-metadata-configmap-wipe

Conversation

@jbouder

@jbouder jbouder commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #85 — API keys disappearing from the UI.

The key-manager stores key values in the <model>-api-keys Secret (what the gateway authenticates against) and key metadata in the <model>-api-key-metadata ConfigMap (what the UI lists). The LLMModel reconciler applied these two asymmetrically: createOrUpdateSecret deliberately preserves existing.Data, but createOrUpdateConfigMap overwrote existing.Data with the operator's desired data — which for the metadata ConfigMap is an empty placeholder the key-manager is supposed to fill in. So every reconcile of an LLMModel wiped the key metadata, and keys vanished from the UI while continuing to authenticate (the Secret was untouched).

Changes

  • Added createOrUpdateConfigMapPreserveData to the LLMModel reconciler — it manages labels only and leaves Data alone, mirroring createOrUpdateSecret and the PassthroughModel reconciler's existing (correct) ConfigMap behavior. The metadata ConfigMap now reconciles through this variant.
  • The EPP ConfigMap keeps the original overwriting createOrUpdateConfigMap, since its data is operator-owned config that must propagate on reconcile.
  • Added a regression test: reconcile a model, simulate the key-manager writing a key into the Secret and its metadata into the ConfigMap, reconcile again, and assert both survive. Verified the test fails against the previous code and passes with the fix.

Notes

  • The PassthroughModel reconciler already preserved ConfigMap data (passthroughmodel_controller.go), so only the LLMModel path needed the fix.
  • Full operator suite passes (make test, envtest k8s 1.34).

Screenshots

Screenshot 2026-08-14 at 6 56 04 PM

🤖 Generated with Claude Code

The LLMModel reconciler's createOrUpdateConfigMap overwrites
existing.Data with the desired data on every reconcile. The desired
<model>-api-key-metadata ConfigMap the operator builds is an empty
placeholder (the key-manager fills it in), so each reconcile reset the
metadata to empty and API keys vanished from the UI while the keys in
the <model>-api-keys Secret kept authenticating.

Reconcile the metadata ConfigMap with a data-preserving variant that
only manages labels, mirroring createOrUpdateSecret (and the
PassthroughModel reconciler, which already preserves ConfigMap data).
The EPP ConfigMap keeps the overwriting behavior since its data is
operator-owned.

Fixes #85

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jbouder
jbouder requested a review from dcmcand August 14, 2026 23:01
@jbouder
jbouder merged commit fb3c123 into main Aug 17, 2026
12 checks passed
@jbouder
jbouder deleted the fix/api-key-metadata-configmap-wipe branch August 17, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API Keys Disappearing from UI

2 participants