update
This commit is contained in:
1 parent
0690285147
commit
5618cd2738
154 files changed
+5021
-3161
No files matched your search
@@ -38,16 +38,16 @@ func (h *KubernetesHandler) ListNamespaces(c *gin.Context) {
|
||||
|
||||
// NamespaceDetail is the enriched namespace info for the management page
|
||||
type NamespaceDetail struct {
|
||||
Name string `json:"name"`
|
||||
Status string `json:"status"`
|
||||
Age string `json:"age"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
ResourceCounts map[string]int `json:"resource_counts"`
|
||||
HasResourceQuota bool `json:"has_resource_quota"`
|
||||
HasLimitRange bool `json:"has_limit_range"`
|
||||
ResourceQuotas []k8sclient.ResourceQuotaItem `json:"resource_quotas,omitempty"`
|
||||
LimitRanges []k8sclient.LimitRangeItem `json:"limit_ranges,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Status string `json:"status"`
|
||||
Age string `json:"age"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
ResourceCounts map[string]int `json:"resource_counts"`
|
||||
HasResourceQuota bool `json:"has_resource_quota"`
|
||||
HasLimitRange bool `json:"has_limit_range"`
|
||||
ResourceQuotas []k8sclient.ResourceQuotaItem `json:"resource_quotas,omitempty"`
|
||||
LimitRanges []k8sclient.LimitRangeItem `json:"limit_ranges,omitempty"`
|
||||
}
|
||||
|
||||
// GetNamespacesDetail returns all namespaces with metadata, resource counts and quota info
|
||||
@@ -110,11 +110,11 @@ func (h *KubernetesHandler) GetNamespacesDetail(c *gin.Context) {
|
||||
for _, ns := range nsList.Items {
|
||||
name := ns.Metadata.Name
|
||||
nd := NamespaceDetail{
|
||||
Name: name,
|
||||
Status: ns.Status.Phase,
|
||||
Age: formatAge(ns.Metadata.CreationTimestamp),
|
||||
Labels: ns.Metadata.Labels,
|
||||
Annotations: ns.Metadata.Annotations,
|
||||
Name: name,
|
||||
Status: ns.Status.Phase,
|
||||
Age: formatAge(ns.Metadata.CreationTimestamp),
|
||||
Labels: ns.Metadata.Labels,
|
||||
Annotations: ns.Metadata.Annotations,
|
||||
ResourceCounts: map[string]int{
|
||||
"deployments": depCounts[name],
|
||||
"pods": podCounts[name],
|
||||
@@ -181,21 +181,27 @@ func (h *KubernetesHandler) GetNamespaceDetailHandler(c *gin.Context) {
|
||||
if deps, err := client.ListDeployments(); err == nil {
|
||||
count := 0
|
||||
for _, d := range deps.Items {
|
||||
if d.Metadata.Namespace == nsName { count++ }
|
||||
if d.Metadata.Namespace == nsName {
|
||||
count++
|
||||
}
|
||||
}
|
||||
nd.ResourceCounts["deployments"] = count
|
||||
}
|
||||
if pods, err := client.ListPods(); err == nil {
|
||||
count := 0
|
||||
for _, p := range pods.Items {
|
||||
if p.Metadata.Namespace == nsName { count++ }
|
||||
if p.Metadata.Namespace == nsName {
|
||||
count++
|
||||
}
|
||||
}
|
||||
nd.ResourceCounts["pods"] = count
|
||||
}
|
||||
if svcs, err := client.ListServices(); err == nil {
|
||||
count := 0
|
||||
for _, s := range svcs.Items {
|
||||
if s.Metadata.Namespace == nsName { count++ }
|
||||
if s.Metadata.Namespace == nsName {
|
||||
count++
|
||||
}
|
||||
}
|
||||
nd.ResourceCounts["services"] = count
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user