Skip to content

api/7_configure/kubernetes/kubernetes_agent_spec.rb | Configure Kubernetes Agent deploys a K8s manifest file

Full description

Configure Kubernetes Agent deploys a K8s manifest file

GitLab recently introduced a new service to its infrastructure. The GitLab Kubernetes Agent. This service has two components:

  1. GitLab Kubernetes Agent Server (gitlab-kas), installed alongside with GitLab (Omnibus or Chart)
  2. GitLab Kubernetes Agent Server Agent (agentk), installed in the user's Kubernetes cluster

The main idea is that the user is able to use GitLab as a GitOps tool. The user will create a so called "manifest project", wherein, K8s manifests will be provided. Every time this manifest files change gitlab-kas will send the contents of these files to agentk, which will then apply this resources to K8s.

The feature works and will be tested like the following:

  1. gitlab-kas will be already installed together with GitLab via GitLab chart or Omnibus (might not be enabled by default).
  2. The user creates a "manifest configuration project" with k8s resources via API.
  3. The user creates a "agent configuration project". This project contains a file that specifies which projects agentk should be interested in managing via API.
  4. The user uses the GitLab GraphQL API to create a Clusters::Agent, which will be associated to the "agent configuration project", and also an associated Clusters::AgentToken(token) on the database.
  5. agentk is installed in any Kubernetes server configured by the user informing agentk of the token created above. This token is what allows gitlab-kas to trust the communication with agentk. In the test it's done via K3s.
  6. We then verify programmatically that agentk sent a request to gitlab-kas asking to sync the "manifest project" files.

File path

./qa/specs/features/ee/api/7_configure/kubernetes/kubernetes_agent_spec.rb

Edited by João Alexandre Cunha