Skip to content

feat: cluster agent bootstrap command

Description

This change set introduces a new glab cluster agent bootstrap command which can be used as a complement to flux bootstrap to setup the GitLab Agent for Kubernetes with FluxCD.

Related Issues

Resolves gitlab#473987 (closed)

How has this been tested?

  1. Start with an existing project (e.g. root/glab-bootstrap in GDK (gdk.test:8080))
  2. A Kubernetes cluster (e.g. kind create cluster --name=glab-bootstrap)
  3. (optional, but required for reconciliation to work) Bootstrap Flux (e.g. flux bootstrap gitlab --owner=root --repository=glab-bootstrap --deploy-token-auth --hostname=gdk.test:8080) (you probably need to set --ca-cert to your GDK cert)
  4. Use the new glab command to bootstrap an agent (see command examples in the help page) (e.g. GITLAB_HOST=https://gdk.test:8080 GITLAB_TOKEN=$GDK_GITLAB_TOKEN make run run='-R root/glab-bootstrap cluster agent bootstrap bootstrapped-agent')

A successful output looks something like this:

Registering Agent ... [OK]
Creating Agent Token ... [OK]
Creating Kubernetes Secret with Agent Token ... [OK]
Creating Flux Helm Resources ... [OK]
Syncing Flux Helm Resources ... [OK]
Reconciling Flux Helm Resources ... Output from flux command:
► annotating GitRepository flux-system in flux-system namespace
✔ GitRepository annotated
◎ waiting for GitRepository reconciliation
✔ fetched revision main@sha1:54d68dbd88aa02e5f8a7ccb4035bcc133ee14ed9
► annotating HelmRepository gitlab in flux-system namespace
✔ HelmRepository annotated
◎ waiting for HelmRepository reconciliation
✔ fetched revision sha256:bbf8f942c7945efb66101a4dc0cbc88d2c4cfcf39eeed9f00186e83df5e04e3a
► annotating HelmChart flux-system-gitlab-agent in flux-system namespace
✔ HelmChart annotated
◎ waiting for HelmChart reconciliation
✔ fetched revision 2.6.2
► annotating HelmRelease gitlab-agent in flux-system namespace
✔ HelmRelease annotated
◎ waiting for HelmRelease reconciliation
✔ applied revision 2.6.2
Successfully bootstrapped the GitLab Agent

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap
Edited by Timo Furrer

Merge request reports

Loading