예제 #1
0
def cli(
    graph_attr: dict = GRAPH_ATTR,
    output_format: str = OUTPUT_FORMAT,
    output_path: str = OUTPUT_PATH,
) -> str:
    """ Generates CLI diagrams """
    output = f"{output_path}/cli"

    with Diagram(
            "CLI",
            show=False,
            outformat=output_format,
            # graph_attr=graph_attr,
            filename=output,
    ):
        cli = Python("CLI")

        with Cluster("targets"):

            with Cluster("local resources"):
                data = Storage("build objects\nassets")
                layers = Layer("build\nLambda layers")
                server = Server("media\nlocal build")

            with Cluster("cloud resources"):
                db = Dynamodb("create DB\nseed DB")
                s3 = S3("sync data")
                lbd = Lambda("resize images\nencode video")
                sqs = SQS("queue\nmedia generate\ntasks")

        cli >> data >> cli
        cli >> s3
        cli >> db
        cli >> lbd
        cli >> sqs
        cli >> layers
        cli >> server

    return f"{output}.{output_format}"
예제 #2
0
def group_nodes_diagram():
    from diagrams import Diagram, Cluster
    from diagrams.aws.compute import EC2
    from diagrams.aws.network import ELB
    from diagrams.aws.network import Route53
    from diagrams.onprem.database import PostgreSQL  # Would typically use RDS from aws.database
    from diagrams.onprem.inmemory import Redis  # Would typically use ElastiCache from aws.database

    with Diagram("Simple Website Diagram") as diag3:
        dns = Route53("dns")
        load_balancer = ELB("Load Balancer")
        database = PostgreSQL("User Database")
        cache = Redis("Cache")
        with Cluster("Webserver Cluster"):
            svc_group = [
                EC2("Webserver 1"),
                EC2("Webserver 2"),
                EC2("Webserver 3")
            ]
    print(
        diag3
    )  # This will illustrate the diagram if you are using a Google Colab or Jypiter notebook.
def apigw_dynamodb_sfn_with_heavytask():
    stack_objective = "apigw-dynamodb-sfn-with-heavytask"
    with Diagram(stack_objective,
                 outformat="png",
                 filename=f"{stack_objective}/pics/arch",
                 show=False):
        sqs = SQS("SQS")
        apigw = APIGateway("/task") >> Lambda("integration") >> [
            sqs, Dynamodb("DynamoDB")
        ]

        timer_lambda = Lambda("timer lambda")
        sqs << Edge(label="dequeue") << timer_lambda << Cloudwatch("cron")

        with Cluster(label="StepFunctions", direction="TB"):
            sfn_start = SFn_TASK("update DynamoDB\nset `running`")
            sfn_start \
                >> Lambda("Some Task") \
                >> [SFn_TASK("update DynamoDB\nset `success`"), SFn_TASK("update DynamoDB\nset `failure`")]

        # invoke sfn from Lambda
        timer_lambda >> sfn_start
예제 #4
0
def simple_main():
    # graph_attr é a lista de parâmetros utilizados na construção do diagrama.
    graph_attr = {"fontsize": "32", "fontcolor": "#1D3B52", "bgcolor": "white"}

    # Cria o Diagrama base do nosso mapa
    with Diagram('fboaventura.dev',
                 direction='LR',
                 filename='simple_fboaventura_dev',
                 outformat='png',
                 graph_attr=graph_attr,
                 show=False) as diag:
        # Adiciona os nós no mapa
        ingress = Haproxy('loadbalancer')
        webserver = Nginx('django')
        db = Postgresql('database')
        memcached = Memcached('sessions')

        # Criamos um cluster para os componentes do Celery, que trabalham em conjunto
        with Cluster('Celery'):
            beat = Celery('beat')
            workers = [Celery('worker1'), Celery('worker2')]
            flower = Celery('flower')
            broker = Rabbitmq('broker')
            logs = Redis('logs')

        # Montamos o mapa de relacionamentos entre os nós
        ingress >> webserver
        webserver >> broker
        beat >> broker
        workers >> beat
        webserver >> db
        db >> broker
        webserver >> memcached
        broker >> logs
        workers >> logs
        flower >> beat
        flower >> workers
        beat >> logs
