This file provides guidance for AI coding agents working on this Headlamp plugin.
The following npm scripts are available for development and testing:
npm run format- Format code with prettiernpm run lint- Lint code with eslint for coding issuesnpm run lint-fix- Automatically fix linting issuesnpm run build- Build the plugin for productionnpm run tsc- Type check code with TypeScript compilernpm run test- Run tests with vitestnpm start- Start development server watching for changesnpm run storybook- Start Storybook for component developmentnpm run storybook-build- Build static Storybooknpm run i18n- Extract translatable strings for internationalizationnpm run package- Create a tarball of the plugin package
Explore these example plugins in node_modules/@kinvolk/headlamp-plugin/examples/ to learn common patterns:
- activity - Shows how to add activity tracking and monitoring
- app-menus - Demonstrates adding custom menus to the app bar
- change-logo - Shows how to customize the Headlamp logo
- cluster-chooser - Demonstrates cluster selection UI
- custom-theme - Shows how to create custom themes
- customizing-map - Demonstrates customizing resource visualization maps
- details-view - Shows how to customize resource detail views
- dynamic-clusters - Demonstrates dynamic cluster configuration
- headlamp-events - Shows how to work with Kubernetes events
- pod-counter - Simple example counting pods and displaying in app bar
- projects - Demonstrates project/namespace organization
- resource-charts - Shows how to add custom charts for resources
- sidebar - Demonstrates customizing the sidebar navigation
- tables - Shows how to create custom resource tables
- ui-panels - Demonstrates adding custom UI panels
Check out production-ready plugins in node_modules/@kinvolk/headlamp-plugin/official-plugins/ for advanced patterns:
- cert-manager - Complete CRD integration for cert-manager resources
- Files:
official-plugins/cert-manager/src/resources/(certificate.ts, issuer.ts, clusterIssuer.ts, etc.) - Shows how to register and display custom resources for certificates, issuers, challenges, and orders
- Files:
- flux - GitOps CRDs for Flux resources
- Files:
official-plugins/flux/src/(kustomization, helmrelease, gitrepository resources) - Demonstrates working with Flux CRDs for GitOps workflows
- Files:
- keda - Kubernetes Event Driven Autoscaling CRDs
- Files:
official-plugins/keda/src/resources/(scaledobject.ts, scaledjob.ts, triggerauthentication.ts) - Shows CRD integration for event-driven autoscaling
- Files:
- karpenter - Node provisioning CRDs
- Files:
official-plugins/karpenter/src/(NodeClass, EC2NodeClass resources) - Demonstrates multiple CRD deployment types (EKS Auto Mode, self-installed)
- Files:
- keda - Map view showing KEDA resource relationships
- File:
official-plugins/keda/src/mapView.tsx - Uses edge creation (
makeKubeToKubeEdge) to visualize connections between ScaledObjects, ScaledJobs, and TriggerAuthentications - Shows how to build graph visualizations of resource dependencies
- File:
- prometheus - Advanced charts for workload resources
- Files:
official-plugins/prometheus/src/components/Chart/ - Provides CPU, memory, network, and disk charts using Prometheus metrics
- Includes specialized charts for Karpenter (KarpenterChart, KarpenterNodeClaimCreationChart)
- Shows KEDA metrics (KedaActiveJobsChart, KedaScalerMetricsChart, KedaHPAReplicasChart)
- File:
official-plugins/prometheus/src/request.tsxfor fetching Prometheus data
- Files:
- opencost - Cost metrics and visualization
- File:
official-plugins/opencost/src/detail.tsx - Uses
rechartslibrary (AreaChart, CartesianGrid, Tooltip) to display cost data - Shows how to fetch and display custom metrics from external services
- Demonstrates time-series data visualization with stacked area charts
- File:
- ai-assistant - AI integration for cluster management
- app-catalog - Helm chart catalog powered by ArtifactHub
- backstage - Integration with Backstage developer portal
- Example:
pod-counter- ShowsregisterAppBarActionto add items to top bar - File:
examples/pod-counter/src/index.tsx
- Example:
sidebar- DemonstratesregisterSidebarEntryandregisterSidebarEntryFilter - File:
examples/sidebar/src/index.tsx
- Example:
details-view- Shows how to customize resource detail pages - File:
examples/details-view/src/index.tsx
- Example:
tables- Demonstrates custom table implementations - File:
examples/tables/src/index.tsx
- Example:
resource-charts- Shows how to add custom charts - File:
examples/resource-charts/src/index.tsx
- Example:
custom-theme- Demonstrates theme customization - File:
examples/custom-theme/src/index.tsx
- Use
npm run i18n <locale>to add new locales (e.g.,npm run i18n esfor Spanish) - Translation files are in
locales/<locale>/translation.json - Use
useTranslation()hook from@kinvolk/headlamp-plugin/i18n
- Start Development: Run
npm startto watch for changes - Make Changes: Edit files in
src/ - Type Check: Run
npm run tscto check for TypeScript errors - Lint: Run
npm run lintto check for code quality issues - Format: Run
npm run formatto format code - Test: Run
npm run testto run tests - Build: Run
npm run buildto create production build
- Follow the patterns shown in the example plugins
- Use TypeScript for type safety
- Keep plugins focused on a single feature or enhancement
- Document your plugin's functionality in the README.md
For detailed API documentation, visit: