示例#1
0
def k8s(name):
    with Cluster(name):
        with Cluster('ns: onepanel'):
            svc_core = Service('core')
            pd_core = Pod('core-*')
            dep_core = Deployment('core')
            dep_core >> pd_core
            svc_core >> pd_core

            svc_core_ui = Service('core-ui')
            pd_core_ui = Pod('core-ui-*')
            dep_core_ui = Deployment('core-ui')
            dep_core_ui >> pd_core_ui
            svc_core_ui >> pd_core_ui

        with Cluster('ns: istio-system'):
            ing = Ingress('istio-ingressgateway')
            # cert = Secret('TLS')

        with Cluster('ns: my-project'):
            with Cluster('Workspace'):
                svc_workspace = Service('jupyterlab')
                pd_workspace = Pod('jupyterlab-*')
                pv_workspace = PV('jupyterlab-data-0')
                sts_workspace = StatefulSet('jupyterlab')
                sts_workspace >> pd_workspace
                pd_workspace - pv_workspace
                svc_workspace >> pd_workspace

        # with Cluster('ns: cert-manager'):
        #     certmanager = Pod('cert-manager')

        # certmanager >> cert
        ing >> [svc_core, svc_core_ui, svc_workspace]

        node_1 = Node('node-1')
        node_2 = Node('node-2')
        node_3 = Node('node-2')
        pd_core - node_1
        pd_core - node_2
        pd_core_ui - node_1
        pd_core_ui - node_2
        pd_workspace - node_3

    return node_1, node_2, node_3, ing, pd_core, pv_workspace
示例#2
0
def get_common_architecture(cloud_provider, filename, container_registry,
                            k8s_cluster_name, k8s_engine_name):
    with Diagram(
            f"QHub Architecture: {cloud_provider}",
            filename=f'{filename}',
            show=False,
            direction="TB",
    ):
        with Cluster(cloud_provider):
            gcr = ContainerRegistry(container_registry)
            with Cluster(k8s_cluster_name):
                kube_engine = KubernetesEngine(k8s_engine_name)

                conda_pvc = PersistentVolume('Conda')
                nfs_pvc = PersistentVolume('NFS')
                elb = LoadBalancing('Ingress')

                with Cluster('Master'):
                    general = Node('general')
                    Node('user')
                    Node('worker')
                    general << kube_engine

                with Cluster("Pods"):
                    dask_gateway = Pod('Dask Gateway')
                    jupyterhub = Pod('JupyterHub')
                    dask_scheduler = Pod('Dask Scheduler')
                    nfs_server = Pod('NFS Server')
                    conda_store = Pod('Conda Store')
                    nginx = Pod('Nginx')
                    Pod('Cert Manager')
                    image_puller = Pod('Image Puller')

        nginx >> elb
        nginx >> jupyterhub
        [nfs_server, conda_store, dask_gateway] << jupyterhub
        [conda_store, dask_scheduler] << dask_gateway
        image_puller >> gcr
        nfs_server >> nfs_pvc
        conda_store >> conda_pvc
        Helm('Helm') >> kube_engine
示例#3
0
def get_common_architecture(cloud_provider, filename, container_registry,
                            k8s_cluster_name, k8s_engine_name):
    with Diagram(
            f"QHub Architecture: {cloud_provider}",
            filename=f"{filename}",
            show=False,
            direction="TB",
    ):
        with Cluster(cloud_provider):
            gcr = ContainerRegistry(container_registry)
            with Cluster(k8s_cluster_name):
                kube_engine = KubernetesEngine(k8s_engine_name)

                conda_pvc = PersistentVolume("Conda")
                nfs_pvc = PersistentVolume("NFS")
                elb = LoadBalancing("Ingress")

                with Cluster("Master"):
                    general = Node("general")
                    Node("user")
                    Node("worker")
                    general << kube_engine

                with Cluster("Pods"):
                    dask_gateway = Pod("Dask Gateway")
                    jupyterhub = Pod("JupyterHub")
                    dask_scheduler = Pod("Dask Scheduler")
                    nfs_server = Pod("NFS Server")
                    conda_store = Pod("Conda Store")
                    nginx = Pod("Nginx")
                    Pod("Cert Manager")
                    image_puller = Pod("Image Puller")

        nginx >> elb
        nginx >> jupyterhub
        [nfs_server, conda_store, dask_gateway] << jupyterhub
        [conda_store, dask_scheduler] << dask_gateway
        image_puller >> gcr
        nfs_server >> nfs_pvc
        conda_store >> conda_pvc
        Helm("Helm") >> kube_engine
