-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated OPA orchestration to show creation using variables
- Loading branch information
Showing
7 changed files
with
60 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,64 @@ | ||
from fluentm import Actor, Boundary, Process, DataFlow, TLS, HTTP, Internal, GIT, SSH | ||
from fluentm import report | ||
|
||
Process("Policy Repo").inBoundary(Boundary("Version Control")) | ||
# Example of a more code-oriented approach, using variables which will play | ||
# nicely with IDEs. It can be a faster way to write these. | ||
|
||
Boundary("New Kubernetes Cluster").inBoundary("New AWS Account") | ||
# Setup scenes here: | ||
scenes = {} | ||
|
||
scenes = { | ||
"Developer requests a new cluster": [ | ||
DataFlow( | ||
Actor("Developer"), | ||
Process("Cluster Orchestrator").inBoundary(Boundary("Control Cluster")), | ||
TLS(HTTP("Create cluster request")), | ||
), | ||
DataFlow( | ||
Process("Cluster Orchestrator"), | ||
Process("Cluster Orchestrator"), | ||
Internal("Validates user"), | ||
), | ||
DataFlow( | ||
Process("Cluster Orchestrator"), | ||
Process("IAM").inBoundary("AWS"), | ||
TLS(HTTP("Create new account")), | ||
response=TLS(HTTP("Account Details")), | ||
), | ||
DataFlow( | ||
Process("Cluster Orchestrator"), | ||
Process("EKS").inBoundary("AWS"), | ||
TLS(HTTP("Create new cluster")), | ||
response=TLS(HTTP("Cluster Details")), | ||
), | ||
DataFlow( | ||
Process("Cluster Orchestrator"), | ||
Process("k8s API").inBoundary(Boundary("New Kubernetes Cluster")), | ||
TLS(HTTP("Add default admission controller")), | ||
), | ||
], | ||
"Developer creates a pod": [ | ||
DataFlow(Actor("Developer"), Process("k8s API"), TLS(HTTP("Create POD"))), | ||
DataFlow( | ||
Process("k8s API"), | ||
Process("Admission Controller").inBoundary("Cluster Orchestrator"), | ||
TLS(HTTP("Validate pod creation")), | ||
), | ||
DataFlow( | ||
Process("Admission Controller"), | ||
Process("OPA").inBoundary("Cluster Orchestrator"), | ||
HTTP("Validate pod creation.."), | ||
), | ||
DataFlow( | ||
Process("OPA"), | ||
Process("Policy Repo"), | ||
SSH(GIT("Get latest policy")), | ||
response=SSH(GIT("Latest policy REGO")), | ||
), | ||
DataFlow(Process("OPA"), Process("k8s API"), TLS(HTTP("Validation Decision"))), | ||
DataFlow(Process("k8s API"), Actor("Developer"), TLS(HTTP("Approve/Denied"))), | ||
], | ||
} | ||
newK8sClusterBoundary = Boundary("New Kubernetes Cluster").inBoundary("New AWS Account") | ||
|
||
## Developer requests a new cluster | ||
# Participants | ||
developer = Actor("Developer") | ||
clusterOrchestrator = Process("Cluster Orchestrator").inBoundary( | ||
Boundary("Control Cluster") | ||
) | ||
iam = Process("IAM").inBoundary("AWS") | ||
eks = Process("EKS").inBoundary("AWS") | ||
k8sApi = Process("k8s API").inBoundary(Boundary("New Kubernetes Cluster")) | ||
# Flows | ||
scenes["Developer requests a new cluster"] = [ | ||
DataFlow(developer, clusterOrchestrator, TLS(HTTP("Create cluster request"))), | ||
DataFlow(clusterOrchestrator, clusterOrchestrator, Internal("Validates user")), | ||
DataFlow( | ||
clusterOrchestrator, | ||
iam, | ||
TLS(HTTP("Create new account")), | ||
response=TLS(HTTP("Account Details")), | ||
), | ||
DataFlow( | ||
clusterOrchestrator, | ||
eks, | ||
TLS(HTTP("Create new cluster")), | ||
response=TLS(HTTP("Cluster Details")), | ||
), | ||
DataFlow( | ||
clusterOrchestrator, k8sApi, TLS(HTTP("Add default admission controller")) | ||
), | ||
] | ||
|
||
## Developer creates a pod | ||
# New participants (not seen above) | ||
developer = Actor("Developer") | ||
admissionController = Process("Admission Controller").inBoundary("Cluster Orchestrator") | ||
policyRepo = Process("Policy Repo").inBoundary(Boundary("Version Control")) | ||
opa = Process("OPA") | ||
# DataFlows | ||
scenes["Developer creates a pod"] = [ | ||
DataFlow(developer, k8sApi, TLS(HTTP("Create POD"))), | ||
DataFlow(k8sApi, admissionController, TLS(HTTP("Validate pod creation"))), | ||
DataFlow(admissionController, opa, TLS(HTTP("Validate pod creation"))), | ||
DataFlow( | ||
opa, | ||
policyRepo, | ||
SSH(GIT("Get latest policy")), | ||
response=SSH(GIT("Latest policy REGO")), | ||
), | ||
DataFlow(opa, k8sApi, TLS(HTTP("Validation Decision"))), | ||
DataFlow(k8sApi, developer, TLS(HTTP("Approve/Denied"))), | ||
] | ||
|
||
if __name__ == "__main__": | ||
r = report(scenes, outputDir="examples/OPA_orchestration", dfdLabels=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
digraph { | ||
graph [bgcolor=transparent fontsize=11 fontstyle=Arial] | ||
node [fontsize=11 fontstyle=Arial shape=plaintext] | ||
struct [label="HTTP|{Validate pod creation..}" shape=record] | ||
struct [label="TLS|HTTP|{Validate pod creation}" shape=record] | ||
} |
Binary file modified
BIN
+256 Bytes
(110%)
examples/OPA_orchestration/flow-Developer creates a pod-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.