Skip to content

Commit 17460c5

Browse files
committed
improve docs
1 parent 66537e9 commit 17460c5

6 files changed

Lines changed: 64 additions & 60 deletions

File tree

ARCHITECTURE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Architecture
2+
3+
For the main documentation, See [README](./README.md).
4+
5+
## Iris' architecture
6+
* Iris runs in Google App Engine Standard Environment (Python 3).
7+
* It has Organization-level and project-level elements
8+
* Note that Iris's design makes it focused on labeling resources across an organization.
9+
* You can filter using the config file, so that Iris labels only some of the projects in an org
10+
* Iris has architecture components which are deployed to the org, and others which are deployed to the project.
11+
* If you want a person with all permissions to deploy the org-level elements and a person without org-level permissions to redeploy only the project-level elements (e.g. when you change configuration), you can split the deployment in this way with flags on the script. Run `deploy.sh -h`.
12+
* The Cloud Scheduler "cron" job triggers Iris at configured intervals. See `cron_full.yaml` for config. The GCP Console view for this is in a separate App Engine tab in the Cloud Scheduler view.
13+
* For newly created resources, a Log Sink on the organization level sends all logs for resource creation to a PubSub topic.
14+
* The Log Sink is filtered to include only supported resource types.
15+
* If you edit the configuration file so that only specific projects are to be labeled, the Log Sink only captures these.
16+
* PubSub topics:
17+
*
18+
19+
iris_deadletter_topic
20+
* `iris_logs_topic` receives the resource-creation logs from the Log Sink
21+
* `iris_schedulelabeling_topic` receives messages sent by the `/schedule` endpoint in `main.py` (after the `/schedule` endpoint was triggered by the Cloud Scheduler). Each message goes to endpoint `/do_label` to trigger the labeling of a given resource type in a given project.
22+
* Messages to `iris_label_all_types_topic` triggers the labeling of all resources regardless of type.
23+
* Another topic is a dead-letter topic.
24+
* PubSub subscriptions
25+
* There are subscriptions that that direct the messages to endpoints in `main.py`: `/label_one`, `/do_label` and `label_all_types`.
26+
* For security, the endpoints hit by these PubSub subscriptions [use JWT auth](https://cloud.google.com/pubsub/docs/authenticate-push-subscriptions), where the JWT token is verified in the Iris webapp.
27+
* A dead-letter subscription. This is a pull subscription. By default, it just accumulates the messages. You can use it to see statistics, or you can pull messages from it.
28+
29+
# Development and Testing
30+
Please see [HACKING](./HACKING.md).
31+

HACKING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Iris: How to develop and test
1+
# How to develop and test in this codebase
22

3-
## For the main documentation
4-
See [README](./README.md).
3+
For the main documentation, see [README](./README.md).
54

65
## Development tools
76

INSTALL.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# How to Install
22

3-
(For the main documentation, see [README](./README.md).)
3+
For the main documentation, See [README](./README.md).
44

55
## Before deploying
6-
7-
### In which Project
8-
### In which Project
6+
### Selecting a Project
97

108
* You can deploy Iris in any one project within your Google Cloud organization, but we recommend using a [new project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project) just for this.
11-
* The script will deploy Iris (an App Engine service) into this project. That does not mean that Iris is focused on labeling this project. (See [README](./README.md).)
9+
* The script will deploy Iris (an App Engine service) into this project. That does not mean that Iris is focused on labeling this project. Rather, Iris is always focused on labeling across an organization (though you can filter that to specific projects). See [README](./README.md).
1210

1311
### Needed roles for deployment
1412
#### Organization-level roles
@@ -55,10 +53,10 @@
5553

5654
# Configuration
5755

58-
* Iris' config file is `config*.yaml`.
56+
* Iris' config file is `config.yaml`.
5957
* All values are optional.
6058
* `config.yaml.orig` has detailed documentation of the fields.
61-
* Alternatively, you can have `config-test.yaml`. It takes priority if both it and `config-test.yaml` are present.
59+
* Alternatively, you can have `config-test.yaml`. It takes priority if both it and `config.yaml` are present.
6260
* `app.yaml` lets you configure App Engine, for example, to set a maximum number of instances. See App Engine documentation.
6361
* Editing `cron_full.yaml` lets you optionally change the timing for the Cloud Scheduler scheduled labelings, e.g. to do it more frequently. See Google App Engine documentation.
6462

@@ -68,7 +66,7 @@
6866
* Use `uninstall.sh -h` for help.
6967

7068
# Architecture
71-
Please see [README_architecture](README_architecture.md).
69+
Please see [ARCHITECTURE](./ARCHITECTURE.md).
7270

7371
# Development and Testing
7472
Please see [HACKING](./HACKING.md).

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Iris
22

33
In Greek mythology, Iris(Ἶρις) is the personification of the rainbow and messenger of the gods. She was the handmaiden to Hera.
4+
45
![Iris](./iris.jpg "Iris")
56
# Blog post
67

@@ -14,43 +15,45 @@ Iris automatically assigns labels to Google Cloud Platform resources for easier
1415
Resources of all supported types in all or some of the projects in the GCP organization will get automatically-generated labels with keys like `iris_zone` (the prefix is configurable), and a value copied from the resource. For example, a Google Compute Engine instance would get labels like
1516
`[iris_name:nginx]`, `[iris_region:us-central1]` and `[iris_zone:us-central1-a]`. This behavior can be configured in various ways; see below.
1617

17-
## Note: Organization focus
18+
## Organization focus
1819

19-
Note that Iris is designed to serve the organization.
20-
* It is designed to label all projects in the organization (though you can configure that).
21-
* The organization focus was chosen because labels are used for billing analysis which is typically done on the organization level (even though projects can in fact be associated arbitrarily with billing accounts).
20+
Note that Iris is designed to serve the organization.
21+
* Iris is designed to label all projects in the organization (though you can filter that down).
22+
* Iris does not have a project-focused design, where you launch it in a project, and it labels just that project.
23+
* The organization focus was chosen because labels are used for billing analysis, which is typically done on the organization level. (But this is not mandatory: Projects can be associated arbitrarily with any billing accounts).
2224

2325
## Iris doesn't add new information
2426

25-
Iris does not *add* information, only *copy* values that already exist. For example, it can label a VM instance with its zone; but it cannot add a "business unit" label because it does not know a resource's business unit. For that, you should label all resources when creating them, e.g., in your Terraform scripts. (Indeed, iris can be made extraneous in this way.)
27+
Iris does not *add* information, only *copy* values that already exist. For example, it can label a VM instance with its zone; but it cannot add a "business unit" label because it does not know a resource's business unit.
28+
29+
For that, you should label all resources when creating them, e.g., in your Terraform scripts. In fact, I recommend doing that (and making Iris extraneous.)
2630

2731
## Labeling existing resources when you deploy Iris
2832

2933
If you want to label the resources -- virtual machines, PubSub topics etc. -- that *already exist* when you deploy Iris, see section "[Labeling existing resources](#labeling-existing-resources)" below.
3034

3135
# Open source
3236

33-
Iris is open-source;it is not an official DoiT product. Feel free to send Pull Requests with new functionality and add new types of labels. See the `TODO.md` file and Github
34-
issues for features and fixes you might do.
37+
Iris is open-source; it is not an official DoiT product. Feel free to send Pull Requests with new functionality and add new types of labels. See the `TODO.md` file and Github issues for features and fixes you might do.
3538

3639
# When Iris adds labels
3740

3841
## On resource creation
3942

40-
Iris labels newly-created resources by listening to Google Cloud Operations Logs. You can disable this: See [INSTALL](INSTALL.md) or run `deploy.sh -h`.
43+
Iris labels most types of newly-created resources by listening to Google Cloud Operations Logs. You can disable this: See [INSTALL](INSTALL.md) or run `deploy.sh -h`.
4144

4245
## On schedule
4346

44-
Iris labels resources periodically on a Cloud Scheduler "cron" job. By default, only some types of resources are labeled on these Cloud Scheduler runs, while most types are not labeled on schedule, , to save the costs of relabeling with the same label every day.
47+
Iris labels a few types of resources periodically on a Cloud Scheduler "cron" job. By default, Iris does not label all types of resources on these cron runs, to save the costs of relabeling -- with the same label -- every day.
4548

46-
You can change that in configuration. Set `label_all_on_cron` to `True` in the configuration file.
49+
You can have Iris relabel everything on every cron run, See `label_all_on_cron` to `True` in the configuration file.
4750

48-
You can also disable the scheduled labeling. See Deployment below or run `./deploy.sh -h`
51+
You can also disable the scheduled labeling entirely. See Deployment below or run `./deploy.sh -h`
4952

5053
## Labeling existing resources
5154

52-
* When you first use Iris, you may want to label all existing resources. Iris does not do this by default.
53-
* Publish a PubSub message (the content doesn't matter) to `iris_label_all_types_topic`, for example with `gcloud pubsub topics publish iris_label_all_types_topic --message=does_not_matter --project $PROJECT_ID` and a full labeling will be triggered.
55+
* When you first use Iris, you may want to label all existing resources. Iris *does not* do this by default.
56+
* To do this, publish a PubSub message (the content doesn't matter) to `iris_label_all_types_topic`, and a full labeling will be triggered. For example, run with `gcloud pubsub topics publish iris_label_all_types_topic --message=does_not_matter --project $PROJECT_ID` where `$PROJECT_ID` is where Iris is deployed.
5457

5558
# Supported Google Cloud resources
5659

@@ -63,7 +66,7 @@ names start `_gcp_`. The part of the function name after `_gcp_` is used for the
6366
* Including preemptible instances and instances created by Managed Instance Groups.
6467
* Including instances used as GKE Nodes
6568
* Compute Engine Disks (Labels name, zone, region)
66-
* Disks are labeld on creation and on schedule.
69+
* Disks are labeled on creation and on schedule.
6770
* But disks created along with an Instance are not labeled on creation. They are labeled with the Cloud Scheduler cron job.
6871
* The label indicating whether a disk is attached will change, if the state changed, on the scheduled labeling.
6972
* Compute Engine Snapshots (Labels name, zone, region)
@@ -81,8 +84,7 @@ names start `_gcp_`. The part of the function name after `_gcp_` is used for the
8184
# Installing
8285
Please see [INSTALL](./INSTALL.md).
8386
# Architecture
84-
Please see [README_architecture](./README_architecture.md).
85-
87+
Please see [ARCHITECTURE](./ARCHITECTURE.md).
8688
# Development and Testing
8789
Please see [HACKING](./HACKING.md).
8890

README_architecture.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

deploy.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,21 @@ while getopts 'cepoh' opt; do
5353
Usage deploy.sh PROJECT_ID
5454
Argument:
5555
The project to which Iris will be deployed
56-
Advancd options, to be given before project ID. These are not to be used except in advanced schenarios.
56+
Flags: Advanced options. Not to be used in most cases.
5757
A. Labeling only on-creation or on-schedule:
5858
-c: Label on Cloud Scheduler cron only
5959
-e: Label on-creation-event only
6060
The default, if neither -c or -e are given, is to enable both; equivalent to -c -e
6161
62-
B. Project/Org level with -p or -o. If neither -p nor -o is given,
63-
the default behavior is to do both; equivalent to -p -o
62+
B. Project/Org level elements with -p or -o. If neither -p nor -o is given,
63+
the default behavior is to do both; equivalent to -p -o.
64+
Note that Iris is always focused on labeling in an org. See README. These flags
65+
are just about limiting the components that are installed when some already are installed.
6466
-o: Deploy org-level elements like Log Sink
6567
-p: Deploy project-level elements. Org-level elements are a pre-requisite.
6668
This is useful for redeploying to the same project, e.g., to change config.
67-
If you want to deploy to a *different* project,
68-
then you have to deploy the org-level elements.
69+
If you want to deploy to a *different* project, then you have to deploy the
70+
org-level elements.
6971
7072
Environment variable:
7173
IRIS_CUSTOM_ROLE (Optional, default is iris3) An identifier for the Iris custom role,

0 commit comments

Comments
 (0)