Avoid use of github.com/pkg/errors functions that capture stack

We are not making use of the stack traces that these functions capture, so we should avoid using them as unnecessary overhead.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit bed1f66880)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson
2025-03-04 20:03:15 +00:00
committed by Brad Davidson
parent ab09acdc20
commit 3cb6c2dc92
70 changed files with 360 additions and 328 deletions

View File

@@ -8,7 +8,7 @@ import (
"strings"
"github.com/k3s-io/k3s/pkg/nodepassword"
"github.com/pkg/errors"
pkgerrors "github.com/pkg/errors"
coreclient "github.com/rancher/wrangler/v3/pkg/generated/controllers/core/v1"
"github.com/sirupsen/logrus"
core "k8s.io/api/core/v1"
@@ -72,7 +72,7 @@ func (h *handler) updateHosts(node *core.Node, removed bool) (*core.Node, error)
}
if removed {
if err := h.removeNodePassword(nodeName); err != nil {
logrus.Warn(errors.Wrap(err, "Unable to remove node password"))
logrus.Warn(pkgerrors.WithMessage(err, "Unable to remove node password"))
}
}
if h.modCoreDNS {
@@ -99,7 +99,7 @@ func (h *handler) updateCoreDNSConfigMap(nodeName, hostName, nodeIPv4, nodeIPv6
configMap, err := h.configMaps.Get("kube-system", "coredns", metav1.GetOptions{})
if err != nil || configMap == nil {
logrus.Warn(errors.Wrap(err, "Unable to fetch coredns config map"))
logrus.Warn(pkgerrors.WithMessage(err, "Unable to fetch coredns config map"))
return nil
}