fix: match plugin settings name to deploy dir + fix badge nav URL #55
@@ -30,7 +30,7 @@ jobs:
|
|||||||
HEADLAMP_URL: ${{ secrets.HEADLAMP_URL || 'http://headlamp.kube-system.svc.cluster.local' }}
|
HEADLAMP_URL: ${{ secrets.HEADLAMP_URL || 'http://headlamp.kube-system.svc.cluster.local' }}
|
||||||
run: |
|
run: |
|
||||||
EXPECTED=$(node -p "require('./package.json').version")
|
EXPECTED=$(node -p "require('./package.json').version")
|
||||||
PLUGIN_NAME=$(node -p "require('./package.json').artifacthub?.name || require('./package.json').name")
|
PLUGIN_NAME=$(node -p "require('./package.json').name")
|
||||||
echo "Expected: $PLUGIN_NAME@$EXPECTED"
|
echo "Expected: $PLUGIN_NAME@$EXPECTED"
|
||||||
|
|
||||||
# Check Headlamp connectivity
|
# Check Headlamp connectivity
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
---
|
|
||||||
# Custom Headlamp values for static plugin installation
|
|
||||||
# This disables the plugin manager and uses an init container instead
|
|
||||||
|
|
||||||
# Disable the plugin manager sidecar
|
|
||||||
pluginsManager:
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
# Use an init container to install plugins to /headlamp/static-plugins
|
|
||||||
initContainers:
|
|
||||||
- name: install-plugins
|
|
||||||
image: node:lts-alpine
|
|
||||||
command:
|
|
||||||
- /bin/sh
|
|
||||||
- -c
|
|
||||||
- |
|
|
||||||
set -e
|
|
||||||
echo "Installing plugins to /headlamp/static-plugins..."
|
|
||||||
|
|
||||||
# Create plugins directory
|
|
||||||
mkdir -p /headlamp/static-plugins
|
|
||||||
|
|
||||||
# Set up npm cache
|
|
||||||
export NPM_CONFIG_CACHE=/tmp/npm-cache
|
|
||||||
export NPM_CONFIG_USERCONFIG=/tmp/npm-userconfig
|
|
||||||
mkdir -p /tmp/npm-cache /tmp/npm-userconfig
|
|
||||||
|
|
||||||
# Install polaris plugin
|
|
||||||
echo "Installing polaris plugin..."
|
|
||||||
cd /headlamp/static-plugins
|
|
||||||
npm pack headlamp-polaris-plugin@0.3.0
|
|
||||||
tar -xzf headlamp-polaris-plugin-0.3.0.tgz
|
|
||||||
mv package headlamp-polaris-plugin
|
|
||||||
rm headlamp-polaris-plugin-0.3.0.tgz
|
|
||||||
|
|
||||||
# Install other plugins
|
|
||||||
npx --yes @headlamp-k8s/plugin@latest install \
|
|
||||||
--source https://artifacthub.io/packages/headlamp/headlamp-plugins/headlamp_flux \
|
|
||||||
--folderName /headlamp/static-plugins
|
|
||||||
|
|
||||||
npx --yes @headlamp-k8s/plugin@latest install \
|
|
||||||
--source https://artifacthub.io/packages/headlamp/headlamp-trivy/headlamp_trivy \
|
|
||||||
--folderName /headlamp/static-plugins
|
|
||||||
|
|
||||||
npx --yes @headlamp-k8s/plugin@latest install \
|
|
||||||
--source https://artifacthub.io/packages/headlamp/headlamp-plugins/headlamp_cert-manager \
|
|
||||||
--folderName /headlamp/static-plugins
|
|
||||||
|
|
||||||
npx --yes @headlamp-k8s/plugin@latest install \
|
|
||||||
--source https://artifacthub.io/packages/headlamp/headlamp-plugins/headlamp_ai_assistant \
|
|
||||||
--folderName /headlamp/static-plugins
|
|
||||||
|
|
||||||
echo "All plugins installed successfully"
|
|
||||||
ls -la /headlamp/static-plugins
|
|
||||||
securityContext:
|
|
||||||
runAsUser: 100
|
|
||||||
runAsGroup: 101
|
|
||||||
runAsNonRoot: true
|
|
||||||
privileged: false
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 256Mi
|
|
||||||
limits:
|
|
||||||
memory: 512Mi
|
|
||||||
volumeMounts:
|
|
||||||
- name: static-plugins
|
|
||||||
mountPath: /headlamp/static-plugins
|
|
||||||
|
|
||||||
# Configure headlamp to use static plugins
|
|
||||||
config:
|
|
||||||
pluginsDir: /headlamp/static-plugins
|
|
||||||
|
|
||||||
# Add volume for static plugins
|
|
||||||
volumes:
|
|
||||||
- name: static-plugins
|
|
||||||
emptyDir: {}
|
|
||||||
|
|
||||||
# Add volume mount to main container
|
|
||||||
volumeMounts:
|
|
||||||
- name: static-plugins
|
|
||||||
mountPath: /headlamp/static-plugins
|
|
||||||
readOnly: true
|
|
||||||
@@ -29,6 +29,7 @@ vi.mock('@mui/material/styles', () => ({
|
|||||||
const mockPush = vi.fn();
|
const mockPush = vi.fn();
|
||||||
vi.mock('react-router-dom', () => ({
|
vi.mock('react-router-dom', () => ({
|
||||||
useHistory: () => ({ push: mockPush }),
|
useHistory: () => ({ push: mockPush }),
|
||||||
|
useLocation: () => ({ pathname: '/c/test-cluster/some-page', search: '', hash: '' }),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const mockUsePolarisDataContext = vi.fn();
|
const mockUsePolarisDataContext = vi.fn();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { K8s, Router } from '@kinvolk/headlamp-plugin/lib';
|
import { K8s } from '@kinvolk/headlamp-plugin/lib';
|
||||||
import { useTheme } from '@mui/material/styles';
|
import { useTheme } from '@mui/material/styles';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory, useLocation } from 'react-router-dom';
|
||||||
import { computeScore, countResults } from '../api/polaris';
|
import { computeScore, countResults } from '../api/polaris';
|
||||||
import { usePolarisDataContext } from '../api/PolarisDataContext';
|
import { usePolarisDataContext } from '../api/PolarisDataContext';
|
||||||
|
|
||||||
@@ -13,7 +13,13 @@ export default function AppBarScoreBadge() {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { data, loading } = usePolarisDataContext();
|
const { data, loading } = usePolarisDataContext();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const cluster = K8s.useCluster();
|
const location = useLocation();
|
||||||
|
const clusterFromHook = K8s.useCluster();
|
||||||
|
|
||||||
|
// useCluster() returns null in AppBar context (outside cluster routes),
|
||||||
|
// so extract cluster from the current URL path as primary source.
|
||||||
|
const clusterMatch = location.pathname.match(/^\/c\/([^/]+)/);
|
||||||
|
const cluster = clusterMatch ? clusterMatch[1] : clusterFromHook;
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return null; // Graceful degradation when Polaris unavailable
|
return null; // Graceful degradation when Polaris unavailable
|
||||||
@@ -36,7 +42,8 @@ export default function AppBarScoreBadge() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
history.push(Router.createRouteURL('polaris', { cluster: cluster ?? '' }));
|
const prefix = cluster ? `/c/${cluster}` : '';
|
||||||
|
history.push(`${prefix}/polaris`);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+1
-1
@@ -99,7 +99,7 @@ registerRoute({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Register plugin settings
|
// Register plugin settings
|
||||||
registerPluginSettings('headlamp-polaris', PolarisSettings, true);
|
registerPluginSettings('polaris', PolarisSettings, true);
|
||||||
|
|
||||||
// Register details view section for supported controller types
|
// Register details view section for supported controller types
|
||||||
registerDetailsViewSection(({ resource }) => {
|
registerDetailsViewSection(({ resource }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user