Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for namespace label selectors #2500

Open
mpreu opened this issue May 16, 2024 · 5 comments
Open

Support for namespace label selectors #2500

mpreu opened this issue May 16, 2024 · 5 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@mpreu
Copy link

mpreu commented May 16, 2024

Hi,

at the moment, the ClusterLogForwarder API can only handle log selection by static namespaces or pod labels. It would be nice if label selectors can be supported for namespaces as well. This would enable much easier log selection when multiple namespaces do not share a common glob expression.

@jcantrill
Copy link
Contributor

jcantrill commented May 17, 2024

Does kubernetes support listing pods by namespace labels? I've never tried. If not then it makes it much more difficult to support this request.

Also, are you expressing this limitation with the latest release which includes the ability to provide namespace and container globs?

@mpreu
Copy link
Author

mpreu commented May 17, 2024

Hi,

I do not think it is supported. But is listing pods by namespace label really necessary as it would just avoid one additional filtering step?

I assume from the question, the current code just lets vector find the correct targets without much pre-processing?

I am aware of the latest version and the globbing feature. While this is useful for some situations, label selection is more flexible and seems in-line with the already implemented API.

In my use case, I have a lot of namespaces I would want to select for log-forwarding, regardless of the applications in them. As they do not have a common naming scheme, globbing is not really helping me here. But I have easier access to the namespace labels (and their modification to fit the use-case).

@jcantrill
Copy link
Contributor

I assume from the question, the current code just lets vector find the correct targets without much pre-processing?

Currently vector essentially is capable of doing the equivalent of oc get -l which becomes the list of pods from which it reads logs. We couple this with a file glob to further filter out by namespace based on what is spec'd; those files simply are not read. This is the most efficient.

Looking at the available config, it may be possible to accomplish this using this setting. This will require investigation.

Consider trying it yourself by:

  • setting the ClusterLogging.spec.managementState to "Unmanaged'
  • Extracting the config secret
  • Adding the field to the toml
  • Updating the secret
  • restarting the pods with 'oc delete -lcomponent=collector'

@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 22, 2024
@openshift-bot
Copy link
Contributor

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

3 participants