示例#4
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
示例#5
0
    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"):
        with Cluster("WireGuard VPN"):
            with Cluster("Kubernetes Cluster"):
                masterNodes = Master("N masters")
                workerNodes = Node("N workers")
                with Cluster("System Application"):
                    argoCd = Argocd("Argo CD")
                    sealedSecrets = Custom("Sealed Secrets", bitnami_icon)
                    metallb = Custom("Metal LB", metallb_icon)
                    certManager = Custom("Cert Manager", cert_manager_icon)
                    istio = Istio("Istio")
                    storage = StorageClass("HCloud CSI")
                    loki = Custom("Loki", loki_icon)

    createServersStage >> deployClusterStage >> deployComponentsStage
    createServersStage >> masterNodes
    deployClusterStage >> masterNodes
    deployComponentsStage >> argoCd
    deployComponentsStage >> sealedSecrets
    deployClusterStage >> metallb
示例#6
0
文件: aws.py 项目: leej3/qhub-cloud
                efs = ElasticFileSystemEFS("EFS")
                with Cluster("Kubernetes Cluster"):
                    eks = ElasticKubernetesService("EKS")
                    eks - ApplicationAutoScaling("Auto Scaling")

                    k8s_vol = PersistentVolume("NFS")
                    k8s_vol >> efs

                    with Cluster("Public"):
                        ig = InternetGateway("Internet gateway")
                        elb = ElasticLoadBalancing("Ingress")
                        public = [ig, elb]
                        elb >> ecr

                    with Cluster("Master"):
                        general = Node("general")
                        user = Node("user")
                        worker = Node("worker")
                        general << eks

                    with Cluster("Pods"):
                        dask_gateway = Pod("Dask Gateway")
                        jupyterhub = Pod("JupyterHub")
                        dask_scheduler = Pod("Dask Scheduler")
                        nfs_server = Pod("NFS Server")
                        conda_store = Pod("Conda Store")
                        nginx = Pod("Nginx")
                        cert_manager = Pod("Cert Manager")
                        image_puller = Pod("Image Puller")

    nginx >> jupyterhub
示例#7
0
from diagrams import Diagram, Cluster
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("Standard Kubernetes Install", show=False, direction="LR"):
    ing = Ingress("trow.io")
    svc = Service("trow-svc")
    ing >> svc
    pod = Pod("trow")
    StatefulSet("trow-set") - pod
    pod - PV("data-vol")

    svc >> pod

    with Cluster("Nodes"):
        workers = [Node("Node 1"), Node("Node 2"), Node("Node 3")]

    workers >> ing
示例#8
0
                efs = ElasticFileSystemEFS('EFS')
                with Cluster('Kubernetes Cluster'):
                    eks = ElasticKubernetesService('EKS')
                    eks - ApplicationAutoScaling('Auto Scaling')

                    k8s_vol = PersistentVolume('NFS')
                    k8s_vol >> efs

                    with Cluster('Public'):
                        ig = InternetGateway('Internet gateway')
                        elb = ElasticLoadBalancing('Ingress')
                        public = [ig, elb]
                        elb >> ecr

                    with Cluster('Master'):
                        general = Node('general')
                        user = Node('user')
                        worker = Node('worker')
                        general << eks

                    with Cluster("Pods"):
                        dask_gateway = Pod('Dask Gateway')
                        jupyterhub = Pod('JupyterHub')
                        dask_scheduler = Pod('Dask Scheduler')
                        nfs_server = Pod('NFS Server')
                        conda_store = Pod('Conda Store')
                        nginx = Pod('Nginx')
                        cert_manager = Pod('Cert Manager')
                        image_puller = Pod('Image Puller')

    nginx >> jupyterhub
示例#9
0
def infrastructure(c):
    with Diagram('infrastructure', show=False):
        _ = Master('compute01') - Node('compute02') - Node('compute03')
