Endpoint /stackgres/sgcluster/stats/ doesn't return the correct pod list
-
Implement in target_version1.0.0-alpha2 -
Backport to target_version0.9.6
Scaling up and down StackGres instances can sometimes create a hole in the pods
For a cluster with 2 pods we can end up with something like:
+ Cluster: simple (6955854166863044760) ---------+----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+----------+------------------+--------+---------+----+-----------+
| simple-0 | 10.244.2.14:7433 | | running | 2 | 0 |
| simple-2 | 10.244.3.10:7433 | Leader | running | 2 | |
+----------+------------------+--------+---------+----+-----------+
Here the simple-1 pod is missing, the problem come with the restapi endpoint stats that only returns a single pod reference:
{
"metadata": {
"namespace": "default",
"name": "simple",
"uid": "fac02836-c64c-4a0c-86d0-e1fc1a4c2150"
},
"cpuRequested": "1000m",
"cpuFound": "1000m",
"memoryRequested": "2.00Gi",
"memoryFound": "113.24Mi",
"memoryUsed": "78.50Mi",
"diskRequested": "5.00Gi",
"diskFound": "456.96Gi",
"diskUsed": "427.99Gi",
"averageLoad1m": "4.27",
"averageLoad5m": "3.38",
"averageLoad10m": "3.44",
"connections": "0",
"pods": [
{
"namespace": "default",
"name": "simple-0",
"role": "replica",
"ip": "10.244.2.14",
"status": "Active",
"containers": 6,
"containersReady": 6,
"cpuRequested": "1000m",
"cpuFound": "1000m",
"memoryRequested": "2.00Gi",
"memoryFound": "113.24Mi",
"memoryUsed": "78.50Mi",
"diskRequested": "5.00Gi",
"diskFound": "456.96Gi",
"diskUsed": "427.99Gi",
"averageLoad1m": "4.27",
"averageLoad5m": "3.38",
"averageLoad10m": "3.44",
"connections": "0"
}
],
"podsReady": 1
}
Editing the cluster to just one instance we get only the current primary, but it's not the pod -0:
+ Cluster: simple (6955854166863044760) ---------+----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+----------+------------------+--------+---------+----+-----------+
| simple-2 | 10.244.3.10:7433 | Leader | running | 2 | |
+----------+------------------+--------+---------+----+-----------+
The endpoint returns:
{
"metadata": {
"namespace": "default",
"name": "simple",
"uid": "fac02836-c64c-4a0c-86d0-e1fc1a4c2150"
},
"pods": [],
"podsReady": 0
}
Edited by Matteo Melli