InseeFrLab / InseeFrLab/onyxia-api

Fetching logs fail if pod has more than one container

Open
#425 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
34
Forks
34
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.