fix
This commit is contained in:
@@ -1074,6 +1074,12 @@ func Worker_nodes_plan(w http.ResponseWriter, r *http.Request) {
|
|||||||
func ClusterStats(w http.ResponseWriter, r *http.Request) {
|
func ClusterStats(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
data := models.ClusterStats{
|
data := models.ClusterStats{
|
||||||
|
Name: "vcluster-cluster",
|
||||||
|
ClusterId: "6547",
|
||||||
|
Status: "Healthy",
|
||||||
|
Version: "v3.31.0",
|
||||||
|
Alerts: "0/1",
|
||||||
|
Endpoint: "http://aa.bugx.ir",
|
||||||
ResourceUsage: models.ResourceUsage{
|
ResourceUsage: models.ResourceUsage{
|
||||||
CPU: models.Usage{Used: 65, Total: 100, Unit: "cores"},
|
CPU: models.Usage{Used: 65, Total: 100, Unit: "cores"},
|
||||||
Memory: models.Usage{Used: 8.2, Total: 16, Unit: "GB"},
|
Memory: models.Usage{Used: 8.2, Total: 16, Unit: "GB"},
|
||||||
@@ -1087,6 +1093,7 @@ func ClusterStats(w http.ResponseWriter, r *http.Request) {
|
|||||||
SchedulerLatency: "8ms",
|
SchedulerLatency: "8ms",
|
||||||
},
|
},
|
||||||
Health: models.Health{
|
Health: models.Health{
|
||||||
|
Status: "Healthy",
|
||||||
NodesHealthy: 3,
|
NodesHealthy: 3,
|
||||||
NodesTotal: 3,
|
NodesTotal: 3,
|
||||||
PodsRunning: 10,
|
PodsRunning: 10,
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -128,7 +128,7 @@ func main() {
|
|||||||
router.HandleFunc("/createcluster", handler.CreateClusterHandler)
|
router.HandleFunc("/createcluster", handler.CreateClusterHandler)
|
||||||
router.HandleFunc("/deletecluster", handler.Deletecluster)
|
router.HandleFunc("/deletecluster", handler.Deletecluster)
|
||||||
router.HandleFunc("/clusters", handler.ListUserClusters)
|
router.HandleFunc("/clusters", handler.ListUserClusters)
|
||||||
router.HandleFunc("/cluster/stats", handler.ClusterStats)
|
router.HandleFunc("/cluster_stats", handler.ClusterStats)
|
||||||
router.HandleFunc("/connect", handler.Connect)
|
router.HandleFunc("/connect", handler.Connect)
|
||||||
// router.HandleFunc("/cluster_nodes", handler.Cluster_nodes)
|
// router.HandleFunc("/cluster_nodes", handler.Cluster_nodes)
|
||||||
router.HandleFunc("/cluster_namespaces", handler.Cluster_namespaces)
|
router.HandleFunc("/cluster_namespaces", handler.Cluster_namespaces)
|
||||||
|
|||||||
@@ -115,6 +115,12 @@ type ClusterStats struct {
|
|||||||
Performance Performance `json:"performance"`
|
Performance Performance `json:"performance"`
|
||||||
Health Health `json:"health"`
|
Health Health `json:"health"`
|
||||||
Uptime Uptime `json:"uptime"`
|
Uptime Uptime `json:"uptime"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
ClusterId string `json:"clusterId"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
Alerts string `json:"alerts"`
|
||||||
|
Endpoint string `json:"endpoint"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceUsage struct {
|
type ResourceUsage struct {
|
||||||
@@ -144,6 +150,7 @@ type Health struct {
|
|||||||
PodsTotal int `json:"podsTotal"`
|
PodsTotal int `json:"podsTotal"`
|
||||||
Alerts int `json:"alerts"`
|
Alerts int `json:"alerts"`
|
||||||
Warnings int `json:"warnings"`
|
Warnings int `json:"warnings"`
|
||||||
|
Status string `json:"healthy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Uptime struct {
|
type Uptime struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user