[ENHANCEMENT] Add PostgreSQL configuration directly to CoderControlPlane
- Ngôn ngữ chính
- Go
- Star
- 4
- Fork
- 3
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### Problem
I noticed that connecting a `CoderControlPlane` to `PostgreSQL` is manual. Create a secret with a `postgres://...` URL and set CODER_PG_CONNECTION_URL via `spec.extraEnv`.
The [CloudNativePG example](https://github.com/coder/coder-k8s/tree/main/examples/cloudnativepg) shows one working pattern, but the operator does not own or validate database setup.
It would be nice to have some improvements for this.
### Proposal
Add a clear `spec.database` field on `CoderControlPlane` (name can change) so users declare Postgres connection details in one place.
#### It should support at least:
1. External PostgreSQL - reference a Secret that holds the connection URL (same as Helm: `CODER_PG_CONNECTION_URL` from `postgres://...`).
2. Optional managed PostgreSQL (follow-up or behind a flag) - operator helps wire a Postgres instance the project already documents (e.g. CloudNativePG)
#### The controller should:
1. Set 1CODER_PG_CONNECTION_URL1 on the Coder deployment from the spec (no manual extraEnv).
2. Surface database status (e.g. configured, Secret missing, not ready to start Coder).
3. Surface clear errors when database config is missing or invalid.
### Why this helps
- One manifest describes the control plane and how it connects to Postgres.
- Matches how [Coder Helm installs](https://coder.com/docs/install/kubernetes) already work (Secret + env var).
- Fewer copy-paste steps from examples.
- Clear status when Postgres is not ready yet.
Example:
```
apiVersion: coder.com/v1alpha1
kind: CoderControlPlane
metadata:
name: coder
spec:
image: ghcr.io/coder/coder:latest
database:
connectionSecretRef:
name: coder-db-url
key: url
```
CC: @ibetitsmike @ThomasK33
Interested to know your thoughts! I am willing to make a PR contribution for this as well :)
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với examples/cloudnativepg và đặc tả/cấu hình spec/extraEnv của CoderControlPlane được mô tả trong issue, sau đó so sánh với mẫu cài đặt Coder Helm Kubernetes được tham chiếu. Trước tiên, hãy xác định luồng Secret bên ngoài; chỉ rõ cách biểu diễn các trạng thái cơ sở dữ liệu đã được cấu hình, bị thiếu, không hợp lệ và chưa sẵn sàng, đồng thời để managed PostgreSQL cho bước tiếp theo hoặc đánh dấu là phạm vi cần xem xét.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- kubernetes, postgresql
- Lĩnh vực
- databases, devops, infrastructure
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100