INNER CODE UNIT · Go
checkVolumeAttachments
kubernetes-sigs/aws-ebs-csi-driver · cmd/hooks/prestop.go:147
func checkVolumeAttachments(clientset kubernetes.Interface, nodeName string, allAttachmentsDeleted chan struct{}) error {
allAttachments, err := clientset.StorageV1().VolumeAttachments().List(context.Background(), metav1.ListOptions{})
if err != nil {
return fmt.Errorf("checkVolumeAttachments: failed to list VolumeAttachments: %w", err)
}
for _, attachment := range allAttachments.Items {
if attachment.Spec.NodeName == nodeName {
klog.InfoS("isVolumeAttachmentEmpty: not ready to exit, found VolumeAttachment", "attachment", attachment, "node", nodeName)
return nil
}
}
close(allAttachmentsDeleted)
return nil
}