Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Namespace deletion leaves AI Gateway keys and AI providers in Coder

Aberta
#353 4 comentários 0 reações 1 responsável Ver no GitHub

Mantenedores costumam responder em até 1 dia

@ThomasK33 já está trabalhando nisso.

Desde 14/10/2026.

Avaliação

Esta issue ainda não foi avaliada.

Descrição

Problem

When a namespace is deleted, Kubernetes deletes the CoderControlPlane and its CoderAIGatewayKey objects at the same time. The operator then cannot reach Coder: the control plane is gone, or its Coder pod is already down when the bounded pass runs. So it releases the finalizers without deleting the keys, and full-trust gateway keys stay valid in Coder. CoderAIProvider has the same gap for providers.

Seen in the dogfood run of #346 (see the G3 evidence comment, step 13):

  • The namespace was gone after 11 s.
  • The key row stayed in Coder's ai_gateway_keys table.
  • The operator logged Releasing the finalizer without deleting the keys in Coder with reason ControlPlaneGone and the key ID.

Today the how-to (docs/how-to/manage-ai-gateway-keys.md) warns about this and gives the cleanup: delete the key objects before the namespace, or delete the logged keys with coder ai-gateway keys delete.

Options

  1. A cluster-wide sweeper (plan risk RK7) that deletes ck8s-<uid>- keys whose UID no CoderAIGatewayKey has, after the settle window. The same idea works for providers.
  2. Hold the control plane's deletion (a finalizer or a deletion check) while dependent CoderAIGatewayKey and CoderAIProvider objects exist, so they are cleaned up first.

Related items to decide together

  • While the control plane is being deleted, a failed operator-access read releases at once without a retry (#156 plan, K9 notes item q). This is a second path that leaves keys.
  • The CoderAnswerMismatch gate is lost when the status write right after the mismatch fails (K9 notes item u). The settle window bounds this to one extra create, whose key the sweep deletes.
  • A metric or a Kubernetes Event for ControlPlaneGone releases. Today the log line is the only signal.

Refs #156


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Linguagem predominante
Go
Estrelas
5
Forks
3
Merge médio
3h
PRs com merge (30d)
192

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de coder/coder-k8s

Todas as issues de coder/coder-k8s

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.