예제 #5
0
def create_diagram(*, graph: Graph, name="Web Service", show=True):
    with Diagram(name, show=show):
        nodes = {}
        for name, aa in graph.actors.items():
            if "customer" in name:
                nodes[name] = Client(label=name)
            else:
                nodes[name] = Server(label=name)

        aa: Actor
        for name, aa in graph.actors.items():
            clusters = [Cluster(cluster.name) for cluster in aa.trust_zones]
            node = nodes[name]
            for cluster in clusters:
                cluster.node(node._id, node.label, **node._attrs)

        # ELB("lb") >> EC2("web") >> RDS("userdb") >> ss

        ff: Flow
        for name, ff in graph.flows.items():
            nodes[ff.producer.name] >> Edge(label=ff.type.name) >> nodes[
                ff.consumer.name
            ]
예제 #6
0
파일: vpc.py 프로젝트: avatarworf/awsmap
    def compile(self, profile_name="default", region_name="us-west-2"):
        self.p(f"Compiling: {profile_name} / {region_name}")

        vpcs = self.get_vpcs(profile_name, region_name)
        self.pp(vpcs)

        with Diagram(self.get_account_name(profile_name, region_name),
                     filename="images/{}/vpcs".format(
                         self.get_account_id(profile_name, region_name)),
                     show=False,
                     graph_attr=self.graph_attr):
            for vpc in vpcs:
                self.pp(vpc)
                tags = self._tags(vpc['Tags'])

                peering_connections = self.get_peering_connections(
                    vpc["VpcId"],
                    profile_name=profile_name,
                    region_name=region_name)
                self.pp(peering_connections)

                with Cluster(tags['Name']):
                    vpc = VPC(vpc['CidrBlock'])

                if len(peering_connections) > 0:
                    for peer_connection in peering_connections:
                        pc_tags = self._tags(peer_connection['Tags'])
                        with Cluster(
                                peer_connection['RequesterVpcInfo']['VpcId']):
                            # pc_use_name = "\n".join(pc_tags['Name'].split(" "))
                            pc_use_name = pc_tags['Name']

                            pc_vpc = VPC(
                                f"{peer_connection['RequesterVpcInfo']['CidrBlock']}\n{pc_use_name}"
                            )
                        vpc << pc_vpc
예제 #7
0
#!/usr/bin/env nix-shell
#!nix-shell -i python -p python39Packages.diagrams

from diagrams import Cluster, Diagram
from diagrams.generic.device import Tablet
from diagrams.generic.network import Firewall
from diagrams.k8s.infra import Node
from diagrams.k8s.controlplane import KProxy

with Diagram("My K8s infrastructure"):
    end_user = Tablet("end user")
    firewall = Firewall("cloud firewall")

    with Cluster("Kubernetes cluster"):
        with Cluster("main node"):
            proxy1 = KProxy()
            node1 = Node("aarch64")
            proxy1 >> node1

        node2 = Node("x86_64")
        proxy1 >> node2

    end_user >> firewall >> proxy1
예제 #8
0
파일: lambda.py 프로젝트: nimkar/diagrams
from diagrams import Diagram
from diagrams.aws.network import APIGateway
from diagrams.aws.compute import Lambda
from diagrams.aws.database import Aurora

with Diagram("Lambda Invocation", show=False):
    api_gw = APIGateway("API Gateway")
    my_lambda = Lambda("Lambda")
    my_db = Aurora("Aurora Database")

    api_gw >> my_lambda >> my_db




예제 #9
0
#!/usr/bin/env python
from diagrams import Diagram
from diagrams.aws.compute import Lambda
from diagrams.aws.ml import Personalize
from diagrams.aws.analytics import KinesisDataStreams, KinesisDataFirehose, Athena, Quicksight, Glue
from diagrams.onprem.client import Client
from diagrams.aws.storage import S3

