Skip to content

Commit

Permalink
ci: log pvc events
Browse files Browse the repository at this point in the history
incase if the pvc is not bound
yet, log the pvc events to
check what is happening.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
  • Loading branch information
Madhu-1 committed Sep 12, 2024
1 parent 0949fa2 commit 5eeb614
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions e2e/pvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 5eeb614

Please sign in to comment.