Skip to content

Commit 9667cfc

Browse files
committed
Add rule to prevent users from attempting to use the ssl_groups parameter with pg17 or earlier.
1 parent 8b3410a commit 9667cfc

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18700,6 +18700,9 @@ spec:
1870018700
- postgresVersion
1870118701
type: object
1870218702
x-kubernetes-validations:
18703+
- message: The ssl_groups parameter is only available in pg18 and greater
18704+
rule: '!has(self.?config.parameters.ssl_groups) || self.postgresVersion
18705+
> 17'
1870318706
- fieldPath: .config.parameters.log_directory
1870418707
message: all instances need "volumes.temp" to log in "/pgtmp"
1870518708
rule: self.?config.parameters.log_directory.optMap(v, type(v) != string
@@ -37769,6 +37772,10 @@ spec:
3776937772
- instances
3777037773
- postgresVersion
3777137774
type: object
37775+
x-kubernetes-validations:
37776+
- message: The ssl_groups parameter is only available in pg18 and greater
37777+
rule: '!has(self.?config.parameters.ssl_groups) || self.postgresVersion
37778+
> 17'
3777237779
status:
3777337780
description: PostgresClusterStatus defines the observed state of PostgresCluster
3777437781
properties:

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ import (
1717
// PostgresClusterSpec defines the desired state of PostgresCluster
1818
// ---
1919
//
20+
// # Postgres 18
21+
//
22+
// +kubebuilder:validation:XValidation:rule=`!has(self.?config.parameters.ssl_groups) || self.postgresVersion > 17`,message=`The ssl_groups parameter is only available in pg18 and greater`
23+
//
2024
// # Postgres Logging
2125
//
2226
// +kubebuilder:validation:XValidation:fieldPath=`.config.parameters.log_directory`,message=`all instances need "volumes.temp" to log in "/pgtmp"`,rule=`self.?config.parameters.log_directory.optMap(v, type(v) != string || !v.startsWith("/pgtmp/logs/postgres") || self.instances.all(i, i.?volumes.temp.hasValue())).orValue(true)`

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import (
1313
)
1414

1515
// PostgresClusterSpec defines the desired state of PostgresCluster
16+
// ---
17+
//
18+
// # Postgres 18
19+
//
20+
// +kubebuilder:validation:XValidation:rule=`!has(self.?config.parameters.ssl_groups) || self.postgresVersion > 17`,message=`The ssl_groups parameter is only available in pg18 and greater`
1621
type PostgresClusterSpec struct {
1722
// +optional
1823
Metadata *Metadata `json:"metadata,omitempty"`

0 commit comments

Comments
 (0)