Skip to content

Only adopt Reloader override dir when trigger file exists#71

Merged
tamalsaha merged 1 commit into
masterfrom
fix-reloader-override-trigger
Jul 13, 2026
Merged

Only adopt Reloader override dir when trigger file exists#71
tamalsaha merged 1 commit into
masterfrom
fix-reloader-override-trigger

Conversation

@tamalsaha

Copy link
Copy Markdown
Contributor

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 (via kmodules.xyz/resource-metadata's embedded resourceeditors hub) loaded zero editors when a leftover /tmp/hub/resourceeditors was present, producing a broken catalog.

Fix

Require the trigger file — 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.Stat error instead of only IsNotExist, avoiding a nil FileInfo dereference 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.

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
tamalsaha merged commit 2bbba65 into master Jul 13, 2026
3 checks passed
@tamalsaha
tamalsaha deleted the fix-reloader-override-trigger branch July 13, 2026 09:48
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant