Skip to content

Commit f4218e0

Browse files
author
Jeff McCormick
committed
fix various rename issues in the config templates
1 parent bdd0db7 commit f4218e0

File tree

8 files changed

+34
-42
lines changed

8 files changed

+34
-42
lines changed

apis/cr/v1/cluster.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ type PgclusterSpec struct {
4141
PrimaryStorage PgStorageSpec `json:primarystorage`
4242
ReplicaStorage PgStorageSpec `json:replicastorage`
4343
PrimaryHost string `json:"primaryhost"`
44-
PrimaryUser string `json:"primaryuser"`
4544
PrimaryPassword string `json:"primarypassword"`
4645
User string `json:"user"`
4746
Password string `json:"password"`

apis/cr/v1/common.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ limitations under the License.
1818
import ()
1919

2020
// RootSecretSuffix ...
21-
const RootSecretSuffix = "-pgroot-secret"
21+
const RootSecretSuffix = "-root-secret"
2222

2323
// UserSecretSuffix ...
24-
const UserSecretSuffix = "-pguser-secret"
24+
const UserSecretSuffix = "-user-secret"
2525

2626
// PrimarySecretSuffix ...
27-
const PrimarySecretSuffix = "-pgprimary-secret"
27+
const PrimarySecretSuffix = "-primary-secret"
2828

2929
// StorageExisting ...
3030
const StorageExisting = "existing"

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@
3434
"timeoutSeconds": 8
3535
},
3636
"env": [{
37-
"name": "PG_MASTER_PORT",
37+
"name": "PG_PRIMARY_PORT",
3838
"value": "{{.Port}}"
3939
}, {
4040
"name": "PG_MODE",
4141
"value": "primary"
4242
}, {
4343
"name": "PGDATA_PATH_OVERRIDE",
44-
"value": "{{.PgdataPathOverride}}"
44+
"value": "{{.DataPathOverride}}"
4545
}, {
4646
"name": "BACKUP_PATH",
4747
"value": "{{.BackupPath}}"
4848
}, {
4949
"name": "PG_DATABASE",
50-
"value": "{{.PgDatabase}}"
50+
"value": "{{.Database}}"
5151
}, {
5252
"name": "PGHOST",
5353
"value": "/tmp"
@@ -62,13 +62,13 @@
6262
"readOnly": true
6363
}, {
6464
"mountPath": "/pguser",
65-
"name": "pguser-volume"
65+
"name": "user-volume"
6666
}, {
6767
"mountPath": "/pgprimary",
68-
"name": "pgprimary-volume"
68+
"name": "primary-volume"
6969
}, {
7070
"mountPath": "/pgroot",
71-
"name": "pgroot-volume"
71+
"name": "root-volume"
7272
}
7373

7474
],
@@ -87,19 +87,19 @@
8787
"name": "backup",
8888
{{.BackupPVCName}}
8989
}, {
90-
"name": "pguser-volume",
90+
"name": "user-volume",
9191
"secret": {
92-
"secretName": "{{.PgUserSecretName}}"
92+
"secretName": "{{.UserSecretName}}"
9393
}
9494
}, {
95-
"name": "pgprimary-volume",
95+
"name": "primary-volume",
9696
"secret": {
97-
"secretName": "{{.PgPrimarySecretName}}"
97+
"secretName": "{{.PrimarySecretName}}"
9898
}
9999
}, {
100-
"name": "pgroot-volume",
100+
"name": "root-volume",
101101
"secret": {
102-
"secretName": "{{.PgRootSecretName}}"
102+
"secretName": "{{.RootSecretName}}"
103103
}
104104
}
105105

conf/postgres-operator/pvc-storageclass.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
"kind": "PersistentVolumeClaim",
33
"apiVersion": "v1",
44
"metadata": {
5-
"name": "{{.PVCName}}",
5+
"name": "{{.Name}}",
66
"labels": {
77
"pgremove": "true"
88
}
99
},
1010
"spec": {
1111
"accessModes": [
12-
"{{.PVCAccessMode}}"
12+
"{{.AccessMode}}"
1313
],
1414
"storageClassName": "{{.StorageClass}}",
1515
"resources": {
1616
"requests": {
17-
"storage": "{{.PVCSize}}"
17+
"storage": "{{.Size}}"
1818
}
1919
}
2020
}

