mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 01:26:59 +02:00
chore(deps): code cleanup, do not use pkg/errors (#5335)
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
This commit is contained in:
parent
adf9fb20a4
commit
ba64e8bb01
4
Makefile
4
Makefile
@ -201,3 +201,7 @@ helm-template:
|
||||
helm-lint:
|
||||
scripts/helm-tools.sh --schema
|
||||
scripts/helm-tools.sh --docs
|
||||
|
||||
.PHONY: go-dependency
|
||||
go-dependency: ## Dependency maintanance
|
||||
go mod tidy
|
||||
|
2
go.mod
2
go.mod
@ -50,7 +50,6 @@ require (
|
||||
github.com/oracle/oci-go-sdk/v65 v65.89.1
|
||||
github.com/ovh/go-ovh v1.7.0
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pluralsh/gqlclient v1.12.2
|
||||
github.com/projectcontour/contour v1.30.3
|
||||
github.com/prometheus/client_golang v1.22.0
|
||||
@ -170,6 +169,7 @@ require (
|
||||
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
|
||||
github.com/peterhellberg/link v1.1.0 // indirect
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.62.0 // indirect
|
||||
|
@ -18,6 +18,7 @@ package oci
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
@ -27,7 +28,6 @@ import (
|
||||
"github.com/oracle/oci-go-sdk/v65/common"
|
||||
"github.com/oracle/oci-go-sdk/v65/common/auth"
|
||||
"github.com/oracle/oci-go-sdk/v65/dns"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"sigs.k8s.io/external-dns/endpoint"
|
||||
|
@ -18,6 +18,8 @@ package oci
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
@ -25,7 +27,6 @@ import (
|
||||
|
||||
"github.com/oracle/oci-go-sdk/v65/common"
|
||||
"github.com/oracle/oci-go-sdk/v65/dns"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"sigs.k8s.io/external-dns/endpoint"
|
||||
@ -621,7 +622,7 @@ func (c *mutableMockOCIDNSClient) PatchZoneRecords(ctx context.Context, request
|
||||
case dns.RecordOperationOperationRemove:
|
||||
delete(records, k)
|
||||
default:
|
||||
err = errors.Errorf("unsupported operation %q", op.Operation)
|
||||
err = fmt.Errorf("unsupported operation %q", op.Operation)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,12 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
ambassador "github.com/datawire/ambassador/pkg/api/getambassador.io/v2"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
@ -96,7 +96,7 @@ func NewAmbassadorHostSource(
|
||||
|
||||
uc, err := newUnstructuredConverter()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to setup Unstructured Converter")
|
||||
return nil, fmt.Errorf("failed to setup Unstructured Converter: %w", err)
|
||||
}
|
||||
|
||||
return &ambassadorHostSource{
|
||||
@ -137,10 +137,10 @@ func (sc *ambassadorHostSource) Endpoints(ctx context.Context) ([]*endpoint.Endp
|
||||
// Filter Ambassador Hosts
|
||||
ambassadorHosts, err = sc.filterByAnnotations(ambassadorHosts)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter Ambassador Hosts by annotation")
|
||||
return nil, fmt.Errorf("failed to filter Ambassador Hosts by annotation: %w", err)
|
||||
}
|
||||
|
||||
endpoints := []*endpoint.Endpoint{}
|
||||
var endpoints []*endpoint.Endpoint
|
||||
|
||||
for _, host := range ambassadorHosts {
|
||||
fullname := fmt.Sprintf("%s/%s", host.Namespace, host.Name)
|
||||
@ -260,7 +260,7 @@ func parseAmbLoadBalancerService(service string) (namespace, name string, err er
|
||||
}
|
||||
|
||||
// If we got here, this string is simply ill-formatted. Return an error.
|
||||
return "", "", errors.New(fmt.Sprintf("invalid external-dns service: %s", service))
|
||||
return "", "", fmt.Errorf("invalid external-dns service: %s", service)
|
||||
}
|
||||
|
||||
func (sc *ambassadorHostSource) AddEventHandler(ctx context.Context, handler func()) {
|
||||
|
@ -18,11 +18,11 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"text/template"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
projectcontour "github.com/projectcontour/contour/apis/projectcontour/v1"
|
||||
log "github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -87,7 +87,7 @@ func NewContourHTTPProxySource(
|
||||
|
||||
uc, err := NewUnstructuredConverter()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to setup Unstructured Converter")
|
||||
return nil, fmt.Errorf("failed to setup Unstructured Converter: %w", err)
|
||||
}
|
||||
|
||||
return &httpProxySource{
|
||||
@ -121,14 +121,14 @@ func (sc *httpProxySource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint,
|
||||
hpConverted := &projectcontour.HTTPProxy{}
|
||||
err := sc.unstructuredConverter.scheme.Convert(unstructuredHP, hpConverted, nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to convert to HTTPProxy")
|
||||
return nil, fmt.Errorf("failed to convert to HTTPProxy: %w", err)
|
||||
}
|
||||
httpProxies = append(httpProxies, hpConverted)
|
||||
}
|
||||
|
||||
httpProxies, err = sc.filterByAnnotations(httpProxies)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter HTTPProxies")
|
||||
return nil, fmt.Errorf("failed to filter HTTPProxies: %w", err)
|
||||
}
|
||||
|
||||
endpoints := []*endpoint.Endpoint{}
|
||||
@ -144,14 +144,14 @@ func (sc *httpProxySource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint,
|
||||
|
||||
hpEndpoints, err := sc.endpointsFromHTTPProxy(hp)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get endpoints from HTTPProxy")
|
||||
return nil, fmt.Errorf("failed to get endpoints from HTTPProxy: %w", err)
|
||||
}
|
||||
|
||||
// apply template if fqdn is missing on HTTPProxy
|
||||
if (sc.combineFQDNAnnotation || len(hpEndpoints) == 0) && sc.fqdnTemplate != nil {
|
||||
tmplEndpoints, err := sc.endpointsFromTemplate(hp)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get endpoints from template")
|
||||
return nil, fmt.Errorf("failed to get endpoints from template: %w", err)
|
||||
}
|
||||
|
||||
if sc.combineFQDNAnnotation {
|
||||
|
@ -18,11 +18,11 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
fakeDynamic "k8s.io/client-go/dynamic/fake"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
projectcontour "github.com/projectcontour/contour/apis/projectcontour/v1"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -18,10 +18,10 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
@ -82,7 +82,7 @@ func NewF5TransportServerSource(
|
||||
|
||||
uc, err := newTSUnstructuredConverter()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to setup unstructured converter")
|
||||
return nil, fmt.Errorf("failed to setup unstructured converter: %w", err)
|
||||
}
|
||||
|
||||
return &f5TransportServerSource{
|
||||
@ -120,7 +120,7 @@ func (ts *f5TransportServerSource) Endpoints(ctx context.Context) ([]*endpoint.E
|
||||
|
||||
transportServers, err = ts.filterByAnnotations(transportServers)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter TransportServers")
|
||||
return nil, fmt.Errorf("failed to filter TransportServers: %w", err)
|
||||
}
|
||||
|
||||
endpoints, err := ts.endpointsFromTransportServers(transportServers)
|
||||
|
@ -18,11 +18,11 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
@ -83,7 +83,7 @@ func NewF5VirtualServerSource(
|
||||
|
||||
uc, err := newVSUnstructuredConverter()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to setup unstructured converter")
|
||||
return nil, fmt.Errorf("failed to setup unstructured converter: %w", err)
|
||||
}
|
||||
|
||||
return &f5VirtualServerSource{
|
||||
@ -121,7 +121,7 @@ func (vs *f5VirtualServerSource) Endpoints(ctx context.Context) ([]*endpoint.End
|
||||
|
||||
virtualServers, err = vs.filterByAnnotations(virtualServers)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter VirtualServers")
|
||||
return nil, fmt.Errorf("failed to filter VirtualServers: %w", err)
|
||||
}
|
||||
|
||||
endpoints, err := vs.endpointsFromVirtualServers(virtualServers)
|
||||
|
@ -18,9 +18,9 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
@ -18,10 +18,10 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
@ -18,10 +18,10 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -82,7 +82,7 @@ func NewKongTCPIngressSource(ctx context.Context, dynamicKubeClient dynamic.Inte
|
||||
|
||||
uc, err := newKongUnstructuredConverter()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to setup Unstructured Converter")
|
||||
return nil, fmt.Errorf("failed to setup Unstructured Converter: %w", err)
|
||||
}
|
||||
|
||||
return &kongTCPIngressSource{
|
||||
@ -121,7 +121,7 @@ func (sc *kongTCPIngressSource) Endpoints(ctx context.Context) ([]*endpoint.Endp
|
||||
|
||||
tcpIngresses, err = sc.filterByAnnotations(tcpIngresses)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter TCPIngresses")
|
||||
return nil, fmt.Errorf("failed to filter TCPIngresses: %w", err)
|
||||
}
|
||||
|
||||
var endpoints []*endpoint.Endpoint
|
||||
|
@ -18,9 +18,9 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"sigs.k8s.io/external-dns/endpoint"
|
||||
)
|
||||
|
@ -18,6 +18,8 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
@ -27,7 +29,6 @@ import (
|
||||
"github.com/cloudfoundry-community/go-cfclient"
|
||||
"github.com/linki/instrumented_http"
|
||||
openshift "github.com/openshift/client-go/route/clientset/versioned"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
istioclient "istio.io/client-go/pkg/clientset/versioned"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
@ -509,7 +510,7 @@ func NewIstioClient(kubeConfig string, apiServerURL string) (*istioclient.Client
|
||||
|
||||
ic, err := istioclient.NewForConfig(restCfg)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Failed to create istio client")
|
||||
return nil, fmt.Errorf("failed to create istio client: %w", err)
|
||||
}
|
||||
|
||||
return ic, nil
|
||||
|
@ -18,12 +18,12 @@ package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
@ -151,7 +151,7 @@ func NewTraefikSource(ctx context.Context, dynamicKubeClient dynamic.Interface,
|
||||
|
||||
uc, err := newTraefikUnstructuredConverter()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to setup Unstructured Converter")
|
||||
return nil, fmt.Errorf("failed to setup Unstructured Converter: %w", err)
|
||||
}
|
||||
|
||||
return &traefikSource{
|
||||
@ -249,7 +249,7 @@ func (ts *traefikSource) ingressRouteEndpoints() ([]*endpoint.Endpoint, error) {
|
||||
|
||||
ingressRoutes, err = ts.filterIngressRouteByAnnotation(ingressRoutes)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter IngressRoute")
|
||||
return nil, fmt.Errorf("failed to filter IngressRoute: %w", err)
|
||||
}
|
||||
|
||||
for _, ingressRoute := range ingressRoutes {
|
||||
@ -301,7 +301,7 @@ func (ts *traefikSource) ingressRouteTCPEndpoints() ([]*endpoint.Endpoint, error
|
||||
|
||||
ingressRouteTCPs, err = ts.filterIngressRouteTcpByAnnotations(ingressRouteTCPs)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter IngressRouteTCP")
|
||||
return nil, fmt.Errorf("failed to filter IngressRouteTCP: %w", err)
|
||||
}
|
||||
|
||||
for _, ingressRouteTCP := range ingressRouteTCPs {
|
||||
@ -353,7 +353,7 @@ func (ts *traefikSource) ingressRouteUDPEndpoints() ([]*endpoint.Endpoint, error
|
||||
|
||||
ingressRouteUDPs, err = ts.filterIngressRouteUdpByAnnotations(ingressRouteUDPs)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter IngressRouteUDP")
|
||||
return nil, fmt.Errorf("failed to filter IngressRouteUDP: %w", err)
|
||||
}
|
||||
|
||||
for _, ingressRouteUDP := range ingressRouteUDPs {
|
||||
@ -405,7 +405,7 @@ func (ts *traefikSource) oldIngressRouteEndpoints() ([]*endpoint.Endpoint, error
|
||||
|
||||
ingressRoutes, err = ts.filterIngressRouteByAnnotation(ingressRoutes)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter IngressRoute")
|
||||
return nil, fmt.Errorf("failed to filter IngressRoute: %w", err)
|
||||
}
|
||||
|
||||
for _, ingressRoute := range ingressRoutes {
|
||||
@ -457,7 +457,7 @@ func (ts *traefikSource) oldIngressRouteTCPEndpoints() ([]*endpoint.Endpoint, er
|
||||
|
||||
ingressRouteTCPs, err = ts.filterIngressRouteTcpByAnnotations(ingressRouteTCPs)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter IngressRouteTCP")
|
||||
return nil, fmt.Errorf("failed to filter IngressRouteTCP: %w", err)
|
||||
}
|
||||
|
||||
for _, ingressRouteTCP := range ingressRouteTCPs {
|
||||
@ -509,7 +509,7 @@ func (ts *traefikSource) oldIngressRouteUDPEndpoints() ([]*endpoint.Endpoint, er
|
||||
|
||||
ingressRouteUDPs, err = ts.filterIngressRouteUdpByAnnotations(ingressRouteUDPs)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to filter IngressRouteUDP")
|
||||
return nil, fmt.Errorf("failed to filter IngressRouteUDP: %w", err)
|
||||
}
|
||||
|
||||
for _, ingressRouteUDP := range ingressRouteUDPs {
|
||||
|
@ -19,9 +19,10 @@ package source
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"testing"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
Loading…
Reference in New Issue
Block a user