-
Notifications
You must be signed in to change notification settings - Fork 609
/
Copy pathnames.go
561 lines (482 loc) · 20.8 KB
/
names.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
/*
Copyright 2021 - 2022 Crunchy Data Solutions, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package naming
import (
"fmt"
"hash/fnv"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/rand"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/crunchydata/postgres-operator/internal/config"
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
)
const (
// ContainerDatabase is the name of the container running PostgreSQL and
// supporting tools: Patroni, pgBackRest, etc.
ContainerDatabase = "database"
// ContainerPGAdmin is the name of a container running pgAdmin.
ContainerPGAdmin = "pgadmin"
// ContainerPGAdminStartup is the name of the initialization container
// that prepares the filesystem for pgAdmin.
ContainerPGAdminStartup = "pgadmin-startup"
// ContainerPGBackRestConfig is the name of a container supporting pgBackRest.
ContainerPGBackRestConfig = "pgbackrest-config"
// ContainerPGBouncer is the name of a container running PgBouncer.
ContainerPGBouncer = "pgbouncer"
// ContainerPGBouncerConfig is the name of a container supporting PgBouncer.
ContainerPGBouncerConfig = "pgbouncer-config"
// ContainerPostgresStartup is the name of the initialization container
// that prepares the filesystem for PostgreSQL.
ContainerPostgresStartup = "postgres-startup"
// ContainerClientCertCopy is the name of the container that is responsible for copying and
// setting proper permissions on the client certificate and key after initialization whenever
// there is a change in the certificates or key
ContainerClientCertCopy = "replication-cert-copy"
// ContainerNSSWrapperInit is the name of the init container utilized to configure support
// for the nss_wrapper
ContainerNSSWrapperInit = "nss-wrapper-init"
// ContainerPGBackRestLogDirInit is the name of the init container utilized to make
// a pgBackRest log directory when using a dedicated repo host.
ContainerPGBackRestLogDirInit = "pgbackrest-log-dir"
// ContainerPGMonitorExporter is the name of a container running postgres_exporter
ContainerPGMonitorExporter = "exporter"
// ContainerJobMovePGDataDir is the name of the job container utilized to copy v4 Operator
// pgData directories to the v5 default location
ContainerJobMovePGDataDir = "pgdata-move-job"
// ContainerJobMovePGWALDir is the name of the job container utilized to copy v4 Operator
// pg_wal directories to the v5 default location
ContainerJobMovePGWALDir = "pgwal-move-job"
// ContainerJobMovePGBackRestRepoDir is the name of the job container utilized to copy v4
// Operator pgBackRest repo directories to the v5 default location
ContainerJobMovePGBackRestRepoDir = "repo-move-job"
)
const (
// PortExporter is the named port for the "exporter" container
PortExporter = "exporter"
// PortPGAdmin is the name of a port that connects to pgAdmin.
PortPGAdmin = "pgadmin"
// PortPGBouncer is the name of a port that connects to PgBouncer.
PortPGBouncer = "pgbouncer"
// PortPostgreSQL is the name of a port that connects to PostgreSQL.
PortPostgreSQL = "postgres"
)
const (
// RootCertSecret is the default root certificate secret name
RootCertSecret = "pgo-root-cacert" /* #nosec */
// ClusterCertSecret is the default cluster leaf certificate secret name
ClusterCertSecret = "%s-cluster-cert" /* #nosec */
)
const (
// CertVolume is the name of the Certificate volume and volume mount in a
// PostgreSQL instance Pod
CertVolume = "cert-volume"
// CertMountPath is the path for mounting the postgrescluster certificates
// and key
CertMountPath = "/pgconf/tls"
// ReplicationDirectory is the directory at CertMountPath where the replication
// certificates and key are mounted
ReplicationDirectory = "/replication"
// ReplicationTmp is the directory where the replication certificates and key can
// have the proper permissions set due to:
// https://github.com/kubernetes/kubernetes/issues/57923
ReplicationTmp = "/tmp/replication"
// ReplicationCert is the secret key to the postgrescluster's
// replication/rewind user's client certificate
ReplicationCert = "tls.crt"
// ReplicationCertPath is the path to the postgrescluster's replication/rewind
// user's client certificate
ReplicationCertPath = "replication/tls.crt"
// ReplicationPrivateKey is the secret key to the postgrescluster's
// replication/rewind user's client private key
ReplicationPrivateKey = "tls.key"
// ReplicationPrivateKeyPath is the path to the postgrescluster's
// replication/rewind user's client private key
ReplicationPrivateKeyPath = "replication/tls.key"
// ReplicationCACert is the key name of the postgrescluster's replication/rewind
// user's client CA certificate
// Note: when using auto-generated certificates, this will be identical to the
// server CA cert
ReplicationCACert = "ca.crt"
// ReplicationCACertPath is the path to the postgrescluster's replication/rewind
// user's client CA certificate
ReplicationCACertPath = "replication/ca.crt"
)
const (
// PGBackRestRepoContainerName is the name assigned to the container used to run pgBackRest
PGBackRestRepoContainerName = "pgbackrest"
// PGBackRestRestoreContainerName is the name assigned to the container used to run pgBackRest
// restores
PGBackRestRestoreContainerName = "pgbackrest-restore"
// PGBackRestRepoName is the name used for a pgbackrest repository
PGBackRestRepoName = "%s-pgbackrest-repo-%s"
// PGBackRestPGDataLogPath is the pgBackRest default log path configuration used by the
// PostgreSQL instance.
PGBackRestPGDataLogPath = "/pgdata/pgbackrest/log"
// PGBackRestRepoLogPath is the pgBackRest default log path configuration used by the
// dedicated repo host, if configured.
PGBackRestRepoLogPath = "/pgbackrest/%s/log"
// suffix used with postgrescluster name for associated configmap.
// for instance, if the cluster is named 'mycluster', the
// configmap will be named 'mycluster-pgbackrest-config'
cmNameSuffix = "%s-pgbackrest-config"
// suffix used with postgrescluster name for associated configmap.
// for instance, if the cluster is named 'mycluster', the
// configmap will be named 'mycluster-ssh-config'
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
sshCMNameSuffix = "%s-ssh-config"
// suffix used with postgrescluster name for associated secret.
// for instance, if the cluster is named 'mycluster', the
// secret will be named 'mycluster-ssh'
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
sshSecretNameSuffix = "%s-ssh"
// RestoreConfigCopySuffix is the suffix used for ConfigMap or Secret configuration
// resources needed when restoring from a PostgresCluster data source. If, for
// example, a Secret is named 'mysecret' and is the first item in the configuration
// slice, the copied Secret will be named 'mysecret-restorecopy-0'
RestoreConfigCopySuffix = "%s-restorecopy-%d"
)
const (
// AppProtocolHTTP is the name of the appProtocol for Services which use the HTTP protocol
AppProtocolHTTP = "http"
)
// AsObjectKey converts the ObjectMeta API type to a client.ObjectKey.
// When you have a client.Object, use client.ObjectKeyFromObject() instead.
func AsObjectKey(m metav1.ObjectMeta) client.ObjectKey {
return client.ObjectKey{Namespace: m.Namespace, Name: m.Name}
}
// ClusterConfigMap returns the ObjectMeta necessary to lookup
// cluster's shared ConfigMap.
func ClusterConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-config",
}
}
// ClusterInstanceRBAC returns the ObjectMeta necessary to lookup the
// ServiceAccount, Role, and RoleBinding for cluster's PostgreSQL instances.
func ClusterInstanceRBAC(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-instance",
}
}
// ClusterPGAdmin returns the ObjectMeta necessary to lookup the ConfigMap,
// Service, StatefulSet, or Volume for the cluster's pgAdmin user interface.
func ClusterPGAdmin(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-pgadmin",
}
}
// ClusterPGBouncer returns the ObjectMeta necessary to lookup the ConfigMap,
// Deployment, Secret, PodDisruptionBudget or Service that is cluster's
// PgBouncer proxy.
func ClusterPGBouncer(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-pgbouncer",
}
}
// ClusterPodService returns the ObjectMeta necessary to lookup the Service
// that is responsible for the network identity of Pods.
func ClusterPodService(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
// The hyphen below ensures that the DNS name will not be interpreted as a
// top-level domain. Partially qualified requests for "{pod}.{cluster}-pods"
// should not leave the Kubernetes cluster, and if they do they are less
// likely to resolve.
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-pods",
}
}
// ClusterPrimaryService returns the ObjectMeta necessary to lookup the Service
// that exposes the PostgreSQL primary instance.
func ClusterPrimaryService(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-primary",
}
}
// ClusterReplicaService returns the ObjectMeta necessary to lookup the Service
// that exposes PostgreSQL replica instances.
func ClusterReplicaService(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-replicas",
}
}
// GenerateInstance returns a random name for a member of cluster and set.
func GenerateInstance(
cluster *v1beta1.PostgresCluster, set *v1beta1.PostgresInstanceSetSpec,
) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-" + set.Name + "-" + rand.String(4),
}
}
// GenerateStartupInstance returns a stable name that's shaped like
// GenerateInstance above. The stable name is based on a four character
// hash of the cluster name and instance set name
func GenerateStartupInstance(
cluster *v1beta1.PostgresCluster, set *v1beta1.PostgresInstanceSetSpec,
) metav1.ObjectMeta {
// Calculate a stable name that's shaped like GenerateInstance above.
// hash.Hash.Write never returns an error: https://pkg.go.dev/hash#Hash.
hash := fnv.New32()
_, _ = hash.Write([]byte(cluster.Name + set.Name))
suffix := rand.SafeEncodeString(fmt.Sprint(hash.Sum32()))[:4]
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-" + set.Name + "-" + suffix,
}
}
// InstanceConfigMap returns the ObjectMeta necessary to lookup
// instance's shared ConfigMap.
func InstanceConfigMap(instance metav1.Object) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: instance.GetNamespace(),
Name: instance.GetName() + "-config",
}
}
// InstanceCertificates returns the ObjectMeta necessary to lookup the Secret
// containing instance's certificates.
func InstanceCertificates(instance metav1.Object) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: instance.GetNamespace(),
Name: instance.GetName() + "-certs",
}
}
// InstanceSet returns the ObjectMeta necessary to lookup the objects
// associated with a single instance set. Includes PodDisruptionBudgets
func InstanceSet(cluster *v1beta1.PostgresCluster,
set *v1beta1.PostgresInstanceSetSpec) metav1.ObjectMeta {
return metav1.ObjectMeta{
Name: cluster.Name + "-set-" + set.Name,
Namespace: cluster.Namespace,
}
}
// InstancePostgresDataVolume returns the ObjectMeta for the PostgreSQL data
// volume for instance.
func InstancePostgresDataVolume(instance *appsv1.StatefulSet) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: instance.GetNamespace(),
Name: instance.GetName() + "-pgdata",
}
}
// InstancePostgresWALVolume returns the ObjectMeta for the PostgreSQL WAL
// volume for instance.
func InstancePostgresWALVolume(instance *appsv1.StatefulSet) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: instance.GetNamespace(),
Name: instance.GetName() + "-pgwal",
}
}
// MonitoringUserSecret returns ObjectMeta necessary to lookup the Secret
// containing authentication credentials for monitoring tools.
func MonitoringUserSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-monitoring",
}
}
// ExporterWebConfigMap returns ObjectMeta necessary to lookup and create the
// exporter web configmap. This configmap is used to configure the exporter
// web server.
func ExporterWebConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-exporter-web-config",
}
}
// OperatorConfigurationSecret returns the ObjectMeta necessary to lookup the
// Secret containing PGO configuration.
func OperatorConfigurationSecret() metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: config.PGONamespace(),
Name: "pgo-config",
}
}
// ReplicationClientCertSecret returns ObjectMeta necessary to lookup the Secret
// containing the Patroni client authentication certificate information.
func ReplicationClientCertSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-replication-cert",
}
}
// PatroniDistributedConfiguration returns the ObjectMeta necessary to lookup
// the DCS created by Patroni for cluster. This same name is used for both
// ConfigMap and Endpoints. See Patroni DCS "config_path".
func PatroniDistributedConfiguration(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: PatroniScope(cluster) + "-config",
}
}
// PatroniLeaderConfigMap returns the ObjectMeta necessary to lookup the
// ConfigMap created by Patroni for the leader election of cluster.
// See Patroni DCS "leader_path".
func PatroniLeaderConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: PatroniScope(cluster) + "-leader",
}
}
// PatroniLeaderEndpoints returns the ObjectMeta necessary to lookup the
// Endpoints created by Patroni for the leader election of cluster.
// See Patroni DCS "leader_path".
func PatroniLeaderEndpoints(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: PatroniScope(cluster),
}
}
// PatroniScope returns the "scope" Patroni uses for cluster.
func PatroniScope(cluster *v1beta1.PostgresCluster) string {
return cluster.Name + "-ha"
}
// PatroniTrigger returns the ObjectMeta necessary to lookup the ConfigMap or
// Endpoints Patroni creates for cluster to initiate a controlled change of the
// leader. See Patroni DCS "failover_path".
func PatroniTrigger(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: PatroniScope(cluster) + "-failover",
}
}
// PGBackRestConfig returns the ObjectMeta for a pgBackRest ConfigMap
func PGBackRestConfig(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.GetNamespace(),
Name: fmt.Sprintf(cmNameSuffix, cluster.GetName()),
}
}
// PGBackRestBackupJob returns the ObjectMeta for the pgBackRest backup Job utilized
// to create replicas using pgBackRest
func PGBackRestBackupJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Name: cluster.GetName() + "-backup-" + rand.String(4),
Namespace: cluster.GetNamespace(),
}
}
// PGBackRestCronJob returns the ObjectMeta for a pgBackRest CronJob
func PGBackRestCronJob(cluster *v1beta1.PostgresCluster, backuptype, repoName string) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.GetNamespace(),
Name: cluster.Name + "-" + repoName + "-" + backuptype,
}
}
// PGBackRestRestoreJob returns the ObjectMeta for a pgBackRest restore Job
func PGBackRestRestoreJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.GetNamespace(),
Name: cluster.Name + "-pgbackrest-restore",
}
}
// PGBackRestRBAC returns the ObjectMeta necessary to lookup the ServiceAccount, Role, and
// RoleBinding for pgBackRest Jobs
func PGBackRestRBAC(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-pgbackrest",
}
}
// PGBackRestRepoVolume returns the ObjectMeta for a pgBackRest repository volume
func PGBackRestRepoVolume(cluster *v1beta1.PostgresCluster,
repoName string) metav1.ObjectMeta {
return metav1.ObjectMeta{
Name: fmt.Sprintf("%s-%s", cluster.GetName(), repoName),
Namespace: cluster.GetNamespace(),
}
}
// PGBackRestSSHConfig returns the ObjectMeta for a pgBackRest SSHD ConfigMap
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
func PGBackRestSSHConfig(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Name: fmt.Sprintf(sshCMNameSuffix, cluster.GetName()),
Namespace: cluster.GetNamespace(),
}
}
// PGBackRestSSHSecret returns the ObjectMeta for a pgBackRest SSHD Secret
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
func PGBackRestSSHSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Name: fmt.Sprintf(sshSecretNameSuffix, cluster.GetName()),
Namespace: cluster.GetNamespace(),
}
}
// PGBackRestSecret returns the ObjectMeta for a pgBackRest Secret
func PGBackRestSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Name: cluster.GetName() + "-pgbackrest",
Namespace: cluster.GetNamespace(),
}
}
// DeprecatedPostgresUserSecret returns the ObjectMeta necessary to lookup the
// old Secret containing the default Postgres user and connection information.
// Use PostgresUserSecret instead.
func DeprecatedPostgresUserSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-pguser",
}
}
// PostgresUserSecret returns the ObjectMeta necessary to lookup a Secret
// containing a PostgreSQL user and its connection information.
func PostgresUserSecret(cluster *v1beta1.PostgresCluster, username string) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-pguser-" + username,
}
}
// PostgresTLSSecret returns the ObjectMeta necessary to lookup the Secret
// containing the default Postgres TLS certificates and key
func PostgresTLSSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name + "-cluster-cert",
}
}
// MovePGDataDirJob returns the ObjectMeta for a pgData directory move Job
func MovePGDataDirJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.GetNamespace(),
Name: cluster.Name + "-move-pgdata-dir",
}
}
// MovePGWALDirJob returns the ObjectMeta for a pg_wal directory move Job
func MovePGWALDirJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.GetNamespace(),
Name: cluster.Name + "-move-pgwal-dir",
}
}
// MovePGBackRestRepoDirJob returns the ObjectMeta for a pgBackRest repo directory move Job
func MovePGBackRestRepoDirJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: cluster.GetNamespace(),
Name: cluster.Name + "-move-pgbackrest-repo-dir",
}
}
// UpgradeCheckConfigMap returns the ObjectMeta for the PGO ConfigMap
func UpgradeCheckConfigMap() metav1.ObjectMeta {
return metav1.ObjectMeta{
Namespace: config.PGONamespace(),
Name: "pgo-upgrade-check",
}
}