Check agent access rights

As a result of this issue, we want to have an API that would help to show if the agent's access rights work as expected:

  • Agent access rights (as success status)
  • Missing access rights to do X (as severity warning)

We'll need the information available on the getClusterAgent GraphQl query.

There are some concerns raised here: gitlab-org&8149 (comment 964186695)

Implementation guide

  1. The KAS cookie is already created when the user navigates to the agent page.
  2. The requested information should be added to the Integration status section.
  3. Implement connection to the cluster with the KAS cookie and proxy similar to how it's done on the Environments page.
  4. Don't connect to the cluster if the agent is not currently connected.
  5. Check the agent's access rights using Kubernetes can-I API from the frontend cluster-client library.
  6. Add a warning icon to the overall status if the agent lacks access rights.
  7. Add a separate loading icon to the access rights row as getting this information from the cluster might take more time.
  8. Add an error in case the cluster connection wasn't successful.
Edited by Anna Vovchenko