This repository has been archived on 2026-06-16. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
headlamp-tns-csi-plugin/CLAUDE.md
T
Chris Farhood 45bb74d42c docs: update install docs and ArtifactHub metadata to headlamp namespace
- README: update Helm install URL to v1.0.0, add pods/proxy RBAC scope notes
- docs/getting-started/installation.md: update all download URLs from v0.2.4 to v1.0.0, remove obsolete sha256sum example, fix build output placeholder
- docs/getting-started/quick-start.md: update Helm URL to v1.0.0
- docs/deployment/helm.md: update install command and values URLs to v1.0.0
- docs/README.md: fix Artifact Hub URL (was duplicated 'headlamp')
- docs/architecture/overview.md: update namespace references from kube-system to headlamp
- CLAUDE.md: update driver namespace constant from kube-system to headlamp
- CHANGELOG.md: add [Unreleased] entry documenting the namespace reference update

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-04 07:36:05 +00:00

3.0 KiB

headlamp-tns-csi-plugin

Headlamp plugin for tns-csi CSI driver visibility and kbench benchmarking.

Project

Commands

npm start          # dev server with hot reload
npm run build      # production build
npm run package    # package for headlamp
npm run tsc        # TypeScript type check (no emit)
npm run lint       # ESLint
npm test           # vitest run
npm run test:watch # vitest watch mode

Architecture

src/
├── index.tsx                    # Plugin entry: registerRoute, registerSidebarEntry, etc.
├── api/
│   ├── k8s.ts                   # Types + filtering helpers (provisioner: tns.csi.io)
│   ├── metrics.ts               # Prometheus text format parser
│   ├── kbench.ts                # kbench Job/PVC lifecycle + FIO log parser
│   └── TnsCsiDataContext.tsx    # Shared React context provider
└── components/
    ├── OverviewPage.tsx
    ├── StorageClassesPage.tsx
    ├── VolumesPage.tsx
    ├── SnapshotsPage.tsx
    ├── MetricsPage.tsx
    ├── BenchmarkPage.tsx        # ONLY write operation in the plugin
    ├── DriverStatusCard.tsx
    └── PVCDetailSection.tsx     # Injected into Headlamp PVC detail view

Key constants

  • Provisioner: tns.csi.io
  • Controller pod selector: app.kubernetes.io/name=tns-csi-driver,app.kubernetes.io/component=controller
  • Node pod selector: app.kubernetes.io/name=tns-csi-driver,app.kubernetes.io/component=node
  • Driver namespace: headlamp
  • Metrics port: 8080
  • kbench image: yasker/kbench:latest
  • kbench managed-by label: app.kubernetes.io/managed-by=headlamp-tns-csi-plugin

Code conventions

  • Functional React components only — no class components
  • All imports from @kinvolk/headlamp-plugin/lib and @kinvolk/headlamp-plugin/lib/CommonComponents
  • No additional UI libraries (no MUI direct imports, no Ant Design, etc.)
  • TypeScript strict mode — no any, use unknown + type guards at API boundaries
  • Slide-in detail panels follow the polaris plugin pattern: URL hash state, Escape to close, backdrop overlay
  • Context provider (TnsCsiDataProvider) wraps each route component in index.tsx
  • Tests: vitest + @testing-library/react, mock with vi.mock('@kinvolk/headlamp-plugin/lib', ...)

Testing

All tests must pass before committing:

npm test
npm run tsc     # must exit 0

Mock pattern for headlamp APIs:

vi.mock('@kinvolk/headlamp-plugin/lib', () => ({
  ApiProxy: { request: vi.fn().mockResolvedValue({ items: [] }) },
  K8s: {
    ResourceClasses: {
      StorageClass: { useList: vi.fn(() => [[], null]) },
      PersistentVolume: { useList: vi.fn(() => [[], null]) },
      PersistentVolumeClaim: { useList: vi.fn(() => [[], null]) },
    },
  },
}));