You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ability to set Postgres password type at cluster creation
Specifically, this allows one to use "scram-sha-256" formatted passwords when a PostgreSQL cluster is created. This adds a new attribute to the `pgclusters.crunchydata.com` CRD called "passwordType", which stores the default value of the password hashing mechanism that the Postgres cluster should use. This also adds the "--password-type" flag to "pgo create cluster", which accepts the same values as the user-oriented commands, i.e. "scram-sha-256" and "md5". If a password type is not provided when a new user is created, the value from the custom resource is used. Issue: [ch11049]
Copy file name to clipboardExpand all lines: cmd/pgo/cmd/create.go
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -418,6 +418,8 @@ func init() {
418
418
createClusterCmd.Flags().StringVarP(&NodeLabel, "node-label", "", "", "The node label (key=value) to use in placing the primary database. If not set, any node is used.")
419
419
createClusterCmd.Flags().StringVarP(&Password, "password", "", "", "The password to use for standard user account created during cluster initialization.")
420
420
createClusterCmd.Flags().IntVarP(&PasswordLength, "password-length", "", 0, "If no password is supplied, sets the length of the automatically generated password. Defaults to the value set on the server.")
421
+
createClusterCmd.Flags().StringVar(&PasswordType, "password-type", "", "The default Postgres password type to use for managed users. "+
422
+
"Either \"scram-sha-256\" or \"md5\". Defaults to \"md5\".")
421
423
createClusterCmd.Flags().StringVarP(&PasswordSuperuser, "password-superuser", "", "", "The password to use for the PostgreSQL superuser.")
422
424
createClusterCmd.Flags().StringVarP(&PasswordReplication, "password-replication", "", "", "The password to use for the PostgreSQL replication user.")
423
425
createClusterCmd.Flags().StringVar(&BackrestCPURequest, "pgbackrest-cpu", "", "Set the number of millicores to request for CPU "+
createUserCmd.Flags().StringVarP(&Password, "password", "", "", "The password to use for creating a new user which overrides a generated password.")
597
599
createUserCmd.Flags().IntVarP(&PasswordLength, "password-length", "", 0, "If no password is supplied, sets the length of the automatically generated password. Defaults to the value set on the server.")
598
-
createUserCmd.Flags().StringVar(&PasswordType, "password-type", "md5", "The type of password hashing to use."+
600
+
createUserCmd.Flags().StringVar(&PasswordType, "password-type", "", "The type of password hashing to use."+
599
601
"Choices are: (md5, scram-sha-256).")
600
602
createUserCmd.Flags().StringVarP(&Selector, "selector", "s", "", "The selector to use for cluster filtering.")
601
603
createUserCmd.Flags().StringVarP(&Username, "username", "", "", "The username to use for creating a new user")
UpdateUserCmd.Flags().StringVarP(&Password, "password", "", "", "Specifies the user password when updating a user password or creating a new user. If --rotate-password is set as well, --password takes precedence.")
208
208
UpdateUserCmd.Flags().IntVarP(&PasswordLength, "password-length", "", 0, "If no password is supplied, sets the length of the automatically generated password. Defaults to the value set on the server.")
209
-
UpdateUserCmd.Flags().StringVar(&PasswordType, "password-type", "md5", "The type of password hashing to use."+
209
+
UpdateUserCmd.Flags().StringVar(&PasswordType, "password-type", "", "The type of password hashing to use."+
210
210
"Choices are: (md5, scram-sha-256). This only takes effect if the password is being changed.")
211
211
UpdateUserCmd.Flags().BoolVar(&PasswordValidAlways, "valid-always", false, "Sets a password to never expire based on expiration time. Takes precedence over --valid-days")
212
212
UpdateUserCmd.Flags().BoolVar(&RotatePassword, "rotate-password", false, "Rotates the user's password with an automatically generated password. The length of the password is determine by either --password-length or the value set on the server, in that order.")
Copy file name to clipboardExpand all lines: docs/content/custom-resources/_index.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -933,6 +933,7 @@ make changes, as described below.
933
933
| limits |`create`, `update`| Specify the container resource limits that the PostgreSQL cluster should use. Follows the [Kubernetes definitions of resource limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-requests-and-limits-of-pod-and-container). |
934
934
| name |`create`| The name of the PostgreSQL instance that is the primary. On creation, this should be set to be the same as `ClusterName`. |
935
935
| nodeAffinity |`create`| Sets the [node affinity rules](/architecture/high-availability/#node-affinity) for the PostgreSQL cluster and associated PostgreSQL instances. Can be overridden on a per-instance (`pgreplicas.crunchydata.com`) basis. Please see the `Node Affinity Specification` section below. |
936
+
| passwordType |`create`, `update`| If set, provides the Postgres password type that is used for creating Postgres users that are managed by PGO. Can be either `md5` or `scram-sha-256`. |
936
937
| pgBadger |`create`,`update`| If `true`, deploys the `crunchy-pgbadger` sidecar for query analysis. |
937
938
| pgbadgerport |`create`| If the `PGBadger` label is set, then this specifies the port that the pgBadger sidecar runs on (e.g. `10000`) |
938
939
| pgBouncer |`create`, `update`| If specified, defines the attributes to use for the pgBouncer connection pooling deployment that can be used in conjunction with this PostgreSQL cluster. Please see the specification defined below. |
Copy file name to clipboardExpand all lines: docs/content/pgo-client/reference/pgo_update_user.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ pgo update user [flags]
41
41
-o, --output string The output format. Supported types are: "json"
42
42
--password string Specifies the user password when updating a user password or creating a new user. If --rotate-password is set as well, --password takes precedence.
43
43
--password-length int If no password is supplied, sets the length of the automatically generated password. Defaults to the value set on the server.
44
-
--password-type string The type of password hashing to use.Choices are: (md5, scram-sha-256). This only takes effect if the password is being changed. (default "md5")
44
+
--password-type string The type of password hashing to use.Choices are: (md5, scram-sha-256). This only takes effect if the password is being changed.
45
45
--rotate-password Rotates the user's password with an automatically generated password. The length of the password is determine by either --password-length or the value set on the server, in that order.
46
46
-s, --selector string The selector to use for cluster filtering.
47
47
--set-system-account-password Allows for a system account password to be set.
@@ -67,4 +67,4 @@ pgo update user [flags]
67
67
68
68
*[pgo update](/pgo-client/reference/pgo_update/) - Update a pgouser, pgorole, or cluster
69
69
70
-
###### Auto generated by spf13/cobra on 14-Jan-2021
70
+
###### Auto generated by spf13/cobra on 19-Apr-2021
0 commit comments