add pvc status submit function
This commit is contained in:
@@ -29,7 +29,7 @@ import (
|
|||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
const inUse = "in_use_pods"
|
const inUse = "kubesphere.io/in_use_pods"
|
||||||
|
|
||||||
func (ctl *PodCtl) addAnnotationToPvc(item v1.Pod) {
|
func (ctl *PodCtl) addAnnotationToPvc(item v1.Pod) {
|
||||||
volumes := item.Spec.Volumes
|
volumes := item.Spec.Volumes
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
resyncCircle = 180
|
resyncCircle = 180
|
||||||
Stopped = "stopped"
|
Stopped = "stopped"
|
||||||
|
PvcPending = "Pending"
|
||||||
Running = "running"
|
Running = "running"
|
||||||
Updating = "updating"
|
Updating = "updating"
|
||||||
tablePods = "pods"
|
tablePods = "pods"
|
||||||
|
|||||||
@@ -140,15 +140,18 @@ type workLoadStatus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetNamespacesResourceStatus(namespace string) (*workLoadStatus, error) {
|
func GetNamespacesResourceStatus(namespace string) (*workLoadStatus, error) {
|
||||||
|
|
||||||
res := workLoadStatus{Count: make(map[string]int), NameSpace: namespace, Items: make(map[string]interface{})}
|
res := workLoadStatus{Count: make(map[string]int), NameSpace: namespace, Items: make(map[string]interface{})}
|
||||||
var status *ResourceList
|
var status *ResourceList
|
||||||
var err error
|
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 {
|
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 {
|
} else {
|
||||||
status, err = ListResource(resource, fmt.Sprintf("status=%s", controllers.Updating), "")
|
status, err = ListResource(resource, fmt.Sprintf("status=%s", resourceStatus), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user