From 1753e5af7ad2e958bb692efa654b2ae429a4222f Mon Sep 17 00:00:00 2001 From: "xin.li" Date: Mon, 2 Jan 2023 21:39:14 +0800 Subject: [PATCH] Reused errdefs for error Signed-off-by: xin.li --- pkg/cri/server/bandwidth/fake_shaper.go | 8 ++++---- pkg/cri/server/bandwidth/unsupported.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/cri/server/bandwidth/fake_shaper.go b/pkg/cri/server/bandwidth/fake_shaper.go index 4d46517c0..99bfd338a 100644 --- a/pkg/cri/server/bandwidth/fake_shaper.go +++ b/pkg/cri/server/bandwidth/fake_shaper.go @@ -33,7 +33,7 @@ limitations under the License. package bandwidth import ( - "errors" + "github.com/containerd/containerd/errdefs" "k8s.io/apimachinery/pkg/api/resource" ) @@ -47,7 +47,7 @@ type FakeShaper struct { // Limit is not implemented func (f *FakeShaper) Limit(cidr string, egress, ingress *resource.Quantity) error { - return errors.New("unimplemented") + return errdefs.ErrNotImplemented } // Reset appends a particular CIDR to the set of ResetCIDRs being managed by this shaper @@ -58,12 +58,12 @@ func (f *FakeShaper) Reset(cidr string) error { // ReconcileInterface is not implemented func (f *FakeShaper) ReconcileInterface() error { - return errors.New("unimplemented") + return errdefs.ErrNotImplemented } // ReconcileCIDR is not implemented func (f *FakeShaper) ReconcileCIDR(cidr string, egress, ingress *resource.Quantity) error { - return errors.New("unimplemented") + return errdefs.ErrNotImplemented } // GetCIDRs returns the set of CIDRs that are being managed by this shaper diff --git a/pkg/cri/server/bandwidth/unsupported.go b/pkg/cri/server/bandwidth/unsupported.go index 08b629fda..26bda16ef 100644 --- a/pkg/cri/server/bandwidth/unsupported.go +++ b/pkg/cri/server/bandwidth/unsupported.go @@ -35,7 +35,7 @@ limitations under the License. package bandwidth import ( - "errors" + "github.com/containerd/containerd/errdefs" "k8s.io/apimachinery/pkg/api/resource" ) @@ -49,7 +49,7 @@ func NewTCShaper(iface string) Shaper { } func (f *unsupportedShaper) Limit(cidr string, egress, ingress *resource.Quantity) error { - return errors.New("unimplemented") + return errdefs.ErrNotImplemented } func (f *unsupportedShaper) Reset(cidr string) error { @@ -57,11 +57,11 @@ func (f *unsupportedShaper) Reset(cidr string) error { } func (f *unsupportedShaper) ReconcileInterface() error { - return errors.New("unimplemented") + return errdefs.ErrNotImplemented } func (f *unsupportedShaper) ReconcileCIDR(cidr string, egress, ingress *resource.Quantity) error { - return errors.New("unimplemented") + return errdefs.ErrNotImplemented } func (f *unsupportedShaper) GetCIDRs() ([]string, error) {