with Diagram('イベントストリーミング'):
    # インスタンス化によってノードを作成
    # ノードにラベルを付与でき、\nを入れることでラベルの改行も可能
    stream = KinesisDataStreams('Kinesis\nData Streams')
    s3 = S3('S3')
    athena = Athena('Athena')

    # 定義したノードを始点とした流れを作成
    # 変数に代入せずとも、ノードは作成可能
    Client() >> stream >> Lambda('Lambda') >> Personalize('Personalize\nEventTracker')
    stream >> KinesisDataFirehose('Kinesis\nData Firehose') >> s3
    s3 - athena >> Quicksight('QuickSight') << Client()
    s3 >> Glue('Glue') >> athena
예제 #10
0
from diagrams import Cluster, Diagram
from diagrams.aws.compute import ECS
from diagrams.aws.database import ElastiCache, RDS
from diagrams.aws.network import ELB
from diagrams.aws.network import Route53

with Diagram("Clustered Web Services",
             filename="out/aws-001",
             outformat="svg",
             show=False):
    dns = Route53("dns")
    lb = ELB("lb")

    with Cluster("Services"):
        svc_group = [ECS("web1"), ECS("web2"), ECS("web3")]

    with Cluster("DB Cluster"):
        db_master = RDS("userdb")
        db_master - [RDS("userdb ro")]

    memcached = ElastiCache("memcached")

    dns >> lb >> svc_group
    svc_group >> db_master
    svc_group >> memcached
from diagrams import Diagram, Cluster, Edge
from diagrams.aws.compute import AutoScaling
from diagrams.aws.network import VPC
from diagrams.onprem.iac import Ansible
from diagrams.programming.language import Bash
from diagrams.onprem.compute import Server

with Diagram("AWS Launch Template", show=False, direction="TB"):

    with Cluster("vpc"):

        launch_template = AutoScaling("launch template")
        VPC("security group(s)") >> launch_template
        [Bash("bash"), Ansible("ansible"), Server("cloud-init")] >> Edge(label="userdata") >> launch_template
예제 #12
0
from diagrams import Diagram, Edge
from diagrams.onprem.database import PostgreSQL
from diagrams.onprem.queue import Kafka
from diagrams.onprem.container import Docker


with Diagram("Monitoring Application", show=False):
    Docker("Monitoring service") >> Edge(color="black", style="bold") >> Kafka(
        "stream"
    ) >> Edge(color="black", style="bold") >> Docker("Consumer service") >> Edge(
        color="black", style="bold"
    ) >> PostgreSQL(
        "storage"
    )
예제 #13
0
graph_attr = {"pad": "0"}


class Vault(Custom):
    def __init__(self, label):
        super(Vault, self).__init__(label, './img/vault.png')


class ExternalSecrets(Custom):
    def __init__(self, label):
        super(ExternalSecrets, self).__init__(label,
                                              './img/external-secrets.png')


with Diagram("Secret Management Flow",
             graph_attr=graph_attr,
             outformat="jpg",
             show=False):
    init_script = Python("vault_init.py")

    init_secrets = Secret('Kubernetes secrets')

    with Cluster("External-secrets components") as external_secrets_cluster:
        external_service_account = ServiceAccount('Service account')
        external_secrets = ExternalSecrets("Secret workers")
        external_secrets_manifests = Secret('External secrets')

        external_secrets << external_secrets_manifests

        external_secrets << external_service_account

    with Cluster("Vault components") as vault_cluster:
예제 #14
0
    "fontname": "IBM Plex Mono bold",
    "bgcolor": "transparent",
    "fontcolor": "grey"
}

node_attr = {
    "width": "1",
    "height": "1",
    "fontsize": "8",
    "fontname": "IBM Plex Mono",
    "fontcolor": "grey"
}

