Filter APIKeyStatus Secret watch by label instead of watching all Secrets cluster-wide
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- go
- Ambito
- backend, documentation, infrastructure
Direzione di ricerca
Inizia da internal/controller/apikey_status_controller.go e dal relativo Secret watch, quindi leggi cmd/main.go per comprendere il comportamento della cache a livello di cluster. Decidi la chiave e il valore della label, aggiungi il predicate e documenta in questo repository e in docs.kuadrant.io l'ambito limitato del ripristino in caso di Secret mancante; il completamento include anche gli aggiornamenti di integrazione di console e Backstage indicati, ove applicabile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Background
#82 adds a Secret watch to APIKeyStatusReconciler (internal/controller/apikey_status_controller.go) so that APIKeys stuck in SecretNotFound recover once their referenced Secret is created. See #78.
The watch is currently unfiltered:
Watches(&corev1.Secret{}, handler.EnqueueRequestsFromMapFunc(r.enqueueClass)).
This reconciler uses a "class reconciler" pattern: every watched event enqueues the same fixed key and triggers a full list-and-reconcile of all APIKeys (Reconcile, internal/controller/apikey_status_controller.go:63). The manager's cache is not namespace-scoped (cmd/main.go), so in practice any Secret create/update/delete anywhere in the cluster now triggers a full reconcile pass of every APIKey.
Proposal
Define a label that marks a Secret as an APIKey's referenced secret (e.g. devportal.kuadrant.io/apikey-secret: "true"), and filter the Secret watch in apikey_status_controller.go with a predicate so it only reacts to Secrets carrying that label.
Scope — when the label is (and isn't) needed
The label is only relevant to the Secret-created-after-APIKey race. If the Secret already exists at the time the APIKey is created (the normal/original ordering), reconciliation is already triggered by the APIKey watch itself — no Secret event, and therefore no label, is needed for that path to succeed. The label-scoped watch exists solely to catch the recovery case from #78/#82: APIKey created first, referencing a Secret that doesn't exist yet, created moments later. Consumers/plugins that always create the Secret before the APIKey never need to set this label for correctness — only those that create the APIKey first (e.g. to set an ownerReference, per kuadrant-console-plugin#541) need it.
Non-goal: keeping the APIKey in sync with later Secret content changes. This watch only reacts to the Secret appearing (create/update events firing the same generic re-reconcile). It does not mean the system keeps API key material in sync if someone edits the Secret's data.api_key after the fact:
APIKeyStatusReconcileronly re-checks existence/non-emptiness of the entry, it doesn't project the value anywhere that would need re-syncing.APIKeySecretReconciler(internal/controller/apikey_secret_controller.go), which copies the consumer Secret'sapi_keyvalue into the Authorino-enforced secret, does not watch Secrets at all (only APIKey) — so an in-place edit of the consumer's Secret value is never propagated to enforcement, label or no label.
This issue is scoped to detecting Secret creation for the missing-secret recovery case, not to general Secret-content sync. That gap (edits to an existing Secret's value not propagating to enforcement) is a separate, pre-existing issue if it needs addressing.
Tasks
- Decide on the label key/value
- Add predicate to the Secret watch in
apikey_status_controller.go - Document the label (and its limited scope, per above) in this repo
- Document the label in docs.kuadrant.io
- Update kuadrant-console-plugin (
RequestAPIKeyModal.tsx) to set the label — only strictly required for the create-APIKey-before-Secret flow (kuadrant-console-plugin#541) - Update kuadrant-backstage-plugin (
router.tsPOST /secrets) to set the label if/when it adopts the same create-order
- Lingua principale
- Go
- Stelle
- 3
- Fork
- 15
- Merge medio
- 1g 21h
- PR unite (30g)
- 4
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Kuadrant/developer-portal-controller
-
documentation linkinator-failure
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
Add reference documentation for APIKeyRequest CRDForse già presa @amalsaidov l’ha presa 18 giorni fa. Apertadocumentation good first issue triage/accepted
Difficoltà 2/5 Mezza giornata Idoneità per principianti 74/100
-
Add unit tests for name generation, data transformation, and object helpersForse di nuovo libera @VISHNU0906 l’ha presa 19 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement good first issue triage/accepted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 72/100
Kuadrant/developer-portal-controller#76 · 1 commento ·
-
Add unit tests for status and condition helper functionsForse di nuovo libera @aviralgarg05 l’ha presa 21 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement good first issue triage/accepted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
Kuadrant/developer-portal-controller#75 · 1 commento ·
-
enhancement maintainers-only
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Tutte le issue di Kuadrant/developer-portal-controller
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mattermost/mattermost-plugin-jira#1397 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Add Free CS Systems Workshops, Starter Scaffolds & Zero-Dependency Verification CLI to CS SeriesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
docs: Route53 EKS Terraform example uses outdated EKS module arguments in main.tfForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
nutmos/expensetrackr#235 ·
I maintainer di solito rispondono entro 1 giorno