示例#10
0
    controller = Server("Controller")

    with Cluster("./metal") as metal:
        metals = Server("Metal cluster")
        pxe = Docker("PXE server")
        rockies = Rocky('Rocky Linux')
        initial_resources = [metals, pxe]
        k3s = K3s('K3s')

        rockies >> k3s
        metals >> rockies

    controller >> initial_resources

    with Cluster("./bootstrap") as bootstrap:
        nodes = Node('Node(s)')
        argocd = ArgoCD('ArgoCD')
        root_chart = Helm("Root chart")

    k3s >> nodes
    k3s >> argocd

    with Cluster('Kubernetes cluster'):
        with Cluster("./system"):
            system_chart = Helm("System chart")

        with Cluster("./platform"):
            platform_chart = Helm("Platform chart")

        with Cluster("./apps"):
            apps_chart = Helm("Applications chart")
示例#11
0
            os1 = Centos()
            Ubuntu()

        with Cluster("Bastion services", direction='LR'):
            dnsmasq = Crio("dnsmasq", width='0.5')
            Crio("HAproxy", width='0.5', pin="true", pos="1,0")
            Crio("Nginx", width='0.5', pin="true", pos="2,0")
            Crio("Registry", width='0.5')
            Crio("Apache", width='0.5')
            Crio("Bind", width='0.5')

        controller >> ansible
        ansible >> kubeinit
        kubeinit >> libvirt
        kubeinit >> dnsmasq
        libvirt >> os1
        os1 >> bare_metal_machines

        with Cluster("Cluster(s) guest(s)"):
            ansible2 = Ansible("Ansible")
            kubeinit2 = Custom("Kubeinit", "./resources/kubeinit.png")
            kubernetes_nodes = Node("Kuberentes node(s)")

            controller >> ansible2
            ansible2 >> kubeinit2
            kubeinit2 >> kubernetes_nodes

            with Cluster("Cluster applications"):
                kustomize = Kustomize("Kustomize")
                kubeinit2 >> kustomize
示例#12
0
def infrastructure(c):
    with Diagram('ASTRID Kubernetes infrastructure',
                 filename='infrastructure',
                 show=False,
                 graph_attr={'pad': '0.0'}):
        _ = Master('compute01') - Node('compute02') - Node('compute03')
示例#13
0
from diagrams import Cluster, Diagram
from diagrams.k8s.compute import Pod, Deploy
from diagrams.k8s.network import Service
from diagrams.k8s.infra import Master, Node
from diagrams.programming.language import Go
from diagrams.programming.framework import Vue
from diagrams.generic.database import SQL
from diagrams.generic.device import Tablet

print("hello world!\n")
with Diagram("", show=False):
    with Cluster("cluster"):
        Master("master") - Node("worker1") - Node("worker2")

    with Cluster("worker node"):
        with Cluster("deploy"):
            pod = [Pod("hello"), Pod("hello"), Pod("hello")]
        nodeport = Service("NodePort")
        nodeport >> pod
    Tablet("user") >> nodeport

    with Cluster("container in Pod, hello"):
        Vue("front end") - Go("back end") - SQL("db")
示例#14
0
from diagrams import Cluster, Diagram
from diagrams.k8s.infra import Master
from diagrams.k8s.storage import Volume
from diagrams.k8s.podconfig import ConfigMap
from diagrams.k8s.podconfig import Secret
from diagrams.k8s.compute import Pod
from diagrams.k8s.network import Ingress
from diagrams.onprem.network import Internet
from diagrams.k8s.compute import Deployment
from diagrams.k8s.compute import StatefulSet
from diagrams.k8s.infra import Node
from diagrams.k8s.compute import ReplicaSet
from diagrams.k8s.network import Service

with Diagram("kubernetes getting started", show=False):
    node = Node("Node")
    inet = Internet("Kubernetes")
    vol = Volume("Volumes")
    cm = ConfigMap("ConfigMap")
    secret = ConfigMap("Secret")
    pod = ConfigMap("Pod")
    ingress = Ingress("Ingress")
    depl = Deployment("Deployment")
    ss = StatefulSet("StatefulSet")
    service = Service("Service")
    rs = ReplicaSet("Replication")
    node << inet
    pod << inet
    service << inet
    ingress << inet
    rs << inet