1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Enhance Kubernetes module with Replica Count (Deployments) (#1062)

This commit adds the ReadyReplicas and Total Replicas count, the information is useful if you want to look over a new release of your application and k8s and want to know how many pods are ready/started from k8s. Otherwise the deployment option of this module is not that useful.

Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
This commit is contained in:
Lukas Kämmerling 2021-03-19 05:57:40 +01:00 committed by GitHub
parent 02db55a136
commit 0a89786826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,9 +164,9 @@ func (client *clientInstance) getDeployments(namespaces []string) ([]string, err
for _, deployment := range deployments.Items {
var deployString string
if len(namespaces) == 1 {
deployString = fmt.Sprintf("%-50s", deployment.ObjectMeta.Name)
deployString = fmt.Sprintf("%-50s (%d/%d)", deployment.ObjectMeta.Name, deployment.Status.ReadyReplicas, deployment.Status.Replicas)
} else {
deployString = fmt.Sprintf("%-20s %-50s", deployment.ObjectMeta.Namespace, deployment.ObjectMeta.Name)
deployString = fmt.Sprintf("%-20s %-50s (%d/%d)", deployment.ObjectMeta.Namespace, deployment.ObjectMeta.Name, deployment.Status.ReadyReplicas, deployment.Status.Replicas)
}
deploymentList = append(deploymentList, deployString)
}
@ -178,7 +178,7 @@ func (client *clientInstance) getDeployments(namespaces []string) ([]string, err
}
for _, deployment := range deployments.Items {
deployString := fmt.Sprintf("%-20s %-50s", deployment.ObjectMeta.Namespace, deployment.ObjectMeta.Name)
deployString := fmt.Sprintf("%-20s %-50s (%d/%d)", deployment.ObjectMeta.Namespace, deployment.ObjectMeta.Name, deployment.Status.ReadyReplicas, deployment.Status.Replicas)
deploymentList = append(deploymentList, deployString)
}
}