Skip to content

Commit 001207e

Browse files
docs(readme): fix example message payload (#58)
1 parent b7109f3 commit 001207e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Currently only the following databases are supported:
99
- **PostgreSQL 13, 12, 11, 10, 9.6**
1010

1111
## Overview
12-
The GroupSync service at an overview is made of Cloud Scheduler Job(s) and Cloud Run instance(s).
12+
The GroupSync service at an overview is made of Cloud Scheduler Job(s) and Cloud Run instance(s).
1313

14-
The Cloud Scheduler Job(s) are configured to run on the interval of your choosing (every 10 mins, 1 hour, daily etc.) When ran, the Cloud Scheduler calls a GroupSync Cloud Run service, passing in the configured request body from the scheduler, which contains parameters that tell the service which IAM groups and which Cloud SQL instances to sync and manage.
14+
The Cloud Scheduler Job(s) are configured to run on the interval of your choosing (every 10 mins, 1 hour, daily etc.) When ran, the Cloud Scheduler calls a GroupSync Cloud Run service, passing in the configured request body from the scheduler, which contains parameters that tell the service which IAM groups and which Cloud SQL instances to sync and manage.
1515

1616
<p align="center"><img src="images/basic_architecture.png" width="640"></p>
1717

@@ -28,7 +28,7 @@ To run this service successfully, please clone this repository to an environment
2828
```
2929
git clone https://github.com/GoogleCloudPlatform/cloud-sql-iam-db-authn-groups
3030
```
31-
31+
3232
Step into the code directory.
3333

3434
```
@@ -52,7 +52,7 @@ GroupSync requires enabling the following Cloud APIs for a successful deployment
5252
- [Admin SDK API](https://console.cloud.google.com/apis/api/admin.googleapis.com/overview)
5353
- [IAM Service Account Credentials API](https://console.cloud.google.com/apis/api/iamcredentials.googleapis.com/overview)
5454

55-
**Note:** If planning to use GroupSync with a Cloud SQL instance that has a Private IP, the following additional APIs need to be enabled.
55+
**Note:** If planning to use GroupSync with a Cloud SQL instance that has a Private IP, the following additional APIs need to be enabled.
5656
- [Serverless VPC Access API](https://console.cloud.google.com/apis/api/vpcaccess.googleapis.com)
5757
- [Service Networking API](https://console.cloud.google.com/apis/api/servicenetworking.googleapis.com/overview)
5858

@@ -232,7 +232,7 @@ Where:
232232
- **sql_instances**: List of all Cloud SQL instances to configure.
233233
- **private_ip** (optional): Boolean flag for private or public IP addresses.
234234

235-
**Note:** These are placeholder values and should be replaced with proper IAM groups and Cloud SQL instance connection names.
235+
**Note:** These are placeholder values and should be replaced with proper IAM groups and Cloud SQL instance connection names.
236236

237237
There is an additional optional parameter `"log_level"` for the JSON payload which can be set to one of `"INFO"`, `"DEBUG"`, `"WARNING"`, or `"ERROR"` to change severity of outputted logs. Defaults to `"INFO"` when not specified.
238238

@@ -263,18 +263,18 @@ The `--schedule` flag is what controls how often the Cloud Scheduler job will tr
263263

264264
The payload for the PUT request to the Cloud Run service can also be configured for Cloud Scheduler directly through a command line flag by switching out the `--message-body-from-file` flag for the flag `--message-body` from the command above above as follows.
265265
```
266-
--message-body="{"iam-groups": ["group@test.com", "group2@test.com"], "sql_instances": ["project:region:instance"], "private_ip": false}"
266+
--message-body="{"iam_groups": ["group@test.com", "group2@test.com"], "sql_instances": ["project:region:instance"], "private_ip": false}"
267267
```
268268

269269
To learn more about the different Cloud Scheduler flags, read the [official documentation](https://cloud.google.com/sdk/gcloud/reference/scheduler/jobs/create/http).
270270

271271
## Granting Database Permissions to IAM Group Database Roles
272272
The Cloud Run service maps each IAM group configured in the JSON payload into a [database role](https://dev.mysql.com/doc/refman/8.0/en/roles.html) on each Cloud SQL instance configured. This database role is then granted to the proper database users that belong to the IAM group, giving them the appropriate database privileges for the IAM group.
273273

274-
The name of the mapped IAM group database role is the email of the IAM group without everything after and including the **"@"** sign of the IAM group email.
274+
The name of the mapped IAM group database role is the email of the IAM group without everything after and including the **"@"** sign of the IAM group email.
275275
(Ex. IAM group with email "example-group@test.com", would map to a database role **"example-group"** on each Cloud SQL instance it is configured with.)
276276

277-
The Cloud Run service verifies that a group role exists or creates one on the database if it does not exist. It is recommended to configure the Cloud Scheduler job(s) and after having it triggered **at least** once, have a Database Administrator or project admin verify the creation of the group roles and **GRANT** the group roles the appropriate privileges on each Cloud SQL instance that should be inherited by database users of those IAM groups on all consecutive Cloud Scheduler runs.
277+
The Cloud Run service verifies that a group role exists or creates one on the database if it does not exist. It is recommended to configure the Cloud Scheduler job(s) and after having it triggered **at least** once, have a Database Administrator or project admin verify the creation of the group roles and **GRANT** the group roles the appropriate privileges on each Cloud SQL instance that should be inherited by database users of those IAM groups on all consecutive Cloud Scheduler runs.
278278

279279
To verify the creation of group roles after Cloud Scheduler has triggered at least once, the following command can be run for **MySQL** instances (**PostgreSQL** instances require connecting to the database to verify):
280280

@@ -309,7 +309,7 @@ gcloud run services update iam-db-authn-groups --vpc-connector <CONNECTOR_NAME>
309309
**NOTE:** Private IP connections require that the Cloud SQL instance and the Cloud Run service be connected to the same VPC Network to work correctly.
310310

311311
## Custom Configurations
312-
Multiple different Cloud Scheduler and Cloud Run configurations can be configured depending on the Cloud SQL instance to IAM Group mappings required along with the IP address types being used to connect to instances.
312+
Multiple different Cloud Scheduler and Cloud Run configurations can be configured depending on the Cloud SQL instance to IAM Group mappings required along with the IP address types being used to connect to instances.
313313

314314
A Cloud Scheduler job maps which IAM group(s) and hence which IAM users to manage permissions for any given Cloud SQL instance(s). When configuring a Cloud Scheduler job, all IAM groups listed in the JSON body will be mapped to all Cloud SQL instances in the JSON body. Therefore, for custom configurations where certain IAM groups need to be mapped to one instance, and other IAM groups to a different Cloud SQL instance, the solution is to deploy multiple Cloud Scheduler jobs.
315315

0 commit comments

Comments
 (0)