diff --git a/pkg/cmd/server/kubernetes/master/master_config_test.go b/pkg/cmd/server/kubernetes/master/master_config_test.go index 9791fe2d730a..1f8048b4f35e 100644 --- a/pkg/cmd/server/kubernetes/master/master_config_test.go +++ b/pkg/cmd/server/kubernetes/master/master_config_test.go @@ -321,17 +321,7 @@ func TestCMServerDefaults(t *testing.T) { ConcurrentGCSyncs: 20, EnableGarbageCollector: true, GCIgnoredResources: []componentconfig.GroupResource{ - {Group: "extensions", Resource: "replicationcontrollers"}, - {Group: "", Resource: "bindings"}, - {Group: "", Resource: "componentstatuses"}, {Group: "", Resource: "events"}, - {Group: "authentication.k8s.io", Resource: "tokenreviews"}, - {Group: "authorization.k8s.io", Resource: "subjectaccessreviews"}, - {Group: "authorization.k8s.io", Resource: "selfsubjectaccessreviews"}, - {Group: "authorization.k8s.io", Resource: "localsubjectaccessreviews"}, - {Group: "authorization.k8s.io", Resource: "selfsubjectrulesreviews"}, - {Group: "apiregistration.k8s.io", Resource: "apiservices"}, - {Group: "apiextensions.k8s.io", Resource: "customresourcedefinitions"}, }, }, HPAController: &cmoptions.HPAControllerOptions{ diff --git a/pkg/quota/admission/clusterresourcequota/admission.go b/pkg/quota/admission/clusterresourcequota/admission.go index 7ca0debf638a..f6cd1f00c783 100644 --- a/pkg/quota/admission/clusterresourcequota/admission.go +++ b/pkg/quota/admission/clusterresourcequota/admission.go @@ -7,8 +7,10 @@ import ( "sync" "time" + "k8s.io/apimachinery/pkg/runtime/schema" utilwait "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apiserver/pkg/admission" + "k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle" kapi "k8s.io/kubernetes/pkg/apis/core" kinternalinformers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion" kcorelisters "k8s.io/kubernetes/pkg/client/listers/core/internalversion" @@ -94,7 +96,7 @@ func (q *clusterQuotaAdmission) Admit(a admission.Attributes) (err error) { q.init.Do(func() { clusterQuotaAccessor := newQuotaAccessor(q.clusterQuotaLister, q.namespaceLister, q.clusterQuotaClient, q.clusterQuotaMapper) - q.evaluator = resourcequota.NewQuotaEvaluator(clusterQuotaAccessor, install.DefaultIgnoredResources(), q.registry, q.lockAquisition, &resourcequotaapi.Configuration{}, numEvaluatorThreads, utilwait.NeverStop) + q.evaluator = resourcequota.NewQuotaEvaluator(clusterQuotaAccessor, ignoredResources, q.registry, q.lockAquisition, &resourcequotaapi.Configuration{}, numEvaluatorThreads, utilwait.NeverStop) }) return q.evaluator.Evaluate(a) @@ -174,3 +176,18 @@ type ByName []kapi.ResourceQuota func (v ByName) Len() int { return len(v) } func (v ByName) Swap(i, j int) { v[i], v[j] = v[j], v[i] } func (v ByName) Less(i, j int) bool { return v[i].Name < v[j].Name } + +// ignoredResources is the set of resources that clusterquota ignores. It's larger because we have to ignore requests +// that the namespace lifecycle plugin ignores. This is because of the need to have a matching namespace in order to be sure +// that the cache is current enough to have mapped the CRQ to the namespaces. Normal RQ doesn't have that requirement. +var ignoredResources = map[schema.GroupResource]struct{}{} + +func init() { + for k, _ := range install.DefaultIgnoredResources() { + ignoredResources[k] = struct{}{} + } + for k, _ := range lifecycle.AccessReviewResources() { + ignoredResources[k] = struct{}{} + } + +} diff --git a/test/integration/oauth_serviceaccount_client_events_test.go b/test/integration/oauth_serviceaccount_client_events_test.go index 3a5f74b48b76..980c1b5cca2f 100644 --- a/test/integration/oauth_serviceaccount_client_events_test.go +++ b/test/integration/oauth_serviceaccount_client_events_test.go @@ -87,7 +87,7 @@ func TestOAuthServiceAccountClientEvent(t *testing.T) { annotationPrefix: saoauth.OAuthRedirectModelAnnotationReferencePrefix + "1", annotation: `{"kind":"foo","apiVersion":"oauth.openshift.io/v1","metadata":{"creationTimestamp":null},"reference":{"group":"foo","kind":"Route","name":"route1"}}`, expectedEventReason: "NoSAOAuthRedirectURIs", - expectedEventMsg: `[no kind "foo" is registered for version "oauth.openshift.io/v1", system:serviceaccount:` + projectName + ":" + saName + " has no redirectURIs; set serviceaccounts.openshift.io/oauth-redirecturi.= or create a dynamic URI using serviceaccounts.openshift.io/oauth-redirectreference.=]", + expectedEventMsg: `[no kind "foo" is registered for version "oauth.openshift.io/v1" in scheme "github.com/openshift/origin/pkg/serviceaccounts/oauthclient/oauthclientregistry.go:54", system:serviceaccount:` + projectName + ":" + saName + " has no redirectURIs; set serviceaccounts.openshift.io/oauth-redirecturi.= or create a dynamic URI using serviceaccounts.openshift.io/oauth-redirectreference.=]", numEvents: 1, expectBadRequest: true, },