Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(console): create vm support set accessModes by sc Provisioner #2239

Merged
merged 3 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface DiskInterface {
type: DiskTypeEnum;
volumeMode: VolumeModeEnum;
storageClass: string;
scProvisioner: string;
size: number;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const DiskPanel = () => {
type: DiskTypeEnum.Data,
volumeMode: VolumeModeEnum.Filesystem,
storageClass: null,
scProvisioner: null,
size: 50
}
];
Expand Down Expand Up @@ -97,6 +98,9 @@ export const DiskPanel = () => {
onChange={storageClass =>
modifyDiskItem({
storageClass,
scProvisioner:
storageClassListLoadable?.contents?.find(({ value }) => value === storageClass)?.provisioner ??
null,
id
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export const VMCreatePanel = () => {
});

history.back();
} catch (error) {}
} catch (error) {
console.log('createVm error --->', error);
}
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const diskListState = atom<DiskInterface[]>({
type: DiskTypeEnum.System,
volumeMode: VolumeModeEnum.Filesystem,
storageClass: null,
scProvisioner: null,
size: 50
},

Expand All @@ -42,6 +43,7 @@ export const diskListState = atom<DiskInterface[]>({
type: DiskTypeEnum.Data,
volumeMode: VolumeModeEnum.Filesystem,
storageClass: null,
scProvisioner: null,
size: 50
}
]
Expand All @@ -56,7 +58,7 @@ export const storageClassListState = selector({

const { items } = await storageClassAPI.fetchStorageClassList(clusterId);

return items?.map(({ metadata }) => ({ value: metadata?.name })) ?? [];
return items?.map(({ metadata, provisioner }) => ({ value: metadata?.name, provisioner })) ?? [];
}
});

Expand Down
2 changes: 1 addition & 1 deletion web/console/src/webApi/virtual-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export function createVM({

spec: {
pvc: {
accessModes: ['ReadWriteOnce'],
accessModes: item?.scProvisioner === 'rbd.csi.ceph.com' ? ['ReadWriteOnce'] : ['ReadWriteMany'],
resources: {
requests: {
storage: `${item.size}Gi`
Expand Down