Skip to content

docs: Control Plane アーキテクチャ設計(Terraform + Keycloak) - #32

Merged
susumutomita merged 1 commit into
mainfrom
docs/control-plane-architecture-plan
Nov 11, 2025
Merged

susumutomita merged 1 commit into
mainfrom
docs/control-plane-architecture-plan

Conversation

@susumutomita

@susumutomita susumutomita commented Nov 11, 2025 •

Copy link
Copy Markdown
Owner

概要

TenkaCloud の Control Plane(管理基盤)のアーキテクチャ設計を Plan.md に追加しました。
マルチクラウド対応とベンダーロックイン回避を優先した技術スタックを選定しています。

背景

  • TenkaCloud はマルチクラウド対応が必須要件(AWS/GCP/Azure/OCI/LocalStack)
  • reference/eks は AWS 固有の実装(AWS CDK + Cognito)だが、アーキテクチャパターンは参考になる
  • ベンダーロックインを避けるため、OSS とクラウドアグノスティックな技術を選択

技術スタック変更

IaC

  • ❌ AWS CDK → ✅ Terraform
  • 理由: マルチクラウド対応、宣言的で再利用可能なモジュール設計

認証・認可

  • ❌ Amazon Cognito → ✅ Keycloak
  • 理由: OSS、OIDC/SAML 対応、ベンダーロックイン回避、自由度が高い

イベントバス

  • ❌ EventBridge (AWS 固有) → ✅ NATS / Apache Kafka
  • 理由: クラウドネイティブ、Kubernetes ネイティブデプロイ可能

データベース

  • Keycloak 用: PostgreSQL(マネージドサービス or セルフホスト)
  • テナントデータ: マルチクラウド対応データストア(DynamoDB/Firestore/CosmosDB)

コンテナオーケストレーション

  • Kubernetes (EKS/GKE/AKS/kind)

アーキテクチャ設計

ディレクトリ構造

infrastructure/terraform/
├── modules/
│   ├── keycloak/          # Keycloak Helm デプロイ
│   ├── event-bus/         # NATS/Kafka
│   ├── database/          # PostgreSQL
│   └── kubernetes-base/   # Namespace/RBAC
├── environments/
│   ├── dev/
│   ├── staging/
│   └── prod/
└── control-plane/         # メイン Control Plane

backend/services/control-plane/
└── tenant-management/     # テナント管理サービス

コントロールプレーンの責務

  1. テナント管理

    • テナント CRUD API
    • Keycloak Realm 自動作成
    • テナントライフサイクル管理
  2. 認証・認可

    • Keycloak による OIDC/SAML 認証
    • マルチテナント対応の Realm 設計
    • Role-Based Access Control (RBAC)
  3. イベント管理

    • テナント状態変更イベントのパブリッシュ
    • Application Plane へのイベント伝搬
  4. システム管理者機能

    • プラットフォーム全体の監視
    • テナント監査ログ

検証手順

  1. Terraform 構文チェック(terraform fmt, terraform validate)
  2. Terraform モジュールテスト(Terratest)
  3. Keycloak デプロイメント検証(kind/LocalStack)
  4. テナント管理サービステスト(カバレッジ 100%)
  5. Keycloak 統合テスト(OIDC トークン取得)

未解決の質問

  • ローカル開発環境: kind vs minikube vs k3s
  • イベントバス: NATS vs Apache Kafka
  • Keycloak の Realm 設計(マスター Realm + テナント別 Realm?)
  • データベース: PostgreSQL マネージドサービス vs セルフホスト
  • マルチクラウドデータストア抽象化レイヤー設計

次のステップ

  1. Terraform モジュール構成の詳細設計
  2. Keycloak Helm Chart の設定
  3. テナント管理サービスの実装(TypeScript)
  4. Terratest によるインフラテスト

参考

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Documentation
    • Added comprehensive control plane infrastructure plan including multi-cloud deployment strategy, tech stack specifications, validation procedures, and implementation roadmap with Terraform and Keycloak components.

- マルチクラウド対応を優先した技術スタック選定
  - IaC: AWS CDK → Terraform(マルチクラウド対応)
  - 認証: Amazon Cognito → Keycloak(ベンダーロックイン回避)
  - イベントバス: EventBridge → NATS/Kafka(クラウドアグノスティック)
  - データベース: PostgreSQL + DynamoDB/Firestore/CosmosDB