with Diagram("Setup a blog on k3s",
             show=False,
             graph_attr=graph_attr,
             node_attr=node_attr,
             direction="TB"):
    users = Users("Users")
    with Cluster("LetsEncrypt API Servers", graph_attr=graph_attr):
        letsencrypt = LetsEncrypt("LE SSL Certificate")
    with Cluster("BareMetal Server", graph_attr=graph_attr):
        with Cluster("K8S Cluster", graph_attr=graph_attr):
            with Cluster("NS Cert-Manager", graph_attr=graph_attr):
                certificate_request = CertManager("mywebsite.com")
            with Cluster("NS www", graph_attr=graph_attr):
                website_secret = Secret("mywebsite.com")
                with Cluster("Ingress", graph_attr=graph_attr):
                    ingress = Ingress("https")
                with Cluster("Pods", graph_attr=graph_attr):
                    pod = Pod('website')
예제 #15
0
#!/usr/bin/env python3

from diagrams.onprem.security import Vault
from diagrams.onprem.compute import Server
from diagrams.aws.general import GenericSamlToken
from diagrams.k8s.controlplane import CM
from diagrams import Diagram, Edge, Cluster
from diagrams.onprem.network import Envoy
from diagrams.onprem.container import Containerd
from diagrams.k8s.compute import Pod

graph_attr = {"fontsize": "15", "pad": "0.5", "bgcolor": "transparent"}

with Diagram(
        show=False,
        filename="../../img/sidecar_full",
        graph_attr=graph_attr,
):
    integration = Server("Target")
    idp = Vault("IdP")
    with Cluster("Kubernetes-based Internal Platform"):
        controller = CM("Custom\nController")
        with Cluster("Pod boundary"):
            Pod("Istio-enabled")
            envoy = Envoy("Envoy")
            sidecar = Containerd("Sidecar")
            primary = Containerd("Primary")
            token = GenericSamlToken("")

            sidecar >> Edge(
                label="1. refresh token (out-of-band)") >> envoy >> idp
예제 #16
0
loki_icon = "loki.png"
urlretrieve(loki_url, loki_icon)

bitnami_url = "https://avatars1.githubusercontent.com/u/34656521?s=280&v=4"
bitnami_icon = "bitnami.png"
urlretrieve(bitnami_url, bitnami_icon)

concourse_url = "https://git.rrerr.net/uploads/-/system/project/avatar/434/concourse-black.png"
concourse_icon = "concourse.png"
urlretrieve(concourse_url, concourse_icon)

metallb_url = "https://v0-3-0--metallb.netlify.com/images/logo.png"
metallb_icon = "metallb.png"
urlretrieve(metallb_url, metallb_icon)

with Diagram("Terraform Kube"):

    cloudFlare = Custom("Cloudflare DNS", cloudflare_icon)
    wasabi = Custom("Wasabi S3 Storage", wasabi_icon)

    with Cluster("Concourse CI"):
        Custom("Concourse CI", concourse_icon)
        with Cluster("K8s Provisioning Pipeline"):
            createServersStage = Custom("Create Servers", terraform_icon)
            deployClusterStage = Custom("Deploy K8s Cluster", kubespray_icon)
            deployComponentsStage = Custom("Deploy K8s Components",
                                           kubernetes_icon)
        with Cluster("K8s Destroying Pipeline"):
            destroyServersStage = Custom("Destroy Servers", terraform_icon)

    with Cluster("Hetzner Cloud"):
예제 #17
0
from diagrams import Cluster, Diagram
from diagrams.aws.database import Dynamodb
from diagrams.aws.storage import S3
from diagrams.aws.security import KMS
# from diagrams.aws.general import User
from diagrams.onprem.client import User
from diagrams.onprem.iac import Terraform

with Diagram("AWS S3 Backend", show=False):

    tf = Terraform("")
    user = User("DevOps")

    with Cluster("AWS"):
        aws = [S3("TF State"), Dynamodb("TF LockTable"), KMS("Encryption Key")]

    user >> tf >> aws
