Skip to content

Commit b442731

Browse files
committed
Refactor volume deletion to retrieve token and client within the loop
1 parent 837dae4 commit b442731

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ui/src/services/k8s/Metalk8sLocalVolumeProvider.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,15 @@ export default class Metalk8sLocalVolumeProvider {
9393
): Promise<void> => {
9494
// The volume name is the same as the PV name
9595
const volumeNames = localPVs.map((localPV) => localPV.metadata.name);
96-
const token = await this.getToken();
97-
const { customObjects } = ApiK8s.updateApiServerConfig(this.apiUrl, token);
98-
const volumeClient = new Metalk8sV1alpha1VolumeClient(customObjects);
9996

10097
for (const volumeName of volumeNames) {
98+
const token = await this.getToken();
99+
const { customObjects } = ApiK8s.updateApiServerConfig(
100+
this.apiUrl,
101+
token,
102+
);
103+
const volumeClient = new Metalk8sV1alpha1VolumeClient(customObjects);
104+
101105
try {
102106
const deleteVolume = await volumeClient.deleteMetalk8sV1alpha1Volume(
103107
volumeName,

0 commit comments

Comments
 (0)