コード例 #1
0
                web_pod = Pod(f"shard-{k}-web")
                prosody_pod = Pod(f"shard-{k}-prosody")
                jicofo_pod = Pod(f"shard-{k}-jicofo")
                Deployment(f"shard-{k}-prosody") >> prosody_pod
                Deployment(f"shard-{k}-jicofo") >> jicofo_pod
                web_service >> web_pod
                prosody_service = Service(f"shard-{k}-prosody")
                prosody_service >> prosody_pod
                prosody_service << web_pod
                prosody_service << jicofo_pod

                n_jvbs = 3
                with Cluster(f"Jitsi Videobridge Shard-{k}"):
                    jvb_pods = [
                        Pod(f"shard-{k}-jvb-{i}") for i in range(n_jvbs)
                    ]
                    jvb_services = [
                        Service(f"shard-{k}-jvb-{i}") for i in range(n_jvbs)
                    ]
                [
                    jvb_services[i] >> jvb_pods[i] >> prosody_service
                    for i in range(n_jvbs)
                ]
                jvb_pods << StatefulSet(f"shard-{k}-jvb") << HPA(
                    f"shard-{k}-hpa")
                if k == 0:
                    users_1 >> jvb_services[0]
                if k == 1:
                    users_2 >> jvb_services[1]
        all_users >> ingress
コード例 #2
0
            mqtt_svc >> sensor_sub >> \
                [water_consumer_sts, sprinkler_consumer_sts, light_consumer_sts] >> \
                redis_sts >> \
                celery_worker_deploy >> \
                controller_publisher >> \
                mqtt_sts
            redis_svc >> redis_sts

        with Cluster(MONITORING):
            telegraf_sts = STS("Telegraf")
            influxdb_sts = STS("InfluxDB")
            grafana_deploy = Deploy("Grafana")

            mqtt_svc >> telegraf_sts >> influxdb_sts >> grafana_deploy
            influxdb_svc >> influxdb_sts

    with Cluster(STORAGE_CLUSTER):
        pg_pvc = PVC("PostgreSQL")
        influxdb_pvc = PVC("InfluxDB")
        grafana_pvc = PVC("Grafana")
        redis_pvc = PVC("Redis")

        pg_sts >> pg_pvc
        influxdb_sts >> influxdb_pvc
        grafana_deploy >> grafana_pvc
        redis_pvc >> redis_sts

    with Cluster(_HPA):
        celery_worker_hpa = HPA("Celery Worker")
        celery_worker_deploy >> celery_worker_hpa
コード例 #3
0
ファイル: pods.py プロジェクト: nimkar/diagrams
from diagrams import Diagram, Cluster
from diagrams.k8s.clusterconfig import HPA
from diagrams.k8s.compute import Deployment, Pod, ReplicaSet
from diagrams.k8s.network import Ingress, Service

with Diagram("Exposed Pod with 4 Replicas", show=True):
    net = Ingress("releasemanagement.org")
    with Cluster("Kube Cluster"):
        net >> Service("svc") >> [Pod("pod1"),
                                  Pod("pod2"),
                                  Pod("pod3"),
                                  Pod("Pod4")] << ReplicaSet("rs") << Deployment("dp") << HPA("hpa")
›
コード例 #4
0
from diagrams import Diagram
from diagrams.k8s.clusterconfig import HPA
from diagrams.k8s.compute import Deployment, Pod, ReplicaSet
from diagrams.k8s.network import Ingress, Service

with Diagram("Research", show=False, filename="research"):
    net = Ingress("research.cashcowpro.com") >> Service("svc")
    pods = [
        Pod("api-1"),
        Pod("api-2"),
        Pod("api-3"),
        Pod("worker-1"),
        Pod("worker-2"),
        Pod("worker-3")
    ]
    net >> pods << ReplicaSet("rs") << Deployment("dp") << HPA("hpa")