Skip to content

Commit

Permalink
Work out show user according to new feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminjb committed Nov 13, 2023
1 parent c42bd99 commit 7c07a82
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 243 deletions.
2 changes: 1 addition & 1 deletion docs/content/reference/pgo_show.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ HA
* [pgo](/reference/) - pgo is a kubectl plugin for PGO, the open source Postgres Operator
* [pgo show backup](/reference/pgo_show_backup/) - Show backup information for a PostgresCluster
* [pgo show ha](/reference/pgo_show_ha/) - Show 'patronictl list' for a PostgresCluster.
* [pgo show user](/reference/pgo_show_user/) - Show pguser Secret details for a PostgresCluster.
* [pgo show user](/reference/pgo_show_user/) - Show details for a PostgresCluster user.

47 changes: 31 additions & 16 deletions docs/content/reference/pgo_show_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ title: pgo show user
---
## pgo show user

Show pguser Secret details for a PostgresCluster.
Show details for a PostgresCluster user.

### Synopsis

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

#### RBAC Requirements
Resources Verbs
Expand All @@ -17,35 +21,46 @@ Show pguser Secret details for a PostgresCluster.
### Usage

```
pgo show user CLUSTER_NAME [flags]
pgo show user USER_NAME --cluster CLUSTER_NAME [flags]
```

### Examples

```
# Show non-sensitive contents of 'pguser' Secret
pgo show user hippo
# Show non-sensitive contents of users for "hippo" cluster
pgo show user --cluster hippo
# Show contents of 'pguser' Secret, including sensitive fields
pgo show user hippo --show-sensitive-fields
# Show non-sensitive contents of user "rhino" for "hippo" cluster
pgo show user rhino --cluster hippo
# Show connection info for user "rhino" for "hippo" cluster,
# including sensitive password info
pgo show user rhino --cluster hippo --show-connection-info
```
### Example output
```
pgo show user hippo
SECRET: hippo-pguser-hippo
DBNAME: hippo
HOST: hippo-primary.postgres-operator.svc
PORT: 5432
USER: hippo
# Showing all the users of the "hippo" cluster
CLUSTER USERNAME
hippo hippo
hippo rhino
# Showing the connection info for user "hippo" of cluster "hippo"
WARNING: This command will show sensitive password information.
Are you sure you want to continue? (yes/no): yes
Connection information for hippo for hippo cluster
Connection info string:
dbname=hippo host=hippo-primary.postgres-operator.svc port=5432 user=hippo password=<password>
Connection URL:
postgres://<password>@hippo-primary.postgres-operator.svc:5432/hippo
```

### Options

```
-h, --help help for user
-f, --show-sensitive-fields show sensitive user fields
-h, --help help for user
--show-connection-info show sensitive user fields
```

### Options inherited from parent commands
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
k8s.io/apimachinery v0.24.3
k8s.io/cli-runtime v0.24.1
k8s.io/client-go v0.24.3
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
sigs.k8s.io/structured-merge-diff/v4 v4.2.1
sigs.k8s.io/yaml v1.3.0
)
Expand Down Expand Up @@ -68,7 +69,6 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/kustomize/api v0.11.4 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.6 // indirect
Expand Down
Loading

0 comments on commit 7c07a82

Please sign in to comment.