Tracking cluster resources managed by GitLab (FREE)
- Introduced in GitLab 14.0.
- Moved from GitLab Premium to GitLab Free in 15.3.
GitLab uses an inventory object to track the resources you deploy to your cluster.
The inventory object is a
ConfigMap that contains a list of controlled objects.
The managed resources use the
Default location of the inventory object
In the agent configuration file, you specify a list of projects. For example:
gitops: manifest_projects: - id: gitlab-org/cluster-integration/gitlab-agent default_namespace: my-ns
The agent creates an inventory object for every item in the
The inventory object is stored in the namespace you specify for
The name and location of the inventory object is based on:
default_namespace. If you don't specify this parameter, the inventory object is stored in the
name, which is the ID of the project with the manifest and the ID of the agent.
The agent cannot locate the existing inventory object if you change
default_namespace parameter or move manifests to another project.
Change the location of the inventory object
You can configure the namespace and the name of the inventory object. This action changes the location of the object in the cluster.
Create an inventory object template, which is a
ConfigMapobject. For example:
apiVersion: v1 kind: ConfigMap metadata: name: unique-name-for-the-inventory namespace: my-project-namespace labels: cli-utils.sigs.k8s.io/inventory-id: unique-name-for-the-inventory
name. Ensure that the
nameis unique so it doesn't conflict with other inventory objects in the same namespace in the future.
Ensure the value for
cli-utils.sigs.k8s.io/inventory-idis unique. This value is used for objects tracked by this inventory object. Their
config.k8s.io/owning-inventoryannotation is set to this value.
The value doesn't have to match the
namebut it's convenient to set them to the same value.
Save the file with the manifest files as a single logical group.
Sometimes your manifest changes affect resources that aren't tracked by the GitLab inventory object.
To change how the agent behaves when it overwrites existing and previously untracked resources,
||The default policy. To be updated, a live object must have the
||Adopt an object if it doesn't have the
||Adopt an object even if it has the