Skip to content

Commit

Permalink
revert removal of error wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
poy committed Nov 30, 2019
1 parent 06d0866 commit 63cfaa9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/pod/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func orderContainers(entrypointImage string, steps []corev1.Container) (corev1.C
func UpdateReady(kubeclient kubernetes.Interface, pod corev1.Pod) error {
newPod, err := kubeclient.CoreV1().Pods(pod.Namespace).Get(pod.Name, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("Error getting Pod %q when updating ready annotation: %v", pod.Name, err)
return fmt.Errorf("Error getting Pod %q when updating ready annotation: %w", pod.Name, err)
}

// Update the Pod's "READY" annotation to signal the first step to
Expand All @@ -152,7 +152,7 @@ func UpdateReady(kubeclient kubernetes.Interface, pod corev1.Pod) error {
if newPod.ObjectMeta.Annotations[readyAnnotation] != readyAnnotationValue {
newPod.ObjectMeta.Annotations[readyAnnotation] = readyAnnotationValue
if _, err := kubeclient.CoreV1().Pods(newPod.Namespace).Update(newPod); err != nil {
return fmt.Errorf("Error adding ready annotation to Pod %q: %v", pod.Name, err)
return fmt.Errorf("Error adding ready annotation to Pod %q: %w", pod.Name, err)
}
}
return nil
Expand All @@ -163,7 +163,7 @@ func UpdateReady(kubeclient kubernetes.Interface, pod corev1.Pod) error {
func StopSidecars(nopImage string, kubeclient kubernetes.Interface, pod corev1.Pod) error {
newPod, err := kubeclient.CoreV1().Pods(pod.Namespace).Get(pod.Name, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("Error getting Pod %q when stopping sidecars: %v", pod.Name, err)
return fmt.Errorf("Error getting Pod %q when stopping sidecars: %w", pod.Name, err)
}

updated := false
Expand All @@ -181,7 +181,7 @@ func StopSidecars(nopImage string, kubeclient kubernetes.Interface, pod corev1.P
}
if updated {
if _, err := kubeclient.CoreV1().Pods(newPod.Namespace).Update(newPod); err != nil {
return fmt.Errorf("Error adding ready annotation to Pod %q: %v", pod.Name, err)
return fmt.Errorf("Error adding ready annotation to Pod %q: %w", pod.Name, err)
}
}
return nil
Expand Down

0 comments on commit 63cfaa9

Please sign in to comment.