Include missing secrets in secretIngressMap

Update secretIngressMap independently from stored annotations, which may
miss some secret references.
This commit is contained in:
Antoine Cotten 2018-04-13 10:44:34 +02:00
parent fec3ddc6cc
commit c786f55336
No known key found for this signature in database
GPG key ID: EA06C9A94E2B3EA0

View file

@ -352,7 +352,6 @@ func New(checkOCSP bool,
continue
}
store.extractAnnotations(ing)
store.updateSecretIngressMap(ing)
store.syncSecrets(ing)
}
updateCh.In() <- Event{
@ -380,7 +379,6 @@ func New(checkOCSP bool,
continue
}
store.extractAnnotations(ing)
store.updateSecretIngressMap(ing)
store.syncSecrets(ing)
}
updateCh.In() <- Event{
@ -420,7 +418,6 @@ func New(checkOCSP bool,
continue
}
store.extractAnnotations(ing)
store.updateSecretIngressMap(ing)
}
updateCh.In() <- Event{
Type: DeleteEvent,
@ -533,18 +530,19 @@ func (s *k8sStore) updateSecretIngressMap(ing *extensions.Ingress) {
}
}
anns, err := s.GetIngressAnnotations(ing)
if err != nil {
glog.Errorf("Error reading Ingress annotations: %v", err)
return
}
// We can not rely on cached ingress annotations because these are
// discarded when the referenced secret does not exist in the local
// store. As a result, adding a secret *after* the ingress(es) which
// references it would not trigger a resync of that secret.
secretAnnotations := []string{
anns.BasicDigestAuth.Secret,
anns.CertificateAuth.Secret,
"auth-secret",
"auth-tls-secret",
}
for _, secrName := range secretAnnotations {
for _, ann := range secretAnnotations {
secrName, err := parser.GetStringAnnotation(ann, ing)
if err != nil {
continue
}
if secrName != "" {
secrKey := fmt.Sprintf("%v/%v", ing.Namespace, secrName)
refSecrets = append(refSecrets, secrKey)