Skip to content

Commit fb0a610

Browse files
authored
Merge branch 'CrunchyData:master' into master
2 parents b6af83d + dd408ff commit fb0a610

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10267,7 +10267,7 @@ spec:
1026710267
postgresVersion:
1026810268
description: The major version of PostgreSQL installed in the PostgreSQL
1026910269
image
10270-
maximum: 14
10270+
maximum: 15
1027110271
minimum: 10
1027210272
type: integer
1027310273
proxy:

internal/controller/postgrescluster/pgbackrest.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,9 @@ func (r *Reconciler) reconcileRestoreJob(ctx context.Context,
10111011
for _, opt := range options {
10121012
var msg string
10131013
switch {
1014-
case strings.Contains(opt, "--repo"):
1014+
// Since '--repo' can be set with or without an equals ('=') sign, we check for both
1015+
// usage patterns.
1016+
case strings.Contains(opt, "--repo=") || strings.Contains(opt, "--repo "):
10151017
msg = "Option '--repo' is not allowed: please use the 'repoName' field instead."
10161018
case strings.Contains(opt, "--stanza"):
10171019
msg = "Option '--stanza' is not allowed: the operator will automatically set this " +
@@ -2200,9 +2202,11 @@ func (r *Reconciler) reconcileManualBackup(ctx context.Context,
22002202
// and not using the "--repo" option in the "manual.options" field. Therefore, record a
22012203
// warning event and return if a "--repo" option is found. Reconciliation will then be
22022204
// reattempted when "--repo" is removed from "manual.options" and the spec is updated.
2205+
// Since '--repo' can be set with or without an equals ('=') sign, we check for both
2206+
// usage patterns.
22032207
backupOpts := postgresCluster.Spec.Backups.PGBackRest.Manual.Options
22042208
for _, opt := range backupOpts {
2205-
if strings.Contains(opt, "--repo") {
2209+
if strings.Contains(opt, "--repo=") || strings.Contains(opt, "--repo ") {
22062210
r.Recorder.Eventf(postgresCluster, corev1.EventTypeWarning, "InvalidManualBackup",
22072211
"Option '--repo' is not allowed: please use the 'repoName' field instead.",
22082212
repoName)

internal/controller/postgrescluster/pgbackrest_test.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,13 +1831,27 @@ func TestReconcilePostgresClusterDataSource(t *testing.T) {
18311831
expectedClusterCondition: nil,
18321832
},
18331833
}, {
1834-
desc: "invalid option: repo",
1834+
desc: "invalid option: --repo=",
18351835
dataSource: &v1beta1.DataSource{PostgresCluster: &v1beta1.PostgresClusterDataSource{
1836-
ClusterName: "invalid-repo-option", RepoName: "repo1",
1837-
Options: []string{"--repo"},
1836+
ClusterName: "invalid-repo-option-equals", RepoName: "repo1",
1837+
Options: []string{"--repo="},
18381838
}},
18391839
clusterBootstrapped: false,
1840-
sourceClusterName: "invalid-repo-option",
1840+
sourceClusterName: "invalid-repo-option-equals",
1841+
sourceClusterRepos: []v1beta1.PGBackRestRepo{{Name: "repo1"}},
1842+
result: testResult{
1843+
configCount: 1, jobCount: 0, pvcCount: 1,
1844+
invalidSourceRepo: false, invalidSourceCluster: false, invalidOptions: true,
1845+
expectedClusterCondition: nil,
1846+
},
1847+
}, {
1848+
desc: "invalid option: --repo ",
1849+
dataSource: &v1beta1.DataSource{PostgresCluster: &v1beta1.PostgresClusterDataSource{
1850+
ClusterName: "invalid-repo-option-space", RepoName: "repo1",
1851+
Options: []string{"--repo "},
1852+
}},
1853+
clusterBootstrapped: false,
1854+
sourceClusterName: "invalid-repo-option-space",
18411855
sourceClusterRepos: []v1beta1.PGBackRestRepo{{Name: "repo1"}},
18421856
result: testResult{
18431857
configCount: 1, jobCount: 0, pvcCount: 1,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ type PostgresClusterSpec struct {
123123
// The major version of PostgreSQL installed in the PostgreSQL image
124124
// +kubebuilder:validation:Required
125125
// +kubebuilder:validation:Minimum=10
126-
// +kubebuilder:validation:Maximum=14
126+
// +kubebuilder:validation:Maximum=15
127127
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=1
128128
PostgresVersion int `json:"postgresVersion"`
129129

0 commit comments

Comments
 (0)