Skip to content

Commit c7eb7ff

Browse files
committed
resolved conflicts
1 parent 2a21cc4 commit c7eb7ff

File tree

6 files changed

+37
-18
lines changed

6 files changed

+37
-18
lines changed

charts/postgres-operator/crds/postgresqls.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,11 @@ spec:
382382
type: integer
383383
standby:
384384
type: object
385-
required:
386-
- s3_wal_path
387385
properties:
388386
s3_wal_path:
389387
type: string
388+
gs_wal_path:
389+
type: string
390390
teamId:
391391
type: string
392392
tls:

docs/reference/cluster_manifest.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ archive is supported.
327327

328328
* **s3_wal_path**
329329
the url to S3 bucket containing the WAL archive of the remote primary.
330-
Required when the `standby` section is present.
330+
Either this or gs_wal_path is required when the `standby` section is present.
331+
332+
* **gs_wal_path**
333+
the url to GCS bucket containing the WAL archive of the remote primary.
334+
Either this or s3_wal_path is required when the `standby` section is present.
331335

332336
## EBS volume resizing
333337

manifests/postgresql.crd.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,11 @@ spec:
378378
type: integer
379379
standby:
380380
type: object
381-
required:
382-
- s3_wal_path
383381
properties:
384382
s3_wal_path:
385383
type: string
384+
gs_wal_path:
385+
type: string
386386
teamId:
387387
type: string
388388
tls:

pkg/apis/acid.zalan.do/v1/crds.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,13 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
530530
},
531531
"standby": {
532532
Type: "object",
533-
Required: []string{"s3_wal_path"},
534533
Properties: map[string]apiextv1beta1.JSONSchemaProps{
535534
"s3_wal_path": {
536535
Type: "string",
537536
},
537+
"gs_wal_path": {
538+
Type: "string",
539+
}
538540
},
539541
},
540542
"teamId": {

pkg/apis/acid.zalan.do/v1/postgresql_type.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ type Patroni struct {
156156

157157
//StandbyCluster
158158
type StandbyDescription struct {
159-
S3WalPath string `json:"s3_wal_path,omitempty"`
159+
S3WalPath string `json:"s3_wal_path,omitempty"`,
160+
GSWalPath string `json:"gs_wal_path,omitempty"`
160161
}
161162

162163
type TLSDescription struct {

pkg/cluster/k8sres.go

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,8 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef
10401040
sort.Slice(customPodEnvVarsList,
10411041
func(i, j int) bool { return customPodEnvVarsList[i].Name < customPodEnvVarsList[j].Name })
10421042

1043-
if spec.StandbyCluster != nil && spec.StandbyCluster.S3WalPath == "" {
1044-
return nil, fmt.Errorf("s3_wal_path is empty for standby cluster")
1043+
if spec.StandbyCluster != nil && spec.StandbyCluster.S3WalPath == "" && spec.StandbyCluster.GSWalPath == "" {
1044+
return nil, fmt.Errorf("s3_wal_path and s3_wal_path are empty for standby cluster")
10451045
}
10461046

10471047
// backward compatible check for InitContainers
@@ -1808,17 +1808,29 @@ func (c *Cluster) generateCloneEnvironment(description *acidv1.CloneDescription)
18081808
func (c *Cluster) generateStandbyEnvironment(description *acidv1.StandbyDescription) []v1.EnvVar {
18091809
result := make([]v1.EnvVar, 0)
18101810

1811-
if description.S3WalPath == "" {
1811+
if description.S3WalPath != "" {
1812+
// standby with S3, find out the bucket to setup standby
1813+
msg := "Standby from S3 bucket using custom parsed S3WalPath from the manifest %s "
1814+
c.logger.Infof(msg, description.S3WalPath)
1815+
1816+
result = append(result, v1.EnvVar{
1817+
Name: "STANDBY_WALE_S3_PREFIX",
1818+
Value: description.S3WalPath,
1819+
})
1820+
1821+
} else if description.GSWalPath != "" {
1822+
// standby with GS, find out the bucket to setup standby
1823+
msg := "Standby from GS bucket using custom parsed GSWalPath from the manifest %s "
1824+
c.logger.Infof(msg, description.GSWalPath)
1825+
1826+
result = append(result, v1.EnvVar{
1827+
Name: "STANDBY_WALE_GS_PREFIX",
1828+
Value: description.GSWalPath,
1829+
})
1830+
1831+
} else {
18121832
return nil
18131833
}
1814-
// standby with S3, find out the bucket to setup standby
1815-
msg := "Standby from S3 bucket using custom parsed S3WalPath from the manifest %s "
1816-
c.logger.Infof(msg, description.S3WalPath)
1817-
1818-
result = append(result, v1.EnvVar{
1819-
Name: "STANDBY_WALE_S3_PREFIX",
1820-
Value: description.S3WalPath,
1821-
})
18221834

18231835
result = append(result, v1.EnvVar{Name: "STANDBY_METHOD", Value: "STANDBY_WITH_WALE"})
18241836
result = append(result, v1.EnvVar{Name: "STANDBY_WAL_BUCKET_SCOPE_PREFIX", Value: ""})

0 commit comments

Comments
 (0)