Skip to content

Add k8s dashboard backend

Hunter Stewart requested to merge hustewart-k8s-dashboard-backend into master

Why

See Create a new route and a controller for Kuberne... (#423713 - closed) for more context.

What

  • new route for /-/kubernetes/:agent_id
  • new controller to handle route
  • show action in new controller only returns :ok (for me locally this a blank page if accessed in the browser), but the before actions
    • check the feature flag
    • look up the agent based on the id in the route
    • authorize current_user can read the agent using existing policy
    • set the kas cookie if the authorized and feature flag on

Steps to check locally

Verify with feature flag off

  • keep k8s_dashboard feature flag disabled
  • identify an id of a Clusters::Agent that's authorized for the user you sign in as
  • navigate to https://gdk.test:3443/-/kubernetes/2 (or whatever you local gdk is and id of the agent you found)
  • you should see the 404 page
  • you should not see | _gitlab_kas | in the cookies in the browser developer tools

Verify with feature flag on

  • enable feature flag k8s_dashboard
  • navigate to https://gdk.test:3443/-/kubernetes/2 (or whatever you local gdk is and id of the agent you found)
  • you should see a blank page
  • you should see | _gitlab_kas | in the Response cookies in the browser developer tools
Edited by Hunter Stewart

Merge request reports