[8.19](backport #7534) Reconcile orphaned output secrets after agent update failures - #7552
[8.19](backport #7534) Reconcile orphaned output secrets after agent update failures#7552mergify[bot] wants to merge 6 commits into
Conversation
(cherry picked from commit 229f161) # Conflicts: # internal/pkg/policy/policy_output.go # internal/pkg/policy/policy_output_test.go # internal/pkg/server/fleet.go
|
Cherry-pick of 229f161 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lution Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
…ranch The OrphanedOutputSecretReconciler references bulk.DeleteSecret, model.ToRetireAPIKeyIdsItems.SecretID, and secret.ParseSecretReference, which are part of the secrets write/delete feature not yet available in this branch. Since output secrets are also never written in this branch, orphaned secrets cannot occur and the reconciler is not needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…anch Revert the collector types and option machinery introduced by the cherry-pick. Since neither WriteSecret nor DeleteSecret is available in this branch, output secrets are never created or deleted, so all the collector wiring is dead code and triggers lint failures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
TL;DRBuildkite 16061 is failing due to a code bug in Remediation
Investigation detailsRoot CauseClassification: Code bug (compile-time type reference mismatch). In commit This leaves Evidence
(from
type recordingOutputSecretCandidateCollector struct {
candidates []OutputSecretCandidate
}
func (c *recordingOutputSecretCandidateCollector) Add(candidate OutputSecretCandidate) bool {
Verification
Follow-upIf this PR is intentionally being closed/reverted, the minimal fix is to also remove these now-dead test helper references so CI can go green while closing cleanly. What is this? | From workflow: PR Buildkite Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
What is the problem this PR solves?
#7533 prevents an ambiguous
.fleet-agentsupdate failure from deleting a secret that Elasticsearch may already have referenced. The safe failure behavior can leave an orphaned.fleet-secretsdocument when the update truly did not commit.This failure mode was observed under load during a 100k-agent scale test.
How does this PR solve the problem?
Add an out-of-band, candidate-based reconciler:
Candidates intentionally do not survive a Fleet Server restart. A restart during the reconciliation window can therefore leave an orphaned secret, but cannot damage an agent by deleting a referenced secret.
This PR is stacked on and depends on #7533. Its implementation is the second commit (
b3f11ce9). Once #7533 merges, GitHub will remove the shared first commit from this PR's diff.How to test
go test ./internal/pkg/policy ./internal/pkg/gc ./internal/pkg/api ./internal/pkg/servermage test:unitmage check:allcurrently reports the same 58 pre-existing linter findings as #7533 in unrelated files. None are in files changed by this PR.Design Checklist
Checklist
CHANGELOG.mdConfiguration changes are not applicable. Package documentation was updated and the changelog entry is supplied as a fragment.
This is an automatic backport of pull request #7534 done by [Mergify](https://mergify.com).