Skip to content

Commit

Permalink
alternatively just create an event if an annotation was denied
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudolph authored and k8s-infra-cherrypick-robot committed Nov 20, 2024
1 parent c33fc94 commit 1d41607
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions internal/ingress/annotations/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,15 @@ func (e Extractor) Extract(ing *networking.Ingress) (*Ingress, error) {
val = nil
}

return nil, err
/* _, alreadyDenied := data[DeniedKeyName]
_, alreadyDenied := data[DeniedKeyName]
if !alreadyDenied {
errString := err.Error()
data[DeniedKeyName] = &errString
klog.ErrorS(err, "error reading Ingress annotation", "name", name, "ingress", klog.KObj(ing))
continue
}

klog.V(5).ErrorS(err, "error reading Ingress annotation", "name", name, "ingress", klog.KObj(ing)) */
klog.V(5).ErrorS(err, "error reading Ingress annotation", "name", name, "ingress", klog.KObj(ing))
}

if val != nil {
Expand Down
4 changes: 3 additions & 1 deletion internal/ingress/controller/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -938,10 +938,12 @@ func (s *k8sStore) syncIngress(ing *networkingv1.Ingress) {

parsed, err := s.annotations.Extract(ing)
if err != nil {
s.recorder.Eventf(ing, corev1.EventTypeWarning, "AnnotationParsingFailed", fmt.Sprintf("Error parsing annotations: %v", err))
klog.Error(err)
return
}
if parsed.Denied != nil {
s.recorder.Eventf(ing, corev1.EventTypeWarning, "AnnotationParsingFailed", fmt.Sprintf("Error parsing annotations: %v", *parsed.Denied))
}
err = s.listers.IngressWithAnnotation.Update(&ingress.Ingress{
Ingress: *copyIng,
ParsedAnnotations: parsed,
Expand Down

0 comments on commit 1d41607

Please sign in to comment.