- アーキテクチャ設計
  - Keycloak による OIDC/SAML 認証基盤
  - Terraform モジュール構成(keycloak/event-bus/database/kubernetes-base)
  - テナント管理サービス(TypeScript/Go)
  - マルチクラウド対応のディレクトリ構造

- 検証手順の定義
  - Terraform テスト(Terratest)
  - Keycloak デプロイメント検証(kind/LocalStack)
  - 統合テスト(カバレッジ 100%)

参照: Plan.md "Control Plane 基盤構築 (Terraform + Keycloak)"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 11, 2025 •

Copy link
Copy Markdown

Walkthrough

The pull request adds a comprehensive planning document to Plan.md for Control Plane infrastructure foundation using Terraform and Keycloak. The new section details objectives, background, technology stack, guardrails, tasks, directory structure, validation steps, and progress tracking for multi-cloud deployment.

Changes

Cohort / File(s) Summary
Control Plane Planning Documentation
Plan.md
Adds detailed section "Control Plane 基盤構築 (Terraform + Keycloak) - 2025-11-10" including objectives, background, tech stack, guardrails, tasks, directory structure, validation steps, open questions, progress log, and retrospective for multi-cloud infrastructure foundation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Review focuses on verifying documentation completeness and clarity
  • Ensure task descriptions and directory structure are coherent and implementable
  • Validate alignment between objectives, tech stack, and planned tasks

Poem

🐰 A control plane spreads its wings so wide,
With Terraform and Keycloak as our guide,
Multi-clouds unite in harmony bright,
The infrastructure foundation shines with light! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding a Control Plane architecture design document to Plan.md, specifically focusing on Terraform and Keycloak implementation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/control-plane-architecture-plan

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
Plan.md (1)

110-262: Excellent comprehensive planning document—structure and content are well-executed.

The new section follows the established template faithfully and provides clear guidance for a multi-cloud Control Plane foundation. Objectives are crisp, guardrails align with project standards, and validation steps are practical and testable. The decision to pivot from AWS CDK to Terraform + Keycloak is well-justified and appropriately documented in the progress log.

Minor suggestions for strengthening the plan:

  1. Task dependency sequencing: Consider adding an implicit ordering note or a DAG comment. For example, "Terraform module design (line 144) must be completed before Keycloak Helm integration (line 145)." Currently, the structure is clear but could benefit from an optional Dependencies: subsection.

  2. Cross-reference to Issue #27: The plan mentions "テナント管理サービスの実装 (TypeScript/Go)" at lines 155–158 but does not explicitly link it to Issue #27, which is already in active development. Consider adding a note like Related to #27 (Tenant Management Service MVP) to clarify the sequencing and dependencies between the two initiatives.

  3. Open Question clarity: The event bus decision (line 246) and local dev environment (line 245) are appropriately flagged as open. Consider adding rough decision timelines (e.g., "Decide by [date]") to prevent these from becoming indefinite blockers.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c23cba and 36eda28.

📒 Files selected for processing (1)
  • Plan.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
Plan.md

163-163: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: claude-review

Comment thread Plan.md
Comment on lines +163 to +207
```
infrastructure/
└── terraform/
├── modules/
│ ├── keycloak/ # Keycloak モジュール
│ │ ├── main.tf
│ │ ├── variables.tf
│ │ ├── outputs.tf
│ │ └── helm-values.yaml # Keycloak Helm values
│ ├── event-bus/ # NATS/Kafka モジュール
│ │ ├── main.tf
│ │ └── variables.tf
│ ├── database/ # PostgreSQL モジュール
│ │ ├── main.tf
│ │ └── variables.tf
│ └── kubernetes-base/ # Kubernetes 基盤
│ ├── main.tf
│ └── namespaces.tf
├── environments/
│ ├── dev/
│ │ ├── main.tf
│ │ ├── variables.tf
│ │ └── terraform.tfvars
│ ├── staging/
│ └── prod/
└── control-plane/ # Control Plane メインディレクトリ
├── main.tf
├── variables.tf
├── outputs.tf
├── providers.tf # マルチクラウドプロバイダー
└── backend.tf

backend/
└── services/
└── control-plane/
└── tenant-management/ # テナント管理サービス
├── src/
│ ├── api/ # REST API
│ ├── keycloak/ # Keycloak クライアント
│ ├── events/ # イベントパブリッシュ
│ └── database/ # DB アクセス
├── test/
├── Dockerfile
└── package.json
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language identifier to code block to resolve markdown linting issue.

The fenced code block lacks a language specifier. According to markdownlint (MD040), all code blocks should declare their language for proper rendering and syntax highlighting.

-```
+```tree
 infrastructure/

Alternatively, use text` or bash` if the intent is to emphasize portability across different environments:

-```
+```text
 infrastructure/
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

163-163: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In Plan.md around lines 163 to 207, the fenced code block showing the project
tree lacks a language identifier which triggers markdownlint MD040; fix it by
adding a language tag after the opening triple backticks (for example "tree",
"text", or "bash") so the block becomes ```tree (or ```text/```bash) and leave
the contents unchanged to satisfy the linter and enable proper syntax
highlighting.

