APIProduct lifecycle enhancements: Deprecated/Retired states and deletion finalizers
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 45/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- go, kubernetes
- 領域
- api, backend, infrastructure
調査の方向性
PublishStatus enum については api/v1alpha1/apiproduct_types.go から始め、既存の APIKey の ownership の動作については internal/controller/apikey_controller.go から始めて、その後 APIProduct の reconcile パスと validation webhook を追跡します。廃止されたプロダクトが依存するキーと Secrets を revoke し、削除が finalizer を通じて子リソースのクリーンアップを待機し、マニフェストとドキュメントが更新され、推奨される混在キーのシナリオがパスすれば、作業は完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
The console-plugin's Developer Portal integration requires two enhancements to the APIProduct CRD and controller logic:
- Extend lifecycle states to support full API retirement workflow (Draft → Published → Deprecated → Retired)
- Add finalizer for clean cascade deletion of APIProducts with dependent APIKeys
These are blocking console-plugin issues #320 and #321.
1. Extend publishStatus Enum for Lifecycle States
Current State
The PublishStatus field only supports two states:
// api/v1alpha1/apiproduct_types.go:102-104
// +kubebuilder:validation:Enum=Draft;Published
// +kubebuilder:default=Draft
PublishStatus string `json:"publishStatus"`
Required Change
Extend to support four lifecycle states:
// +kubebuilder:validation:Enum=Draft;Published;Deprecated;Retired
// +kubebuilder:default=Draft
PublishStatus string `json:"publishStatus"`
State Definitions
- Draft: Not visible in API catalog, cannot request keys
- Published: Visible in catalog, accepting new requests
- Deprecated: Visible with warning badge, new APIKey requests blocked, existing approved keys continue working (grace period)
- Retired: Not visible in catalog, all existing APIKeys transitioned to Rejected phase, Secrets deleted
Controller Logic Required
When APIProduct transitions to publishStatus: Retired:
- Query all APIKey resources where
spec.apiProductRef.namematches the APIProduct - For each APIKey:
- If
status.phase: Approved→ update toRejected, delete the Secret - If
status.phase: Pending→ update toRejected - Set
status.rejectionReason: "Parent API Product was retired on <date>"
- If
- Update APIProduct status conditions to reflect retirement
Validation: Block new APIKey creation if publishStatus: Retired (validating webhook)
2. Finalizer for Clean Cascade Deletion
Current State
- Controller has RBAC for finalizers:
apiproducts/finalizers,verbs=update - Controller sets
OwnerReferenceon APIKeys (apikey_controller.go:130-138) - Missing: Finalizer add/remove logic in reconcile loop
Required Implementation
Add finalizer devportal.kuadrant.io/apiproduct-finalizer to ensure clean deletion order:
Deletion Flow:
1. User deletes APIProduct → resource gets deletionTimestamp
2. Controller detects deletionTimestamp, starts cleanup:
- Delete all child APIKeys (Pending, Approved, Rejected)
- Wait for Kubernetes garbage collection to delete Secrets
3. Once all APIKeys are gone → Controller removes finalizer
4. APIProduct is finally deleted
Why this matters:
- Prevents orphaned APIKeys and Secrets
- Ensures all API access is revoked before APIProduct removal
- Provides predictable deletion behavior for console-plugin UI
Console-Plugin UX Dependency
The console-plugin delete modal (issue #321) needs to query dependent APIKeys before deletion:
// Query dependent APIKeys
const dependentKeys = apiKeys.filter(
key => key.spec.apiProductRef.name === apiProduct.metadata.name
);
// Show counts in delete confirmation modal
- 47 approved API keys will be revoked immediately
- 12 pending requests will be cancelled
- 8 rejected requests will be deleted
The finalizer ensures this cascade deletion completes cleanly.
Acceptance Criteria
-
PublishStatusenum extended to includeDeprecatedandRetired - Controller reconciles
Retiredstate by transitioning dependent APIKeys to Rejected - Controller deletes Secrets when transitioning approved APIKeys to Rejected
- Validating webhook blocks new APIKey creation for retired APIProducts
- Finalizer added to APIProduct on creation
- Controller removes finalizer only after all dependent APIKeys are deleted
- Deletion flow tested with 10+ dependent APIKeys (approved/pending/rejected mix)
- CRD manifests updated and regenerated
- Documentation updated with lifecycle state definitions
References
- Console-plugin design doc - Edge Cases #2 (Finalizers)
- Console-plugin design doc - Edge Cases #3 (Lifecycle States)
- Console-plugin #321 - APIProduct Create/Edit Form
- Console-plugin #320 - APIProduct Detail Page
Notes
Un-retirement Behavior
If an APIProduct is un-retired (transitioned from Retired back to Published):
- Previously revoked APIKeys remain in
Rejectedstate (Secrets were deleted) - Users must create new APIKey requests to regain access
- This is by design to prevent accidental re-activation of old credentials
Testing Recommendations
- Create APIProduct with 10+ dependent APIKeys (mix of approved/pending/rejected)
- Transition to
Retired→ verify all approved keys become rejected, Secrets deleted - Delete APIProduct → verify finalizer prevents deletion until all APIKeys cleaned up
- Attempt to create new APIKey for retired product → verify validation blocks it
- 主要言語
- Go
- スター
- 3
- フォーク
- 15
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
triage/accepted
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
Kuadrant/developer-portal-controller#83 · コメント 1 件 ·
-
Add unit tests for name generation, data transformation, and object helpers再び着手できるかも @VISHNU0906 が 19 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン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 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement good first issue triage/accepted
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
Kuadrant/developer-portal-controller#75 · コメント 1 件 ·
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対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
nutmos/expensetrackr#235 ·
メンテナーはふだん 1 日以内に返信