1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-12 21:33:21 +00:00

Update vendor

This commit is contained in:
Darren Shepherd
2020-08-20 10:30:53 -07:00
parent b715968cde
commit 5fb9a7f204
254 changed files with 5131 additions and 23547 deletions

View File

@@ -96,6 +96,12 @@ func (d *deferredListWatcher) run(stopCh <-chan struct{}) {
d.lw = &cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
d.tweakList(&options)
// If ResourceVersion is set to 0 then the Limit is ignored on the API side. Usually
// that's not a problem, but with very large counts of a single object type the client will
// hit it's connection timeout
if options.ResourceVersion == "0" {
options.ResourceVersion = ""
}
listObj := d.listObj.DeepCopyObject()
err := d.client.List(ctx, d.namespace, listObj, options)
return listObj, err

View File

@@ -119,7 +119,6 @@ func (c *controller) run(workers int, stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer func() {
c.workqueue.ShutDown()
c.workqueue = nil
}()
// Start the informer factories to begin populating the informer caches

View File

@@ -6,6 +6,7 @@ import (
"github.com/rancher/lasso/pkg/cache"
"github.com/rancher/lasso/pkg/client"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest"
@@ -82,6 +83,8 @@ func (s *sharedControllerFactory) Start(ctx context.Context, defaultWorkers int)
return err
}
s.sharedCacheFactory.WaitForCacheSync(ctx)
for gvr, controller := range s.controllers {
w, err := s.getWorkers(gvr, defaultWorkers)
if err != nil {
@@ -180,7 +183,9 @@ func (s *sharedControllerFactory) ForResourceKind(gvr schema.GroupVersionResourc
func (s *sharedControllerFactory) getWorkers(gvr schema.GroupVersionResource, workers int) (int, error) {
gvk, err := s.sharedCacheFactory.SharedClientFactory().GVKForResource(gvr)
if err != nil {
if meta.IsNoMatchError(err) {
return workers, nil
} else if err != nil {
return 0, err
}

View File

@@ -13,16 +13,24 @@ func GetNonInteractiveClientConfig(kubeConfig string) clientcmd.ClientConfig {
return GetClientConfig(kubeConfig, nil)
}
func GetNonInteractiveClientConfigWithContext(kubeConfig, currentContext string) clientcmd.ClientConfig {
return GetClientConfigWithContext(kubeConfig, currentContext, nil)
}
func GetInteractiveClientConfig(kubeConfig string) clientcmd.ClientConfig {
return GetClientConfig(kubeConfig, os.Stdin)
}
func GetClientConfig(kubeConfig string, reader io.Reader) clientcmd.ClientConfig {
func GetClientConfigWithContext(kubeConfig, currentContext string, reader io.Reader) clientcmd.ClientConfig {
loadingRules := GetLoadingRules(kubeConfig)
overrides := &clientcmd.ConfigOverrides{ClusterDefaults: clientcmd.ClusterDefaults}
overrides := &clientcmd.ConfigOverrides{ClusterDefaults: clientcmd.ClusterDefaults, CurrentContext: currentContext}
return clientcmd.NewInteractiveDeferredLoadingClientConfig(loadingRules, overrides, reader)
}
func GetClientConfig(kubeConfig string, reader io.Reader) clientcmd.ClientConfig {
return GetClientConfigWithContext(kubeConfig, "", reader)
}
func GetLoadingRules(kubeConfig string) *clientcmd.ClientConfigLoadingRules {
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
loadingRules.DefaultClientConfig = &clientcmd.DefaultClientConfig