conf/postgres-operator/pvc.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
"kind": "PersistentVolumeClaim",
33
"apiVersion": "v1",
44
"metadata": {
5-
"name": "{{.PVCName}}",
5+
"name": "{{.Name}}",
66
"labels": {
77
"pgremove": "true"
88
}
99
},
1010
"spec": {
1111
"accessModes": [
12-
"{{.PVCAccessMode}}"
12+
"{{.AccessMode}}"
1313
],
1414
"resources": {
1515
"requests": {
16-
"storage": "{{.PVCSize}}"
16+
"storage": "{{.Size}}"
1717
}
1818
}
1919
}

docs/config.asciidoc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ Kubeconfig: /etc/kubernetes/admin.conf
2929
Cluster:
3030
CCPImageTag: centos7-9.6.5-1.6.0
3131
Port: 5432
32-
Primary_USER: master
33-
Primary_PASSWORD: password
32+
PrimaryPassword: password
3433
User: testuser
3534
Password: password
3635
Database: userdb
@@ -80,8 +79,7 @@ Values in the pgo configuration file have the following meaning:
8079
|Kubeconfig | the path to the kubeconfig file
8180
|Cluster.CCPImageTag |newly created containers will be based on this image version (e.g. centos7-9.6.5-1.6.0), unless you override it using the --ccp-image-tag command line flag
8281
|Cluster.Port | the PostgreSQL port to use for new containers (e.g. 5432)
83-
|Cluster.PrimaryUser | the PostgreSQL master user name
84-
|Cluster.PrimaryPassword | the PostgreSQL master user password, when specified, it will be stored in the secret holding the master user credentials, if not specified the value will be generated
82+
|Cluster.PrimaryPassword | the PostgreSQL primary user password, when specified, it will be stored in the secret holding the primary user credentials, if not specified the value will be generated
8583
|Cluster.User | the PostgreSQL normal user name
8684
|Cluster.Password | the PostgreSQL normal user password, when specified, it will be stored in the secret holding the normal user credentials, if not specified the value will be generated
8785
|Cluster.RootPassword | the PostgreSQL *postgres* user password, when specified, it will be stored in the secret holding the root user credentials, if not specified the value will be generated
@@ -90,11 +88,11 @@ Values in the pgo configuration file have the following meaning:
9088
|Cluster.Policies | optional, list of policies to apply to a newly created cluster, comma separated, must be valid policies in the catalog
9189
|Cluster.PasswordAgeDays | optional, if set, will set the VALID UNTIL date on passwords to this many days in the future when creating users or setting passwords, defaults to 365 days
9290
|Cluster.PasswordLength | optional, if set, will determine the password length used when creating passwords, defaults to 8
93-
|PrimaryStorage.Name |for the master PostgreSQL deployment, if set, the PVC to use for created databases, used when the storage type is *existing*
94-
|PrimaryStorage.StorageClass |for the master PostgreSQL deployment, for a dynamic storage type, you can specify the storage class used for storage provisioning(e.g. standard, gold, fast)
95-
|PrimaryStorage.AccessMode |for the master PostgreSQL deployment, the access mode for new PVCs (e.g. ReadWriteMany, ReadWriteOnce, ReadOnlyMany). See below for descriptions of these.
96-
|PrimaryStorage.Size |for the master PostgreSQL deployment, the size to use when creating new PVCs (e.g. 100M, 1Gi)
97-
|PrimaryStorage.StorageType |for the master PostgreSQL deployment, supported values are either *dynamic*, *existing*, *create*, or *emptydir*, if not supplied, *emptydir* is used
91+
|PrimaryStorage.Name |for the primary PostgreSQL deployment, if set, the PVC to use for created databases, used when the storage type is *existing*
92+
|PrimaryStorage.StorageClass |for the primary PostgreSQL deployment, for a dynamic storage type, you can specify the storage class used for storage provisioning(e.g. standard, gold, fast)
93+
|PrimaryStorage.AccessMode |for the primary PostgreSQL deployment, the access mode for new PVCs (e.g. ReadWriteMany, ReadWriteOnce, ReadOnlyMany). See below for descriptions of these.
94+
|PrimaryStorage.Size |for the primary PostgreSQL deployment, the size to use when creating new PVCs (e.g. 100M, 1Gi)
95+
|PrimaryStorage.StorageType |for the primary PostgreSQL deployment, supported values are either *dynamic*, *existing*, *create*, or *emptydir*, if not supplied, *emptydir* is used
9896
|PrimaryStorage.Fsgroup | optional, if set, will cause a *SecurityContext* and *fsGroup* attributes to be added to generated Pod and Deployment definitions
9997
|PrimaryStorage.SupplementalGroups | optional, if set, will cause a SecurityContext to be added to generated Pod and Deployment definitions
10098
|ReplicaStorage.Name |for the replica PostgreSQL deployments, if set, the PVC to use for created databases, used when the storage type is *existing*

