Use errdefs package
This commit is contained in:
@@ -16,8 +16,8 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/cpuguy83/strongerrors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/virtual-kubelet/virtual-kubelet/errdefs"
|
||||
"github.com/virtual-kubelet/virtual-kubelet/manager"
|
||||
"github.com/virtual-kubelet/virtual-kubelet/providers"
|
||||
"github.com/virtual-kubelet/virtual-kubelet/vkubelet/api"
|
||||
@@ -569,7 +569,7 @@ func (p *CRIProvider) DeletePod(ctx context.Context, pod *v1.Pod) error {
|
||||
|
||||
ps, ok := p.podStatus[pod.UID]
|
||||
if !ok {
|
||||
return strongerrors.NotFound(fmt.Errorf("Pod %s not found", pod.UID))
|
||||
return errdefs.NotFoundf("Pod %s not found", pod.UID)
|
||||
}
|
||||
|
||||
// TODO: Check pod status for running state
|
||||
@@ -601,7 +601,7 @@ func (p *CRIProvider) GetPod(ctx context.Context, namespace, name string) (*v1.P
|
||||
|
||||
pod := p.findPodByName(namespace, name)
|
||||
if pod == nil {
|
||||
return nil, strongerrors.NotFound(fmt.Errorf("Pod %s in namespace %s could not be found on the node", name, namespace))
|
||||
return nil, errdefs.NotFoundf("Pod %s in namespace %s could not be found on the node", name, namespace)
|
||||
}
|
||||
|
||||
return createPodSpecFromCRI(pod, p.nodeName), nil
|
||||
@@ -638,11 +638,11 @@ func (p *CRIProvider) GetContainerLogs(ctx context.Context, namespace, podName,
|
||||
|
||||
pod := p.findPodByName(namespace, podName)
|
||||
if pod == nil {
|
||||
return nil, strongerrors.NotFound(fmt.Errorf("Pod %s in namespace %s not found", podName, namespace))
|
||||
return nil, errdefs.NotFoundf("Pod %s in namespace %s not found", podName, namespace)
|
||||
}
|
||||
container := pod.containers[containerName]
|
||||
if container == nil {
|
||||
return nil, strongerrors.NotFound(fmt.Errorf("Cannot find container %s in pod %s namespace %s", containerName, podName, namespace))
|
||||
return nil, errdefs.NotFoundf("Cannot find container %s in pod %s namespace %s", containerName, podName, namespace)
|
||||
}
|
||||
|
||||
return readLogFile(container.LogPath, opts)
|
||||
@@ -686,7 +686,7 @@ func (p *CRIProvider) GetPodStatus(ctx context.Context, namespace, name string)
|
||||
|
||||
pod := p.findPodByName(namespace, name)
|
||||
if pod == nil {
|
||||
return nil, strongerrors.NotFound(fmt.Errorf("Pod %s in namespace %s could not be found on the node", name, namespace))
|
||||
return nil, errdefs.NotFoundf("Pod %s in namespace %s could not be found on the node", name, namespace)
|
||||
}
|
||||
|
||||
return createPodStatusFromCRI(pod), nil
|
||||
|
||||
Reference in New Issue
Block a user