Only adopt Reloader override dir when trigger file exists#71
Merged
Conversation
Reloader.FS() switched to the override directory whenever it merely existed, so an empty or partially-written leftover (e.g. a stale /tmp/hub/resourceeditors) would silently shadow the embedded FS and load nothing. Require the trigger file — the same readiness signal used for hot-reload — before adopting the override directory. Also guard against every os.Stat error instead of only IsNotExist, avoiding a nil FileInfo dereference on errors such as permission denied. Signed-off-by: Tamal Saha <tamal@appscode.com>
tamalsaha
added a commit
to appscode-cloud/installer
that referenced
this pull request
Jul 13, 2026
image-packer embeds the resource-metadata hubs, but the reloader used by kmodules.xyz/resource-metadata shadows the embedded copies with /tmp/hub/<hub> when those directories exist. A stale or empty leftover there makes image-packer load nothing and emit a broken catalog, so remove /tmp/hub before running. The underlying reloader flaw is fixed upstream in gomodules.xyz/x (gomodules/x#71); this guards catalog generation until that lands and re-vendors. Signed-off-by: Tamal Saha <tamal@appscode.com>
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.
Problem
Reloader.FS()switched to the override directory (e.g./tmp/hub/resourceeditors) whenever that directory merely existed, regardless of whether it had been populated. A stale or empty leftover directory would therefore silently shadow the embedded FS, causing the loader to walk an empty tree and load nothing.This surfaced downstream:
image-packer list(viakmodules.xyz/resource-metadata's embeddedresourceeditorshub) loaded zero editors when a leftover/tmp/hub/resourceeditorswas present, producing a broken catalog.Fix
Require the
triggerfile — the same readiness signal already used to drive hot-reload — before adopting the override directory. An empty or partially-written directory no longer shadows the embedded FS.Also guard against every
os.Staterror instead of onlyIsNotExist, avoiding a nilFileInfodereference on errors such as permission denied.Since the trigger file is the reload signal across all hubs (
resourceeditors,resourcedescriptors,clusterprofiles), an override dir populated without it would never dynamically reload anyway, so requiring it does not regress any real use.