File: bootstrap.md

package info (click to toggle)
glab 1.53.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,936 kB
  • sloc: sh: 295; makefile: 153; perl: 99; ruby: 68; javascript: 67
file content (110 lines) | stat: -rw-r--r-- 5,860 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
stage: Create
group: Code Review
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
---

<!--
This documentation is auto generated by a script.
Please do not edit this file directly. Run `make gen-docs` instead.
-->

# `glab cluster agent bootstrap`

Bootstrap a GitLab Agent for Kubernetes in a project.

## Synopsis

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. 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.
5. Push the Kubernetes Secret that contains the token to the cluster.
6. Create Flux HelmRepository and HelmRelease resource.
7. Commit and Push the created Flux Helm resources to the manifest path.
8. Trigger Flux reconciliation of GitLab Agent HelmRelease.

```plaintext
glab cluster agent bootstrap agent-name [flags]
```

## Aliases

```plaintext
bs
```

## Examples

```plaintext

# 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" 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

```

## Options

```plaintext
      --create-environment                      Create an Environment for the GitLab Agent. (default true)
      --environment-flux-resource-path string   Flux Resource Path of the Environment for the GitLab Agent. (default "helm.toolkit.fluxcd.io/v2beta1/namespaces/<helm-release-namespace>/helmreleases/<helm-release-name>")
      --environment-name string                 Name of the Environment for the GitLab Agent. (default "<helm-release-namespace>/<helm-release-name>")
      --environment-namespace string            Kubernetes namespace of the Environment for the GitLab Agent. (default "<helm-release-namespace>")
      --flux-source-name string                 Flux source name. (default "flux-system")
      --flux-source-namespace string            Flux source namespace. (default "flux-system")
      --flux-source-type string                 Source type of the flux-system, e.g. git, oci, helm, ... (default "git")
      --gitlab-agent-token-secret-name string   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. (default "gitlab-agent-token")
      --helm-release-filepath string            Filepath within the GitLab Agent project to commit the Flux HelmRelease to. (default "gitlab-agent-helm-release.yaml")
      --helm-release-name string                Name of the Flux HelmRelease manifest. (default "gitlab-agent")
      --helm-release-namespace string           Namespace of the Flux HelmRelease manifest. (default "flux-system")
      --helm-release-target-namespace string    Namespace of the GitLab Agent deployment. (default "gitlab-agent")
      --helm-release-values strings             Local path to values.yaml files
      --helm-release-values-from strings        Kubernetes object reference that contains the values.yaml data key in the format '<kind>/<name>', where kind must be one of: (Secret,ConfigMap)
      --helm-repository-filepath string         Filepath within the GitLab Agent project to commit the Flux HelmRepository to. (default "gitlab-helm-repository.yaml")
      --helm-repository-name string             Name of the Flux HelmRepository manifest. (default "gitlab")
      --helm-repository-namespace string        Namespace of the Flux HelmRepository manifest. (default "flux-system")
  -b, --manifest-branch string                  Branch to commit the Flux Manifests to. (default to the project default branch)
  -p, --manifest-path string                    Location of directory in Git repository for storing the GitLab Agent for Kubernetes Helm resources.
      --no-reconcile                            Do not trigger Flux reconciliation for GitLab Agent for Kubernetes Flux resource.
```

## Options inherited from parent commands

```plaintext
      --help              Show help for this command.
  -R, --repo OWNER/REPO   Select another repository. Can use either OWNER/REPO or `GROUP/NAMESPACE/REPO` format. Also accepts full URL or Git URL.
```