Add provisioning controller and REST API for managed warehouses#332
Draft
Add provisioning controller and REST API for managed warehouses#332
Conversation
Adds end-to-end provisioning flow: PostHog calls a REST API to initiate provisioning, the controller drives Crossplane via Duckling CRs to create per-team AWS resources (Aurora, S3, IAM), and updates the config store as resources come up. The team router gates worker stack creation on warehouse readiness and uses per-team namespace/SA from the warehouse config. New packages: - controlplane/provisioner: reconciliation loop + K8s dynamic client for Duckling CRs (pending→provisioning→ready, deleting→deleted, failure handling) - controlplane/provisioning: production-facing REST API on separate port (POST /teams/:id/provision, POST /teams/:id/deprovision, GET /teams/:id/warehouse) Key design decisions: - Provisioning API runs on separate port (:9091) from admin (:9090) - Separate bearer token (--provisioning-token) for provisioning vs admin - Controller uses WarehouseStore interface for testability - CAS (compare-and-swap) updates prevent state races - Synced=False tolerance (5min grace period) for Crossplane transients - Teams are auto-created on first provision call - Non-K8s builds get stub (provisioning package has no build tag) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /teams/:id/provision,POST /teams/:id/deprovision,GET /teams/:id/warehouse--provisioning-tokenand--provisioning-portconfigCompanion PR
Test plan
go build -tags kubernetes ./...andgo build ./...🤖 Generated with Claude Code