How to make this diagram less wide?

0 votes
asked Feb 12, 2021 in Question / help by Slyver (160 points)
reshown Feb 13, 2021 by Slyver

This diagram is rendered as a relatively very wide image:

@startuml

component kubectl [
    kubectl
    A command line tool for
    communicating with
    a Kubernetes API server.
]

component cluster {
    component master {
        [kube-APIserver]

        component kube-etcd {
        }

        component kube-cloud-manager {
        }

        component kube-scheduler {
        }

        component kube-controller-manager {
        }
    }

    component node as node1 {
        component kubelet as kbl1 {
        }

        component pod as pod11 {
        }

        component pod as pod12 {
        }

        component pod as pod13 {
        }

    }

    component node as node2 {
        component kubelet as kbl2 {
        }

        component pod as pod21 {
        }

        component pod as pod22 {
        }

        component pod as pod23 {
        }
    }

    component node as node3 {
        component kubelet as kbl3 {
        }

        component pod as pod31 {
        }

        component pod as pod32 {
        }

        component pod as pod33 {       
        }
    }
}

[kubectl] --> [kube-APIserver]

@enduml



How can I make it more "square" and less "rectangle"?

2 Answers

+1 vote
answered Feb 12, 2021 by The-Lu (63,920 points)

Hello S.,

First: Avoid to use nested component if there is empty; You can change all:

component pod as pod11 {
}

just to

component pod as pod11

With that:

@startuml
component kubectl [
    kubectl
    A command line tool for
    communicating with
    a Kubernetes API server.
]

component cluster {
    component master {
        [kube-APIserver]
        component "kube-etcd"
        component "kube-cloud-manager"
        component "kube-scheduler"
        component "kube-controller-manager"
    }

    component node as node1 {
        component kubelet as kbl1
        component pod as pod11
        component pod as pod12
        component pod as pod13
    }

    component node as node2 {
        component kubelet as kbl2
        component pod as pod21
        component pod as pod22
        component pod as pod23
    }

    component node as node3 {
        component kubelet as kbl3
        component pod as pod31
        component pod as pod32
        component pod as pod33
    }
}

[kubectl] --> [kube-APIserver]
@enduml

We observe:


[See on PlantUML online server]


If that can help,
Regards,
Th.

commented Feb 13, 2021 by Slyver (160 points)
Hi,

They are empty just temporarily. Eventually like the `kubectl` component they will contain a paragraph explaining what they are, but I may switch to notes for that.

Thanks.
commented Feb 13, 2021 by The-Lu (63,920 points)

Hello S.,

Without using note for that: instead of used nested component, you can just use long description form like the first `kubectl`component; You can change all:

component pod as pod11

just to:

component pod [
pod
pod description...
]

With that, we observe:


[See on PlantUML server]

If that can help,
Regards,
Th.

+1 vote
answered Feb 12, 2021 by Martin (8,360 points)

Is there a reason that most of your inner components are empty 'containers'?  Is it because you wanted the white background?

It seems that Plantuml doesn't lay out the empty components neatly (I'm not sure if this is a bug or not). But if you convert them all to normal components and throw in a style command to make them white, then I think you get what you're after.

If there is a genuine reason to keep the containers format, then you'll have to throw in some invisible ranking, for example:

or

commented Feb 13, 2021 by Slyver (160 points)
Thanks for the instructions. Yes, they are temporarily empty -- I was going to add some text eventually.
...