Labels section included twice in YAML files docs (#29859)

Related to:

- #29789

---------

Co-authored-by: Rachael Shaw <r@rachael.wtf>
This commit is contained in:
Marko Lisica
2025-06-13 17:04:42 -05:00
committed by GitHub
co-authored by Rachael Shaw
parent ed8506dd77
commit af2bdf024a
+4 -60
View File
@@ -26,6 +26,10 @@ You may also wish to create specialized API-Only users which may modify configur
## labels
Labels can be specified in your `default.yml` file using inline configuration or references to separate files in your `lib/` folder.
> `labels` is an optional key: if included, existing labels not listed will be deleted. If the `label` key is omitted, existing labels will stay intact. For this reason, enabling [GitOps mode](https://fleetdm.com/learn-more-about/ui-gitops-mode) _does not_ restrict creating/editing labels via the UI.
> Any labels referenced in other sections (like [policies](https://fleetdm.com/docs/configuration/yaml-files#policies), [queries](https://fleetdm.com/docs/configuration/yaml-files#queries) or [software](https://fleetdm.com/docs/configuration/yaml-files#software)) _must_ be specified in the `labels` section.
### Options
For possible options, see the parameters for the [Add label API endpoint](https://fleetdm.com/docs/rest-api/rest-api#add-label).
@@ -50,10 +54,6 @@ labels:
- "the-CFOs-computer"
```
The `labels:` key is _optional_ in your YAML configuration:
+ If it is omitted, any existing labels created via the UI or API will remain untouched by GitOps.
+ If included, GitOps will replace all existing labels with those specified in the YAML, and any labels referenced in other sections (like [policies](https://fleetdm.com/docs/configuration/yaml-files#policies), [queries](https://fleetdm.com/docs/configuration/yaml-files#queries) or [software](https://fleetdm.com/docs/configuration/yaml-files#software)) _must_ be specified in the `labels` section.
#### Separate file
`lib/labels-name.labels.yml`
@@ -217,62 +217,6 @@ queries:
- Customer Support
```
## labels
Labels can be specified inline in your `default.yml` file. They can also be specified in separate files in your `lib/` folder.
> `labels` is an optional key: if included, existing labels not listed will be deleted. If the `label` key is omitted, existing labels will stay intact. For this reason, enabling [GitOps mode](https://fleetdm.com/learn-more-about/ui-gitops-mode) _does not_ restrict creating/editing labels via the UI.
### Options
For possible options, see the parameters for the [Add label API endpoint](https://fleetdm.com/docs/rest-api/rest-api#add-label).
### Example
#### Inline
`default.yml`
```yaml
labels:
# Dynamic label:
- name: Windows Arm
description: Windows hosts that are running on Arm64.
query: "SELECT * FROM os_version WHERE arch LIKE 'ARM%';"
platform: windows
# Manual label
- name: Executive (C-suite) computers
hosts:
- FFHH37NTL8
- F2LYH0KG4Y
- H4D5WYVN0L
```
#### Separate file
`lib/labels-name.labels.yml`
```yaml
# Dynamic label:
- name: Windows Arm
description: Windows hosts that are running on Arm64.
query: "SELECT * FROM os_version WHERE arch LIKE 'ARM%';"
platform: windows
# Manual label
- name: Executive (C-suite) computers
hosts:
- FFHH37NTL8
- F2LYH0KG4Y
- H4D5WYVN0L
```
`default.yml`
```yaml
labels:
- path: ../lib/labels-name.labels.yml
```
## agent_options
Agent options can be specified inline in your `default.yml` file or `teams/team-name.yml` files. They can also be specified in separate files in your `lib/` folder.