Skip to content

Add identifiers to K8s api proxy request events

What does this MR do and why?

This MR adds identifiers project and namespace for K8s api proxy request events. These events are populated with user. project, and namespace already in !138607 (merged).

Part of #428008 (closed).

How to set up and validate locally

This MR is about config for events. But if you want to validate this change, this curl request can imitate the request sent by KAS.

$ curl --request POST \
  --url "https://gdk.test:3443/api/v4/internal/kubernetes/agent_events" \
  --header "Gitlab-Kas-Api-Request: <JWT token>" \
  --header "Content-Type: application/json" \
  --data '{
    "events": {
      "k8s_api_proxy_requests_unique_users_via_ci_access": [
        {
          "user_id": 1,
          "project_id": 1
        }
      ]
    }
  }'

To skip authentication with JWT token, comment out here: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/api/helpers/kubernetes/agent_helpers.rb#L10

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Taka Nishida

Merge request reports