From 373c3f9242ac81b6bdb48cb92a2c5d033271f352 Mon Sep 17 00:00:00 2001 From: Michal Kuritka Date: Tue, 11 Jun 2024 14:22:18 +0200 Subject: [PATCH] Bump golangci to v1.59.1 I made the changes that were required to pass the linter. I removed the internal `directory` which hasn't made much sense for a long time. I've modified the GitHub action the new linter has depguard as the main change, which is a guard for imported packages. these must be explicitly enabled/disabled in the configuration. - https://golangci-lint.run/usage/linters/#depguard - https://github.com/OpenPeeDeeP/depguard --- .github/workflows/build.yml | 2 +- .golangci.yaml | 24 +++++++++++++++++ Makefile | 2 +- controllers/depresolver/depresolver.go | 4 +-- controllers/depresolver/depresolver_config.go | 3 ++- controllers/depresolver/depresolver_test.go | 22 +++++++-------- .../depresolver/depresolver_validator.go | 2 +- controllers/gslb_controller_reconciliation.go | 3 ++- .../gslb_controller_reconciliation_test.go | 27 ++++++++++--------- controllers/gslb_controller_weight_test.go | 2 +- controllers/ingress.go | 2 +- controllers/logging/logr.go | 6 ++--- controllers/providers/assistant/gslb.go | 7 ++--- controllers/providers/dns/external_test.go | 7 ++--- controllers/providers/dns/factory_test.go | 4 +-- controllers/providers/dns/infoblox_test.go | 9 ++++--- controllers/providers/metrics/prometheus.go | 3 ++- .../{internal => }/utils/annotations.go | 0 .../{internal => }/utils/annotations_test.go | 0 controllers/{internal => }/utils/dns.go | 0 controllers/{internal => }/utils/dns_test.go | 0 controllers/{internal => }/utils/fakedns.go | 0 .../{internal => }/utils/fakedns_test.go | 0 .../{internal => }/utils/reconciler_result.go | 0 .../{internal => }/utils/reflection.go | 0 .../{internal => }/utils/reflection_test.go | 0 controllers/{internal => }/utils/regex.go | 0 .../{internal => }/utils/regex_test.go | 0 controllers/{internal => }/utils/yaml.go | 0 29 files changed, 80 insertions(+), 49 deletions(-) rename controllers/{internal => }/utils/annotations.go (100%) rename controllers/{internal => }/utils/annotations_test.go (100%) rename controllers/{internal => }/utils/dns.go (100%) rename controllers/{internal => }/utils/dns_test.go (100%) rename controllers/{internal => }/utils/fakedns.go (100%) rename controllers/{internal => }/utils/fakedns_test.go (100%) rename controllers/{internal => }/utils/reconciler_result.go (100%) rename controllers/{internal => }/utils/reflection.go (100%) rename controllers/{internal => }/utils/reflection_test.go (100%) rename controllers/{internal => }/utils/regex.go (100%) rename controllers/{internal => }/utils/regex_test.go (100%) rename controllers/{internal => }/utils/yaml.go (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 93e8c3b943..f104f485f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,7 +56,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@8032b262982c71a7cf7a6d2aa823106fc57e545e with: - version: v1.51.2 + version: v1.59.1 skip-go-installation: true - name: golic run: | diff --git a/.golangci.yaml b/.golangci.yaml index 71189028f8..a60a5f7c79 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -48,6 +48,30 @@ linters-settings: lll: line-length: 150 + depguard: + # https://golangci-lint.run/usage/linters/#depguard + # https://github.com/OpenPeeDeeP/depguard + rules: + main: + allow: + - $gostd + - k8s.io/apimachinery + - k8s.io/client-go + - k8s.io/api + - sigs.k8s.io/controller-runtime + - sigs.k8s.io/external-dns + - github.com/AbsaOSS + - github.com/ghodss/yaml + - github.com/go-logr + - github.com/golang/mock/ + - github.com/infobloxopen + - github.com/k8gb-io + - github.com/miekg + - github.com/prometheus + - github.com/rs/zerolog + - github.com/stretchr/testify + - go.opentelemetry.io/otel + issues: exclude-rules: - path: _test\.go diff --git a/Makefile b/Makefile index 99661825f7..176734ba92 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ LOG_LEVEL ?= debug CONTROLLER_GEN_VERSION ?= v0.8.0 GOLIC_VERSION ?= v0.7.2 GOKART_VERSION ?= v0.5.1 -GOLANGCI_VERSION ?= v1.51.2 +GOLANGCI_VERSION ?= v1.59.1 POD_NAMESPACE ?= k8gb CLUSTER_GEO_TAG ?= eu EXT_GSLB_CLUSTERS_GEO_TAGS ?= us diff --git a/controllers/depresolver/depresolver.go b/controllers/depresolver/depresolver.go index ce900e873d..600cc5cd13 100644 --- a/controllers/depresolver/depresolver.go +++ b/controllers/depresolver/depresolver.go @@ -27,9 +27,9 @@ Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic import ( "sync" - "github.com/k8gb-io/k8gb/api/v1beta1" - "github.com/k8gb-io/k8gb/controllers/internal/utils" + "github.com/k8gb-io/k8gb/controllers/utils" + "github.com/k8gb-io/k8gb/api/v1beta1" "github.com/rs/zerolog" ) diff --git a/controllers/depresolver/depresolver_config.go b/controllers/depresolver/depresolver_config.go index 71d99e9e2b..db15da2f1a 100644 --- a/controllers/depresolver/depresolver_config.go +++ b/controllers/depresolver/depresolver_config.go @@ -25,8 +25,9 @@ import ( "strconv" "strings" + "github.com/k8gb-io/k8gb/controllers/utils" + "github.com/AbsaOSS/env-binder/env" - "github.com/k8gb-io/k8gb/controllers/internal/utils" "github.com/rs/zerolog" ) diff --git a/controllers/depresolver/depresolver_test.go b/controllers/depresolver/depresolver_test.go index 35a4723a56..67f15b8b01 100644 --- a/controllers/depresolver/depresolver_test.go +++ b/controllers/depresolver/depresolver_test.go @@ -27,9 +27,9 @@ import ( "strings" "testing" - k8gbv1beta1 "github.com/k8gb-io/k8gb/api/v1beta1" - "github.com/k8gb-io/k8gb/controllers/internal/utils" + utils2 "github.com/k8gb-io/k8gb/controllers/utils" + k8gbv1beta1 "github.com/k8gb-io/k8gb/api/v1beta1" "github.com/rs/zerolog" "github.com/stretchr/testify/assert" "k8s.io/apimachinery/pkg/runtime" @@ -58,7 +58,7 @@ var predefinedConfig = Config{ ClusterGeoTag: "us", ExtClustersGeoTags: []string{"za", "eu"}, EdgeDNSType: DNSTypeInfoblox, - EdgeDNSServers: []utils.DNSServer{ + EdgeDNSServers: []utils2.DNSServer{ { Host: "dns.cloud.example.com", Port: 53, @@ -348,7 +348,7 @@ func TestResolveConfigWithEmptyEdgeDnsServer(t *testing.T) { // arrange defer cleanup() expected := predefinedConfig - expected.EdgeDNSServers = []utils.DNSServer{} + expected.EdgeDNSServers = []utils2.DNSServer{} // act,assert arrangeVariablesAndAssert(t, expected, assert.Error) } @@ -357,7 +357,7 @@ func TestResolveConfigWithTwoEdgeDnsServers(t *testing.T) { // arrange defer cleanup() expected := predefinedConfig - expected.EdgeDNSServers = []utils.DNSServer{ + expected.EdgeDNSServers = []utils2.DNSServer{ { Host: "8.8.8.8", Port: 53, @@ -375,7 +375,7 @@ func TestResolveConfigWithNoEdgeDnsServer(t *testing.T) { // arrange defer cleanup() expected := predefinedConfig - expected.EdgeDNSServers = []utils.DNSServer{} + expected.EdgeDNSServers = []utils2.DNSServer{} // act,assert arrangeVariablesAndAssert(t, expected, assert.Error, EdgeDNSServersKey) } @@ -384,7 +384,7 @@ func TestResolveConfigWithEmptyIpAddressInEdgeDnsServer(t *testing.T) { // arrange defer cleanup() expected := predefinedConfig - expected.EdgeDNSServers = []utils.DNSServer{ + expected.EdgeDNSServers = []utils2.DNSServer{ { Host: defaultEdgeDNSServerIP, Port: 53, @@ -398,7 +398,7 @@ func TestResolveConfigWithHostnameEdgeDnsServer(t *testing.T) { // arrange defer cleanup() expected := predefinedConfig - expected.EdgeDNSServers = []utils.DNSServer{ + expected.EdgeDNSServers = []utils2.DNSServer{ { Host: "server-nonprod.on.domain.l3.2l.com", Port: 53, @@ -413,7 +413,7 @@ func TestResolveConfigWithInvalidIpAddressEdgeDnsServer(t *testing.T) { // arrange defer cleanup() expected := predefinedConfig - expected.EdgeDNSServers = []utils.DNSServer{ + expected.EdgeDNSServers = []utils2.DNSServer{ { Host: fmt.Sprintf("%s.", defaultEdgeDNSServerIP), Port: 53, @@ -1251,7 +1251,7 @@ func TestNsServerNamesForLocalEdgeDNS(t *testing.T) { defer cleanup() for _, edgeDNSServer := range []string{"127.0.0.1", "localhost"} { customConfig := predefinedConfig - customConfig.EdgeDNSServers = []utils.DNSServer{ + customConfig.EdgeDNSServers = []utils2.DNSServer{ { Host: edgeDNSServer, Port: 53, @@ -1550,7 +1550,7 @@ func getTestContext(testData string) (client.Client, *k8gbv1beta1.Gslb) { if err != nil { panic(fmt.Errorf("can't open example CR file: %s", testData)) } - gslb, err := utils.YamlToGslb(gslbYaml) + gslb, err := utils2.YamlToGslb(gslbYaml) if err != nil { panic(err) } diff --git a/controllers/depresolver/depresolver_validator.go b/controllers/depresolver/depresolver_validator.go index 9872fb537a..87222e08b3 100644 --- a/controllers/depresolver/depresolver_validator.go +++ b/controllers/depresolver/depresolver_validator.go @@ -23,7 +23,7 @@ import ( "regexp" "strings" - "github.com/k8gb-io/k8gb/controllers/internal/utils" + "github.com/k8gb-io/k8gb/controllers/utils" ) const ( diff --git a/controllers/gslb_controller_reconciliation.go b/controllers/gslb_controller_reconciliation.go index d869048351..e39f1da3d0 100644 --- a/controllers/gslb_controller_reconciliation.go +++ b/controllers/gslb_controller_reconciliation.go @@ -22,11 +22,12 @@ import ( "context" "fmt" + "github.com/k8gb-io/k8gb/controllers/utils" + "github.com/k8gb-io/k8gb/controllers/providers/metrics" k8gbv1beta1 "github.com/k8gb-io/k8gb/api/v1beta1" "github.com/k8gb-io/k8gb/controllers/depresolver" - "github.com/k8gb-io/k8gb/controllers/internal/utils" "github.com/k8gb-io/k8gb/controllers/logging" "github.com/k8gb-io/k8gb/controllers/providers/dns" "go.opentelemetry.io/otel/codes" diff --git a/controllers/gslb_controller_reconciliation_test.go b/controllers/gslb_controller_reconciliation_test.go index f5252481c7..a399013b84 100644 --- a/controllers/gslb_controller_reconciliation_test.go +++ b/controllers/gslb_controller_reconciliation_test.go @@ -27,9 +27,10 @@ import ( "testing" "time" + utils2 "github.com/k8gb-io/k8gb/controllers/utils" + k8gbv1beta1 "github.com/k8gb-io/k8gb/api/v1beta1" "github.com/k8gb-io/k8gb/controllers/depresolver" - "github.com/k8gb-io/k8gb/controllers/internal/utils" "github.com/k8gb-io/k8gb/controllers/logging" "github.com/k8gb-io/k8gb/controllers/mocks" "github.com/k8gb-io/k8gb/controllers/providers/assistant" @@ -74,7 +75,7 @@ var predefinedConfig = depresolver.Config{ ReconcileRequeueSeconds: 30, ClusterGeoTag: "us-west-1", ExtClustersGeoTags: []string{"us-east-1"}, - EdgeDNSServers: []utils.DNSServer{ + EdgeDNSServers: []utils2.DNSServer{ { Host: "127.0.0.1", Port: 7753, @@ -97,7 +98,7 @@ var predefinedConfig = depresolver.Config{ }, } -var fakeDNSSettings = utils.FakeDNSSettings{ +var fakeDNSSettings = utils2.FakeDNSSettings{ FakeDNSPort: 7753, EdgeDNSZoneFQDN: "example.com.", DNSZoneFQDN: "cloud.example.com.", @@ -111,7 +112,7 @@ const ( defaultEdgeDNS1 = "1.1.1.1" ) -var defaultEdgeDNSServers = []utils.DNSServer{ +var defaultEdgeDNSServers = []utils2.DNSServer{ { Host: defaultEdgeDNS1, Port: 53, @@ -441,7 +442,7 @@ func TestLocalDNSRecordsHasSpecialAnnotation(t *testing.T) { {IP: "10.0.0.2"}, {IP: "10.0.0.3"}, } - utils.NewFakeDNS(fakeDNSSettings). + utils2.NewFakeDNS(fakeDNSSettings). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 3)). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 2)). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 1)). @@ -494,7 +495,7 @@ func TestCanGetExternalTargetsFromK8gbInAnotherLocation(t *testing.T) { {IP: "10.0.0.3"}, } dnsEndpoint := &externaldns.DNSEndpoint{} - utils.NewFakeDNS(fakeDNSSettings). + utils2.NewFakeDNS(fakeDNSSettings). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 3)). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 2)). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 1)). @@ -528,7 +529,7 @@ func TestCanGetExternalTargetsFromK8gbInAnotherLocation(t *testing.T) { func TestCanCheckExternalGslbTXTRecordForValidityAndFailIfItIsExpired(t *testing.T) { // arrange - utils.NewFakeDNS(fakeDNSSettings). + utils2.NewFakeDNS(fakeDNSSettings). AddTXTRecord("test-gslb-heartbeat-eu.example.com.", oldEdgeTimestamp("10m")). Start(). RunTestFunc(func() { @@ -543,7 +544,7 @@ func TestCanCheckExternalGslbTXTRecordForValidityAndFailIfItIsExpired(t *testing func TestCanCheckExternalGslbTXTRecordForValidityAndPAssIfItISNotExpired(t *testing.T) { // arrange - utils.NewFakeDNS(fakeDNSSettings). + utils2.NewFakeDNS(fakeDNSSettings). AddTXTRecord("test-gslb-heartbeat-za.example.com.", oldEdgeTimestamp("3m")). Start(). RunTestFunc(func() { @@ -635,13 +636,13 @@ func TestReturnsExternalRecordsUsingFailoverStrategy(t *testing.T) { dnsEndpoint := &externaldns.DNSEndpoint{} customConfig := predefinedConfig customConfig.ClusterGeoTag = "za" - customConfig.EdgeDNSServers = []utils.DNSServer{ + customConfig.EdgeDNSServers = []utils2.DNSServer{ { Host: "localhost", Port: 7753, }, } - utils.NewFakeDNS(fakeDNSSettings). + utils2.NewFakeDNS(fakeDNSSettings). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 3)). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 2)). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 1)). @@ -702,7 +703,7 @@ func TestReturnsExternalRecordsUsingFailoverStrategyAndFallbackDNSserver(t *test dnsEndpoint := &externaldns.DNSEndpoint{} customConfig := predefinedConfig customConfig.ClusterGeoTag = "za" - customConfig.EdgeDNSServers = []utils.DNSServer{ + customConfig.EdgeDNSServers = []utils2.DNSServer{ { // this one will be tried frist, but fails Host: "localhost", Port: 7752, @@ -716,7 +717,7 @@ func TestReturnsExternalRecordsUsingFailoverStrategyAndFallbackDNSserver(t *test Port: 7754, }, } - utils.NewFakeDNS(fakeDNSSettings). + utils2.NewFakeDNS(fakeDNSSettings). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 2)). AddARecord("localtargets-roundrobin.cloud.example.com.", net.IPv4(10, 1, 0, 1)). Start(). @@ -1284,7 +1285,7 @@ func provideSettings(t *testing.T, expected depresolver.Config) (settings testSe t.Fatalf("Can't open example CR file: %s", crSampleYaml) } // Set the log to development mode for verbose logs. - gslb, err := utils.YamlToGslb(gslbYaml) + gslb, err := utils2.YamlToGslb(gslbYaml) if err != nil { t.Fatal(err) } diff --git a/controllers/gslb_controller_weight_test.go b/controllers/gslb_controller_weight_test.go index dc8cf42e32..9bce853baa 100644 --- a/controllers/gslb_controller_weight_test.go +++ b/controllers/gslb_controller_weight_test.go @@ -143,7 +143,7 @@ func TestWeight(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - injectWeight := func(ctx context.Context, gslb *k8gbv1beta1.Gslb, client client.Client) error { + injectWeight := func(_ context.Context, gslb *k8gbv1beta1.Gslb, _ client.Client) error { if !test.injectWeights { return nil } diff --git a/controllers/ingress.go b/controllers/ingress.go index 67fc315ea9..0f2a5d4cd8 100644 --- a/controllers/ingress.go +++ b/controllers/ingress.go @@ -22,7 +22,7 @@ import ( "context" "reflect" - "github.com/k8gb-io/k8gb/controllers/internal/utils" + "github.com/k8gb-io/k8gb/controllers/utils" k8gbv1beta1 "github.com/k8gb-io/k8gb/api/v1beta1" netv1 "k8s.io/api/networking/v1" diff --git a/controllers/logging/logr.go b/controllers/logging/logr.go index e488c0ddbb..ade7752963 100644 --- a/controllers/logging/logr.go +++ b/controllers/logging/logr.go @@ -49,15 +49,15 @@ func newLogrSinkAdapter(z *zerolog.Logger) *logrSinkAdapter { } } -func (a *logrSinkAdapter) Init(info logr.RuntimeInfo) { +func (a *logrSinkAdapter) Init(_ logr.RuntimeInfo) { } -func (a *logrSinkAdapter) Enabled(level int) bool { +func (a *logrSinkAdapter) Enabled(_ int) bool { return true } -func (a *logrSinkAdapter) Info(level int, msg string, keysAndValues ...interface{}) { +func (a *logrSinkAdapter) Info(_ int, msg string, keysAndValues ...interface{}) { a.WithValues(keysAndValues) if a.name != "" { a.z.Info().Msgf("%s: %s %s", a.name, msg, a.valuesAsJSON()) diff --git a/controllers/providers/assistant/gslb.go b/controllers/providers/assistant/gslb.go index 6797098f38..6eab754eb4 100644 --- a/controllers/providers/assistant/gslb.go +++ b/controllers/providers/assistant/gslb.go @@ -25,8 +25,9 @@ import ( "strings" "time" + "github.com/k8gb-io/k8gb/controllers/utils" + k8gbv1beta1 "github.com/k8gb-io/k8gb/api/v1beta1" - "github.com/k8gb-io/k8gb/controllers/internal/utils" "github.com/k8gb-io/k8gb/controllers/logging" "github.com/miekg/dns" @@ -305,7 +306,7 @@ func (r *Gslb) GetExternalTargets(host string, extClusterNsNames map[string]stri Msg("Adding external Gslb targets from cluster") glueA, err := dnsQuery(cluster, r.edgeDNSServers) if err != nil { - return + return targets } log.Info(). Str("nameserver", cluster). @@ -323,7 +324,7 @@ func (r *Gslb) GetExternalTargets(host string, extClusterNsNames map[string]stri lHost := fmt.Sprintf("localtargets-%s", host) a, err := dnsQuery(lHost, nameServersToUse) if err != nil { - return + return targets } clusterTargets := getARecords(a) if len(clusterTargets) > 0 { diff --git a/controllers/providers/dns/external_test.go b/controllers/providers/dns/external_test.go index 65f2a038bd..aa88d5fd2f 100644 --- a/controllers/providers/dns/external_test.go +++ b/controllers/providers/dns/external_test.go @@ -24,9 +24,10 @@ import ( "reflect" "testing" + utils2 "github.com/k8gb-io/k8gb/controllers/utils" + k8gbv1beta1 "github.com/k8gb-io/k8gb/api/v1beta1" "github.com/k8gb-io/k8gb/controllers/depresolver" - "github.com/k8gb-io/k8gb/controllers/internal/utils" "github.com/k8gb-io/k8gb/controllers/mocks" "github.com/stretchr/testify/require" @@ -55,7 +56,7 @@ var a = struct { ReconcileRequeueSeconds: 30, ClusterGeoTag: "us", ExtClustersGeoTags: []string{"za", "eu"}, - EdgeDNSServers: []utils.DNSServer{ + EdgeDNSServers: []utils2.DNSServer{ { Host: "dns.cloud.example.com", Port: 53, @@ -68,7 +69,7 @@ var a = struct { Gslb: func() *k8gbv1beta1.Gslb { var crSampleYaml = "../../../deploy/crds/k8gb.absa.oss_v1beta1_gslb_cr.yaml" gslbYaml, _ := os.ReadFile(crSampleYaml) - gslb, _ := utils.YamlToGslb(gslbYaml) + gslb, _ := utils2.YamlToGslb(gslbYaml) return gslb }(), TargetIPs: []string{ diff --git a/controllers/providers/dns/factory_test.go b/controllers/providers/dns/factory_test.go index eaca97836e..1c944f9b57 100644 --- a/controllers/providers/dns/factory_test.go +++ b/controllers/providers/dns/factory_test.go @@ -21,9 +21,9 @@ Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic import ( "testing" - "github.com/k8gb-io/k8gb/controllers/depresolver" - "github.com/k8gb-io/k8gb/controllers/internal/utils" + "github.com/k8gb-io/k8gb/controllers/utils" + "github.com/k8gb-io/k8gb/controllers/depresolver" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "k8s.io/apimachinery/pkg/runtime" diff --git a/controllers/providers/dns/infoblox_test.go b/controllers/providers/dns/infoblox_test.go index f23508409b..68baf8a433 100644 --- a/controllers/providers/dns/infoblox_test.go +++ b/controllers/providers/dns/infoblox_test.go @@ -22,9 +22,10 @@ import ( "os" "testing" + "github.com/k8gb-io/k8gb/controllers/utils" + k8gbv1beta1 "github.com/k8gb-io/k8gb/api/v1beta1" "github.com/k8gb-io/k8gb/controllers/depresolver" - "github.com/k8gb-io/k8gb/controllers/internal/utils" "github.com/k8gb-io/k8gb/controllers/mocks" "github.com/k8gb-io/k8gb/controllers/providers/assistant" @@ -190,7 +191,7 @@ func TestInfobloxCreateZoneDelegationForExternalDNSWithSplitBrainEnabled(t *test cl := mocks.NewMockInfobloxClient(ctrl) con := mocks.NewMockIBConnector(ctrl) a.EXPECT().GslbIngressExposedIPs(gomock.Any()).Return(ipRange, nil).Times(1) - a.EXPECT().InspectTXTThreshold(gomock.Any(), gomock.Any()).Do(func(fqdn string, arg1 interface{}) { + a.EXPECT().InspectTXTThreshold(gomock.Any(), gomock.Any()).Do(func(fqdn string, _ interface{}) { require.Equal(t, "test-gslb-heartbeat-us-east-1.example.com", fqdn) }).Return(nil).Times(1) con.EXPECT().CreateObject(gomock.Any()).Return(ref, nil).AnyTimes() @@ -198,7 +199,7 @@ func TestInfobloxCreateZoneDelegationForExternalDNSWithSplitBrainEnabled(t *test con.EXPECT().GetObject(gomock.Any(), gomock.Any(), gomock.Any()).SetArg(2, []ibclient.ZoneDelegated{defaultDelegatedZone}).Return(nil) cl.EXPECT().GetObjectManager().Return(ibclient.NewObjectManager(con, "k8gbclient", ""), nil).Times(1) con.EXPECT().GetObject(gomock.Any(), gomock.Any(), gomock.Any()).SetArg(2, []ibclient.RecordTXT{{Ref: ref}}). - Return(nil).Do(func(arg0 *ibclient.RecordTXT, arg1, arg2 interface{}) { + Return(nil).Do(func(arg0 *ibclient.RecordTXT, _, _ interface{}) { require.Equal(t, "test-gslb-heartbeat-us-west-1.example.com", arg0.Name) }).AnyTimes() config := defaultConfig @@ -248,7 +249,7 @@ func TestInfobloxFinalize(t *testing.T) { con.EXPECT().GetObject(gomock.Any(), gomock.Any(), gomock.Any()).SetArg(2, []ibclient.ZoneDelegated{defaultDelegatedZone}). Return(nil).Times(1) con.EXPECT().GetObject(gomock.Any(), gomock.Any(), gomock.Any()).SetArg(2, []ibclient.RecordTXT{{Ref: ref}}). - Return(nil).Do(func(arg0 *ibclient.RecordTXT, arg1, arg2 interface{}) { + Return(nil).Do(func(arg0 *ibclient.RecordTXT, _, _ interface{}) { require.Equal(t, "test-gslb-heartbeat-us-west-1.example.com", arg0.Name) }).Times(1) cl.EXPECT().GetObjectManager().Return(ibclient.NewObjectManager(con, "k8gbclient", ""), nil).Times(1) diff --git a/controllers/providers/metrics/prometheus.go b/controllers/providers/metrics/prometheus.go index 444c527776..cc23062749 100644 --- a/controllers/providers/metrics/prometheus.go +++ b/controllers/providers/metrics/prometheus.go @@ -27,11 +27,12 @@ import ( "sync" "time" + "github.com/k8gb-io/k8gb/controllers/utils" + externaldns "sigs.k8s.io/external-dns/endpoint" k8gbv1beta1 "github.com/k8gb-io/k8gb/api/v1beta1" "github.com/k8gb-io/k8gb/controllers/depresolver" - "github.com/k8gb-io/k8gb/controllers/internal/utils" "github.com/prometheus/client_golang/prometheus" crm "sigs.k8s.io/controller-runtime/pkg/metrics" ) diff --git a/controllers/internal/utils/annotations.go b/controllers/utils/annotations.go similarity index 100% rename from controllers/internal/utils/annotations.go rename to controllers/utils/annotations.go diff --git a/controllers/internal/utils/annotations_test.go b/controllers/utils/annotations_test.go similarity index 100% rename from controllers/internal/utils/annotations_test.go rename to controllers/utils/annotations_test.go diff --git a/controllers/internal/utils/dns.go b/controllers/utils/dns.go similarity index 100% rename from controllers/internal/utils/dns.go rename to controllers/utils/dns.go diff --git a/controllers/internal/utils/dns_test.go b/controllers/utils/dns_test.go similarity index 100% rename from controllers/internal/utils/dns_test.go rename to controllers/utils/dns_test.go diff --git a/controllers/internal/utils/fakedns.go b/controllers/utils/fakedns.go similarity index 100% rename from controllers/internal/utils/fakedns.go rename to controllers/utils/fakedns.go diff --git a/controllers/internal/utils/fakedns_test.go b/controllers/utils/fakedns_test.go similarity index 100% rename from controllers/internal/utils/fakedns_test.go rename to controllers/utils/fakedns_test.go diff --git a/controllers/internal/utils/reconciler_result.go b/controllers/utils/reconciler_result.go similarity index 100% rename from controllers/internal/utils/reconciler_result.go rename to controllers/utils/reconciler_result.go diff --git a/controllers/internal/utils/reflection.go b/controllers/utils/reflection.go similarity index 100% rename from controllers/internal/utils/reflection.go rename to controllers/utils/reflection.go diff --git a/controllers/internal/utils/reflection_test.go b/controllers/utils/reflection_test.go similarity index 100% rename from controllers/internal/utils/reflection_test.go rename to controllers/utils/reflection_test.go diff --git a/controllers/internal/utils/regex.go b/controllers/utils/regex.go similarity index 100% rename from controllers/internal/utils/regex.go rename to controllers/utils/regex.go diff --git a/controllers/internal/utils/regex_test.go b/controllers/utils/regex_test.go similarity index 100% rename from controllers/internal/utils/regex_test.go rename to controllers/utils/regex_test.go diff --git a/controllers/internal/utils/yaml.go b/controllers/utils/yaml.go similarity index 100% rename from controllers/internal/utils/yaml.go rename to controllers/utils/yaml.go