Include missing secrets in secretIngressMap
Update secretIngressMap independently from stored annotations, which may miss some secret references.
This commit is contained in:
parent
fec3ddc6cc
commit
c786f55336
1 changed files with 11 additions and 13 deletions
|
@ -352,7 +352,6 @@ func New(checkOCSP bool,
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
store.extractAnnotations(ing)
|
store.extractAnnotations(ing)
|
||||||
store.updateSecretIngressMap(ing)
|
|
||||||
store.syncSecrets(ing)
|
store.syncSecrets(ing)
|
||||||
}
|
}
|
||||||
updateCh.In() <- Event{
|
updateCh.In() <- Event{
|
||||||
|
@ -380,7 +379,6 @@ func New(checkOCSP bool,
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
store.extractAnnotations(ing)
|
store.extractAnnotations(ing)
|
||||||
store.updateSecretIngressMap(ing)
|
|
||||||
store.syncSecrets(ing)
|
store.syncSecrets(ing)
|
||||||
}
|
}
|
||||||
updateCh.In() <- Event{
|
updateCh.In() <- Event{
|
||||||
|
@ -420,7 +418,6 @@ func New(checkOCSP bool,
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
store.extractAnnotations(ing)
|
store.extractAnnotations(ing)
|
||||||
store.updateSecretIngressMap(ing)
|
|
||||||
}
|
}
|
||||||
updateCh.In() <- Event{
|
updateCh.In() <- Event{
|
||||||
Type: DeleteEvent,
|
Type: DeleteEvent,
|
||||||
|
@ -533,18 +530,19 @@ func (s *k8sStore) updateSecretIngressMap(ing *extensions.Ingress) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
anns, err := s.GetIngressAnnotations(ing)
|
// We can not rely on cached ingress annotations because these are
|
||||||
if err != nil {
|
// discarded when the referenced secret does not exist in the local
|
||||||
glog.Errorf("Error reading Ingress annotations: %v", err)
|
// store. As a result, adding a secret *after* the ingress(es) which
|
||||||
return
|
// references it would not trigger a resync of that secret.
|
||||||
}
|
|
||||||
|
|
||||||
secretAnnotations := []string{
|
secretAnnotations := []string{
|
||||||
anns.BasicDigestAuth.Secret,
|
"auth-secret",
|
||||||
anns.CertificateAuth.Secret,
|
"auth-tls-secret",
|
||||||
}
|
}
|
||||||
|
for _, ann := range secretAnnotations {
|
||||||
for _, secrName := range secretAnnotations {
|
secrName, err := parser.GetStringAnnotation(ann, ing)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if secrName != "" {
|
if secrName != "" {
|
||||||
secrKey := fmt.Sprintf("%v/%v", ing.Namespace, secrName)
|
secrKey := fmt.Sprintf("%v/%v", ing.Namespace, secrName)
|
||||||
refSecrets = append(refSecrets, secrKey)
|
refSecrets = append(refSecrets, secrKey)
|
||||||
|
|
Loading…
Reference in a new issue