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
--commit-author-email="noreply@glab.gitlab.com"
    The Git commit author email to use. Conflicts with the --use-api-commit-author flag.

--commit-author-name="glab"
    The Git commit author name to use. Conflicts with the --use-api-commit-author flag.

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

--create-flux-environment[=true]
    Create an environment for FluxCD. Affects only the environment creation, not the use of Flux itself. Flux 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, like Git, OCI, or 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"
    File path 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. Multiple files can be comma-separated or specified by repeating the flag.

--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). Multiple references can be comma-separated or specified by repeating the flag.

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

--helm-repository-filepath="gitlab-helm-repository.yaml"
    File path 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.

--use-api-commit-author[=false]
    When creating Git commits use the user from the authenticated API request. Conflicts with the --commit-author-name and --commit-author-email flags.

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 the root of the Git project in CWD, and trigger reconciliation
    $ glab cluster agent bootstrap my-agent
    # Bootstrap "my-agent" to "manifests/" of the Git project in CWD, and trigger reconciliation
    # Especially useful when "flux bootstrap gitlab --path manifests/" is 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 the 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
    # Bootstrap "my-agent" and commit with custom user
    $ glab cluster agent bootstrap my-agent --commit-author-name="Tanuki" --commit-author-email="tanuki@example.com"
    # Bootstrap "my-agent" with authenticated API user
    $ glab cluster agent bootstrap my-agent --use-api-commit-author

SEE ALSO
glab-cluster-agent(1)