Skip to content

Commit 194ee40

Browse files
authored
fix: PVC resizing doesn't trigger a redeployment (opendatahub-io#4334)
* fix: PVC resizing doesn't trigger a redeployment * one annotation solution * updated tests * fixed lint * NIM isolation * generic version * fix: lint * deleted comment
1 parent 5a989e6 commit 194ee40

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

frontend/src/api/k8s/pvcs.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,17 @@ export const assemblePvc = (
2020
namespace: string,
2121
editName?: string,
2222
hideFromUI?: boolean,
23+
additionalAnnotations?: Record<string, string>, // Generic alternative to forceRedeploy
2324
): PersistentVolumeClaimKind => {
2425
const { name: pvcName, description, size, storageClassName, accessMode } = data;
2526
const name = editName || data.k8sName || translateDisplayNameForK8s(pvcName);
2627

28+
const annotations: Record<string, string> = {
29+
'openshift.io/display-name': pvcName.trim(),
30+
...(description && { 'openshift.io/description': description }),
31+
...(additionalAnnotations || {}),
32+
};
33+
2734
return {
2835
apiVersion: 'v1',
2936
kind: 'PersistentVolumeClaim',
@@ -35,10 +42,7 @@ export const assemblePvc = (
3542
[KnownLabels.DASHBOARD_RESOURCE]: 'true',
3643
},
3744
}),
38-
annotations: {
39-
'openshift.io/display-name': pvcName.trim(),
40-
...(description && { 'openshift.io/description': description }),
41-
},
45+
annotations,
4246
},
4347
spec: {
4448
accessModes: [accessMode ?? AccessMode.RWO],
@@ -70,8 +74,9 @@ export const createPvc = (
7074
namespace: string,
7175
opts?: K8sAPIOptions,
7276
hideFromUI?: boolean,
77+
additionalAnnotations?: Record<string, string>,
7378
): Promise<PersistentVolumeClaimKind> => {
74-
const pvc = assemblePvc(data, namespace, undefined, hideFromUI);
79+
const pvc = assemblePvc(data, namespace, undefined, hideFromUI, additionalAnnotations);
7580

7681
return k8sCreateResource<PersistentVolumeClaimKind>(
7782
applyK8sAPIOptions({ model: PVCModel, resource: pvc }, opts),
@@ -84,8 +89,15 @@ export const updatePvc = (
8489
namespace: string,
8590
opts?: K8sAPIOptions,
8691
excludeSpec?: boolean,
92+
additionalAnnotations?: Record<string, string>,
8793
): Promise<PersistentVolumeClaimKind> => {
88-
const pvc = assemblePvc(data, namespace, existingData.metadata.name);
94+
const pvc = assemblePvc(
95+
data,
96+
namespace,
97+
existingData.metadata.name,
98+
undefined,
99+
additionalAnnotations,
100+
);
89101
const newData = excludeSpec
90102
? {
91103
...pvc,

frontend/src/pages/modelServing/screens/projects/NIMServiceModal/ManageNIMServingModal.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,11 @@ const ManageNIMServingModal: React.FC<ManageNIMServingModalProps> = ({
329329
description: pvc.metadata.annotations?.description || '',
330330
storageClassName: pvc.spec.storageClassName,
331331
};
332-
promises.push(updatePvc(updatePvcData, pvc, namespace, { dryRun: false }));
332+
promises.push(
333+
updatePvc(updatePvcData, pvc, namespace, { dryRun: false }, false, {
334+
'runtimes.opendatahub.io/force-redeploy': new Date().toISOString(),
335+
}),
336+
);
333337
}
334338
return Promise.all(promises);
335339
})

0 commit comments

Comments
 (0)