mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #103059 from rajaSahil/fix-error
Update github.com/pkg/errors to go native errors pkg
This commit is contained in:
commit
b559434c02
@ -17,12 +17,11 @@ limitations under the License.
|
|||||||
package configfiles
|
package configfiles
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
|
|
||||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
kubeletconfigv1beta1 "k8s.io/kubelet/config/v1beta1"
|
kubeletconfigv1beta1 "k8s.io/kubelet/config/v1beta1"
|
||||||
@ -166,7 +165,7 @@ foo: bar`),
|
|||||||
}
|
}
|
||||||
kc, err := loader.Load()
|
kc, err := loader.Load()
|
||||||
|
|
||||||
if c.strictErr && !runtime.IsStrictDecodingError(errors.Cause(err)) {
|
if c.strictErr && !runtime.IsStrictDecodingError(errors.Unwrap(err)) {
|
||||||
t.Fatalf("got error: %v, want strict decoding error", err)
|
t.Fatalf("got error: %v, want strict decoding error", err)
|
||||||
}
|
}
|
||||||
if utiltest.SkipRest(t, c.desc, err, c.err) {
|
if utiltest.SkipRest(t, c.desc, err, c.err) {
|
||||||
|
@ -19,7 +19,6 @@ package codec
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
|
||||||
// ensure the core apis are installed
|
// ensure the core apis are installed
|
||||||
@ -95,7 +94,7 @@ func DecodeKubeletConfiguration(kubeletCodecs *serializer.CodecFactory, data []b
|
|||||||
// decoder, which has only v1beta1 registered, and log a warning.
|
// decoder, which has only v1beta1 registered, and log a warning.
|
||||||
// The lenient path is to be dropped when support for v1beta1 is dropped.
|
// The lenient path is to be dropped when support for v1beta1 is dropped.
|
||||||
if !runtime.IsStrictDecodingError(err) {
|
if !runtime.IsStrictDecodingError(err) {
|
||||||
return nil, errors.Wrap(err, "failed to decode")
|
return nil, fmt.Errorf("failed to decode: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var lenientErr error
|
var lenientErr error
|
||||||
|
@ -22,13 +22,13 @@ package operationexecutor
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"k8s.io/client-go/tools/record"
|
"k8s.io/client-go/tools/record"
|
||||||
registerapi "k8s.io/kubelet/pkg/apis/pluginregistration/v1"
|
registerapi "k8s.io/kubelet/pkg/apis/pluginregistration/v1"
|
||||||
@ -163,7 +163,7 @@ func (og *operationGenerator) notifyPlugin(client registerapi.RegistrationClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
if _, err := client.NotifyRegistrationStatus(ctx, status); err != nil {
|
if _, err := client.NotifyRegistrationStatus(ctx, status); err != nil {
|
||||||
return errors.Wrap(err, errStr)
|
return fmt.Errorf("%s: %w", errStr, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errStr != "" {
|
if errStr != "" {
|
||||||
|
@ -23,7 +23,6 @@ import (
|
|||||||
restful "github.com/emicklei/go-restful"
|
restful "github.com/emicklei/go-restful"
|
||||||
cadvisorapi "github.com/google/cadvisor/info/v1"
|
cadvisorapi "github.com/google/cadvisor/info/v1"
|
||||||
cadvisorv2 "github.com/google/cadvisor/info/v2"
|
cadvisorv2 "github.com/google/cadvisor/info/v2"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
@ -143,7 +142,7 @@ func (h *handler) handleSummary(request *restful.Request, response *restful.Resp
|
|||||||
onlyCPUAndMemory := false
|
onlyCPUAndMemory := false
|
||||||
err := request.Request.ParseForm()
|
err := request.Request.ParseForm()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
handleError(response, "/stats/summary", errors.Wrapf(err, "parse form failed"))
|
handleError(response, "/stats/summary", fmt.Errorf("parse form failed: %w", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if onlyCluAndMemoryParam, found := request.Request.Form["only_cpu_and_memory"]; found &&
|
if onlyCluAndMemoryParam, found := request.Request.Form["only_cpu_and_memory"]; found &&
|
||||||
|
Loading…
Reference in New Issue
Block a user