Filter APIKeyStatus Secret watch by label instead of watching all Secrets cluster-wide
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- go
调研方向
从 internal/controller/apikey_status_controller.go 及其 Secret watch 开始,然后阅读 cmd/main.go 以了解集群范围的缓存行为。确定 label 的键和值,添加 predicate,并在此 repository 和 docs.kuadrant.io 中记录缺少 Secret 时有限的恢复范围;完成工作还包括适用时所述的 console 和 Backstage 集成更新。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Go
- 星标
- 3
- 派生
- 15
- 平均合并
- 1 天 21 小时
- 30 天内合并 PR
- 4
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Kuadrant/developer-portal-controller 的其他 Issue
-
documentation linkinator-failure
难度 2/5 1-3 小时 新手友好度 66/100
-
Add reference documentation for APIKeyRequest CRD可能已有人在做 @amalsaidov 于 18 天前认领。 未关闭documentation good first issue triage/accepted
难度 2/5 半天 新手友好度 74/100
-
Add unit tests for name generation, data transformation, and object helpers可能重新可做 @VISHNU0906 于 19 天前认领,目前没有进行中的 PR。 未关闭enhancement good first issue triage/accepted
难度 4/5 3-5 天 新手友好度 72/100
Kuadrant/developer-portal-controller#76 · 1 条评论 ·
-
Add unit tests for status and condition helper functions可能重新可做 @aviralgarg05 于 21 天前认领,目前没有进行中的 PR。 未关闭enhancement good first issue triage/accepted
难度 4/5 3-5 天 新手友好度 68/100
Kuadrant/developer-portal-controller#75 · 1 条评论 ·
-
enhancement maintainers-only
难度 4/5 3-5 天 新手友好度 45/100
查看 Kuadrant/developer-portal-controller 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
mattermost/mattermost-plugin-jira#1397 · 1 条评论 ·
维护者通常 1 天内回复
-
Add Free CS Systems Workshops, Starter Scaffolds & Zero-Dependency Verification CLI to CS Series未关闭
难度 2/5 1-3 小时 新手友好度 68/100
-
tech-debt
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
docs: Route53 EKS Terraform example uses outdated EKS module arguments in main.tf可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
nutmos/expensetrackr#235 ·
维护者通常 1 天内回复