1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-17 15:40:07 +00:00

go mod changes

This commit is contained in:
Murali Paluru
2019-10-30 12:48:32 -07:00
committed by Alena Prokharchyk
parent a1ec25375c
commit 995fa72fe2
54 changed files with 7629 additions and 356 deletions

View File

@@ -364,7 +364,8 @@ func (s *sharedIndexInformer) AddIndexers(indexers Indexers) error {
defer s.startedLock.Unlock()
if s.started {
return fmt.Errorf("informer has already started")
s.blockDeltas.Lock()
defer s.blockDeltas.Unlock()
}
return s.indexer.AddIndexers(indexers)

View File

@@ -125,6 +125,11 @@ func (c *threadSafeMap) Replace(items map[string]interface{}, resourceVersion st
c.items = items
// rebuild any index
c.rebuildIndices()
}
// rebuildIndices rebuilds all indices for the current set c.items. Assumes that c.lock is held by caller
func (c *threadSafeMap) rebuildIndices() {
c.indices = Indices{}
for key, item := range c.items {
c.updateIndices(nil, item, key)
@@ -229,10 +234,6 @@ func (c *threadSafeMap) AddIndexers(newIndexers Indexers) error {
c.lock.Lock()
defer c.lock.Unlock()
if len(c.items) > 0 {
return fmt.Errorf("cannot add indexers to running index")
}
oldKeys := sets.StringKeySet(c.indexers)
newKeys := sets.StringKeySet(newIndexers)
@@ -243,6 +244,11 @@ func (c *threadSafeMap) AddIndexers(newIndexers Indexers) error {
for k, v := range newIndexers {
c.indexers[k] = v
}
if len(c.items) > 0 {
c.rebuildIndices()
}
return nil
}

View File

@@ -74,6 +74,10 @@ type tokenSourceTransport struct {
ort http.RoundTripper
}
func (tst *tokenSourceTransport) WrappedRoundTripper() http.RoundTripper {
return tst.base
}
func (tst *tokenSourceTransport) RoundTrip(req *http.Request) (*http.Response, error) {
// This is to allow --token to override other bearer token providers.
if req.Header.Get("Authorization") != "" {