fleet/pkg/spec
Scott Gress 40e91c0ece
Allow hosts key to be empty for manual labels (#42022)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #41672 

# Details

Updates GitOps label functionality so that omitting the `hosts:` key
under a manual label will _not_ clear hosts from that label, but will
instead preserve the existing membership. This allows users to manage
manual hosts with an external system (via the labels API), while still
managing the labels themselves in GitOps.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [X] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

## Testing

- [X] Added/updated automated tests
- [X] QA'd all new/changed functionality manually
  - [X] verified that you can still add a manual label with `hosts:`
- [X] verified that leaving `hosts:` off a manual label doesn't change
the host assignment
- [X] verified that putting `hosts:` with no value on a manual label
clears the hosts
  - [X] verified that you can still add a dynamic label
  - [X] verified that generate-gitops still exports manual hosts

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-20 10:36:14 -05:00
..
testdata Add aliases for more multi-platform setup experience fields (#41599) 2026-03-13 15:17:05 -05:00
gitops.go Allow hosts key to be empty for manual labels (#42022) 2026-03-20 10:36:14 -05:00
gitops_deprecations.go Add more deprecation logs and mute by default (#40305) 2026-02-23 23:09:08 -06:00
gitops_test.go Allow hosts key to be empty for manual labels (#42022) 2026-03-20 10:36:14 -05:00
gitops_validate.go Feat/31914 patch policy (#41518) 2026-03-13 16:47:09 -04:00
gitops_validate_test.go Feat/31914 patch policy (#41518) 2026-03-13 16:47:09 -04:00
spec.go Allow hosts key to be empty for manual labels (#42022) 2026-03-20 10:36:14 -05:00
spec_test.go Add aliases for macos fields (#40959) 2026-03-05 18:08:54 -06:00