@susumutomita
susumutomita merged commit 8b6ffba into main Nov 11, 2025
8 of 9 checks passed
@susumutomita
susumutomita deleted the docs/control-plane-architecture-plan branch November 11, 2025 20:56
susumutomita added a commit that referenced this pull request May 17, 2026
audit table #6: 旧 UI は 「正解 (+100 pt) 合計スコア: 100 pt」 という事務的 Alert で
flag 提出成功を伝えていた (= image #32 「正解時の喜びがない」 指摘)。 競技体験として致命的で、
JAM/GameDay 系競技の「やった!」 という瞬間を完全に殺していた。

修正:
- CelebrationOverlay component (= 自前 CSS keyframes confetti、 外部 lib なし) を追加
- 正解時 (= outcome.kind === 'ok') に 3 秒間 confetti animation を全画面 overlay
- success Alert を '🎉 正解!  +N pt' + 「おめでとうございます」 + 合計スコア strong 強調 に
- 既出提出 (= reload 後 flagSubmitted=true 表示) の '提出済み' を '🏆 クリア済み +N pt' + 励まし
  文言に差し替え

実装ポリシー:
- 外部 lib 不採用 (= supply chain 対策、 confetti は CSS keyframes で自作)
- pointer-events: none (= 操作の邪魔をしない)
- 60 particles × 1.8-2.8s で 3 秒完結。 動画チラつかない範囲

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
susumutomita added a commit that referenced this pull request May 17, 2026
epic #952 / #956 Phase 1: 直近 audit (image #29 / #32-#36 / #43 / #45 / #50 等)
で表面 UX を 1 件ずつ修正してきたが、 画面ごとの IA を体系的に見直して
いなかった。 5 persona (Participant / TenantAdmin / TenantOperator /
TenantViewer / SystemAdmin) × 12 主要 screen の primary/secondary/non-target
を 1 表で正本化する。

新規 docs/ux/persona-screen-matrix.html:
- Persona 一覧: 主役の状況 / 典型タスク / 絶対に見せない情報
- Screen × Persona 行列: 12 screen × 5 persona の primary action
- 情報のティアリング規約: 一等地 / 中段 / 下段に何を入れるか
- エラー / 空状態 UX 規約: FriendlyErrorAlert の 4 要素 + 空状態 = 次の一歩
- Cloudscape 使い方規約: Header / Container / Table-vs-Cards / Button variant
- Roadmap: Phase 1 = 本 PR / Phase 2 = primary action 統一 (画面ごとに別 PR)
  / Phase 3 = FriendlyErrorAlert を全 SPA 展開 / Phase 4 = ADR 化

設計判断:
- HTML 直書き (= ADR と同じ理由で表現力 / row span / color を保つ。
  feedback_design_docs_html メモリに沿う)
- docs/ux/ を新設 (= 既存の docs/operations/ docs/problems/ と並列に)
- 機械検査 ルール (= harness) は Phase 4 (= ADR 化) で追加。 本 doc は
  reference として配布する段階

Relates #956 Phase 1
Relates #952

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
susumutomita added a commit that referenced this pull request Jun 2, 2026
…ma + reference (ADR-031) [#1419] (#1647)

Brings the problems submodule to main (schema #32 + microservice-migration-battle
ec2-latency-injection action #33), so the platform catalog (discoverProblemsDisruptions)
carries the action and the cross-account executor's BATTLE_PROBLEMS_DISRUPTIONS env
dispatches it. validate-problems (with the merged #1639 validator) passes; infra 2442 pass.

Relates #1419

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant