Skip to content

Commit

Permalink
go/runtime/bundle/manager: Cleanup key manager bundles on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
peternose committed Feb 12, 2025
1 parent b212a81 commit 0fed5e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions .changelog/6062.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/runtime/bundle/manager: Cleanup key manager bundles on startup
11 changes: 4 additions & 7 deletions go/runtime/bundle/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,23 +560,20 @@ func (m *Manager) loadManifests() ([]*ExplodedManifest, error) {
func (m *Manager) cleanOnStartup(manifests, exploded []*ExplodedManifest) ([]*ExplodedManifest, error) {
m.logger.Info("cleaning bundles")

detached := make(map[hash.Hash]struct{})
explodedHashes := make(map[hash.Hash]struct{})
for _, manifest := range exploded {
if manifest.IsDetached() {
detached[manifest.Hash()] = struct{}{}
}
explodedHashes[manifest.Hash()] = struct{}{}
}

shouldKeep := func(manifest *ExplodedManifest) bool {
if _, ok := m.runtimeIDs[manifest.ID]; !ok {
return false
}
if manifest.IsDetached() {
if _, ok := detached[manifest.Hash()]; !ok {
if manifest.IsDetached() || manifest.ID.IsKeyManager() {
if _, ok := explodedHashes[manifest.Hash()]; !ok {
return false
}
}

return true
}

Expand Down

0 comments on commit 0fed5e5

Please sign in to comment.