Skip to content

Commit a5cd15d

Browse files
jrudolphGacko
authored andcommitted
Controller: Fail annotation parsing fast and report errors. (#11740)
1 parent 6ceccbd commit a5cd15d

File tree

1 file changed

+6
-0
lines changed
  • internal/ingress/controller/store

1 file changed

+6
-0
lines changed

internal/ingress/controller/store/store.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ type k8sStore struct {
240240
backendConfigMu *sync.RWMutex
241241

242242
defaultSSLCertificate string
243+
244+
recorder record.EventRecorder
243245
}
244246

245247
// New creates a new object store to be used in the ingress controller.
@@ -279,6 +281,7 @@ func New(
279281
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{
280282
Component: "nginx-ingress-controller",
281283
})
284+
store.recorder = recorder
282285

283286
// k8sStore fulfills resolver.Resolver interface
284287
store.annotations = annotations.NewAnnotationExtractor(store)
@@ -938,6 +941,9 @@ func (s *k8sStore) syncIngress(ing *networkingv1.Ingress) {
938941
klog.Error(err)
939942
return
940943
}
944+
if parsed.Denied != nil {
945+
s.recorder.Eventf(ing, corev1.EventTypeWarning, "AnnotationParsingFailed", fmt.Sprintf("Error parsing annotations: %v", *parsed.Denied))
946+
}
941947
err = s.listers.IngressWithAnnotation.Update(&ingress.Ingress{
942948
Ingress: *copyIng,
943949
ParsedAnnotations: parsed,

0 commit comments

Comments
 (0)