Skip to content

Commit 765a5d7

Browse files
committed
Validation for pgBackRest Data Sources
Adds validation to ensure only cloud-based repos (S3, Azure or GCS) are configured as a pgBackRest data source.
1 parent 740400d commit 765a5d7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6519,6 +6519,11 @@ spec:
65196519
- repo
65206520
- stanza
65216521
type: object
6522+
x-kubernetes-validations:
6523+
- fieldPath: .repo
6524+
message: Only S3, GCS or Azure repos can be used as a pgBackRest
6525+
data source.
6526+
rule: '!has(self.repo.volume)'
65226527
postgresCluster:
65236528
description: |-
65246529
Defines a pgBackRest data source that can be used to pre-populate the PostgreSQL data

pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ type DataSource struct {
194194
// The PGBackRest field is incompatible with the PostgresCluster field: only one
195195
// data source can be used for pre-populating a new PostgreSQL cluster
196196
// +optional
197+
// +kubebuilder:validation:XValidation:rule="!has(self.repo.volume)", message="Only S3, GCS or Azure repos can be used as a pgBackRest data source.", fieldPath=".repo"
197198
PGBackRest *PGBackRestDataSource `json:"pgbackrest,omitempty"`
198199

199200
// Defines a pgBackRest data source that can be used to pre-populate the PostgreSQL data

0 commit comments

Comments
 (0)