Repository navigation
feat: tag the live service spore-host:role=service; keep the reaper's sweeps out of the infra account - #1660
Merged
Merged
Conversation
…r's sweeps out of the infra account Part of spore-host/spore-host#750 (epic spore-host/spore-host#752). Most service resources in the infra account carried only spawn:managed=true, which is also the workload-litter tag, and a litter classifier marked 12 live ones as litter. Every deploy path now adds spore-host:role=service, spore-host:component=<id> and spore-host:deployed-by=<repo path>: - scripts/lib/service-tags.sh: the keys and helpers for the shell deploys - Lambda deploy scripts: function, log group (every deploy), created role - role/table/bucket/API setup scripts: on create, and on re-run where cheap - SAM templates: Function.Tags + PropagateTags, log group, table, event bus - schedules-tables stack tags + template tags; scheduler-handler-role template - CI deployer: adds missing service tags with the spawn:version stamp; the CI role's tag-key allow-list gains the three keys - pkg/staging: a spawn-schedules-<region> bucket is tagged on create The TTL reaper refuses its orphan sweeps in 966362334030 or an unresolved account (GuardTeardown) and never deletes a role=service resource (GuardDelete; the same keep rule in pkg/bucketsweep, instancerole, poolqueue). Gates: TestServiceCreatesCarryTheServiceTags (shell creates), the census's SAM check, TestServiceTagKeysAgree, TestEveryOperatedComponentHasAServiceComponentID. libs bumped to v0.52.0 for the tags constants.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
scttfrdmn
marked this pull request as ready for review
November 16, 2026 21:09
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.
Part of spore-host/spore-host#750 (epic spore-host/spore-host#752). Companion PR: spore-host/spore-host#753 — tofu
default_tags,infra/DEPLOY.md, and the one-offscripts/retag-service-resources.sh.Why
Most service resources in the infra account (966362334030) carry only
spawn:managed=true. Spawn also puts that tag on workload litter, so a litter classifier marked 12 live resources as litter. Every deploy path now adds three more tags, and keeps the existing ones (spawn:managedstays, because the CI role's allow-list relies on it):spore-host:role=servicespore-host:component=<id>spore-host:deployed-by=<repo path of the deploy mechanism>What is tagged, and where
lambda/dashboard-api/deploy.shandscripts/deploy.sh, every deploysetup-dashboard-lambda-role.sh, on create and re-runspawn-user-accounts(setup-user-accounts-table.sh); HTTP API andapi.spore.hostdomain (on create)deploy.sh, every deployspawn-websocket-connections(create, or re-run on an existing table); WS API (on create)deploy.sh, every deployscripts/deploy-custom-dns.sh, every deployscripts/deploy-sweep-orchestrator.shsetup-sweep-orchestrator-lambda-role.shspawn-sweep-orchestration,spawn-availability-stats,spawn-sweeps-us-east-1(merge)scripts/deploy-cost-history-collector.shscripts/deploy-scheduler-handler.shscheduler-handler-role.yamlTagsspawn-schedules-<region>buckets tagged on create bypkg/stagingFunction.Tags+PropagateTagsTagsspawn-pipeline-orchestrationtableFunction.Tags+PropagateTagsTagsscripts/deploylambdasadds any service tag a function lacks, in the sametag-resourcecall asspawn:version. It corrects a wrong role or component, and keeps an existingdeployed-byGitHubActions-spawn-lambda-deployis taggedlambda-deploy-ci, and itsaws:TagKeysallow-list gains the three keysThe shell keys come from
scripts/lib/service-tags.sh. The Go keys come frompkg/servicetags(built on libs v0.52.0tags), and the deployer's fromscripts/deploylambdas/servicetags.go.Infra-account guard (TTL reaper)
lambda/ttl-reaper/serviceguard.gohas two functions:GuardTeardown(accountID string) errorrefuses966362334030(ErrInfraAccount) and an empty ID (ErrAccountUnknown).GuardDelete(accountID, what string, tags map[string]string) errorruns the account check, then refuses anything taggedspore-host:role=service(ErrServiceResource).It is wired in as follows:
GuardTeardownbefore their first call.GuardDelete, before any discovery stamp.pkg/bucketsweep,pkg/instanceroleandpkg/poolqueuegain the same keep rule (KeepService), sospawn cleanupkeeps these resources too.The idle sweep (#1654) does not exist yet. These are the checks it must call.
Gates (each watched failing against a compiling revert)
TestServiceCreatesCarryTheServiceTags: a script that creates a role, table, log group, function, queue, API, domain or stack without--tagsand aSPORE_SERVICE_TAGS_*value fails it. So does a bucket create with nospore_merge_bucket_tagsafter it, alambda tag-resourcewithout the map, or a script that doesn't name itself asdeployed-by. It discovers the scripts itself; only member-account scripts are excluded.make lambda-versionsfails a SAM template whose function lacksspore-host:role: service.TestServiceTagKeysAgreechecks the shell, Go and deployer copies of the keys against each other.TestEveryOperatedComponentHasAServiceComponentIDchecks each operated Lambda against the shell library's component list.To take effect (owner)
scripts/setup-lambda-deploy-ci-role.shbefore the next CI deploy. Until then, the CI role can't write the new keys.spawn schedule createnow also callss3:PutBucketTaggingwhen it creates a bucket. It is best-effort: it warns and does not fail.Gate results
make checksteps 1–6 pass, run from a copy at a path without a space. In the clone itself,test-hermeticfails only because its unquoted-execpath contains a space.check-build-tags, fails here on the base commit as well (local Go 1.27.4). This PR does not cause it.--config=autoon the changed files (0 findings).