예제 #18
0
from diagrams import Cluster, Diagram, Edge
from diagrams.aws.compute import EC2
from diagrams.aws.management import Cloudwatch
from diagrams.aws.network import InternetGateway, RouteTable, VPCRouter
from diagrams.aws.security import KMS, IAMRole
from diagrams.generic.network import Firewall
from diagrams.onprem.network import Internet

graph_attr = {
    "pad": "0",
    "bgcolor": "transparent"
}

with Diagram("template-08", show=False, direction="LR", filename="diagram-08", graph_attr=graph_attr):
    internet = Internet("Public Internet")
    with Cluster("Vpc 10.0.0.0/16"):
        internet_gateway = InternetGateway("Igw")
        internet - internet_gateway
        routeTable = RouteTable("RouteTable")
        routeTable >> Edge(label="0.0.0.0/0", style="dashed") >> internet_gateway
        with Cluster("Subnet 10.0.0.0/24"):
            router = VPCRouter("Router\n10.0.0.1")
            router - Edge(style="dashed") - routeTable
            router - internet_gateway
            ec2 = EC2("ec2\n10.0.0.x")
            ec2 - Edge(style="dashed") - router
            sg = Firewall("SG: 22/tcp")
            ec2 - sg - router
    KMS("KeyPair") - ec2
    ec2Role = IAMRole("Ec2InstanceRole") - ec2
예제 #19
0
from diagrams import Diagram
from diagrams.onprem.vcs import Github
from diagrams.onprem.ci import GithubActions
from diagrams.onprem.container import Docker

with Diagram("Flow", show=False, direction="LR"):
    Github("Github") >> GithubActions("GithubActions") >> Docker("Docker")
예제 #20
0
from diagrams import Cluster, Diagram
from diagrams.aws.compute import ECS, EKS, Lambda
from diagrams.aws.database import Redshift
from diagrams.aws.integration import SQS
from diagrams.aws.storage import S3

with Diagram("Event Processing", show=False):
    source = EKS("k8s source")

    with Cluster("Event Flows"):
        with Cluster("Event Workers"):
            workers = [ECS("worker1"), ECS("worker2"), ECS("worker3")]

        queue = SQS("event queue")

        with Cluster("Processing"):
            handlers = [Lambda("proc1"), Lambda("proc2"), Lambda("proc3")]

    store = S3("events store")
    dw = Redshift("analytics")

    source >> workers >> queue >> handlers
    handlers >> store
    handlers >> dw
from diagrams import Diagram, Cluster, Edge
from diagrams.k8s.network import Ingress, Service
from diagrams.k8s.compute import StatefulSet, Pod
from diagrams.k8s.storage import PV
from diagrams.k8s.infra import Node

with Diagram("Advanced Distribution",
             show=False,
             direction="LR",
             graph_attr={"splines": "spline"}):

    with Cluster("Node 1"):
        be1 = Pod("trow-backend-1")
        fe = Pod("trow-frontend")
        fe >> be1

    with Cluster("Node 2"):
        be2 = Pod("trow-backend-2")

    with Cluster("Node 3"):
        be3 = Pod("trow-backend-3")

    with Cluster("Node 4"):
        be4 = Pod("trow-backend-4")

    with Cluster("Node 5"):
        be5 = Pod("trow-backend-5")

    be1 - be2
    be1 - be3
    be1 - be4
from diagrams import Cluster, Diagram
from diagrams.gcp.analytics import BigQuery, Dataflow, PubSub
from diagrams.gcp.compute import AppEngine, Functions
from diagrams.gcp.database import BigTable
from diagrams.gcp.iot import IotCore
from diagrams.gcp.storage import GCS

with Diagram("Message Collecting", show=False):
    pubsub = PubSub("pubsub")

    with Cluster("Source of Data"):
        [IotCore("core1"), IotCore("core2"), IotCore("core3")] >> pubsub

    with Cluster("Targets"):
        with Cluster("Data Flow"):
            flow = Dataflow("data flow")

        with Cluster("Data Lake"):
            flow >> [BigQuery("bq"), GCS("storage")]

        with Cluster("Event Driven"):
            with Cluster("Processing"):
                flow >> AppEngine("engine") >> BigTable("bigtable")

            with Cluster("Serverless"):
                flow >> Functions("func") >> AppEngine("appengine")

    pubsub >> flow
