feat: 接入 Database 三资源 API 与分层绑定协调
确定单库单账号、集群级 Database、资源侧先写绑定和凭据定位合同。领域层承载纯规则,service 协調流程,Kubernetes adapter 负责资源呈现与版本保护。 验证:全量 make test、三轮 race、真实 API server 并发与重启补写、最小 RBAC/watch、lint 和文档检查通过。供应、凭据交付及删除清理尚未实现,保留 DeletionPending/finalizer 边界。
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# 管理员登记已有数据库;不会因创建 CR 就修改数据库或凭据。
|
||||
apiVersion: database.ayatori.ddupan.top/v1alpha1
|
||||
kind: PostgreSQLDatabase
|
||||
metadata:
|
||||
name: imported-app
|
||||
spec:
|
||||
instanceRef:
|
||||
name: shared-postgres
|
||||
database: existing_app
|
||||
loginRole: existing_app
|
||||
source: Import
|
||||
credentialRef:
|
||||
mount: secret
|
||||
path: existing/app/postgresql
|
||||
reclaimPolicy: Retain
|
||||
@@ -0,0 +1,11 @@
|
||||
# Instance 观察 controller 尚未接入;管理 Secret 由管理员在 controller namespace 提供。
|
||||
apiVersion: database.ayatori.ddupan.top/v1alpha1
|
||||
kind: PostgreSQLInstance
|
||||
metadata:
|
||||
name: shared-postgres
|
||||
spec:
|
||||
endpoint:
|
||||
host: postgres.example.test
|
||||
hostaddr: 192.0.2.10
|
||||
adminCredentialRef:
|
||||
name: shared-postgres-admin
|
||||
@@ -0,0 +1,25 @@
|
||||
# 二选一:动态申请或显式引用已有 Database;当前只有绑定协调,没有供应/交付 controller。
|
||||
apiVersion: database.ayatori.ddupan.top/v1alpha1
|
||||
kind: PostgreSQLTenant
|
||||
metadata:
|
||||
name: new-app
|
||||
namespace: default
|
||||
spec:
|
||||
provision:
|
||||
instanceRef:
|
||||
name: shared-postgres
|
||||
database: new_app
|
||||
loginRole: new_app
|
||||
extensions:
|
||||
- pgcrypto
|
||||
secretName: new-app-postgresql
|
||||
---
|
||||
apiVersion: database.ayatori.ddupan.top/v1alpha1
|
||||
kind: PostgreSQLTenant
|
||||
metadata:
|
||||
name: existing-app
|
||||
namespace: default
|
||||
spec:
|
||||
databaseRef:
|
||||
name: imported-app
|
||||
secretName: existing-app-postgresql
|
||||
@@ -1,5 +1,8 @@
|
||||
## Append samples of your project ##
|
||||
resources:
|
||||
- database_v1alpha1_postgresqlinstance.yaml
|
||||
- database_v1alpha1_postgresqldatabase.yaml
|
||||
- database_v1alpha1_postgresqltenant.yaml
|
||||
- execution_v1alpha1_job.yaml
|
||||
- execution_v1alpha1_jobclass.yaml
|
||||
- execution_v1alpha1_kubernetesexecutionparameters.yaml
|
||||
|
||||
Reference in New Issue
Block a user