Merge branch 'master' into make-mock-provider-async2

This commit is contained in:
Brian Goff
2019-06-05 14:42:11 -07:00
committed by GitHub
60 changed files with 1144 additions and 1427 deletions

View File

@@ -10,8 +10,7 @@ import (
"strings"
"time"
"github.com/cpuguy83/strongerrors"
"github.com/cpuguy83/strongerrors/status/ocstatus"
"github.com/virtual-kubelet/virtual-kubelet/errdefs"
"github.com/virtual-kubelet/virtual-kubelet/log"
"github.com/virtual-kubelet/virtual-kubelet/trace"
"github.com/virtual-kubelet/virtual-kubelet/vkubelet/api"
@@ -252,7 +251,7 @@ func (p *MockLegacyProvider) DeletePod(ctx context.Context, pod *v1.Pod) (err er
}
if _, exists := p.pods[key]; !exists {
return strongerrors.NotFound(fmt.Errorf("pod not found"))
return errdefs.NotFound("pod not found")
}
now := metav1.Now()
@@ -281,7 +280,7 @@ func (p *MockLegacyProvider) DeletePod(ctx context.Context, pod *v1.Pod) (err er
func (p *MockLegacyProvider) GetPod(ctx context.Context, namespace, name string) (pod *v1.Pod, err error) {
ctx, span := trace.StartSpan(ctx, "GetPod")
defer func() {
span.SetStatus(ocstatus.FromError(err))
span.SetStatus(err)
span.End()
}()
@@ -298,7 +297,7 @@ func (p *MockLegacyProvider) GetPod(ctx context.Context, namespace, name string)
if pod, ok := p.pods[key]; ok {
return pod, nil
}
return nil, strongerrors.NotFound(fmt.Errorf("pod \"%s/%s\" is not known to the provider", namespace, name))
return nil, errdefs.NotFoundf("pod \"%s/%s\" is not known to the provider", namespace, name)
}
// GetContainerLogs retrieves the logs of a container by name from the provider.