From 744b8e1c1c6538e643f900b4af5f9e84597384da Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 11 Sep 2024 10:22:55 +0200 Subject: [PATCH] ci: log pvc events incase if the pvc is not bound yet, log the pvc events to check what is happening. Signed-off-by: Madhu Rajanna --- e2e/pvc.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/e2e/pvc.go b/e2e/pvc.go index ede131c56..932d66b33 100644 --- a/e2e/pvc.go +++ b/e2e/pvc.go @@ -75,6 +75,19 @@ func createPVCAndvalidatePV(c kubernetes.Interface, pvc *v1.PersistentVolumeClai } if pvc.Spec.VolumeName == "" { + var events *v1.EventList + // Log the events for the PVC if its not bound yet + events, err = c.CoreV1().Events(namespace).List(ctx, metav1.ListOptions{ + FieldSelector: "involvedObject.kind=PersistentVolumeClaim,involvedObject.name=" + name, + }) + if err == nil { + for i := range events.Items { + framework.Logf("PVC %s Event: %s - %s", name, events.Items[i].Reason, events.Items[i].Message) + } + } else { + framework.Logf("error getting events for PVC %s: %v", name, err) + } + return false, nil }