Skip to content

Commit 56b1598

Browse files
authored
chore: Create diagrams for single project and organization example (#38)
* chore: single project diagram * fix: change some elements in the single account diagram * chore: add organization diagrams * fix: change elementos in diagrams * fix: Fix build
1 parent dc72583 commit 56b1598

File tree

6 files changed

+143
-1
lines changed

6 files changed

+143
-1
lines changed

examples/organization/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
This example deploys Cloud Connector into a GCP organizational GCP account.
44

5+
![single project diagram]()
56

67
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
78
## Requirements
173 KB
Loading
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# diagrams as code vía https://diagrams.mingrammer.com
2+
3+
from diagrams import Cluster, Diagram, Edge
4+
from diagrams.gcp.analytics import PubSub
5+
from diagrams.gcp.compute import Run
6+
from diagrams.gcp.devtools import Code, Build, GCR
7+
from diagrams.gcp.storage import GCS
8+
from diagrams.gcp.security import KMS
9+
from diagrams.gcp.network import TrafficDirector
10+
from diagrams.custom import Custom
11+
12+
diagram_attr = {
13+
"pad": "0.25",
14+
}
15+
16+
color_event = "firebrick"
17+
color_scanning = "dark-green"
18+
color_permission = "red"
19+
color_non_important = "gray"
20+
color_sysdig = "lightblue"
21+
22+
with Diagram("Sysdig Secure for Cloud\n(organization)", graph_attr=diagram_attr, filename="diagram-org", show=True,
23+
direction="LR"):
24+
with Cluster("GCP account (sysdig)", graph_attr={"bgcolor": "lightblue"}):
25+
sds = Custom("Sysdig Secure", "../../resources/diag-sysdig-icon.png")
26+
with Cluster("GCP organization project", graph_attr={"bgcolor": "pink"}):
27+
ccProjectSink = TrafficDirector("CC Organization Sink")
28+
csProjectSink = TrafficDirector("CS Organization Sink")
29+
30+
with Cluster("Cloud Connector (children project)"):
31+
ccPubSub = PubSub("CC PubSub Topic")
32+
ccEventarc = Code("CC Eventarc\nTrigger")
33+
ccCloudRun = Run("Cloud Connector")
34+
bucket = GCS("Bucket\nCC Config")
35+
36+
bucket << Edge(style="dashed") << ccCloudRun
37+
ccEventarc >> ccCloudRun
38+
ccEventarc << ccPubSub
39+
ccProjectSink >> ccPubSub
40+
41+
ccCloudRun >> sds
42+
with Cluster("Cloud Scanning (children project)"):
43+
keys = KMS("Sysdig \n Secure Keys")
44+
csPubSub = PubSub("CS PubSub Topic")
45+
gcrPubSub = PubSub("GCR PubSub Topic")
46+
csEventarc = Code("CS Eventarc\nTrigger")
47+
gcrEventarc = Code("GCR Eventarc\nTrigger")
48+
csCloudrun = Run("Cloud Scanning")
49+
csCloudBuild = Build("Triggered\n Cloud Builds")
50+
gcr = GCR("Google \n Cloud Registry")
51+
52+
gcrEventarc << gcrPubSub
53+
csEventarc >> csCloudrun
54+
csEventarc << csPubSub
55+
csCloudrun << Edge(style="dashed") << keys
56+
csCloudBuild << Edge(style="dashed") << keys
57+
gcrEventarc >> csCloudrun
58+
csProjectSink >> csPubSub
59+
csCloudrun >> csCloudBuild
60+
gcr >> gcrPubSub
61+
csCloudBuild >> sds

examples/single-project/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
# Single Project Example
22

3-
43
This example deploys Cloud Connector and Cloud Scanning into a GCP account.
54

5+
All the resources will be run in a single project.
6+
7+
![single project diagram]()
8+
9+
## Prerequisits
10+
11+
> ##### APIs Required by Cloud Scanning
12+
>* Cloud Run API
13+
>* Eventarc API
14+
>* Secret Manger API
15+
>* Cloud Build API
16+
>* Identity and access management API
17+
618

719
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
820
## Requirements
166 KB
Loading
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# diagrams as code vía https://diagrams.mingrammer.com
2+
3+
from diagrams import Cluster, Diagram, Edge
4+
from diagrams.gcp.analytics import PubSub
5+
from diagrams.gcp.compute import Run
6+
from diagrams.gcp.devtools import Code, Build, GCR
7+
from diagrams.gcp.storage import GCS
8+
from diagrams.gcp.security import KMS
9+
from diagrams.custom import Custom
10+
from diagrams.gcp.network import TrafficDirector
11+
12+
diagram_attr = {
13+
"pad": "0.25"
14+
}
15+
16+
role_attr = {
17+
"imagescale": "false",
18+
"height": "1.5",
19+
"width": "3",
20+
"fontsize": "9",
21+
}
22+
23+
color_event = "firebrick"
24+
color_scanning = "dark-green"
25+
color_permission = "red"
26+
color_non_important = "gray"
27+
color_sysdig = "lightblue"
28+
29+
with Diagram("Sysdig Secure for Cloud\n(single project)", graph_attr=diagram_attr, filename="diagram-single", show=True,
30+
direction="LR"):
31+
with Cluster("GCP account (sysdig)"):
32+
sds = Custom("Sysdig Secure", "../../resources/diag-sysdig-icon.png")
33+
34+
with Cluster("GCP project"):
35+
with Cluster("Cloud Connector"):
36+
ccProjectSink = TrafficDirector("CC Project Sink")
37+
ccPubSub = PubSub("CC PubSub Topic")
38+
ccEventarc = Code("CC Eventarc\nTrigger")
39+
ccCloudRun = Run("Cloud Connector")
40+
bucket = GCS("Bucket\nCC Config")
41+
42+
bucket << Edge(style="dashed") << ccCloudRun
43+
ccEventarc >> ccCloudRun
44+
ccEventarc << ccPubSub
45+
ccProjectSink >> ccPubSub
46+
47+
ccCloudRun >> sds
48+
with Cluster("Cloud Scanning"):
49+
keys = KMS("Sysdig Keys")
50+
csProjectSink = TrafficDirector("CS Project Sink")
51+
csPubSub = PubSub("CS PubSub Topic")
52+
gcrPubSub = PubSub("GCR PubSub Topic")
53+
csEventarc = Code("CS Eventarc\nTrigger")
54+
gcrEventarc = Code("GCR Eventarc\nTrigger")
55+
csCloudrun = Run("Cloud Scanning")
56+
csCloudBuild = Build("Triggered\n Cloud Builds")
57+
gcr = GCR("Google \n Cloud Registry")
58+
59+
gcrEventarc << gcrPubSub
60+
csEventarc >> csCloudrun
61+
csEventarc << csPubSub
62+
csCloudrun << keys
63+
csCloudBuild << keys
64+
gcrEventarc >> csCloudrun
65+
csProjectSink >> csPubSub
66+
csCloudrun >> csCloudBuild
67+
gcr >> gcrPubSub
68+
csCloudBuild >> sds

0 commit comments

Comments
 (0)