Skip to content

Namespace fallback for annotation logs #492

@tun0

Description

@tun0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions