Repository navigation
fix: add ec2:DescribeVolumes to spored's self-management baseline policy - #519
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
LookupAndTagEBSCost needs DescribeInstances (block-device mappings) and DescribeVolumes (actual sizes/types) to price EBS storage, but the baseline policy spored#502 attaches to every instance only granted the first. The EBS cost lookup always 403'd, spawn:ebs-hourly-cost was never written, and spored status's storage line stayed "not yet available" forever. Also make the un-measured 0.003 fallback distinguishable from a real measurement: LookupAndTagEBSCost now returns (cost float64, measured bool) instead of a bare float64, so the caller's log line no longer states an unmeasured constant as if it were data. Fixes #517
scttfrdmn
force-pushed
the
fix/517-ebs-describevolumes-permission
branch
from
August 19, 2026 05:01
737f067 to
5d63edb
Compare
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
sporedSelfManagementStatements()grantedec2:DescribeTags+ec2:DescribeInstancesbut notec2:DescribeVolumes.LookupAndTagEBSCost(pkg/provider/ec2.go) needs bothDescribeInstances(block-device mappings) andDescribeVolumes(actual sizes/types) to price EBS storage — the second call always 403'd. Since CRITICAL:launch --iam-policy-fileomits the spored baseline policy — TTL, --on-complete and --pre-stop all silently dead (the #406 fix covers 2 of 3 role paths) #502 madespored-baseline-policyapply to every spawn-launched instance, the EBS cost lookup could never succeed in the default configuration,spawn:ebs-hourly-costwas never written, andspored status's storage-cost line stayed permanently "not yet available".ec2:DescribeVolumesto the same statement (alreadyResource: "*"— Describe APIs don't support resource-level scoping, so this widens nothing that wasn't already wide).0.003fallback constant was logged in the exact same shape as a real measurement (EBS hourly cost: $0.0030/hr), so a reader comparing that log line againstspored status's "not yet available" storage line for the same instance got contradictory answers.Provider.LookupAndTagEBSCostnow returns(cost float64, measured bool)instead of a barefloat64; the caller inpkg/agent/agent.goonly logs a rate whenmeasuredis true, otherwise logs an explicit "unknown (lookup failed or denied)" line.Test plan
go build ./...go vet ./...go test ./pkg/provider/... ./pkg/agent/... ./pkg/aws/...TestEC2Provider_LookupAndTagEBSCost_CachedTagIsMeasured,TestEC2Provider_LookupAndTagEBSCost_NoVolumesIsNotMeasuredTestSporedBaselinePolicyDocto assertec2:DescribeVolumesis present — verified it fails without theiam.gochange and passes with it.golangci-lint run ./pkg/provider/... ./pkg/agent/... ./pkg/aws/...— no new findings on touched lines (pre-existing findings elsewhere in these packages are unchanged)[Unreleased]Fixes #517