1. change glog to klog
2. move types to api package to avoid cyclic import
This commit is contained in:
@@ -19,14 +19,14 @@
|
||||
package quotas
|
||||
|
||||
import (
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/klog"
|
||||
"kubesphere.io/kubesphere/pkg/informers"
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
"kubesphere.io/kubesphere/pkg/models/resources"
|
||||
"kubesphere.io/kubesphere/pkg/params"
|
||||
"kubesphere.io/kubesphere/pkg/server/params"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -76,7 +76,7 @@ func getUsage(namespace, resource string) (int, error) {
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
glog.Error(err)
|
||||
klog.Error(err)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ func GetClusterQuotas() (*models.ResourceQuota, error) {
|
||||
func GetNamespaceQuotas(namespace string) (*NamespacedResourceQuota, error) {
|
||||
quota, err := getNamespaceResourceQuota(namespace)
|
||||
if err != nil {
|
||||
glog.Error(err)
|
||||
klog.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
if quota == nil {
|
||||
@@ -132,7 +132,7 @@ func GetNamespaceQuotas(namespace string) (*NamespacedResourceQuota, error) {
|
||||
if _, ok := quota.Used[v1.ResourceName(key)]; !ok {
|
||||
used, err := getUsage(namespace, val)
|
||||
if err != nil {
|
||||
glog.Error(err)
|
||||
klog.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ func getNamespaceResourceQuota(namespace string) (*v1.ResourceQuotaStatus, error
|
||||
resourceQuotaLister := informers.SharedInformerFactory().Core().V1().ResourceQuotas().Lister()
|
||||
quotaList, err := resourceQuotaLister.ResourceQuotas(namespace).List(labels.Everything())
|
||||
if err != nil {
|
||||
glog.Error(err)
|
||||
klog.Error(err)
|
||||
return nil, err
|
||||
} else if len(quotaList) == 0 {
|
||||
return nil, nil
|
||||
|
||||
Reference in New Issue
Block a user