Skip to content

Fix error when displaying pod logs of pod that has multiple containers

Reuben Pereira requested to merge 12819-fix-pod-logs-bug into master

What does this MR do?

When a pod contains more than one container, the container name has to be included in the pod_logs API call to Kubernetes otherwise the Kubernetes API returns 400.

Currently, the logs API does not accept a container_name parameter. So, any request for logs of a pod which has more than one container fails.

This MR makes the following changes:

  • Changes the logs API to accept a container_name parameter.

  • Adds a feature flag called pod_logs_reactive_cache. When the feature flag is enabled:

    • Reactive caching is used when making calls to the Kubernetes API.
    • If container_name is not specified, it will return the logs of the first container in the pod.

Once we change the frontend to poll the logs API (in order to support reactive caching), we can remove the feature flag.

Issue: #12819 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports