1. change glog to klog

2. move types to api package to avoid cyclic import
This commit is contained in:
Jeff
2019-09-16 12:46:53 +08:00
committed by zryfish
parent 79735c4543
commit 97c9a1786a
109 changed files with 1076 additions and 552 deletions

View File

@@ -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