forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
registry.go
38 lines (32 loc) · 1.54 KB
/
registry.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package quota
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
kquota "k8s.io/kubernetes/pkg/quota"
"k8s.io/kubernetes/pkg/quota/install"
osclient "github.com/openshift/origin/pkg/client"
"github.com/openshift/origin/pkg/controller/shared"
imageapi "github.com/openshift/origin/pkg/image/api"
"github.com/openshift/origin/pkg/quota/image"
)
// NewOriginQuotaRegistry returns a registry object that knows how to evaluate quota usage of OpenShift
// resources.
func NewOriginQuotaRegistry(isInformer shared.ImageStreamInformer, osClient osclient.Interface) kquota.Registry {
return image.NewImageQuotaRegistry(isInformer, osClient)
}
// NewAllResourceQuotaRegistry returns a registry object that knows how to evaluate all resources
func NewAllResourceQuotaRegistry(informerFactory shared.InformerFactory, osClient osclient.Interface, kubeClientSet clientset.Interface) kquota.Registry {
return kquota.UnionRegistry{install.NewRegistry(kubeClientSet, informerFactory.KubernetesInformers()), NewOriginQuotaRegistry(informerFactory.ImageStreams(), osClient)}
}
// AllEvaluatedGroupKinds is the list of all group kinds that we evaluate for quotas in openshift and kube
var AllEvaluatedGroupKinds = []unversioned.GroupKind{
kapi.Kind("Pod"),
kapi.Kind("Service"),
kapi.Kind("ReplicationController"),
kapi.Kind("PersistentVolumeClaim"),
kapi.Kind("Secret"),
kapi.Kind("ConfigMap"),
imageapi.Kind("ImageStream"),
imageapi.LegacyKind("ImageStream"),
}