Repository navigation
Conversation
A Fleet-managed sensor rejects direct configuration, so the metadata put after a paired deploy always failed. Stage pairing as a drop-in and apply it with a second deploy after the metadata is written.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a sensor has both Fleet pairing and deployment metadata, cloud-init deployed the sensor already paired and then applied the metadata with
corelightctl sensor configuration put. A Fleet-managed sensor rejects direct configuration (422 ... managed by Fleet Manager), so the metadata was never applied and the Terraform module/version fields stayed empty.This change applies pairing only after the metadata:
corelightctl.yamlis written withoutsensor.pairing. The pairing settings are staged in/etc/corelight/fleet-pairing.yaml(mode0600).corelightctl sensor deployruns with the sensor unpaired.configuration put(still best-effort)./etc/corelight/corelightctl.yaml.d/01-fleet.yaml, andcorelightctl sensor deployruns again to pair with Fleet.Without deployment metadata, the generated cloud-init is unchanged: pairing stays in
corelightctl.yamland the sensor deploys once.Testing
tests/paired_metadata.tftest.hclnow asserts that pairing is absent fromcorelightctl.yaml, that the staged 0600 drop-in has the full pairing, and the deploy → metadata → drop-in → deploy order. A new case keeps inline pairing without metadata. The updated test fails against the previous template.modules/_shared/config/sensor: 16 passed, 0 failed.just test-unit: no failures.just fmt-checkandtflint --recursivepass.just docs-checkfails only onmodules/_shared/config/fleet/README.md, which also fails onmainand is untouched here.configuration putsucceeded, the sensor re-paired after the second deploy, and Fleet reporteddeployment_metadata.terraform_module.Note: sensors with both pairing and metadata now run
corelightctl sensor deploytwice; the second run took about a minute in testing.