Skip to content

Commit 1bb95f0

Browse files
committed
move validation
1 parent ac894c4 commit 1bb95f0

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2021 - 2025 Crunchy Data Solutions, Inc.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
package v1
6+
7+
import (
8+
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
9+
)
10+
11+
// PGBouncerPodSpec defines the desired state of a PgBouncer connection pooler.
12+
// +kubebuilder:validation:XValidation:rule=`!has(self.config) || !has(self.config.global) || !has(self.config.global.logfile) || self.config.global.logfile.startsWith('/tmp/logs/pgbouncer/') || self.volumes.additional.exists(x, self.config.global.logfile.startsWith("/volumes/"+x.name))`,message=`logfile destination is restricted to '/tmp/logs/pgbouncer/' or an existing additional volume`
13+
type PGBouncerPodSpec struct {
14+
v1beta1.PGBouncerPodSpec `json:",inline"`
15+
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,7 @@ type PostgresInstanceSetStatus struct {
598598
type PostgresProxySpec struct {
599599

600600
// Defines a PgBouncer proxy and connection pooler.
601-
// +kubebuilder:validation:XValidation:rule=`!has(self.config) || !has(self.config.global) || !has(self.config.global.logfile) || self.config.global.logfile.startsWith('/tmp/logs/pgbouncer/') || self.volumes.additional.exists(x, self.config.global.logfile.startsWith("/volumes/"+x.name))`,message=`logfile destination is restricted to '/tmp/logs/pgbouncer/' or an existing additional volume`
602-
PGBouncer *v1beta1.PGBouncerPodSpec `json:"pgBouncer"`
601+
PGBouncer *PGBouncerPodSpec `json:"pgBouncer"`
603602
}
604603

605604
// Default sets the defaults for any proxies that are set.

pkg/apis/postgres-operator.crunchydata.com/v1/zz_generated.deepcopy.go

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)