예제 #23
0
from diagrams.custom import Custom
from diagrams.onprem.network import Internet


def create_ecs_cluster(start, end):
    cluster = ECS("Primary Cluster")
    workers = [EC2(f"worker#{i}") for i in range(start, end)]
    cluster >> Edge(color="pink", style="dashed",
                    label="Container Instance") >> workers

    return cluster


with Diagram("Cluster Integration",
             show=False,
             direction="TB",
             outformat="png",
             filename="/output/grouped_workers"):

    with Cluster("Other AWS Resources"):
        primary_load_balancer = ELB("Load Balancer")
        events_database = RDS("Events Databse")

    with Cluster("Primary ECS Cluster"):
        primary_cluster = create_ecs_cluster(start=0, end=7)

    with Cluster("Backup Clusters"):
        with Cluster("First Backup ECS Cluster"):
            backup_cluster1 = create_ecs_cluster(start=10, end=12)

        with Cluster("Second Backup ECS Cluster"):
예제 #24
0
from diagrams.onprem.monitoring import Prometheus, Grafana
from diagrams.onprem.network import Istio
from diagrams.onprem.tracing import Jaeger
from diagrams.programming.framework import React


def kube_svc(name, replica_count, db):
    svc = Service(name)
    apps = []
    for _ in range(replica_count):
        pod = Pod("pod")
        apps.append(svc >> pod >> db)
    return svc


with Diagram("Lorem Ipsum Cloud Native", show=True, filename='lorem_ipsum_cloud_native'):
    ui = React("UI")

    with Cluster("Kube"):
        net = Istio("loremipsum.com")
        with Cluster('Logging'):
            logging = Fluentd('logging')
            es = ElasticSearch('index')
            kibana = Kibana('Log View')
            logging >> es >> kibana
        with Cluster('Monitoring'):
            metrics = Prometheus('metrics')
            monitoring = Grafana('monitoring')
            tracing = Jaeger('tracing')

        with Cluster("DB") as cluster:
예제 #25
0
from diagrams import Cluster, Diagram, Edge
from diagrams.k8s.compute import Pod
from diagrams.k8s.compute import Deployment
from diagrams.k8s.compute import ReplicaSet
from diagrams.onprem.container import Docker

with Diagram("kubernetes configuration files", show=False):
    depl = Deployment("Deployment")
    rs = ReplicaSet("ReplicaSet")
    pod = Pod("Pod")
    docker = Docker("Container")
    depl >> rs >> pod >> docker
예제 #26
0
from diagrams import Cluster, Diagram
from diagrams.aws.compute import ECS
from diagrams.aws.database import Redshift, RDS
from diagrams.aws.integration import SQS
from diagrams.aws.storage import S3

with Diagram("ASIF TFP CREDIT CONSTRAINT",
             show=False,
             filename="IMAGES/IMAGES/asif_tfp_credit_constraint",
             outformat="jpg"):

    temp_1 = S3('china_city_code_normalised')
    temp_2 = S3('china_city_sector_pollution')
    temp_3 = S3('china_city_reduction_mandate')
    temp_4 = S3('china_city_tcz_spz')
    temp_5 = S3('ind_cic_2_name')
    temp_6 = S3('province_credit_constraint')
    temp_7 = S3('china_credit_constraint')
    temp_8 = ECS('asif_firms_prepared')
    temp_9 = SQS('asif_tfp_firm_level')

    with Cluster("FINAL"):

        temp_final_1 = Redshift('asif_tfp_credit_constraint')

    temp_final_1 << temp_1
    temp_final_1 << temp_2
    temp_final_1 << temp_3
    temp_final_1 << temp_4
    temp_final_1 << temp_5
    temp_final_1 << temp_6
