feat: 定义 v1alpha1 API 合同
E2E Tests / Run on Ubuntu (pull_request) Failing after 1m6s
Lint / Run on Ubuntu (pull_request) Successful in 7m7s
Tests / Run on Ubuntu (pull_request) Successful in 4m42s

This commit is contained in:
2026-09-10 06:25:34 +00:00
parent b443d78d14
commit 1f5aa3bd2f
13 changed files with 630 additions and 137 deletions
@@ -20,16 +20,25 @@ spec:
- jsonPath: .spec.instanceRef
name: Instance
type: string
- jsonPath: .spec.database
- jsonPath: .status.database
name: Database
type: string
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .status.credential.secretRef.name
name: Secret
type: string
- jsonPath: .status.conditions[?(@.type=="Ready")].status
name: Ready
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: PostgreSQLTenant is the Schema for the postgresqltenants API
description: PostgreSQLTenant is the Schema for the postgresqltenants API.
properties:
apiVersion:
description: |-
@@ -49,31 +58,36 @@ spec:
metadata:
type: object
spec:
description: spec defines the desired state of PostgreSQLTenant
description: PostgreSQLTenantSpec defines one application database and
its login owner.
properties:
credential:
description: Credential configures the application login credential.
description: Credential configures projection of the application credential.
properties:
openBaoPath:
description: OpenBaoPath is the KV path receiving the generated
login credential.
secretName:
description: |-
SecretName is the target Kubernetes Secret in the Tenant namespace.
It semantically defaults to <instanceRef>-<metadata.name>-postgresql.
maxLength: 253
pattern: ^[a-z0-9]([-a-z0-9.]*[a-z0-9])?$
type: string
required:
- openBaoPath
type: object
database:
description: Database defaults to metadata.name when omitted.
description: Database is the database to create. It semantically defaults
to metadata.name.
pattern: ^[a-z][a-z0-9_]{0,62}$
type: string
deletionPolicy:
default: Retain
description: DeletionPolicy controls whether deleting this object
removes the database.
description: DeletionPolicy controls cleanup when this object is deleted.
enum:
- Retain
- Delete
type: string
extensions:
description: Extensions to install from the instance allowlist.
description: |-
Extensions is the set to install from the referenced Instance allowlist.
Once provisioned, this set may only grow.
items:
type: string
type: array
@@ -81,31 +95,25 @@ spec:
instanceRef:
description: InstanceRef names the cluster-scoped PostgreSQLInstance
to use.
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9.]*[a-z0-9])?$
type: string
loginRole:
description: LoginRole defaults to metadata.name when omitted.
type: string
ownerRole:
description: OwnerRole defaults to <database>_owner when omitted.
description: |-
LoginRole is both the database owner and application login.
It semantically defaults to metadata.name.
pattern: ^[a-z][a-z0-9_]{0,62}$
type: string
required:
- credential
- instanceRef
type: object
status:
description: status defines the observed state of PostgreSQLTenant
description: PostgreSQLTenantStatus defines the observed state of PostgreSQLTenant.
properties:
conditions:
description: |-
conditions represent the current state of the PostgreSQLTenant resource.
Each condition has a unique type and reflects the status of a specific aspect of the resource.
Standard condition types include:
- "Available": the resource is fully functional
- "Progressing": the resource is being created or updated
- "Degraded": the resource failed to reach or maintain its desired state
The status of each condition is one of True, False, or Unknown.
description: Conditions contains the current Ready condition and any
future auxiliary conditions.
items:
description: Condition contains details for one aspect of the current
state of this API Resource.
@@ -164,20 +172,66 @@ spec:
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
credential:
description: Credential identifies the projected Secret and the non-authenticated
OpenBao API URL.
properties:
openBaoURL:
description: |-
OpenBaoURL is the complete KV v2 data API URL for non-Kubernetes consumers.
It contains no token or credential value.
type: string
secretRef:
description: SecretRef identifies the target Secret in the Tenant
namespace.
properties:
name:
description: Name is the Secret name.
type: string
type: object
type: object
database:
description: Database is the effective database name after applying
semantic defaults.
type: string
databaseOID:
description: DatabaseOID is the server-side identity observed for
the database.
description: DatabaseOID is the observed PostgreSQL object identifier
for diagnostics.
format: int32
type: integer
loginRole:
description: LoginRole is the effective owner/login role after applying
semantic defaults.
type: string
observedGeneration:
description: ObservedGeneration is the most recent generation observed
by the controller.
description: ObservedGeneration is the most recent generation for
which reconciliation reached a conclusion.
format: int64
type: integer
phase:
description: |-
Phase is the authoritative checkpoint of the controller workflow.
External state is still read back before and after every operation.
enum:
- Pending
- Planned
- CredentialCreated
- RoleCreated
- DatabaseCreated
- ExternalSecretCreated
- CredentialProjected
- Ready
- Deleting
type: string
type: object
required:
- metadata
- spec
type: object
x-kubernetes-validations:
- message: instanceRef and metadata.name are too long to derive the ExternalSecret
name
rule: size(self.spec.instanceRef) + size(self.metadata.name) <= 241
served: true
storage: true
subresources: