Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bfe9f59c8e | |||
| 9e1d4d07a0 | |||
| 375132bdc3 | |||
| 0b5ca61785 | |||
| 300c705033 | |||
| ea587c149f | |||
| 4468396e52 | |||
| ead81a51a9 | |||
| 8e0b95ed64 | |||
| e54caa7be4 |
@@ -37,7 +37,7 @@ jobs:
|
|||||||
- name: Update artifacthub-pkg.yml version and URL
|
- name: Update artifacthub-pkg.yml version and URL
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ inputs.version }}"
|
||||||
RELEASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}/headlamp-rook-ceph-plugin-${VERSION}.tar.gz"
|
RELEASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}/headlamp-rook-plugin-${VERSION}.tar.gz"
|
||||||
|
|
||||||
sed -i "s|^version:.*|version: \"${VERSION}\"|" artifacthub-pkg.yml
|
sed -i "s|^version:.*|version: \"${VERSION}\"|" artifacthub-pkg.yml
|
||||||
sed -i "s|headlamp/plugin/archive-url:.*|headlamp/plugin/archive-url: \"${RELEASE_URL}\"|" artifacthub-pkg.yml
|
sed -i "s|headlamp/plugin/archive-url:.*|headlamp/plugin/archive-url: \"${RELEASE_URL}\"|" artifacthub-pkg.yml
|
||||||
@@ -59,7 +59,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Validate tarball name
|
- name: Validate tarball name
|
||||||
run: |
|
run: |
|
||||||
EXPECTED="headlamp-rook-ceph-plugin-${{ inputs.version }}.tar.gz"
|
EXPECTED="headlamp-rook-plugin-${{ inputs.version }}.tar.gz"
|
||||||
ACTUAL=$(ls *.tar.gz)
|
ACTUAL=$(ls *.tar.gz)
|
||||||
if [ "$EXPECTED" != "$ACTUAL" ]; then
|
if [ "$EXPECTED" != "$ACTUAL" ]; then
|
||||||
echo "::error::Tarball name mismatch! Expected: $EXPECTED, Got: $ACTUAL"
|
echo "::error::Tarball name mismatch! Expected: $EXPECTED, Got: $ACTUAL"
|
||||||
@@ -70,7 +70,7 @@ jobs:
|
|||||||
- name: Compute checksum
|
- name: Compute checksum
|
||||||
id: compute_checksum
|
id: compute_checksum
|
||||||
run: |
|
run: |
|
||||||
TARBALL="headlamp-rook-ceph-plugin-${{ inputs.version }}.tar.gz"
|
TARBALL="headlamp-rook-plugin-${{ inputs.version }}.tar.gz"
|
||||||
CHECKSUM=$(sha256sum "$TARBALL" | awk '{print $1}')
|
CHECKSUM=$(sha256sum "$TARBALL" | awk '{print $1}')
|
||||||
echo "checksum=${CHECKSUM}" >> $GITHUB_OUTPUT
|
echo "checksum=${CHECKSUM}" >> $GITHUB_OUTPUT
|
||||||
echo "Checksum: sha256:${CHECKSUM}"
|
echo "Checksum: sha256:${CHECKSUM}"
|
||||||
@@ -95,7 +95,7 @@ jobs:
|
|||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
tag_name: "v${{ inputs.version }}"
|
tag_name: "v${{ inputs.version }}"
|
||||||
files: headlamp-rook-ceph-plugin-${{ inputs.version }}.tar.gz
|
files: headlamp-rook-plugin-${{ inputs.version }}.tar.gz
|
||||||
fail_on_unmatched_files: true
|
fail_on_unmatched_files: true
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|||||||
+49
-3
@@ -1,12 +1,52 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
All notable changes to the Headlamp Rook-Ceph Plugin will be documented in this file.
|
All notable changes to the Headlamp Rook Plugin will be documented in this file.
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.2.2] - 2026-02-19
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **Package name** — renamed from `headlamp-rook-plugin` to `rook` so the plugin displays correctly in Headlamp's Plugins list
|
||||||
|
|
||||||
|
## [0.2.1] - 2026-02-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **Duplicate columns** — Protocol and Pool columns on mixed-driver clusters (rook-ceph + tns-csi) are now merged into a single shared column rather than duplicated; whichever plugin loads first owns the column and the second merges into it
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **Sidebar label** — top-level navigation entry renamed from `Rook-Ceph` to `Rook`
|
||||||
|
|
||||||
|
## [0.2.0] - 2026-02-19
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **Rename** — plugin renamed from `headlamp-rook-ceph-plugin` to `headlamp-rook-plugin`
|
||||||
|
|
||||||
|
## [0.1.3] - 2026-02-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **Protocol column** — renamed `Type` → `Protocol` with short values (`RBD`, `CephFS`) to match tns-csi column naming convention on shared native tables
|
||||||
|
|
||||||
|
## [0.1.2] - 2026-02-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **Column naming** — renamed `Rook Type` → `Type` and `Cluster ID` → `Cluster` in StorageClass and PV column processors
|
||||||
|
|
||||||
|
## [0.1.1] - 2026-02-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **StorageClass/PV column injection** — removed redundant `Rook Type` label prefix; standardized column headers across plugins
|
||||||
|
|
||||||
## [0.1.0] - 2026-02-18
|
## [0.1.0] - 2026-02-18
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -32,5 +72,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- TypeScript strict mode with zero `any` types
|
- TypeScript strict mode with zero `any` types
|
||||||
- ESLint + Prettier code quality tooling
|
- ESLint + Prettier code quality tooling
|
||||||
|
|
||||||
[Unreleased]: https://github.com/cpfarhood/headlamp-rook-ceph-plugin/compare/v0.1.0...HEAD
|
[Unreleased]: https://github.com/cpfarhood/headlamp-rook-plugin/compare/v0.2.2...HEAD
|
||||||
[0.1.0]: https://github.com/cpfarhood/headlamp-rook-ceph-plugin/releases/tag/v0.1.0
|
[0.2.2]: https://github.com/cpfarhood/headlamp-rook-plugin/compare/v0.2.1...v0.2.2
|
||||||
|
[0.2.1]: https://github.com/cpfarhood/headlamp-rook-plugin/compare/v0.2.0...v0.2.1
|
||||||
|
[0.2.0]: https://github.com/cpfarhood/headlamp-rook-plugin/compare/v0.1.3...v0.2.0
|
||||||
|
[0.1.3]: https://github.com/cpfarhood/headlamp-rook-plugin/compare/v0.1.2...v0.1.3
|
||||||
|
[0.1.2]: https://github.com/cpfarhood/headlamp-rook-plugin/compare/v0.1.1...v0.1.2
|
||||||
|
[0.1.1]: https://github.com/cpfarhood/headlamp-rook-plugin/compare/v0.1.0...v0.1.1
|
||||||
|
[0.1.0]: https://github.com/cpfarhood/headlamp-rook-plugin/releases/tag/v0.1.0
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||||||
|
|
||||||
Headlamp plugin for Rook-Ceph cluster visibility.
|
Headlamp plugin for Rook-Ceph cluster visibility.
|
||||||
|
|
||||||
- **Plugin name**: `headlamp-rook-ceph-plugin`
|
- **Plugin name**: `headlamp-rook-plugin`
|
||||||
- **Rook-Ceph API group**: `ceph.rook.io/v1`
|
- **Rook-Ceph API group**: `ceph.rook.io/v1`
|
||||||
- **Default namespace**: `rook-ceph`
|
- **Default namespace**: `rook-ceph`
|
||||||
- **Reference plugin**: `../headlamp-tns-csi-plugin`
|
- **Reference plugin**: `../headlamp-tns-csi-plugin`
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@ Contributions are welcome! Please open an issue before submitting large PRs.
|
|||||||
## Development Setup
|
## Development Setup
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/cpfarhood/headlamp-rook-ceph-plugin.git
|
git clone https://github.com/cpfarhood/headlamp-rook-plugin.git
|
||||||
cd headlamp-rook-ceph-plugin
|
cd headlamp-rook-plugin
|
||||||
npm install
|
npm install
|
||||||
npm start # hot-reload dev server
|
npm start # hot-reload dev server
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Headlamp Rook-Ceph Plugin
|
# Headlamp Rook Plugin
|
||||||
|
|
||||||
[](https://github.com/cpfarhood/headlamp-rook-ceph-plugin/actions/workflows/ci.yaml)
|
[](https://github.com/cpfarhood/headlamp-rook-plugin/actions/workflows/ci.yaml)
|
||||||
[](https://opensource.org/licenses/Apache-2.0)
|
[](https://opensource.org/licenses/Apache-2.0)
|
||||||
|
|
||||||
A [Headlamp](https://headlamp.dev/) plugin that surfaces [Rook-Ceph](https://rook.io/) cluster health, storage resources, and CSI driver status directly in the Headlamp UI.
|
A [Headlamp](https://headlamp.dev/) plugin that surfaces [Rook-Ceph](https://rook.io/) cluster health, storage resources, and CSI driver status directly in the Headlamp UI.
|
||||||
@@ -53,16 +53,16 @@ Download the latest release tarball and place it in your Headlamp plugins direct
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Download the latest release
|
# Download the latest release
|
||||||
curl -L https://github.com/cpfarhood/headlamp-rook-ceph-plugin/releases/latest/download/headlamp-rook-ceph-plugin-<version>.tar.gz \
|
curl -L https://github.com/cpfarhood/headlamp-rook-plugin/releases/latest/download/headlamp-rook-plugin-<version>.tar.gz \
|
||||||
-o headlamp-rook-ceph-plugin.tar.gz
|
-o headlamp-rook-plugin.tar.gz
|
||||||
|
|
||||||
# Extract to Headlamp plugins directory
|
# Extract to Headlamp plugins directory
|
||||||
tar -xzf headlamp-rook-ceph-plugin.tar.gz -C ~/.config/Headlamp/plugins/
|
tar -xzf headlamp-rook-plugin.tar.gz -C ~/.config/Headlamp/plugins/
|
||||||
```
|
```
|
||||||
|
|
||||||
### Option 2: Headlamp In-App Plugin Manager
|
### Option 2: Headlamp In-App Plugin Manager
|
||||||
|
|
||||||
Browse the Headlamp Plugin Manager (Settings → Plugins) and install **headlamp-rook-ceph-plugin** directly.
|
Browse the Headlamp Plugin Manager (Settings → Plugins) and install **headlamp-rook-plugin** directly.
|
||||||
|
|
||||||
## RBAC & Security Setup
|
## RBAC & Security Setup
|
||||||
|
|
||||||
@@ -117,8 +117,8 @@ subjects:
|
|||||||
### Setup
|
### Setup
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/cpfarhood/headlamp-rook-ceph-plugin.git
|
git clone https://github.com/cpfarhood/headlamp-rook-plugin.git
|
||||||
cd headlamp-rook-ceph-plugin
|
cd headlamp-rook-plugin
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
Please report security vulnerabilities by opening a [GitHub Security Advisory](https://github.com/cpfarhood/headlamp-rook-ceph-plugin/security/advisories/new) rather than a public issue.
|
Please report security vulnerabilities by opening a [GitHub Security Advisory](https://github.com/cpfarhood/headlamp-rook-plugin/security/advisories/new) rather than a public issue.
|
||||||
|
|
||||||
## Scope
|
## Scope
|
||||||
|
|
||||||
|
|||||||
+11
-7
@@ -1,12 +1,12 @@
|
|||||||
version: "0.1.2"
|
version: "0.2.2"
|
||||||
name: headlamp-rook-ceph-plugin
|
name: headlamp-rook-plugin
|
||||||
displayName: Rook-Ceph Plugin
|
displayName: Rook Plugin
|
||||||
createdAt: "2026-02-18T00:00:00Z"
|
createdAt: "2026-02-18T00:00:00Z"
|
||||||
description: Headlamp plugin for Rook-Ceph cluster visibility — CephCluster health, pool status, CSI driver monitoring, and native Headlamp StorageClass/PV integrations.
|
description: Headlamp plugin for Rook-Ceph cluster visibility — CephCluster health, pool status, CSI driver monitoring, and native Headlamp StorageClass/PV integrations.
|
||||||
logoPath: ""
|
logoPath: ""
|
||||||
digest: ""
|
digest: ""
|
||||||
license: Apache-2.0
|
license: Apache-2.0
|
||||||
homeURL: https://github.com/privilegedescalation/headlamp-rook-ceph-plugin
|
homeURL: https://github.com/privilegedescalation/headlamp-rook-plugin
|
||||||
keywords:
|
keywords:
|
||||||
- rook
|
- rook
|
||||||
- ceph
|
- ceph
|
||||||
@@ -16,14 +16,18 @@ keywords:
|
|||||||
- kubernetes
|
- kubernetes
|
||||||
links:
|
links:
|
||||||
- name: source
|
- name: source
|
||||||
url: https://github.com/privilegedescalation/headlamp-rook-ceph-plugin
|
url: https://github.com/privilegedescalation/headlamp-rook-plugin
|
||||||
maintainers:
|
maintainers:
|
||||||
- name: privilegedescalation
|
- name: privilegedescalation
|
||||||
email: privilegedescalation@users.noreply.github.com
|
email: privilegedescalation@users.noreply.github.com
|
||||||
provider:
|
provider:
|
||||||
name: privilegedescalation
|
name: privilegedescalation
|
||||||
|
changes:
|
||||||
|
- kind: changed
|
||||||
|
description: "Package renamed to rook so the plugin displays correctly in Headlamp's Plugins list"
|
||||||
|
|
||||||
annotations:
|
annotations:
|
||||||
headlamp/plugin/archive-url: "https://github.com/privilegedescalation/headlamp-rook-ceph-plugin/releases/download/v0.1.2/headlamp-rook-ceph-plugin-0.1.2.tar.gz"
|
headlamp/plugin/archive-url: "https://github.com/privilegedescalation/headlamp-rook-plugin/releases/download/v0.2.2/rook-0.2.2.tar.gz"
|
||||||
headlamp/plugin/archive-checksum: "sha256:c74aef8dd3e67b66bd20ce4845d324ee351b3bb560b43a4a5fff26f31b3d73e1"
|
headlamp/plugin/archive-checksum: "sha256:0c0d39f275f206cd0fe66a17f98c9bf0b9a5d74122bad770c7d4051e59f85675"
|
||||||
headlamp/plugin/distro-compat: ""
|
headlamp/plugin/distro-compat: ""
|
||||||
headlamp/plugin/version-compat: ">=0.20"
|
headlamp/plugin/version-compat: ">=0.20"
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "headlamp-rook-ceph-plugin",
|
"name": "headlamp-rook-plugin",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "headlamp-rook-ceph-plugin",
|
"name": "headlamp-rook-plugin",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+5
-5
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "headlamp-rook-ceph-plugin",
|
"name": "rook",
|
||||||
"version": "0.1.2",
|
"version": "0.2.2",
|
||||||
"description": "Headlamp plugin for Rook-Ceph cluster visibility and CSI driver monitoring",
|
"description": "Headlamp plugin for Rook-Ceph cluster visibility and CSI driver monitoring",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/privilegedescalation/headlamp-rook-ceph-plugin.git"
|
"url": "https://github.com/privilegedescalation/headlamp-rook-plugin.git"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/privilegedescalation/headlamp-rook-ceph-plugin/issues"
|
"url": "https://github.com/privilegedescalation/headlamp-rook-plugin/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/privilegedescalation/headlamp-rook-ceph-plugin#readme",
|
"homepage": "https://github.com/privilegedescalation/headlamp-rook-plugin#readme",
|
||||||
"author": "privilegedescalation",
|
"author": "privilegedescalation",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -4,10 +4,14 @@
|
|||||||
* Adds Rook-Ceph-specific columns to the native Headlamp StorageClass table
|
* Adds Rook-Ceph-specific columns to the native Headlamp StorageClass table
|
||||||
* ('headlamp-storageclasses') and PV table ('headlamp-persistentvolumes').
|
* ('headlamp-storageclasses') and PV table ('headlamp-persistentvolumes').
|
||||||
* Non-Rook-Ceph rows show '—'.
|
* Non-Rook-Ceph rows show '—'.
|
||||||
|
*
|
||||||
|
* Column names (Protocol, Pool) are intentionally shared with the tns-csi
|
||||||
|
* column processor so both plugins contribute to the same logical columns
|
||||||
|
* on a mixed-driver cluster.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { formatStorageType, isRookCephProvisioner } from '../../api/k8s';
|
import { isRookCephProvisioner } from '../../api/k8s';
|
||||||
|
|
||||||
/** Safely read a nested field from either a KubeObject instance or plain object. */
|
/** Safely read a nested field from either a KubeObject instance or plain object. */
|
||||||
function getField(item: unknown, ...path: string[]): unknown {
|
function getField(item: unknown, ...path: string[]): unknown {
|
||||||
@@ -36,23 +40,26 @@ function isRookPvRow(item: unknown): boolean {
|
|||||||
return typeof driver === 'string' && isRookCephProvisioner(driver);
|
return typeof driver === 'string' && isRookCephProvisioner(driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function rookProtocol(s: string | undefined): string {
|
||||||
|
if (!s) return '—';
|
||||||
|
if (s.includes('.rbd.')) return 'RBD';
|
||||||
|
if (s.includes('.cephfs.')) return 'CephFS';
|
||||||
|
return '—';
|
||||||
|
}
|
||||||
|
|
||||||
export function buildStorageClassColumns() {
|
export function buildStorageClassColumns() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: 'Rook Type',
|
label: 'Protocol',
|
||||||
getValue: (item: unknown) => {
|
getValue: (item: unknown) => {
|
||||||
if (!isRookRow(item)) return null;
|
if (!isRookRow(item)) return null;
|
||||||
const provisioner = getField(item, 'provisioner') as string | undefined;
|
const provisioner = getField(item, 'provisioner') as string | undefined;
|
||||||
if (!provisioner) return null;
|
return rookProtocol(provisioner);
|
||||||
const type = provisioner.includes('.rbd.') ? 'rbd' : provisioner.includes('.cephfs.') ? 'cephfs' : 'unknown';
|
|
||||||
return formatStorageType(type as 'rbd' | 'cephfs' | 'unknown');
|
|
||||||
},
|
},
|
||||||
render: (item: unknown) => {
|
render: (item: unknown) => {
|
||||||
if (!isRookRow(item)) return <span>—</span>;
|
if (!isRookRow(item)) return <span>—</span>;
|
||||||
const provisioner = getField(item, 'provisioner') as string | undefined;
|
const provisioner = getField(item, 'provisioner') as string | undefined;
|
||||||
if (!provisioner) return <span>—</span>;
|
return <span>{rookProtocol(provisioner)}</span>;
|
||||||
const type = provisioner.includes('.rbd.') ? 'rbd' : provisioner.includes('.cephfs.') ? 'cephfs' : 'unknown';
|
|
||||||
return <span style={{ color: '#1976d2', fontWeight: 500 }}>{formatStorageType(type as 'rbd' | 'cephfs' | 'unknown')}</span>;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -65,13 +72,12 @@ export function buildStorageClassColumns() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Cluster ID',
|
label: 'Cluster',
|
||||||
getValue: (item: unknown) => getField(item, 'parameters', 'clusterID') as string | null ?? null,
|
getValue: (item: unknown) => getField(item, 'parameters', 'clusterID') as string | null ?? null,
|
||||||
render: (item: unknown) => {
|
render: (item: unknown) => {
|
||||||
if (!isRookRow(item)) return <span>—</span>;
|
if (!isRookRow(item)) return <span>—</span>;
|
||||||
const clusterID = getField(item, 'parameters', 'clusterID') as string | undefined;
|
const clusterID = getField(item, 'parameters', 'clusterID') as string | undefined;
|
||||||
if (!clusterID) return <span>—</span>;
|
if (!clusterID) return <span>—</span>;
|
||||||
// Truncate long cluster IDs
|
|
||||||
return <span title={clusterID}>{clusterID.length > 16 ? `${clusterID.slice(0, 16)}…` : clusterID}</span>;
|
return <span title={clusterID}>{clusterID.length > 16 ? `${clusterID.slice(0, 16)}…` : clusterID}</span>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -81,20 +87,16 @@ export function buildStorageClassColumns() {
|
|||||||
export function buildPVColumns() {
|
export function buildPVColumns() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: 'Rook Type',
|
label: 'Protocol',
|
||||||
getValue: (item: unknown) => {
|
getValue: (item: unknown) => {
|
||||||
if (!isRookPvRow(item)) return null;
|
if (!isRookPvRow(item)) return null;
|
||||||
const driver = getField(item, 'spec', 'csi', 'driver') as string | undefined;
|
const driver = getField(item, 'spec', 'csi', 'driver') as string | undefined;
|
||||||
if (!driver) return null;
|
return rookProtocol(driver);
|
||||||
const type = driver.includes('.rbd.') ? 'rbd' : driver.includes('.cephfs.') ? 'cephfs' : 'unknown';
|
|
||||||
return formatStorageType(type as 'rbd' | 'cephfs' | 'unknown');
|
|
||||||
},
|
},
|
||||||
render: (item: unknown) => {
|
render: (item: unknown) => {
|
||||||
if (!isRookPvRow(item)) return <span>—</span>;
|
if (!isRookPvRow(item)) return <span>—</span>;
|
||||||
const driver = getField(item, 'spec', 'csi', 'driver') as string | undefined;
|
const driver = getField(item, 'spec', 'csi', 'driver') as string | undefined;
|
||||||
if (!driver) return <span>—</span>;
|
return <span>{rookProtocol(driver)}</span>;
|
||||||
const type = driver.includes('.rbd.') ? 'rbd' : driver.includes('.cephfs.') ? 'cephfs' : 'unknown';
|
|
||||||
return <span style={{ color: '#1976d2', fontWeight: 500 }}>{formatStorageType(type as 'rbd' | 'cephfs' | 'unknown')}</span>;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
+32
-4
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* headlamp-rook-ceph-plugin — entry point.
|
* headlamp-rook-plugin — entry point.
|
||||||
*
|
*
|
||||||
* Registers sidebar entries, routes, detail view sections, table column
|
* Registers sidebar entries, routes, detail view sections, table column
|
||||||
* processors, and app bar action for Rook-Ceph visibility in Headlamp.
|
* processors, and app bar action for Rook-Ceph visibility in Headlamp.
|
||||||
@@ -32,7 +32,7 @@ import VolumesPage from './components/VolumesPage';
|
|||||||
registerSidebarEntry({
|
registerSidebarEntry({
|
||||||
parent: null,
|
parent: null,
|
||||||
name: 'rook-ceph',
|
name: 'rook-ceph',
|
||||||
label: 'Rook-Ceph',
|
label: 'Rook',
|
||||||
url: '/rook-ceph',
|
url: '/rook-ceph',
|
||||||
icon: 'mdi:database-cog',
|
icon: 'mdi:database-cog',
|
||||||
});
|
});
|
||||||
@@ -202,12 +202,40 @@ registerDetailsViewSection(({ resource }) => {
|
|||||||
// Table column processors — native StorageClass and PV tables
|
// Table column processors — native StorageClass and PV tables
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Merges incoming columns into existing ones by label.
|
||||||
|
// If a column with the same label already exists, the incoming getValue/render
|
||||||
|
// takes priority and falls back to the existing one (for mixed-driver tables).
|
||||||
|
function mergeColumns<T>(
|
||||||
|
existing: T[],
|
||||||
|
incoming: Array<{ label: string; getValue: (r: unknown) => unknown; render: (r: unknown) => React.ReactNode }>
|
||||||
|
): T[] {
|
||||||
|
type ObjCol = { label: string; getValue: (r: unknown) => unknown; render: (r: unknown) => React.ReactNode };
|
||||||
|
const isObjCol = (c: unknown): c is ObjCol =>
|
||||||
|
typeof c === 'object' && c !== null && 'label' in c;
|
||||||
|
const result = [...existing];
|
||||||
|
const toAppend: typeof incoming = [];
|
||||||
|
for (const col of incoming) {
|
||||||
|
const idx = result.findIndex(c => isObjCol(c) && (c as ObjCol).label === col.label);
|
||||||
|
if (idx !== -1) {
|
||||||
|
const prev = result[idx] as ObjCol;
|
||||||
|
result[idx] = {
|
||||||
|
label: col.label,
|
||||||
|
getValue: (r: unknown) => col.getValue(r) ?? prev.getValue(r),
|
||||||
|
render: (r: unknown) => col.getValue(r) !== null ? col.render(r) : prev.render(r),
|
||||||
|
} as unknown as T;
|
||||||
|
} else {
|
||||||
|
toAppend.push(col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [...result, ...(toAppend as unknown as T[])];
|
||||||
|
}
|
||||||
|
|
||||||
registerResourceTableColumnsProcessor(({ id, columns }) => {
|
registerResourceTableColumnsProcessor(({ id, columns }) => {
|
||||||
if (id === 'headlamp-storageclasses') {
|
if (id === 'headlamp-storageclasses') {
|
||||||
return [...columns, ...buildStorageClassColumns()];
|
return mergeColumns(columns, buildStorageClassColumns());
|
||||||
}
|
}
|
||||||
if (id === 'headlamp-persistentvolumes') {
|
if (id === 'headlamp-persistentvolumes') {
|
||||||
return [...columns, ...buildPVColumns()];
|
return mergeColumns(columns, buildPVColumns());
|
||||||
}
|
}
|
||||||
return columns;
|
return columns;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user