@@ -27,6 +27,7 @@ import (
27
27
quotainformer "github.com/openshift/origin/pkg/quota/generated/informers/internalversion/quota/internalversion"
28
28
quotatypedclient "github.com/openshift/origin/pkg/quota/generated/internalclientset/typed/quota/internalversion"
29
29
quotalister "github.com/openshift/origin/pkg/quota/generated/listers/quota/internalversion"
30
+ "k8s.io/client-go/discovery"
30
31
)
31
32
32
33
type ClusterQuotaReconcilationControllerOptions struct {
@@ -107,11 +108,14 @@ func NewClusterQuotaReconcilationController(options ClusterQuotaReconcilationCon
107
108
108
109
c .quotaMonitor = qm
109
110
110
- // do initial quota monitor setup
111
+ // do initial quota monitor setup. If we have a discovery failure here, it's ok. We'll discover more resources when a later sync happens.
111
112
resources , err := resourcequota .GetQuotableResources (options .DiscoveryFunc )
112
- if err != nil {
113
+ if discovery .IsGroupDiscoveryFailedError (err ) {
114
+ utilruntime .HandleError (fmt .Errorf ("initial discovery check failure, continuing and counting on future sync update: %v" , err ))
115
+ } else if err != nil {
113
116
return nil , err
114
117
}
118
+
115
119
if err = qm .SyncMonitors (resources ); err != nil {
116
120
utilruntime .HandleError (fmt .Errorf ("initial monitor sync has error: %v" , err ))
117
121
}
@@ -157,7 +161,16 @@ func (c *ClusterQuotaReconcilationController) Sync(discoveryFunc resourcequota.N
157
161
newResources , err := resourcequota .GetQuotableResources (discoveryFunc )
158
162
if err != nil {
159
163
utilruntime .HandleError (err )
160
- return
164
+
165
+ if discovery .IsGroupDiscoveryFailedError (err ) && len (newResources ) > 0 {
166
+ // In partial discovery cases, don't remove any existing informers, just add new ones
167
+ for k , v := range oldResources {
168
+ newResources [k ] = v
169
+ }
170
+ } else {
171
+ // short circuit in non-discovery error cases or if discovery returned zero resources
172
+ return
173
+ }
161
174
}
162
175
163
176
// Decide whether discovery has reported a change.
0 commit comments