cluster-capacity icon indicating copy to clipboard operation
cluster-capacity copied to clipboard

Feature additions

Open limscoder opened this issue 3 years ago • 13 comments

Hi, I made 3 feature additions in a fork and was wondering if you'd consider accepting PRs for any of them described below.

  1. Replaced --podspec with --replicaset

https://github.com/limscoder/cluster-capacity/commit/6302eb1a754b4ca1eda9a0b888d50af28e139b50

This commit replaces podspec config with replicaset config. This enables multiple podspecs to be defined with the desired number of replicas for each.

example:

./cluster-capacity --kubeconfig ${KUBECONFIG} --replicaset ./examples/smallpod-replicaset.yaml --replicaset ./examples/largepod-replicaset.yaml --verbose

output:

Pod distribution among nodes:
small-pod
        - node.1: 1 instance(s)
        - node.2: 1 instance(s)
        - node.3: 1 instance(s)
large-pod
        - node.4: 2 instance(s)
        - node.2: 1 instance(s)

Set Replicas: 0 to maintain current behavior of scheduling until node resources are exhausted.

example:

 ./cluster-capacity --kubeconfig ${KUBECONFIG} --replicaset ./examples/unbounded-replicaset.yaml --verbose

output:

The cluster can schedule 742 instance(s) of the pod unbounded-pod.

Termination reason: Unschedulable: 0/35 nodes are available: ...

Pod distribution among nodes:
unbounded-pod
...
  1. Add estimated cluster capacity to verbose output.

https://github.com/limscoder/cluster-capacity/commit/6bc3cdf01efde94b6fdee0e430033cb812f1cdee

Calculates estimated cluster and node capacities after requested replicasets have been scheduled.

output:

node.1
        - pod count: 58
        - CPU requested: 15775m/15900m 99.21% allocated
        - CPU limited: 49450m/15900m 311.01% allocated
        - Memory requested: 25243794432bytes/126191124480bytes 20.00% allocated
        - Memory limited: 124531248384bytes/126191124480bytes 98.68% allocated
        - EphemeralStorage requested: 48066723840bytes/240575057113bytes 19.98% allocated
        - EphemeralStorage limited: 128849018880bytes/240575057113bytes 53.56% allocated

Cluster capacity:
        - CPU requested: 506500m/532200m 95.17% allocated
        - CPU limited: 1576200m/532200m 296.17% allocated
        - Memory requested: 949234361344bytes/4136864407552bytes 22.95% allocated
        - Memory limited: 3771463961344bytes/4136864407552bytes 91.17% allocated
        - EphemeralStorage requested: 2195500040192bytes/8420126998955bytes 26.07% allocated
        - EphemeralStorage limited: 5425617436672bytes/8420126998955bytes 64.44% allocated
  1. Add ability to simulate a larger cluster

https://github.com/limscoder/cluster-capacity/commit/21593efa0bd00e84708a573ad16155dcba7e50d7

This commit allows a source node to be virtually replicated.

example adding 10 replicas of node.1 to the scheduler cache:

 ./cluster-capacity --kubeconfig ${KUBECONFIG} --replicaset ./examples/smallpod-replicaset.yaml --simulatenode node.1:10 --verbose

output:

node.1.simulated.1
        - pod count: 1
        - CPU requested: 150m/15900m 0.94% allocated
        - CPU limited: 300m/15900m 1.89% allocated
        - Memory requested: 104857600bytes/126191124480bytes 0.08% allocated
        - Memory limited: 209715200bytes/126191124480bytes 0.17% allocated
        - EphemeralStorage requested: 0bytes/240575057113bytes 0.00% allocated
        - EphemeralStorage limited: 0bytes/240575057113bytes 0.00% allocated
node.1.simulated.2
...

limscoder avatar Jul 12 '21 17:07 limscoder