Skip to content

Commit bb98cd4

Browse files
authored
Tidied Pod Monitor strings (#443)
Signed-off-by: Michael Mattsson <michael.mattsson@gmail.com>
1 parent 3e403cc commit bb98cd4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

pkg/flavor/kubernetes/flavor.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -864,11 +864,11 @@ func (flavor *Flavor) MonitorPod(podLabelkey, podLabelvalue string) error {
864864

865865
podList, err := flavor.kubeClient.CoreV1().Pods(meta_v1.NamespaceAll).List(context.Background(), listOptions)
866866
if err != nil {
867-
log.Errorf("unable to list nfs pods for monitoring: %s", err.Error())
867+
log.Errorf("Unable to enumerate Pods for monitoring: %s", err.Error())
868868
return err
869869
}
870870
if podList == nil || len(podList.Items) == 0 {
871-
log.Tracef("cannot find any nfs pod with label %s=%s", podLabelkey, podLabelvalue)
871+
log.Tracef("Cannot find any Pods with label %s=%s", podLabelkey, podLabelvalue)
872872
return nil
873873
}
874874

@@ -879,7 +879,7 @@ func (flavor *Flavor) MonitorPod(podLabelkey, podLabelvalue string) error {
879879
} else if pod.ObjectMeta.DeletionTimestamp != nil {
880880
node, err := flavor.GetNodeByName(pod.Spec.NodeName)
881881
if err != nil {
882-
log.Warnf("unable to get node for monitoring pod %s: %s", pod.ObjectMeta.Name, err.Error())
882+
log.Warnf("Unable to get Node for monitoring Pod %s: %s", pod.ObjectMeta.Name, err.Error())
883883
// move on with other pods
884884
continue
885885
}
@@ -898,28 +898,28 @@ func (flavor *Flavor) MonitorPod(podLabelkey, podLabelvalue string) error {
898898
continue
899899
}
900900
// delete volume attachments if the node is down for this pod
901-
log.Infof("Force deleting volume attachment for pod %s as it is in unknown state.", pod.ObjectMeta.Name)
901+
log.Infof("Force deleting VolumeAttachment for Pod %s as it is in unknown state.", pod.ObjectMeta.Name)
902902
err := flavor.cleanupVolumeAttachmentsByPod(&pod)
903903
if err != nil {
904-
log.Errorf("Error cleaning up volume attachments for pod %s: %s", pod.ObjectMeta.Name, err.Error())
904+
log.Errorf("Error cleaning up VolumeAttachments for Pod %s: %s", pod.ObjectMeta.Name, err.Error())
905905
// move on with other pods
906906
continue
907907
}
908908

909909
// force delete the pod
910-
log.Infof("Force deleting pod %s as it's in unknown state.", pod.ObjectMeta.Name)
910+
log.Infof("Force deleting Pod %s as it's in unknown state.", pod.ObjectMeta.Name)
911911
err = flavor.DeletePod(pod.Name, pod.ObjectMeta.Namespace, true)
912912
if err != nil {
913913
if !errors.IsNotFound(err) {
914-
log.Errorf("Error deleting pod %s: %s", pod.Name, err.Error())
914+
log.Errorf("Error deleting Pod %s: %s", pod.Name, err.Error())
915915
}
916916
}
917917
}
918918
return nil
919919
}
920920

921921
func (flavor *Flavor) cleanupVolumeAttachmentsByPod(pod *v1.Pod) error {
922-
log.Tracef(">>>>> cleanupVolumeAttachmentsByPod for pod %s", pod.Name)
922+
log.Tracef(">>>>> cleanupVolumeAttachmentsByPod for Pod %s", pod.Name)
923923
defer log.Tracef("<<<<< cleanupVolumeAttachmentsByPod")
924924

925925
// Get all volume attachments
@@ -933,15 +933,15 @@ func (flavor *Flavor) cleanupVolumeAttachmentsByPod(pod *v1.Pod) error {
933933
//check if this va refers to PV which is attached to this pod on same node
934934
isAttached, err := flavor.isVolumeAttachedToPod(pod, &va)
935935
if err != nil {
936-
log.Warnf("unable to determine if va %s belongs to pod %s", va.Name, pod.ObjectMeta.Name)
936+
log.Warnf("Unable to determine if VolumeAttachment %s belongs to Pod %s", va.Name, pod.ObjectMeta.Name)
937937
continue
938938
}
939939
if isAttached {
940940
err := flavor.DeleteVolumeAttachment(va.Name, false)
941941
if err != nil {
942942
return err
943943
}
944-
log.Infof("Deleted volume attachment: %s", va.Name)
944+
log.Infof("Deleted VolumeAttachment: %s", va.Name)
945945
}
946946
}
947947
}
@@ -950,7 +950,7 @@ func (flavor *Flavor) cleanupVolumeAttachmentsByPod(pod *v1.Pod) error {
950950

951951
// check if the volume attachment refers to PV claimed by the pod on same node
952952
func (flavor *Flavor) isVolumeAttachedToPod(pod *v1.Pod, va *storage_v1.VolumeAttachment) (bool, error) {
953-
log.Tracef(">>>>> isVolumeAttachedToPod with pod %s, va %s", pod.ObjectMeta.Name, va.Name)
953+
log.Tracef(">>>>> isVolumeAttachedToPod with Pod %s, va %s", pod.ObjectMeta.Name, va.Name)
954954
defer log.Tracef("<<<<< isVolumeAttachedToPod")
955955

956956
// check only va's attached to node where pod belongs to
@@ -965,7 +965,7 @@ func (flavor *Flavor) isVolumeAttachedToPod(pod *v1.Pod, va *storage_v1.VolumeAt
965965
return false, err
966966
}
967967
if claim != nil && claim.ObjectMeta.Name == vol.VolumeSource.PersistentVolumeClaim.ClaimName {
968-
log.Tracef("volume %s of volumeattachment %s is attached to pod %s", *va.Spec.Source.PersistentVolumeName, va.Name, pod.ObjectMeta.Name)
968+
log.Tracef("PersistentVolume %s of VolumeAttachment %s is attached to Pod %s", *va.Spec.Source.PersistentVolumeName, va.Name, pod.ObjectMeta.Name)
969969
return true, nil
970970
}
971971
}

0 commit comments

Comments
 (0)