Merge pull request #107 from richardxz/master
add pvc status submit function
This commit is contained in:
@@ -31,7 +31,7 @@ import (
|
||||
"kubesphere.io/kubesphere/pkg/models/metrics"
|
||||
)
|
||||
|
||||
const inUse = "in_use_pods"
|
||||
const inUse = "kubesphere.io/in_use_pods"
|
||||
|
||||
func (ctl *PodCtl) addAnnotationToPvc(item v1.Pod) {
|
||||
volumes := item.Spec.Volumes
|
||||
|
||||
@@ -33,6 +33,7 @@ import (
|
||||
const (
|
||||
resyncCircle = 180
|
||||
Stopped = "stopped"
|
||||
PvcPending = "Pending"
|
||||
Running = "running"
|
||||
Updating = "updating"
|
||||
tablePods = "pods"
|
||||
|
||||
@@ -140,15 +140,18 @@ type workLoadStatus struct {
|
||||
}
|
||||
|
||||
func GetNamespacesResourceStatus(namespace string) (*workLoadStatus, error) {
|
||||
|
||||
res := workLoadStatus{Count: make(map[string]int), NameSpace: namespace, Items: make(map[string]interface{})}
|
||||
var status *ResourceList
|
||||
var err error
|
||||
for _, resource := range []string{controllers.Deployments, controllers.Statefulsets, controllers.Daemonsets} {
|
||||
for _, resource := range []string{controllers.Deployments, controllers.Statefulsets, controllers.Daemonsets, controllers.PersistentVolumeClaim} {
|
||||
resourceStatus := controllers.Updating
|
||||
if resource == controllers.PersistentVolumeClaim {
|
||||
resourceStatus = controllers.PvcPending
|
||||
}
|
||||
if len(namespace) > 0 {
|
||||
status, err = ListResource(resource, fmt.Sprintf("status=%s,namespace=%s", controllers.Updating, namespace), "")
|
||||
status, err = ListResource(resource, fmt.Sprintf("status=%s,namespace=%s", resourceStatus, namespace), "")
|
||||
} else {
|
||||
status, err = ListResource(resource, fmt.Sprintf("status=%s", controllers.Updating), "")
|
||||
status, err = ListResource(resource, fmt.Sprintf("status=%s", resourceStatus), "")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user