defenseunicorns/kubernetes-fluent-client

Support for getting logs from pods

Closed this issue ยท 2 comments

When using KFC within tests a common operation you might want to check are what logs a pod has - this could be done in pathbuilder by adding a value that adds /log to the end of the GET request - https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#read-log-pod-v1-core - this could either be exposed as a .Logs() function that would assume / only work for pods or another filter-like thing that would tell a Get() to return logs.

I'm going to go ahead and self-assign this one after leaving it open in the community channel for a few days. (if there are no objections)

Instead of changing the existing GET interface to also return a .Log() function from a pod, we could open it up to get logs from all things with podSelectors, like sts/ds/svc/deploy/rs/job & cj(maybe) also making it more kubectl like, ie( kubectl logs deploy/some-deploy -n some-ns).

The way to do this is to infer the kind of the model , then get the logs from the pods that meet the podSelector. This would even allow us to get allPods logs even by default if the object has podLabels and include a prefix for each pod.

@Racer159 @jeff-mccoy What are your thoughts on this?

๐ŸŽ‰ This issue has been resolved in version 2.4.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€