Merge pull request #1434 from jcmoraisjr/jm-fix-read-secrets
Fix exec of readSecrets
This commit is contained in:
commit
7d4cd1ba27
2 changed files with 12 additions and 9 deletions
|
@ -238,19 +238,21 @@ func (ic GenericController) GetService(name string) (*apiv1.Service, error) {
|
||||||
// sync collects all the pieces required to assemble the configuration file and
|
// sync collects all the pieces required to assemble the configuration file and
|
||||||
// then sends the content to the backend (OnUpdate) receiving the populated
|
// then sends the content to the backend (OnUpdate) receiving the populated
|
||||||
// template as response reloading the backend if is required.
|
// template as response reloading the backend if is required.
|
||||||
func (ic *GenericController) syncIngress(key interface{}) error {
|
func (ic *GenericController) syncIngress(item interface{}) error {
|
||||||
ic.syncRateLimiter.Accept()
|
ic.syncRateLimiter.Accept()
|
||||||
|
|
||||||
if ic.syncQueue.IsShuttingDown() {
|
if ic.syncQueue.IsShuttingDown() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if name, ok := key.(string); ok {
|
if element, ok := item.(task.Element); ok {
|
||||||
|
if name, ok := element.Key.(string); ok {
|
||||||
if obj, exists, _ := ic.listers.Ingress.GetByKey(name); exists {
|
if obj, exists, _ := ic.listers.Ingress.GetByKey(name); exists {
|
||||||
ing := obj.(*extensions.Ingress)
|
ing := obj.(*extensions.Ingress)
|
||||||
ic.readSecrets(ing)
|
ic.readSecrets(ing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sort ingress rules using the ResourceVersion field
|
// Sort ingress rules using the ResourceVersion field
|
||||||
ings := ic.listers.Ingress.List()
|
ings := ic.listers.Ingress.List()
|
||||||
|
|
|
@ -48,7 +48,8 @@ type Queue struct {
|
||||||
lastSync int64
|
lastSync int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type element struct {
|
// Element represents one item of the queue
|
||||||
|
type Element struct {
|
||||||
Key interface{}
|
Key interface{}
|
||||||
Timestamp int64
|
Timestamp int64
|
||||||
}
|
}
|
||||||
|
@ -72,7 +73,7 @@ func (t *Queue) Enqueue(obj interface{}) {
|
||||||
glog.Errorf("%v", err)
|
glog.Errorf("%v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.queue.Add(element{
|
t.queue.Add(Element{
|
||||||
Key: key,
|
Key: key,
|
||||||
Timestamp: ts,
|
Timestamp: ts,
|
||||||
})
|
})
|
||||||
|
@ -99,7 +100,7 @@ func (t *Queue) worker() {
|
||||||
}
|
}
|
||||||
ts := time.Now().UnixNano()
|
ts := time.Now().UnixNano()
|
||||||
|
|
||||||
item := key.(element)
|
item := key.(Element)
|
||||||
if t.lastSync > item.Timestamp {
|
if t.lastSync > item.Timestamp {
|
||||||
glog.V(3).Infof("skipping %v sync (%v > %v)", item.Key, t.lastSync, item.Timestamp)
|
glog.V(3).Infof("skipping %v sync (%v > %v)", item.Key, t.lastSync, item.Timestamp)
|
||||||
t.queue.Forget(key)
|
t.queue.Forget(key)
|
||||||
|
@ -110,7 +111,7 @@ func (t *Queue) worker() {
|
||||||
glog.V(3).Infof("syncing %v", item.Key)
|
glog.V(3).Infof("syncing %v", item.Key)
|
||||||
if err := t.sync(key); err != nil {
|
if err := t.sync(key); err != nil {
|
||||||
glog.Warningf("requeuing %v, err %v", item.Key, err)
|
glog.Warningf("requeuing %v, err %v", item.Key, err)
|
||||||
t.queue.AddRateLimited(element{
|
t.queue.AddRateLimited(Element{
|
||||||
Key: item.Key,
|
Key: item.Key,
|
||||||
Timestamp: time.Now().UnixNano(),
|
Timestamp: time.Now().UnixNano(),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue