File tree Expand file tree Collapse file tree 2 files changed +29
-37
lines changed
Expand file tree Collapse file tree 2 files changed +29
-37
lines changed Original file line number Diff line number Diff line change 1+ import { CoreV1Api , V1PersistentVolume } from '@kubernetes/client-node' ;
2+ import { Config } from '@kubernetes/client-node/dist/browser/config' ;
3+
4+ type LocalPersistentVolume = V1PersistentVolume & {
5+ IP : string ;
6+ devicePath : string ;
7+ } ;
8+
9+ interface K8SLocalVolumeAdapter {
10+ listLocalPersistentVolumes ( ) : Promise < LocalPersistentVolume [ ] > ;
11+ }
12+
13+ export default class K8SLocalVolumeProvider implements K8SLocalVolumeAdapter {
14+ k8sClient : CoreV1Api ;
15+ constructor ( url : string , token : string ) {
16+ const config = new Config ( url , token ) ;
17+ this . k8sClient = config . makeApiClient ( CoreV1Api ) ;
18+ }
19+ public async listLocalPersistentVolumes ( ) : Promise < LocalPersistentVolume [ ] > {
20+ try {
21+ // Fetch all local persistent volumes
22+ const pv = await this . k8sClient . listPersistentVolume ( ) ;
23+ // MERGE with IP and devicePath
24+ return [ ] ;
25+ } catch ( error ) {
26+ // throw new Error(`Failed to fetch local persistent volumes: ${error.message}`);
27+ }
28+ }
29+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments