diff --git a/charts/headlamp/templates/deployment.yaml b/charts/headlamp/templates/deployment.yaml index 94042e1ee33..4ac500edf6e 100644 --- a/charts/headlamp/templates/deployment.yaml +++ b/charts/headlamp/templates/deployment.yaml @@ -327,13 +327,15 @@ spec: {{- end }} args: - | - echo "Installing headlamp-plugin globally..." - npm install -g @headlamp-k8s/pluginctl@{{ .Values.pluginsManager.version }} - echo "Installed headlamp-plugin successfully." if [ -f "/config/plugin.yml" ]; then echo "Installing plugins from config..." cat /config/plugin.yml - pluginctl install --config /config/plugin.yml --folderName {{ .Values.config.pluginsDir }} --watch + # Use a writable cache directory + export NPM_CONFIG_CACHE=/tmp/npm-cache + # Use a writable config directory + export NPM_CONFIG_USERCONFIG=/tmp/npm-userconfig + mkdir -p /tmp/npm-cache /tmp/npm-userconfig + npx --yes @headlamp-k8s/pluginctl@{{ .Values.pluginsManager.version }} install --config /config/plugin.yml --folderName {{ .Values.config.pluginsDir }} --watch fi volumeMounts: - name: plugins-dir diff --git a/charts/headlamp/templates/plugin-configmap.yaml b/charts/headlamp/templates/plugin-configmap.yaml index 5d5619fb4d1..43bf007bde7 100644 --- a/charts/headlamp/templates/plugin-configmap.yaml +++ b/charts/headlamp/templates/plugin-configmap.yaml @@ -1,4 +1,4 @@ -{{- if .Values.pluginsManager.enabled }} +{{- if .Values.pluginsManager.enabled -}} apiVersion: v1 kind: ConfigMap metadata: @@ -7,6 +7,5 @@ metadata: labels: {{- include "headlamp.labels" . | nindent 4 }} data: - plugin.yml: | - {{ .Values.pluginsManager.configContent | nindent 4 }} + plugin.yml: |{{ .Values.pluginsManager.configContent | nindent 4 }} {{- end }} diff --git a/charts/headlamp/tests/expected_templates/security-context.yaml b/charts/headlamp/tests/expected_templates/security-context.yaml index 18830ca82c0..b3dae60534d 100644 --- a/charts/headlamp/tests/expected_templates/security-context.yaml +++ b/charts/headlamp/tests/expected_templates/security-context.yaml @@ -159,13 +159,15 @@ spec: command: ["/bin/sh", "-c"] args: - | - echo "Installing headlamp-plugin globally..." - npm install -g @headlamp-k8s/pluginctl@1.0.0 - echo "Installed headlamp-plugin successfully." if [ -f "/config/plugin.yml" ]; then echo "Installing plugins from config..." cat /config/plugin.yml - pluginctl install --config /config/plugin.yml --folderName /headlamp/plugins --watch + # Use a writable cache directory + export NPM_CONFIG_CACHE=/tmp/npm-cache + # Use a writable config directory + export NPM_CONFIG_USERCONFIG=/tmp/npm-userconfig + mkdir -p /tmp/npm-cache /tmp/npm-userconfig + npx --yes @headlamp-k8s/pluginctl@1.0.0 install --config /config/plugin.yml --folderName /headlamp/plugins --watch fi volumeMounts: - name: plugins-dir