From 251e56c0a40ce587fc514f1f926877e4aa709062 Mon Sep 17 00:00:00 2001 From: Phan Le Date: Tue, 19 Oct 2021 16:43:30 -0700 Subject: [PATCH] Fix: PVC used by a job doesn't get resize after the pod of the job completed Once the job pod is terminated, remove the corresponding PVC from the usedPVCs. issue-175 Signed-off-by: Phan Le --- pkg/controller/controller.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index e68f307c5..bf8e47888 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -161,7 +161,11 @@ func (ctrl *resizeController) updatePod(oldObj, newObj interface{}) { return } - ctrl.usedPVCs.addPod(pod) + if isPodTerminated(pod) { + ctrl.usedPVCs.removePod(pod) + } else { + ctrl.usedPVCs.addPod(pod) + } } func (ctrl *resizeController) updatePVC(oldObj, newObj interface{}) {