Skip to content

Commit cb96903

Browse files
author
Jeff McCormick
committed
add collect container chagnes for 2.1.0, also fix backrest restore job sec context
1 parent 12adb4a commit cb96903

File tree

13 files changed

+57
-13
lines changed

13 files changed

+57
-13
lines changed

conf/apiserver/pgo.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Storage:
2323
AccessMode: ReadWriteMany
2424
Size: 200M
2525
StorageType: create
26+
SupplementalGroups: 65534
2627
storage2:
2728
AccessMode: ReadWriteOnce
2829
Size: 333M

conf/postgres-operator/backrest-restore-job.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
}
1919
},
2020
"spec": {
21-
"securityContext": {
21+
2222
{{.SecurityContext}}
23-
},
23+
2424
"containers": [
2525
{
2626
"name": "backrest-restore",

conf/postgres-operator/cluster/1/cluster-deployment-1.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
}, {
6262
"name": "PG_DATABASE",
6363
"value": "{{.Database}}"
64+
}, {
65+
"name": "PGMONITOR_PASSWORD",
66+
"value": "password"
6467
}, {
6568
"name": "ARCHIVE_MODE",
6669
"value": "{{.ArchiveMode}}"

conf/postgres-operator/cluster/1/collect.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
}],
1111
"env": [{
1212
"name": "DATA_SOURCE_NAME",
13-
"value": "postgresql://primaryuser:{{.PrimaryPassword}}@127.0.0.1:5432/postgres?sslmode=disable"
14-
}]
13+
"value": "postgresql://ccp_monitoring:password@127.0.0.1:5432/postgres?sslmode=disable"
14+
},
15+
{
16+
"name": "JOB_NAME",
17+
"value": "{{.JobName}}"
18+
}
19+
]
1520
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
,{
2+
"name": "collect",
3+
"image": "{{.CCPImagePrefix}}/crunchy-collect:{{.CCPImageTag}}",
4+
"ports": [{
5+
"containerPort": 9187,
6+
"protocol": "TCP"
7+
}, {
8+
"containerPort": 9100,
9+
"protocol": "TCP"
10+
}],
11+
"env": [{
12+
"name": "DATA_SOURCE_NAME",
13+
"value": "postgresql://primaryuser:{{.PrimaryPassword}}@127.0.0.1:5432/postgres?sslmode=disable"
14+
}]
15+
}

config/pgoconfig.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,16 @@ func (c *PgoConfig) Validate() error {
9393
log.Info("pgo.yaml Cluster.Backrest is %v", c.Cluster.Backrest)
9494
_, ok := c.Storage[c.PrimaryStorage]
9595
if !ok {
96-
return errors.New("invalid PrimaryStorage setting")
96+
return errors.New("PrimaryStorage setting required")
9797
}
9898
_, ok = c.Storage[c.BackupStorage]
9999
if !ok {
100-
return errors.New("invalid BackupStorage setting")
100+
return errors.New("BackupStorage setting required")
101101
}
102102
_, ok = c.Storage[c.ReplicaStorage]
103103
if !ok {
104-
return errors.New("invalid ReplicaStorage setting")
104+
return errors.New("ReplicaStorage setting required")
105105
}
106-
107106
if c.Pgo.LSPVCTemplate == "" {
108107
return errors.New("Pgo.LSPVCTemplate is required")
109108
}

hugo/content/getting-started/_index.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ pgo restore withbr --to-cluster=restored --restore-type=backrest-restore-full
274274
pgo create cluster restored --custom-config=backrest-restore-withbr-to-restored --secret-from=withbr --pgbackrest
275275
....
276276

277+
The pgbackrest *backrestrepo* PVCs are created using the *pgo.yaml* BackupStorage setting. Typically this will be a RWX file system which will allow you to restore from this PVC without having to shutdown the currently attached PG cluster.
278+
277279

278280
=== pgo scale
279281

hugo/content/installation/configuration.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ Values in the pgo configuration file have the following meaning:
297297
|Cluster.Backrest | optional, if set, will cause clusters to have the pgbackrest volume PVC provisioned during cluster creation
298298
|Cluster.Autofail | optional, if set, will cause clusters to be checked for auto failover in the event of a non-Ready status
299299
|PrimaryStorage |required, the value of the storage configuration to use for the primary PostgreSQL deployment
300-
|BackupStorage |required, the value of the storage configuration to use for backups
300+
|BackupStorage |required, the value of the storage configuration to use for backups, including the storage for pgbackrest repo volumes
301301
|ReplicaStorage |required, the value of the storage configuration to use for the replica PostgreSQL deployments
302302
|Storage.storage1.StorageClass |for a dynamic storage type, you can specify the storage class used for storage provisioning(e.g. standard, gold, fast)
303303
|Storage.storage1.AccessMode |the access mode for new PVCs (e.g. ReadWriteMany, ReadWriteOnce, ReadOnlyMany). See below for descriptions of these.

hugo/content/installation/upgrading-the-operator.adoc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ previous operator versions:
3333
....
3434
kubectl label deploy mycluster-xxxx primary=false
3535
....
36-
36+
* the collect.json template now specifies a pgmonitor credential that
37+
also must match the PGMONITOR_PASSWORD environment variable which was
38+
added into the cluster-deployment-1.json template. These changes
39+
were required to support crunchy-collect (2.1.0) changes that were
40+
introduced. Users should upgrade to crunchy-collect:centos7-10.5-2.1.0
41+
to use this feature. If you do not want to upgrade to this new
42+
metrics collector, you will need to retain and reuse the prior version
43+
of collect.json used by the Operator and make sure you deploy that
44+
version.
3745

3846
{{%expand "Upgrading from v2.6 to v3.1" %}}
3947

operator/backrest/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func Restore(namespace string, clientset *kubernetes.Clientset, task *crv1.Pgtas
104104

105105
jobFields := backrestRestoreJobTemplateFields{
106106
RestoreName: task.Spec.Name,
107-
SecurityContext: "",
107+
SecurityContext: util.CreateSecContext(storage.Fsgroup, storage.SupplementalGroups),
108108
ToClusterName: task.Spec.Parameters[util.LABEL_BACKREST_RESTORE_TO_CLUSTER],
109109
RestoreConfigMapName: task.Spec.Name,
110110
FromClusterPVCName: task.Spec.Parameters[util.LABEL_BACKREST_RESTORE_FROM_CLUSTER],

0 commit comments

Comments
 (0)