kubexporter icon indicating copy to clipboard operation
kubexporter copied to clipboard

Add field filter option to include

Open pstefka opened this issue 2 years ago • 2 comments

Kindly asking to add kindByField to included config option. This cloud be used to include only resources matching a field filter, e.g. having a set label, something in the line of:

included:
  kindByField:
    *:
      - field: [ metadata.label.component ]
        values: [ 'controller' ]

Seems like a catch all option of "*" available for kindByField, and field nesting might be required for this to work.. Could I help somehow?

pstefka avatar May 15 '23 10:05 pstefka

@pstefka Thank you for your request. Field nesting is supported by the current exclude logic as used in exclude.kindByField

  kindByField:
    Service:
      - field: [ metadata, name ]
        # the value is compared to the string representation of the actual kind value
        values: [ exclude-me-1, exclude-me-2 ]

Includes currently supports kinds. kindByField could be added it should behave the same as currently with kinds, that if includes are defined, all excludes should be ignored.

Would you like to create a merge request?

bakito avatar May 23 '23 21:05 bakito

Unfortunatelly I don't speak GO :-/ wouldn't be sure, it's good ..

pstefka avatar May 29 '23 10:05 pstefka