Skip to content

feat(event-exporter): add field selector support for events - #1281

Open
yuhuayang-google wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
yuhuayang-google:fix-1033-event-exporter-field-selector
Open

yuhuayang-google wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
yuhuayang-google:fix-1033-event-exporter-field-selector

Conversation

@yuhuayang-google

Copy link
Copy Markdown

Description

This PR adds support for filtering events using a Kubernetes field selector in event-exporter, addressing #1033.

Changes

  • Added flag -event-field-selector to main.go matching kubectl --field-selector syntax (e.g. type=Warning,involvedObject.kind=Pod).
  • Parsed the selector using k8s.io/apimachinery/pkg/fields.ParseSelector.
  • Propagated fields.Selector through EventWatcherConfig to ListOptions.FieldSelector for both standard List/Watch and streaming List/Watch (streamingListEvents).
  • Added nil safety check to IsFeatureGateEnabled.
  • Added unit tests in event_exporter_test.go and kubernetes/watchers/events/watcher_test.go to verify selector parsing and that List/Watch options accurately pass field and label selectors.
  • Updated README.md options documentation.

Fixes #1033

Add `-event-field-selector` flag to filter Kubernetes events matching
a specified field selector (e.g. `type=Warning,involvedObject.kind=Pod`),
mirroring `kubectl --field-selector` semantics and existing
`-event-label-selector` support.

The field selector is passed to ListOptions across both standard list/watch
and streaming list watch modes.

Fixes GoogleCloudPlatform#1033
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P2] event-exporter: add field selector support for events

1 participant