예제 #27
0
    "fontcolor": "#e9e9e9",
    "style": "none",
    "pad": "0",
}
node_attr = {
    "fontcolor": "#e9e9e9",
}
edge_attr = {
    "fontcolor": "#e9e9e9",
    "color": "#1cbfa9",
}

kuberik_icon = "logo.png"
with Diagram(filename="play_trigger",
             show=False,
             edge_attr=edge_attr,
             outformat="png",
             graph_attr=graph_attr,
             node_attr=node_attr):
    with Cluster("Screening", graph_attr=graph_attr):
        screener_controller = Pod("Screener Controller")
        screener = CRD("Screener")

    events = CRD("Events")
    screener << Edge(label="configure", **edge_attr) - screener_controller
    screener_controller - Edge(label="") >> events

    movie = CRD("Movie")
    # "\n" fixes padding issues
    engine = Custom("Engine\n", kuberik_icon)
    movie << Edge(constraint="false") - engine
    [events, events, events] << engine
예제 #28
0
from diagrams import Cluster, Diagram
from diagrams.k8s.compute import Job
from diagrams.onprem import client, container
from diagrams.custom import Custom

with Diagram(name="MLCommons-Box-k8s", show=False):
    with Cluster("Kubernetes Runner"):
        yaml_icon = "yaml.jpg"
        config = [
            container.Docker("container"),
            Custom("Task file", yaml_icon)
        ]
    client.User("User") >> config >> Job("k8s")
예제 #29
0
from diagrams import Cluster, Diagram
from diagrams.azure.analytics import Databricks
from diagrams.azure.database import DataLake, SQLDatawarehouse
from diagrams.azure.storage import BlobStorage
from diagrams.aws.database import Dynamodb, RDS, Elasticache
from diagrams.aws.analytics import Redshift
from diagrams.aws.storage import S3

node_attr = {"fontsize": "20"}
graph_attr = {"fontsize": "28"}

with Diagram("", show=False, direction="TB", node_attr=node_attr):
    with Cluster("Azure", graph_attr=graph_attr):
        azdatalake = DataLake("\nData Lake\nStorage Gen2")
        databricks = Databricks("\nDatabricks")
        synapse = SQLDatawarehouse("\nSynapse\nAnalytics")
        azdatalake >> databricks
        azdatalake >> synapse
    with Cluster("AWS", graph_attr=graph_attr):
        s3 = S3("\nS3")
        databricks = Databricks("\nDatabricks")
        redshift = Redshift("\nRedshift")
        s3 >> databricks
        s3 >> redshift
예제 #30
0
# Design with https://diagrams.mingrammer.com/
# kubernetes-diagram.py
# run the cmd: python3 cyri-lan-archi-diagram.py to generate the png file.
from diagrams import Cluster, Diagram
from diagrams.generic.network import Switch, Router
from diagrams.generic.storage import Storage
from diagrams.k8s.compute import Pod
from diagrams.k8s.network import Ingress, Service
from diagrams.k8s.storage import PV, PVC, StorageClass
from diagrams.elastic.elasticsearch import Elasticsearch, Logstash, Kibana
from diagrams.oci.connectivity import DNS
from diagrams.onprem.compute import Server, Nomad

with Diagram("Kubernetes Diagram", show=False):
    synology = DNS("reverse DNS")

    with Cluster("RaspberryPi4 + K3S"):
        ingress = Ingress("cyri.intra")
        svc = Service("services")
        pvc = PVC("pv claim")
        with Cluster("apps"):
            logstash = Logstash("logstash-oss")
            elasticsearch = Elasticsearch("elasticsearch")
            squid = Server("squid")
            elk = [elasticsearch - logstash - Kibana("kibana")]
        with Cluster("local-storage"):
            pv = [StorageClass("storage class") >> PV("persistent volume")]
        k8s = ingress >> svc
        k8s >> squid >> pvc << pv
        k8s >> logstash >> pvc << pv