Skip to content

Commit 19731b9

Browse files
author
Jeff McCormick
committed
update docs
1 parent 9a87283 commit 19731b9

File tree

11 files changed

+182
-56
lines changed

11 files changed

+182
-56
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"/opt/cpm/bin/readiness.sh"
3131
]
3232
},
33-
"initialDelaySeconds": 5,
34-
"timeoutSeconds": 2
33+
"initialDelaySeconds": 15,
34+
"timeoutSeconds": 8
3535
},
3636
"env": [{
3737
"name": "PG_MASTER_PORT",

docs/build.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ Strategies for deploying the operator can be found in the link:strategies.asciid
254254
The *pgo* client requires two configuration files be copied
255255
to your $HOME as follows:
256256
....
257-
cp $COROOT/examples/.pgo.yaml $HOME
258-
cp $COROOT/examples/.pgo.lspvc-template.json $HOME
257+
cp $COROOT/examples/pgo.yaml.emptydir $HOME/.pgo.yaml
258+
cp $COROOT/examples/pgo.lspvc-template.json $HOME/.pgo.lspvc-template.json
259259
vi $HOME/.pgo.yaml
260260
....
261261

docs/config.asciidoc

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ for the *postgres operator*.
77

88
== pgo Client Configuration
99

10-
There is a configuration file named *.pgo.yaml* for the operator client. It
10+
Sample pgo configuration files are located in the $COROOT/examples directory.
11+
12+
You will need to copy a sample to your $HOME/.pgo.yaml location. It
1113
can be defined in the following locations:
1214

1315
* . (current directory)
@@ -19,7 +21,7 @@ The .pgo.yaml file location is checked in that order.
1921
=== pgo Configuration Format
2022

2123
The sample pgo client configuration file, included in
22-
*examples/sample.pgo.yaml*, looks like this:
24+
*examples/pgo.yaml.emptydir*, looks like this:
2325

2426
[source,yaml]
2527
....
@@ -34,22 +36,22 @@ CLUSTER:
3436
PG_DATABASE: userdb
3537
PG_ROOT_PASSWORD: password
3638
STRATEGY: 1
37-
REPLICAS: 2
39+
REPLICAS: 0
3840
POLICIES: policy1,policy2
3941
MASTER_STORAGE:
4042
PVC_NAME: crunchy-pvc
4143
STORAGE_CLASS: standard
4244
PVC_ACCESS_MODE: ReadWriteMany
4345
PVC_SIZE: 100M
44-
STORAGE_TYPE: shared
46+
STORAGE_TYPE: emptydir
4547
FSGROUP: 26
4648
SUPPLEMENTALGROUPS: 65534
4749
REPLICA_STORAGE:
4850
PVC_NAME: crunchy-pvc
4951
STORAGE_CLASS: standard
5052
PVC_ACCESS_MODE: ReadWriteMany
5153
PVC_SIZE: 100M
52-
STORAGE_TYPE: shared
54+
STORAGE_TYPE: emptydir
5355
FSGROUP: 26
5456
SUPPLEMENTALGROUPS: 65534
5557
BACKUP_STORAGE:
@@ -89,21 +91,21 @@ Values in the pgo configuration file have the following meaning:
8991
|MASTER_STORAGE.PVC_SIZE |for the master postgres deployment, the size to use when creating new PVCs (e.g. 100M, 1Gi)
9092
|MASTER_STORAGE.STORAGE_TYPE |for the master postgres deployment, supported values are either *dynamic*, *existing*, *create*, or *emptydir*, if not supplied, *emptydir* is used
9193
|MASTER_STORAGE.FSGROUP | optional, if set, will cause a *SecurityContext* and *fsGroup* attributes to be added to generated Pod and Deployment definitions
92-
|MASTER_STORAGE.SUPPLEMENTALGROUPS | optional, if set, will cause a SecurityContext to be added to generated Pod and Deployment definitions
94+
|MASTER_STORAGE.SUPPLEMENTAL_GROUPS | optional, if set, will cause a SecurityContext to be added to generated Pod and Deployment definitions
9395
|REPLICA_STORAGE.PVC_NAME |for the replica postgres deployments, if set, the PVC to use for created databases, used when the storage type is *existing*
9496
|REPLICA_STORAGE.STORAGE_CLASS |for the replica postgres deployment, for a dynamic storage type, you can specify the storage class used for storage provisioning(e.g. standard, gold, fast)
9597
|REPLICA_STORAGE.PVC_ACCESS_MODE |for the replica postgres deployment, the access mode for new PVCs (e.g. ReadWriteMany, ReadWriteOnce)
9698
|REPLICA_STORAGE.PVC_SIZE |for the replica postgres deployment, the size to use when creating new PVCs (e.g. 100M, 1Gi)
9799
|REPLICA_STORAGE.STORAGE_TYPE |for the replica postgres deployment, supported values are either *dynamic*, *existing*, *create*, or *emptydir*, if not supplied, *emptydir* is used
98100
|REPLICA_STORAGE.FSGROUP | optional, if set, will cause a *SecurityContext* and *fsGroup* attributes to be added to generated Pod and Deployment definitions
99-
|REPLICA_STORAGE.SUPPLEMENTALGROUPS | optional, if set, will cause a SecurityContext to be added to generated Pod and Deployment definitions
101+
|REPLICA_STORAGE.SUPPLEMENTAL_GROUPS | optional, if set, will cause a SecurityContext to be added to generated Pod and Deployment definitions
100102
|BACKUP_STORAGE.PVC_NAME |for the backup job, if set, the PVC to use for holding backup files, used when the storage type is *existing*
101103
|BACKUP_STORAGE.STORAGE_CLASS |for the backup job, for a dynamic storage type, you can specify the storage class used for storage provisioning(e.g. standard, gold, fast)
102104
|BACKUP_STORAGE.PVC_ACCESS_MODE |for the backup job, the access mode for new PVCs (e.g. ReadWriteMany, ReadWriteOnce)
103105
|BACKUP_STORAGE.PVC_SIZE |for the backup job, the size to use when creating new PVCs (e.g. 100M, 1Gi)
104106
|BACKUP_STORAGE.STORAGE_TYPE |for the backup job , supported values are either *dynamic*, *existing*, *create*, or *emptydir*, if not supplied, *emptydir* is used
105107
|BACKUP_STORAGE.FSGROUP | optional, if set, will cause a *SecurityContext* and *fsGroup* attributes to be added to generated Pod and Deployment definitions
106-
|BACKUP_STORAGE.SUPPLEMENTALGROUPS | optional, if set, will cause a SecurityContext to be added to generated Pod and Deployment definitions
108+
|BACKUP_STORAGE.SUPPLEMENTAL_GROUPS | optional, if set, will cause a SecurityContext to be added to generated Pod and Deployment definitions
107109
|PGO.LSPVC_TEMPLATE | the PVC lspvc template file used to view PVCs
108110
|PGO.CO_IMAGE_TAG | image tag to use for the PostgreSQL operator containers
109111
|PGO.DEBUG | set to true if you want to see debug messages from the pgo client
@@ -122,6 +124,8 @@ That script will also create a PV named *crunchy-pv* using a HostPath of */data*
122124
only for testing the operator, edit or remove the PV/PVC creation
123125
to meet your requirements.
124126

127+
You can also create NFS PV(s) using the create-pv-nfs.sh script.
128+
125129
To enable DEBUG messages from the operator pod, set the *DEBUG* environment
126130
variable to *true* within its deployment file *deployment.json*.
127131

@@ -186,3 +190,15 @@ pgo create cluster example1
186190
It will result in a PVC being created named *example1-pvc* and in
187191
the case of a backup job, the pvc is named *example1-backup-pvc*
188192

193+
There are currently 3 sample pgo configuration files provided
194+
for users to use as a starting configuration:
195+
196+
* pgo.yaml.emptydir - this configuration specifies *emptydir* storage
197+
to be used for databases
198+
* pgo.yaml.nfs - this configuration specifies *create* storage to
199+
be used, this is used for NFS storage for example where you want to
200+
have a unique PVC created for each database
201+
* pgo.yaml.dynamic - this configuration specifies *dynamic* storage
202+
to be used, namely a *storageclass* that refers to a dynamic provisioning
203+
strorage such as StorageOS or Portworx, or GCE.
204+

examples/golang/listpods.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,8 @@ package main
1919
import (
2020
"flag"
2121
"fmt"
22-
22+
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323
"k8s.io/client-go/kubernetes"
24-
//"k8s.io/client-go/pkg/api"
25-
//"k8s.io/client-go/pkg/api/errors"
26-
27-
//"k8s.io/client-go/pkg/runtime"
28-
//"k8s.io/client-go/pkg/runtime/serializer"
29-
30-
//"k8s.io/client-go/pkg/api/unversioned"
31-
"k8s.io/client-go/pkg/api/v1"
32-
//"k8s.io/client-go/rest"
3324
"k8s.io/client-go/tools/clientcmd"
3425
)
3526

@@ -50,8 +41,8 @@ func main() {
5041
panic(err.Error())
5142
}
5243

53-
lo := v1.ListOptions{LabelSelector: "pgbackup=true"}
54-
pods, err := clientset.Core().Pods("default").List(lo)
44+
lo := meta_v1.ListOptions{}
45+
pods, err := clientset.CoreV1().Pods("default").List(lo)
5546
if err != nil {
5647
panic(err.Error())
5748
}

examples/operator/create-pv-nfs.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# Copyright 2016 Crunchy Data Solutions, Inc.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
17+
18+
source $DIR/setup.sh
19+
20+
echo "create the test PV and PVC using the NFS dir"
21+
for i in {1..60}
22+
do
23+
echo "creating PV crunchy-pv$i"
24+
export COUNTER=$i
25+
$CO_CMD --namespace=$CO_NAMESPACE delete pv crunchy-pv$i
26+
envsubst < $DIR/crunchy-pv-nfs.json | $CO_CMD --namespace=$CO_NAMESPACE create -f -
27+
done
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"apiVersion": "v1",
3+
"kind": "PersistentVolume",
4+
"metadata": {
5+
"name": "crunchy-pv$COUNTER"
6+
},
7+
"spec": {
8+
"capacity": {
9+
"storage": "1Gi"
10+
},
11+
"accessModes": [ "ReadWriteMany" ],
12+
"nfs": {
13+
"path": "/nfsfileshare",
14+
"server": "192.168.122.172"
15+
},
16+
"persistentVolumeReclaimPolicy": "Retain"
17+
}
18+
}
19+
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,20 @@ CLUSTER:
1212
STRATEGY: 1
1313
REPLICAS: 0
1414
MASTER_STORAGE:
15-
PVC_NAME: crunchy-pvc
16-
STORAGE_CLASS: standard
1715
PVC_ACCESS_MODE: ReadWriteMany
1816
PVC_SIZE: 100M
19-
STORAGE_TYPE: emptydir
20-
REPLICA_STORAGE:
21-
PVC_NAME: crunchy-pvc
22-
STORAGE_CLASS: standard
17+
STORAGE_TYPE: create
18+
SUPPLEMENTAL_GROUPS: 65534
19+
BACKUP_STORAGE:
2320
PVC_ACCESS_MODE: ReadWriteMany
2421
PVC_SIZE: 100M
25-
STORAGE_TYPE: emptydir
26-
BACKUP_STORAGE:
27-
PVC_NAME: crunchy-pvc
28-
STORAGE_CLASS: standard
22+
STORAGE_TYPE: create
23+
SUPPLEMENTAL_GROUPS: 65534
24+
REPLICA_STORAGE:
2925
PVC_ACCESS_MODE: ReadWriteMany
3026
PVC_SIZE: 100M
31-
STORAGE_TYPE: emptydir
27+
STORAGE_TYPE: create
28+
SUPPLEMENTAL_GROUPS: 65534
3229
PGO:
3330
LSPVC_TEMPLATE: /home/jeffmc/.pgo.lspvc-template.json
3431
CO_IMAGE_TAG: centos7-1.4

examples/pgo.yaml.nfs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
KUBECONFIG: /etc/kubernetes/admin.conf
2+
NAMESPACE: default
3+
CLUSTER:
4+
CCP_IMAGE_TAG: centos7-9.6-1.4.1
5+
PORT: 5432
6+
PG_MASTER_USER: master
7+
PG_MASTER_PASSWORD: password
8+
PG_USER: testuser
9+
PG_PASSWORD: password
10+
PG_DATABASE: userdb
11+
PG_ROOT_PASSWORD: password
12+
STRATEGY: 1
13+
REPLICAS: 0
14+
MASTER_STORAGE:
15+
PVC_ACCESS_MODE: ReadWriteMany
16+
PVC_SIZE: 100M
17+
STORAGE_TYPE: create
18+
SUPPLEMENTAL_GROUPS: 65534
19+
BACKUP_STORAGE:
20+
PVC_ACCESS_MODE: ReadWriteMany
21+
PVC_SIZE: 100M
22+
STORAGE_TYPE: create
23+
SUPPLEMENTAL_GROUPS: 65534
24+
REPLICA_STORAGE:
25+
PVC_ACCESS_MODE: ReadWriteMany
26+
PVC_SIZE: 100M
27+
STORAGE_TYPE: create
28+
SUPPLEMENTAL_GROUPS: 65534
29+
PGO:
30+
LSPVC_TEMPLATE: /home/jeffmc/.pgo.lspvc-template.json
31+
CO_IMAGE_TAG: centos7-1.4
32+
DEBUG: false

examples/pgo.yaml.storageclass

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
KUBECONFIG: /etc/kubernetes/admin.conf
2+
NAMESPACE: default
3+
CLUSTER:
4+
CCP_IMAGE_TAG: centos7-9.6-1.4.1
5+
PORT: 5432
6+
PG_MASTER_USER: master
7+
PG_MASTER_PASSWORD: password
8+
PG_USER: testuser
9+
PG_PASSWORD: password
10+
PG_DATABASE: userdb
11+
PG_ROOT_PASSWORD: password
12+
STRATEGY: 1
13+
REPLICAS: 0
14+
MASTER_STORAGE:
15+
STORAGE_CLASS: fast
16+
PVC_ACCESS_MODE: ReadWriteOnce
17+
PVC_SIZE: 100M
18+
STORAGE_TYPE: dynamic
19+
FSGROUP: 26
20+
BACKUP_STORAGE:
21+
STORAGE_CLASS: fast
22+
PVC_ACCESS_MODE: ReadWriteOnce
23+
PVC_SIZE: 100M
24+
STORAGE_TYPE: dynamic
25+
FSGROUP: 26
26+
REPLICA_STORAGE:
27+
STORAGE_CLASS: fast
28+
PVC_ACCESS_MODE: ReadWriteOnce
29+
PVC_SIZE: 100M
30+
STORAGE_TYPE: dynamic
31+
FSGROUP: 26
32+
PGO:
33+
LSPVC_TEMPLATE: /home/jeffmc/.pgo.lspvc-template.json
34+
CO_IMAGE_TAG: centos7-1.4
35+
DEBUG: false

0 commit comments

Comments
 (0)