fluxcd / notification-controller

The GitOps Toolkit event forwarded and notification dispatcher

Home Page:https://fluxcd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Namespace fallback for annotation logs

tun0 opened this issue · comments

Ref:

for _, resource := range receiver.Spec.Resources {
if err := s.annotate(ctx, resource, receiver.Namespace); err != nil {
logger.Error(err, fmt.Sprintf("unable to annotate resource '%s/%s.%s'",
resource.Kind, resource.Name, resource.Namespace))
withErrors = true
} else {
logger.Info(fmt.Sprintf("resource '%s/%s.%s' annotated",
resource.Kind, resource.Name, resource.Namespace))
}
}

Currently my logs are showing like resource '<Kind>/<Name>.' annotated. Note the trailing dot after <Name>. It would be nice to either:

  • Make that dot optional when resource.Namespace isn't defined.
  • Fallback to receiver.Namespace if resource.Namespace isn't defined.