/** * DevicePluginsPage — lists all GpuDevicePlugin CRD instances. * * Shows configuration details for each Intel GPU device plugin deployment, * including spec and status information. */ import { Loader, NameValueTable, SectionBox, SectionHeader, SimpleTable, StatusLabel, } from '@kinvolk/headlamp-plugin/lib/CommonComponents'; import React from 'react'; import { useIntelGpuContext } from '../api/IntelGpuDataContext'; import { formatAge, isPodReady, pluginStatusText, pluginStatusToStatus } from '../api/k8s'; export default function DevicePluginsPage() { const { devicePlugins, pluginPods, crdAvailable, loading, error, refresh } = useIntelGpuContext(); if (loading) { return ; } return ( <>
{error && ( {error} }]} /> )} {!crdAvailable && ( GpuDevicePlugin CRD (deviceplugin.intel.com/v1) is not installed ), }, { name: 'Note', value: 'Install the Intel Device Plugins Operator to manage GpuDevicePlugin resources. ' + 'Plugin daemon pods are shown below if detected.', }, ]} /> )} {/* GpuDevicePlugin CRD instances */} {crdAvailable && devicePlugins.length === 0 && ( No GpuDevicePlugin resources found on this cluster ), }, { name: 'Create', value: 'kubectl apply -f gpudeviceplugin.yaml (see Intel documentation for configuration)', }, ]} /> )} {devicePlugins.map(plugin => ( {pluginStatusText(plugin)} ), }, { name: 'Image', value: plugin.spec.image ?? '—', }, { name: 'Shared Devices/Node', value: String(plugin.spec.sharedDevNum ?? 1), }, { name: 'Allocation Policy', value: plugin.spec.preferredAllocationPolicy ?? 'default', }, { name: 'Monitoring', value: plugin.spec.enableMonitoring ? ( Enabled ) : ( Disabled ), }, { name: 'Resource Manager', value: plugin.spec.resourceManager ? 'Enabled' : 'Disabled', }, { name: 'Desired Nodes', value: String(plugin.status?.desiredNumberScheduled ?? '—'), }, { name: 'Ready Nodes', value: String(plugin.status?.numberReady ?? '—'), }, ...(plugin.status?.numberUnavailable ? [ { name: 'Unavailable Nodes', value: ( {plugin.status.numberUnavailable} ), }, ] : []), { name: 'Node Selector', value: plugin.spec.nodeSelector ? Object.entries(plugin.spec.nodeSelector) .map(([k, v]) => `${k}=${v}`) .join(', ') : '—', }, { name: 'Age', value: formatAge(plugin.metadata.creationTimestamp), }, ]} /> ))} {/* Plugin daemon pods */} {pluginPods.length > 0 && ( p.metadata.name }, { label: 'Namespace', getter: p => p.metadata.namespace ?? '—' }, { label: 'Node', getter: p => p.spec?.nodeName ?? '—' }, { label: 'Ready', getter: p => ( {isPodReady(p) ? 'Ready' : p.status?.phase ?? 'Unknown'} ), }, { label: 'Restarts', getter: p => { const restarts = p.status?.containerStatuses?.reduce((sum, c) => sum + c.restartCount, 0) ?? 0; return restarts > 0 ? ( {restarts} ) : ( String(restarts) ); }, }, { label: 'Age', getter: p => formatAge(p.metadata.creationTimestamp) }, ]} data={pluginPods} /> )} ); }