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
@@ -11,6 +11,8 @@ spec:
kind: PostgreSQLInstance
listKind: PostgreSQLInstanceList
plural: postgresqlinstances
shortNames:
- pginstance
singular: postgresqlinstance
scope: Cluster
versions:
@@ -18,14 +20,20 @@ spec:
- jsonPath: .spec.endpoint.host
name: Endpoint
type: string
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .status.conditions[?(@.type=="Ready")].status
name: Ready
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: PostgreSQLInstance is the Schema for the postgresqlinstances
API
API.
properties:
apiVersion:
description: |-
@@ -45,47 +53,82 @@ spec:
metadata:
type: object
spec:
description: spec defines the desired state of PostgreSQLInstance
description: PostgreSQLInstanceSpec defines an external PostgreSQL server
managed by the controller.
properties:
adminCredentialRef:
description: |-
AdminCredentialRef points to an OpenBao KV secret containing the
administrative login. Secret values are never copied into this resource.
AdminCredentialRef identifies the OpenBao KV v2 record containing the
administrative username and password. Values are never copied into this resource.
properties:
passwordKey:
default: password
description: PasswordKey is the key containing the administrative
password.
minLength: 1
type: string
path:
description: Path is mount-relative and must not include the KV
v2 data or metadata API layer.
maxLength: 512
minLength: 1
pattern: ^[^/]+(/[^/]+)*$
type: string
x-kubernetes-validations:
- message: path must not contain . or .. segments
rule: self.split('/').all(segment, segment != '.' && segment
!= '..')
- message: path must not include the KV v2 data or metadata API
layer
rule: self.split('/')[0] != 'data' && self.split('/')[0] !=
'metadata'
usernameKey:
default: username
description: UsernameKey is the key containing the administrative
username.
minLength: 1
type: string
required:
- path
type: object
allowedExtensions:
description: AllowedExtensions is the allowlist tenants may request.
description: |-
AllowedExtensions is the set of extensions tenants may request.
Removing an item does not remove it from databases where it already exists.
items:
type: string
type: array
x-kubernetes-list-type: set
endpoint:
description: Endpoint is the PostgreSQL server managed by this instance.
description: Endpoint identifies the PostgreSQL server and its administrative
database.
properties:
database:
default: postgres
description: Database used for administrative connections.
description: Database is used for administrative connections and
the ownership registry.
pattern: ^[a-z][a-z0-9_]{0,62}$
type: string
host:
description: Host is the DNS name used as a connection target
and TLS server name.
minLength: 1
type: string
hostaddr:
description: HostAddr is an IPv4 or IPv6 address covered by the
server certificate IP SAN.
format: ip
type: string
port:
default: 5432
description: Port is the PostgreSQL TCP port.
format: int32
maximum: 65535
minimum: 1
type: integer
sslMode:
default: verify-full
description: SSLMode controls PostgreSQL TLS verification.
enum:
- disable
- require
@@ -94,25 +137,18 @@ spec:
type: string
required:
- host
- hostaddr
type: object
required:
- adminCredentialRef
- endpoint
type: object
status:
description: status defines the observed state of PostgreSQLInstance
description: PostgreSQLInstanceStatus defines the observed state of PostgreSQLInstance.
properties:
conditions:
description: |-
conditions represent the current state of the PostgreSQLInstance 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.
@@ -172,15 +208,28 @@ spec:
- type
x-kubernetes-list-type: map
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
- Validating
- InitializingRegistry
- Ready
- Deleting
type: string
postgresqlVersion:
description: PostgreSQLVersion is reported by the target server.
description: PostgreSQLVersion is reported by the target server for
diagnostics.
type: string
type: object
required:
- metadata
- spec
type: object
served: true