glab(1)

NAME
glab-cluster-agent-bootstrap - Bootstrap a GitLab Agent for Kubernetes in a project.

SYNOPSIS
glab cluster agent bootstrap agent-name [flags]

DESCRIPTION
Bootstrap a GitLab Agent for Kubernetes (agentk) in a project.

The first argument must be the name of the agent.

It requires the kubectl and flux commands to be accessible via $PATH.

This command consists of multiple idempotent steps:

1.  Register the agent with the project.

2.  Configure the agent.

3.  Configure an environment with dashboard for the agent.

4.  Configure an environment with dashboard for FluxCD (if --create-flux-environment).

5.  Create a token for the agent.

    •   If the agent has reached the maximum amount of tokens, the one that has not been used the longest is revoked and a new one is created.

    •   If the agent has not reached the maximum amount of tokens, a new one is created.

6.  Push the Kubernetes Secret that contains the token to the cluster.

7.  Create Flux HelmRepository and HelmRelease resources.

8.  Commit and Push the created Flux Helm resources to the manifest path.

9.  Trigger Flux reconciliation of GitLab Agent HelmRelease (unless --no-reconcile).

OPTIONS
--create-environment[=true]
    Create an Environment for the GitLab Agent.

--create-flux-environment[=true]
    Create an Environment for FluxCD. This only affects the environment creation, not the use of Flux itself which is always required for the bootstrap process.

--environment-flux-resource-path="helm.toolkit.fluxcd.io/v2beta1/namespaces//helmreleases/"
    Flux Resource Path of the Environment for the GitLab Agent.

--environment-name="/"
    Name of the Environment for the GitLab Agent.

--environment-namespace=""
    Kubernetes namespace of the Environment for the GitLab Agent.

--flux-environment-flux-resource-path="kustomize.toolkit.fluxcd.io/v1/namespaces/flux-system/kustomizations/flux-system"
    Flux Resource Path of the Environment for FluxCD.

--flux-environment-name="/"
    Name of the Environment for FluxCD.

--flux-environment-namespace=""
    Kubernetes namespace of the Environment for FluxCD.

--flux-source-name="flux-system"
    Flux source name.

--flux-source-namespace="flux-system"
    Flux source namespace.

--flux-source-type="git"
    Source type of the flux-system, e.g. git, oci, helm, ...

--gitlab-agent-token-secret-name="gitlab-agent-token"
    Name of the Secret where the token for the GitLab Agent is stored. The helm-release-target-namespace is implied for the namespace of the Secret.

--helm-release-filepath="gitlab-agent-helm-release.yaml"
    Filepath within the GitLab Agent project to commit the Flux HelmRelease to.

--helm-release-name="gitlab-agent"
    Name of the Flux HelmRelease manifest.

--helm-release-namespace="flux-system"
    Namespace of the Flux HelmRelease manifest.

--helm-release-target-namespace="gitlab-agent"
    Namespace of the GitLab Agent deployment.

--helm-release-values=[]
    Local path to values.yaml files

--helm-release-values-from=[]
    Kubernetes object reference that contains the values.yaml data key in the format '/', where kind must be one of: (Secret,ConfigMap)

--helm-repository-address="https://charts.gitlab.io"
    Address of the HelmRepository.

--helm-repository-filepath="gitlab-helm-repository.yaml"
    Filepath within the GitLab Agent project to commit the Flux HelmRepository to.

--helm-repository-name="gitlab"
    Name of the Flux HelmRepository manifest.

--helm-repository-namespace="flux-system"
    Namespace of the Flux HelmRepository manifest.

-b, --manifest-branch=""
    Branch to commit the Flux Manifests to. (default to the project default branch)

-p, --manifest-path=""
    Location of directory in Git repository for storing the GitLab Agent for Kubernetes Helm resources.

--no-reconcile[=false]
    Do not trigger Flux reconciliation for GitLab Agent for Kubernetes Flux resource.

OPTIONS INHERITED FROM PARENT COMMANDS
-h, --help[=false]
    Show help for this command.

-R, --repo=""
    Select another repository. Can use either OWNER/REPO or GROUP/NAMESPACE/REPO format. Also accepts full URL or Git URL.

EXAMPLE
    # Bootstrap "my-agent" to root of Git project in CWD and trigger reconciliation
    $ glab cluster agent bootstrap my-agent
    # Bootstrap "my-agent" to "manifests/" of Git project in CWD and trigger reconciliation
    # This is especially useful when "flux bootstrap gitlab --path manifests/" was used.
    # Make sure that the "--path" from the "flux bootstrap gitlab" command matches
    # the "--manifest-path" of the "glab cluster agent bootstrap" command.
    $ glab cluster agent bootstrap my-agent --manifest-path manifests/
    # Bootstrap "my-agent" to "manifests/" of Git project in CWD and do not manually trigger a reconilication
    $ glab cluster agent bootstrap my-agent --manifest-path manifests/ --no-reconcile
    # Bootstrap "my-agent" without configuring an environment
    $ glab cluster agent bootstrap my-agent --create-environment=false
    Bootstrap "my-agent" and configure an environment with custom name and Kubernetes namespace
    - glab cluster agent bootstrap my-agent --environment-name production --environment-namespace default
    Bootstrap "my-agent" without configuring a FluxCD environment
    - glab cluster agent bootstrap my-agent --create-flux-environment=false
    Bootstrap "my-agent" and configure a FluxCD environment with custom name and Kubernetes namespace
    - glab cluster agent bootstrap my-agent --flux-environment-name production-flux --flux-environment-namespace flux-system
    # Bootstrap "my-agent" and pass additional GitLab Helm Chart values from a local file
    $ glab cluster agent bootstrap my-agent --helm-release-values values.yaml
    # Bootstrap "my-agent" and pass additional GitLab Helm Chart values from a Kubernetes ConfigMap
    $ glab cluster agent bootstrap my-agent --helm-release-values-from ConfigMap/agent-config

SEE ALSO
glab-cluster-agent(1)