From bf5614f268c444f842ce95056f661e7b82ff3780 Mon Sep 17 00:00:00 2001 From: Hugh Hackman Date: Tue, 17 Mar 2026 18:13:03 +0000 Subject: [PATCH] fix: align plugin deploy dir with package.json name, clean stale dirs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PVC had a stale headlamp-polaris directory from a previous install. Headlamp loads plugins by scanning the plugins dir and reading package.json from each subdirectory — it was loading the old build from headlamp-polaris/ while the deploy script was writing to polaris/. The settings registration name needs to match the plugin name Headlamp identifies. Changes: - Deploy script now uses headlamp-polaris as the directory name (matching package.json name field) - Deploy pod cleans up both polaris/ and headlamp-polaris/ before deploying to ensure no stale copies remain - registerPluginSettings uses headlamp-polaris to match Headlamp's plugin identifier Co-Authored-By: Paperclip --- scripts/deploy-plugin-via-volume.sh | 10 ++++++---- src/index.tsx | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/deploy-plugin-via-volume.sh b/scripts/deploy-plugin-via-volume.sh index 600c81d..8cba0fb 100755 --- a/scripts/deploy-plugin-via-volume.sh +++ b/scripts/deploy-plugin-via-volume.sh @@ -17,9 +17,10 @@ REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" HEADLAMP_NAMESPACE="${HEADLAMP_NAMESPACE:-kube-system}" HEADLAMP_DEPLOY="${HEADLAMP_DEPLOY:-headlamp}" -# The deployed directory name must match the plugin's registered name. -# PR #56 aligns registerPluginSettings to "polaris"; the directory must match. -PLUGIN_DIR_NAME="polaris" +# The deployed directory name must match the package.json name and +# the registerPluginSettings name. Headlamp identifies plugins by +# reading package.json from each subdirectory of the plugins dir. +PLUGIN_DIR_NAME="headlamp-polaris" DIST_DIR="$REPO_ROOT/dist" if [ ! -d "$DIST_DIR" ]; then @@ -78,8 +79,9 @@ spec: command: ["sh", "-c"] args: - | + echo "Cleaning up stale plugin directories..." + rm -rf /plugins/polaris /plugins/headlamp-polaris echo "Extracting plugin to shared volume..." - rm -rf /plugins/PLUGIN_DIR_PLACEHOLDER mkdir -p /plugins/PLUGIN_DIR_PLACEHOLDER tar -xzf /tarball/plugin.tar.gz -C /plugins/PLUGIN_DIR_PLACEHOLDER echo "Files deployed:" diff --git a/src/index.tsx b/src/index.tsx index e5d068f..5a90bbe 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -99,7 +99,7 @@ registerRoute({ }); // Register plugin settings -registerPluginSettings('polaris', PolarisSettings, true); +registerPluginSettings('headlamp-polaris', PolarisSettings, true); // Register details view section for supported controller types registerDetailsViewSection(({ resource }) => {