Skip to content

Commit 35ecfcb

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 dbdfc9a commit 35ecfcb

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

+5
Original file line numberDiff line numberDiff line change
@@ -6646,6 +6646,11 @@ spec:
66466646
- repo
66476647
- stanza
66486648
type: object
6649+
x-kubernetes-validations:
6650+
- fieldPath: .repo
6651+
message: Only S3, GCS or Azure repos can be used as a pgBackRest
6652+
data source.
6653+
rule: '!has(self.repo.volume)'
66496654
postgresCluster:
66506655
description: |-
66516656
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

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ type DataSource struct {
203203
// The PGBackRest field is incompatible with the PostgresCluster field: only one
204204
// data source can be used for pre-populating a new PostgreSQL cluster
205205
// +optional
206+
// +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"
206207
PGBackRest *PGBackRestDataSource `json:"pgbackrest,omitempty"`
207208

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

0 commit comments

Comments
 (0)