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

Fetching logs fail if pod has more than one container #425

Open
johnksv opened this issue May 23, 2024 · 1 comment
Open

Fetching logs fail if pod has more than one container #425

johnksv opened this issue May 23, 2024 · 1 comment

Comments

@johnksv
Copy link
Contributor

johnksv commented May 23, 2024

Expected behaviour: When you in frontend select a pod (to view logs), the logs for the main container should be displayed.

Actual behaviour: Onyxia api crash since container name is not specified, and return a 500 response. This means that the GUI just display a spinner and no logs arrive to the user.
The stack trace below are an example of the stack trace that is produced

Servlet.service() for servlet [dispatcherServlet] in context with path [/api] threw exception [
Request processing failed: io.fabric8.kubernetes.client.KubernetesClientException: 
Failure executing: GET at: https://10.16.0.1:443/api/v1/namespaces/user-ssb/pods/vscode-python-gcsfuse-346384-0/log?pretty=false. 
Message: a container name must be specified for pod vscode-python-gcsfuse-346384-0, 
choose one of: [istio-init istio-proxy gke-gcsfuse-sidecar vscode-python-gcsfuse oauth2-proxy]. 
Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, 
message=a container name must be specified for pod vscode-python-gcsfuse-346384-0, 
choose one of: [istio-init istio-proxy gke-gcsfuse-sidecar vscode-python-gcsfuse oauth2-proxy], metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null,
additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).] with root cause

Suggested fix:

  1. Quick fix: show the logs of the container with the same name as the serivce (vscode-python-gcsfuse).
  2. Ability to select container in GUI. Even though this might be a bit to complex for some users, if sidecars are injected that the user has no knowladge of (e.g. istio, gcsfuse, oauth2-proxy)
@fcomte
Copy link
Contributor

fcomte commented Jun 28, 2024

There is a little work but we are working on it with :

  • fetching all the related pods ( iterrating over ownerReferences and finding in the helm manifest the controller ). Our handling is bad at the moment (annotation look up without perfect assurance )
  • provide all containers names
  • provide a new endpoints for logs of a container in a pod
    @olevitt

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

No branches or pull requests

2 participants