Skip to content

Commit c169b10

Browse files
author
Jeff McCormick
committed
update docs based on latest work
1 parent 3a3cc99 commit c169b10

File tree

2 files changed

+79
-3
lines changed

2 files changed

+79
-3
lines changed

README.asciidoc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ Once the objects are detected, the PostgreSQL Operator enables users to perform
4444
* Clone a PostgreSQL Cluster
4545
* Create a SQL-based Policy
4646
* Apply a SQL-based Policy to a PostgreSQL Cluster
47+
* Perform User Management
48+
* Apply User Defined Labels to PostgreSQL Clusters
49+
* Perform Password Management
4750

4851
What actually gets created on the Kube cluster for a
4952
*pgcluster* resource is defined as a *deployment strategy*. Strategies
@@ -52,8 +55,8 @@ are documented in detail in link:docs/strategies.asciidoc[Deployment Strategies]
5255
[#Requirements]
5356
== Requirements
5457

55-
* Kubernetes 1.5.3+
56-
* Openshift Origin 1.5.1+ and Openshift Container Platform 3.5
58+
* greater than Kubernetes 1.5.3+
59+
* greater than Openshift Origin 1.5.1+ and Openshift Container Platform 3.5
5760
* link:https://hub.docker.com/r/crunchydata/crunchy-postgres/[PostgreSQL 9.5+ Container]
5861
* link:https://hub.docker.com/r/crunchydata/crunchy-backup/[PostgreSQL Backup Container]
5962
* link:https://hub.docker.com/r/crunchydata/crunchy-upgrade/[PostgreSQL Upgrade Container]
@@ -163,7 +166,7 @@ which allows for any sort of SQL to be executed.
163166
pgo apply policy1 --selector=name=mycluster
164167
----
165168

166-
Details on the *pgo* commands are found in the
169+
Details on the *pgo* commands and complex examples are found in the
167170
link:docs/user-guide.asciidoc[User Guide]
168171

169172
[#PostgreSQL Operator Container]

docs/user-guide.asciidoc

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ To create a database, use the following:
1111
pgo create cluster mycluster
1212
....
1313

14+
A more complex example is to create a *series* of clusters such
15+
as:
16+
....
17+
pgo create cluster xraydb --series=3 --labels=project=xray --policies=xrayapp,rlspolicy
18+
....
19+
20+
In the example above, we provision 3 clusters that have a number appended
21+
into their resulting cluster name, apply a user defined label to each
22+
cluster, and also apply user defined policies to each cluster after
23+
they are created.
24+
1425
You can then view that database as:
1526
....
1627
pgo show cluster mydatabase
@@ -78,6 +89,15 @@ This will create a new database called *restoredb* based on the
7889
backup found in *mycluster-backups/2017-03-27-13-56-49* and the
7990
secrets of the *mycluster* cluster.
8091

92+
Selectors can be used to perform backups as well, for example:
93+
....
94+
pgo backup  --selector=project=xray
95+
....
96+
97+
In this example, any cluster that matches the selector will cause
98+
a backup job to be created.
99+
100+
81101
== Cluster Removal
82102

83103
You can remove a cluster by running:
@@ -89,6 +109,15 @@ Note, that this command will not remove the PVC associated with
89109
this cluster. If you want to remove the cluster's old data files,
90110
you will need to remove it manually.
91111

112+
Selectors also apply to the delete command as follows:
113+
....
114+
pgo delete cluster  --selector=project=xray
115+
....
116+
117+
This command will cause any cluster matching the selector
118+
to be removed.
119+
120+
92121
== Cluster Replication
93122

94123
When you create a Cluster, you will see in the output a variety of Kubernetes objects were created including:
@@ -358,6 +387,40 @@ pgo user --expired=7
358387

359388
== User Management - Update Expired Passwords
360389

390+
To assign users to a cluster:
391+
....
392+
pgo user --add-user=user1 --valid-days=30 --managed --db=userdb --selector=name=xraydb1
393+
....
394+
395+
In this example, a user named *user1* is created with a *valid until* password date set to expire in 30 days. That user will be granted access to the *userdb* database. This user account also will have an associated *secret* created to hold the password that was generated for this user. Any clusters that match the selector value will have this user created on it.
396+
397+
To change a user password:
398+
....
399+
pgo user --change-password=user1 --valid-days=10 --selector=name=xray1
400+
....
401+
402+
In this example, a user named *user1* has its password changed to a generated
403+
value and the *valid until* expiration date set to 10 days from now, this
404+
command will take effect across all clusters that match the selector.
405+
406+
To drop a user:
407+
....
408+
pgo user --delete-user=user3   --selector=project=xray
409+
....
410+
411+
To see which passwords are set to expire in a given number of days:
412+
....
413+
pgo user --expired=10  --selector=project=xray
414+
....
415+
416+
To check password age:
417+
....
418+
pgo user --expired=10  --selector=project=xray
419+
....
420+
421+
In this example, any clusters that match the selector are queried to see
422+
if any users are set to expire in 10 days.
423+
361424
To update expired passwords in a cluster:
362425
....
363426
pgo user --update-passwords --selector=name=mycluster
@@ -368,6 +431,16 @@ The same command across all clusters:
368431
pgo user --update-passwords
369432
....
370433

434+
== Label Management
435+
436+
You can apply a user defined label to a cluster as follows:
437+
....
438+
pgo label --label=env=research  --selector=project=xray
439+
....
440+
441+
In this example, we apply a label of *env=research* to any
442+
clusters that have an existing label of *project=xray* applied.
443+
371444
== bash Completion
372445

373446
There is a bash completion file that is included for users to try, this

0 commit comments

Comments
 (0)