pgo/cmd/cluster.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,12 @@ func getClusterParams(name string) *crv1.Pgcluster {
270270
spec.BackupPath = ""
271271
spec.BackupPVCName = ""
272272
spec.PrimaryHost = name
273-
spec.PrimaryUser = "primary"
274273
if PoliciesFlag == "" {
275274
spec.Policies = viper.GetString("Cluster.Policies")
276275
} else {
277276
spec.Policies = PoliciesFlag
278277
}
279-
spec.PrimaryPassword = viper.GetString("Cluster.PgPrimaryPassword")
278+
spec.PrimaryPassword = viper.GetString("Cluster.PrimaryPassword")
280279
spec.User = "testuser"
281280
spec.Password = viper.GetString("Cluster.Password")
282281
spec.Database = "userdb"
@@ -291,10 +290,6 @@ func getClusterParams(name string) *crv1.Pgcluster {
291290
if str != "" {
292291
spec.Port = str
293292
}
294-
str = viper.GetString("Cluster.PrimaryUser")
295-
if str != "" {
296-
spec.PrimaryUser = str
297-
}
298293
str = viper.GetString("Cluster.User")
299294
if str != "" {
300295
spec.User = str

util/secrets.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ func CreateDatabaseSecrets(clientset *kubernetes.Clientset, restclient *rest.RES
5151
}
5252

5353
cl.Spec.RootSecretName = secretName
54-
err = Patch(restclient, "/spec/pgrootsecretname", secretName, crv1.PgclusterResourcePlural, cl.Spec.Name, namespace)
54+
err = Patch(restclient, "/spec/rootsecretname", secretName, crv1.PgclusterResourcePlural, cl.Spec.Name, namespace)
5555
if err != nil {
5656
log.Error("error patching cluster" + err.Error())
5757
}
5858

59-
///pgprimary
60-
username = "primary"
59+
///primary
60+
username = "primaryuser"
6161
suffix = crv1.PrimarySecretSuffix
6262

6363
secretName = cl.Spec.Name + suffix
@@ -67,7 +67,7 @@ func CreateDatabaseSecrets(clientset *kubernetes.Clientset, restclient *rest.RES
6767
}
6868

6969
cl.Spec.PrimarySecretName = secretName
70-
err = Patch(restclient, "/spec/pgprimarysecretname", secretName, crv1.PgclusterResourcePlural, cl.Spec.Name, namespace)
70+
err = Patch(restclient, "/spec/primarysecretname", secretName, crv1.PgclusterResourcePlural, cl.Spec.Name, namespace)
7171
if err != nil {
7272
log.Error("error patching cluster " + err.Error())
7373
}
@@ -83,7 +83,7 @@ func CreateDatabaseSecrets(clientset *kubernetes.Clientset, restclient *rest.RES
8383
}
8484

8585
cl.Spec.UserSecretName = secretName
86-
err = Patch(restclient, "/spec/pgusersecretname", secretName, crv1.PgclusterResourcePlural, cl.Spec.Name, namespace)
86+
err = Patch(restclient, "/spec/usersecretname", secretName, crv1.PgclusterResourcePlural, cl.Spec.Name, namespace)
8787
if err != nil {
8888
log.Error("error patching cluster " + err.Error())
8989
}

0 commit comments

Comments
 (0)