zegl / kube-score

Kubernetes object analysis with recommendations for improved reliability and security. kube-score actively prevents downtime and bugs in your Kubernetes YAML and Charts. Static code analysis for Kubernetes.
https://kube-score.com
MIT License
2.74k stars 176 forks source link

Feature Request: Fail when PDB is set and replica is < 2 #376

Open jkleinlercher opened 3 years ago

jkleinlercher commented 3 years ago

In https://github.com/zegl/kube-score/blob/47b5ae268cec7e6ffb50fa5d1848fb3c15f3fc97/score/disruptionbudget/disruptionbudget.go#L41 kube-score already checks if replicas < 2 ignore the check that a PDB must be set. However, wouldn‘t it be good that if replicas < 2 a PDB must NOT be set because it will prevent node drain operations from succeeding. Any operation that needs to kill that single replica will conflict with the PodDisruptionBudget that is defined.

so I would love to see a seperate test which checks such a constellation.

Any thoughts about that?

jkleinlercher commented 3 years ago

Hm, while reading https://blogs.infosupport.com/how-not-to-configure-pod-disruption-budget/ I learned the topic PDB is maybe more complicated than I thought …