Skip to content

Commit c420448

Browse files
committed
Add volumeType property to LocalPersistentVolume and refactor Metalk8sLocalVolumeProvider
1 parent db2f969 commit c420448

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

ui/src/services/k8s/Metalk8sLocalVolumeProvider.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,10 @@ type LocalPersistentVolume = V1PersistentVolume & {
1313
IP: string;
1414
devicePath: string;
1515
nodeName: string;
16+
volumeType: 'rawBlockDevice' | 'lvmLogicalVolume' | 'sparseLoopDevice';
1617
};
1718

18-
export interface Metalk8sLocalVolumeAdapter {
19-
listLocalPersistentVolumes(
20-
serverName: string,
21-
): Promise<LocalPersistentVolume[]>;
22-
}
23-
24-
export default class Metalk8sLocalVolumeProvider
25-
implements Metalk8sLocalVolumeAdapter
26-
{
19+
export default class Metalk8sLocalVolumeProvider {
2720
volumeClient: Metalk8sV1alpha1VolumeClient;
2821
k8sClient: CoreV1Api;
2922
constructor(url: string, token: string) {
@@ -65,6 +58,11 @@ export default class Metalk8sLocalVolumeProvider
6558
devicePath:
6659
item.spec?.rawBlockDevice?.devicePath || item.metadata['name'],
6760
nodeName: item.spec.nodeName,
61+
volumeType: item.spec.rawBlockDevice
62+
? ('rawBlockDevice' as 'rawBlockDevice')
63+
: item.spec.lvmLogicalVolume
64+
? ('lvmLogicalVolume' as 'lvmLogicalVolume')
65+
: ('sparseLoopDevice' as 'sparseLoopDevice'),
6866
},
6967
];
7068
}, [] as LocalPersistentVolume[]);

0 commit comments

Comments
 (0)