Skip to content

Commit 33d7478

Browse files
benjaminjbtjmoore4
authored andcommitted
Work out show user according to new feedback
1 parent 9189881 commit 33d7478

File tree

7 files changed

+195
-243
lines changed

7 files changed

+195
-243
lines changed

docs/content/reference/pgo_show.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,5 @@ HA
8888
* [pgo](/reference/) - pgo is a kubectl plugin for PGO, the open source Postgres Operator
8989
* [pgo show backup](/reference/pgo_show_backup/) - Show backup information for a PostgresCluster
9090
* [pgo show ha](/reference/pgo_show_ha/) - Show 'patronictl list' for a PostgresCluster.
91-
* [pgo show user](/reference/pgo_show_user/) - Show pguser Secret details for a PostgresCluster.
91+
* [pgo show user](/reference/pgo_show_user/) - Show details for a PostgresCluster user.
9292

docs/content/reference/pgo_show_user.md

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ title: pgo show user
33
---
44
## pgo show user
55

6-
Show pguser Secret details for a PostgresCluster.
6+
Show details for a PostgresCluster user.
77

88
### Synopsis
99

10-
Show pguser Secret details for a PostgresCluster.
10+
Show details for a PostgresCluster user. Only shows
11+
details for the default user for a PostgresCluster
12+
or for users defined on the PostgresCluster spec.
13+
Use the "--show-connection-info" flag to get the
14+
connection info, including password.
1115

1216
#### RBAC Requirements
1317
Resources Verbs
@@ -17,35 +21,46 @@ Show pguser Secret details for a PostgresCluster.
1721
### Usage
1822

1923
```
20-
pgo show user CLUSTER_NAME [flags]
24+
pgo show user USER_NAME --cluster CLUSTER_NAME [flags]
2125
```
2226

2327
### Examples
2428

2529
```
26-
# Show non-sensitive contents of 'pguser' Secret
27-
pgo show user hippo
30+
# Show non-sensitive contents of users for "hippo" cluster
31+
pgo show user --cluster hippo
2832
29-
# Show contents of 'pguser' Secret, including sensitive fields
30-
pgo show user hippo --show-sensitive-fields
33+
# Show non-sensitive contents of user "rhino" for "hippo" cluster
34+
pgo show user rhino --cluster hippo
35+
36+
# Show connection info for user "rhino" for "hippo" cluster,
37+
# including sensitive password info
38+
pgo show user rhino --cluster hippo --show-connection-info
3139
3240
```
3341
### Example output
3442
```
35-
pgo show user hippo
36-
SECRET: hippo-pguser-hippo
37-
DBNAME: hippo
38-
HOST: hippo-primary.postgres-operator.svc
39-
PORT: 5432
40-
USER: hippo
41-
43+
# Showing all the users of the "hippo" cluster
44+
CLUSTER USERNAME
45+
hippo hippo
46+
hippo rhino
47+
48+
# Showing the connection info for user "hippo" of cluster "hippo"
49+
WARNING: This command will show sensitive password information.
50+
Are you sure you want to continue? (yes/no): yes
51+
52+
Connection information for hippo for hippo cluster
53+
Connection info string:
54+
dbname=hippo host=hippo-primary.postgres-operator.svc port=5432 user=hippo password=<password>
55+
Connection URL:
56+
postgres://<password>@hippo-primary.postgres-operator.svc:5432/hippo
4257
```
4358

4459
### Options
4560

4661
```
47-
-h, --help help for user
48-
-f, --show-sensitive-fields show sensitive user fields
62+
-h, --help help for user
63+
--show-connection-info show sensitive user fields
4964
```
5065

5166
### Options inherited from parent commands

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
k8s.io/apimachinery v0.24.3
1212
k8s.io/cli-runtime v0.24.1
1313
k8s.io/client-go v0.24.3
14+
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
1415
sigs.k8s.io/structured-merge-diff/v4 v4.2.1
1516
sigs.k8s.io/yaml v1.3.0
1617
)
@@ -68,7 +69,6 @@ require (
6869
gopkg.in/yaml.v3 v3.0.1 // indirect
6970
k8s.io/klog/v2 v2.60.1 // indirect
7071
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
71-
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
7272
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
7373
sigs.k8s.io/kustomize/api v0.11.4 // indirect
7474
sigs.k8s.io/kustomize/kyaml v0.13.6 // indirect

0 commit comments

Comments
 (0)