From e06ed8cc5d30a299f5d13623cf93f631ed013e5a Mon Sep 17 00:00:00 2001 From: Michel Loiseleur Date: Fri, 16 Jun 2023 17:15:35 +0200 Subject: [PATCH] build(deps): bump dev-dependencies group with 40 updates --- .github/workflows/lint.yaml | 4 ++-- .golangci.yml | 8 +++++++ go.mod | 13 ++++------- go.sum | 28 +++++++++++------------ provider/cloudflare/cloudflare.go | 28 ++++++++++++++++------- provider/cloudflare/cloudflare_test.go | 6 ++--- provider/ibmcloud/ibmcloud.go | 22 +++++++++--------- provider/infoblox/infoblox.go | 20 ++++++---------- provider/infoblox/infoblox_test.go | 20 ++++++---------- provider/rfc2136/rfc2136.go | 1 - provider/tencentcloud/cloudapi/mockapi.go | 17 ++++++-------- source/istio_gateway.go | 14 ++++++------ source/istio_gateway_test.go | 6 ++--- source/istio_virtualservice_test.go | 10 ++++---- source/openshift_route.go | 3 ++- source/source.go | 6 ++--- 16 files changed, 104 insertions(+), 102 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 58465ce1f..9feb49b72 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -23,7 +23,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: 1.20 id: go - name: Check out code into the Go module directory @@ -31,5 +31,5 @@ jobs: - name: Lint run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.3 make lint diff --git a/.golangci.yml b/.golangci.yml index e5a24cf6a..da6227d28 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -60,6 +60,14 @@ issues: - unused - varcheck - whitespace + - path: source/ambassador_host.go + linters: [ typecheck ] + - path: source/contour_httpproxy.go + linters: [ typecheck ] + - path: source/f5_virtualserver.go + linters: [ typecheck ] + - path: source/kong_tcpingress.go + linters: [ typecheck ] run: skip-files: diff --git a/go.mod b/go.mod index 7d5b70a14..ad8f487b0 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( github.com/nic-at/rc0go v1.1.1 github.com/onsi/ginkgo v1.16.5 github.com/openshift/api v3.9.0+incompatible - github.com/openshift/client-go v3.9.0+incompatible + github.com/openshift/client-go v0.0.0-20230607134213-3cd0021bbee3 github.com/oracle/oci-go-sdk/v65 v65.41.0 github.com/ovh/go-ovh v1.4.1 github.com/pkg/errors v0.9.1 @@ -70,9 +70,9 @@ require ( gopkg.in/yaml.v2 v2.4.0 istio.io/api v0.0.0-20230524015941-fa6c5f7916bf istio.io/client-go v1.18.0 - k8s.io/api v0.27.3 - k8s.io/apimachinery v0.27.3 - k8s.io/client-go v0.27.3 + k8s.io/api v0.27.2 + k8s.io/apimachinery v0.27.2 + k8s.io/client-go v0.27.2 sigs.k8s.io/gateway-api v0.7.1 ) @@ -115,7 +115,6 @@ require ( github.com/gofrs/uuid v4.0.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/golang/glog v1.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/gnostic v0.6.9 // indirect @@ -205,12 +204,10 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.100.1 // indirect k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect - k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect + k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect moul.io/http2curl v1.0.0 // indirect sigs.k8s.io/controller-runtime v0.14.6 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) - -replace k8s.io/klog/v2 => github.com/Raffo/knolog v0.0.0-20211016155154-e4d5e0cc970a diff --git a/go.sum b/go.sum index 72077643c..3e55d4233 100644 --- a/go.sum +++ b/go.sum @@ -105,8 +105,6 @@ github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Raffo/knolog v0.0.0-20211016155154-e4d5e0cc970a h1:4D87FDUGSrfLp/NJmYxybiC8+OR8s5eULyNgmmxAI9U= -github.com/Raffo/knolog v0.0.0-20211016155154-e4d5e0cc970a/go.mod h1:AsBYmtPY5rgsIyjQZDLO+Dwdx91Jmi6uxu7LO6Xf9iw= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= @@ -344,6 +342,7 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -450,8 +449,6 @@ github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang/gddo v0.0.0-20190419222130-af0f2af80721/go.mod h1:xEhNfoBDX1hzLm2Nf80qUvZ2sVwoMZ8d6IE2SrsQfh4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -853,8 +850,8 @@ github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.m github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= github.com/openshift/api v3.9.0+incompatible h1:fJ/KsefYuZAjmrr3+5U9yZIZbTOpVkDDLDLFresAeYs= github.com/openshift/api v3.9.0+incompatible/go.mod h1:dh9o4Fs58gpFXGSYfnVxGR9PnV53I8TW84pQaJDdGiY= -github.com/openshift/client-go v3.9.0+incompatible h1:13k3Ok0B7TA2hA3bQW2aFqn6y04JaJWdk7ITTyg+Ek0= -github.com/openshift/client-go v3.9.0+incompatible/go.mod h1:6rzn+JTr7+WYS2E1TExP4gByoABxMznR6y2SnUIkmxk= +github.com/openshift/client-go v0.0.0-20230607134213-3cd0021bbee3 h1:uVCq/Sx2y4UZh+qCsCL1BBUJpc3DULHkN4j7XHHgHtw= +github.com/openshift/client-go v0.0.0-20230607134213-3cd0021bbee3/go.mod h1:M+VUIcqx5IvgzejcbgmQnxETPrXRYlcufHpw2bAgz9Y= github.com/openshift/gssapi v0.0.0-20161010215902-5fb4217df13b h1:it0YPE/evO6/m8t8wxis9KFI2F/aleOKsI6d9uz0cEk= github.com/openshift/gssapi v0.0.0-20161010215902-5fb4217df13b/go.mod h1:tNrEB5k8SI+g5kOlsCmL2ELASfpqEofI0+FLBgBdN08= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= @@ -1665,16 +1662,16 @@ istio.io/gogo-genproto v0.0.0-20190904133402-ee07f2785480/go.mod h1:uKtbae4K9k2r k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8= k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= k8s.io/api v0.18.4/go.mod h1:lOIQAKYgai1+vz9J7YcDZwC26Z0zQewYOGWdyIPUUQ4= -k8s.io/api v0.27.3 h1:yR6oQXXnUEBWEWcvPWS0jQL575KoAboQPfJAuKNrw5Y= -k8s.io/api v0.27.3/go.mod h1:C4BNvZnQOF7JA/0Xed2S+aUyJSfTGkGFxLXz9MnpIpg= +k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= +k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= k8s.io/apiextensions-apiserver v0.18.0/go.mod h1:18Cwn1Xws4xnWQNC00FLq1E350b9lUF+aOdIWDOZxgo= k8s.io/apiextensions-apiserver v0.18.2/go.mod h1:q3faSnRGmYimiocj6cHQ1I3WpLqmDgJFlKL37fC4ZvY= k8s.io/apiextensions-apiserver v0.18.4/go.mod h1:NYeyeYq4SIpFlPxSAB6jHPIdvu3hL0pc36wuRChybio= k8s.io/apimachinery v0.18.0/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/apimachinery v0.18.4/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko= -k8s.io/apimachinery v0.27.3 h1:Ubye8oBufD04l9QnNtW05idcOe9Z3GQN8+7PqmuVcUM= -k8s.io/apimachinery v0.27.3/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= +k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= k8s.io/apiserver v0.18.0/go.mod h1:3S2O6FeBBd6XTo0njUrLxiqk8GNy6wWOftjhJcXYnjw= k8s.io/apiserver v0.18.2/go.mod h1:Xbh066NqrZO8cbsoenCwyDJ1OSi8Ag8I2lezeHxzwzw= k8s.io/apiserver v0.18.4/go.mod h1:q+zoFct5ABNnYkGIaGQ3bcbUNdmPyOCoEBcg51LChY8= @@ -1683,8 +1680,8 @@ k8s.io/cli-runtime v0.18.4/go.mod h1:9/hS/Cuf7NVzWR5F/5tyS6xsnclxoPLVtwhnkJG1Y4g k8s.io/client-go v0.18.0/go.mod h1:uQSYDYs4WhVZ9i6AIoEZuwUggLVEF64HOD37boKAtF8= k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= k8s.io/client-go v0.18.4/go.mod h1:f5sXwL4yAZRkAtzOxRWUhA/N8XzGCb+nPZI8PfobZ9g= -k8s.io/client-go v0.27.3 h1:7dnEGHZEJld3lYwxvLl7WoehK6lAq7GvgjxpA3nv1E8= -k8s.io/client-go v0.27.3/go.mod h1:2MBEKuTo6V1lbKy3z1euEGnhPfGZLKTS9tiJ2xodM48= +k8s.io/client-go v0.27.2 h1:vDLSeuYvCHKeoQRhCXjxXO45nHVv2Ip4Fe0MfioMrhE= +k8s.io/client-go v0.27.2/go.mod h1:tY0gVmUsHrAmjzHX9zs7eCjxcBsf8IiNe7KQ52biTcQ= k8s.io/code-generator v0.18.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/code-generator v0.18.4/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c= @@ -1697,6 +1694,9 @@ k8s.io/helm v2.16.9+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= +k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= +k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= +k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= @@ -1706,8 +1706,8 @@ k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/metrics v0.18.0/go.mod h1:8aYTW18koXqjLVKL7Ds05RPMX9ipJZI3mywYvBOxXd4= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= -k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU= +k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= moul.io/http2curl v1.0.0 h1:6XwpyZOYsgZJrU8exnG87ncVkU1FVCcTRpwzOkTDUi8= moul.io/http2curl v1.0.0/go.mod h1:f6cULg+e4Md/oW1cYmwW4IWQOVl2lGbmCNGOHvzX2kE= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/provider/cloudflare/cloudflare.go b/provider/cloudflare/cloudflare.go index 0623ca2a0..f6bc95045 100644 --- a/provider/cloudflare/cloudflare.go +++ b/provider/cloudflare/cloudflare.go @@ -69,7 +69,7 @@ type cloudFlareDNS interface { ListZonesContext(ctx context.Context, opts ...cloudflare.ReqOption) (cloudflare.ZonesResponse, error) ZoneDetails(ctx context.Context, zoneID string) (cloudflare.Zone, error) ListDNSRecords(ctx context.Context, rc *cloudflare.ResourceContainer, rp cloudflare.ListDNSRecordsParams) ([]cloudflare.DNSRecord, *cloudflare.ResultInfo, error) - CreateDNSRecord(ctx context.Context, rc *cloudflare.ResourceContainer, rp cloudflare.CreateDNSRecordParams) (*cloudflare.DNSRecordResponse, error) + CreateDNSRecord(ctx context.Context, rc *cloudflare.ResourceContainer, rp cloudflare.CreateDNSRecordParams) (cloudflare.DNSRecord, error) DeleteDNSRecord(ctx context.Context, rc *cloudflare.ResourceContainer, recordID string) error UpdateDNSRecord(ctx context.Context, rc *cloudflare.ResourceContainer, rp cloudflare.UpdateDNSRecordParams) error } @@ -90,7 +90,7 @@ func (z zoneService) ZoneIDByName(zoneName string) (string, error) { return z.service.ZoneIDByName(zoneName) } -func (z zoneService) CreateDNSRecord(ctx context.Context, rc *cloudflare.ResourceContainer, rp cloudflare.CreateDNSRecordParams) (*cloudflare.DNSRecordResponse, error) { +func (z zoneService) CreateDNSRecord(ctx context.Context, rc *cloudflare.ResourceContainer, rp cloudflare.CreateDNSRecordParams) (cloudflare.DNSRecord, error) { return z.service.CreateDNSRecord(ctx, rc, rp) } @@ -99,7 +99,8 @@ func (z zoneService) ListDNSRecords(ctx context.Context, rc *cloudflare.Resource } func (z zoneService) UpdateDNSRecord(ctx context.Context, rc *cloudflare.ResourceContainer, rp cloudflare.UpdateDNSRecordParams) error { - return z.service.UpdateDNSRecord(ctx, rc, rp) + _, err := z.service.UpdateDNSRecord(ctx, rc, rp) + return err } func (z zoneService) DeleteDNSRecord(ctx context.Context, rc *cloudflare.ResourceContainer, recordID string) error { @@ -137,9 +138,20 @@ type RecordParamsTypes interface { cloudflare.UpdateDNSRecordParams | cloudflare.CreateDNSRecordParams } -// getRecordParam is a generic function that returns the appropriate Record Param based on the cloudFlareChange passed in -func getRecordParam[T RecordParamsTypes](cfc cloudFlareChange) T { - return T{ +// getUpdateDNSRecordParam is a function that returns the appropriate Record Param based on the cloudFlareChange passed in +func getUpdateDNSRecordParam(cfc cloudFlareChange) cloudflare.UpdateDNSRecordParams { + return cloudflare.UpdateDNSRecordParams{ + Name: cfc.ResourceRecord.Name, + TTL: cfc.ResourceRecord.TTL, + Proxied: cfc.ResourceRecord.Proxied, + Type: cfc.ResourceRecord.Type, + Content: cfc.ResourceRecord.Content, + } +} + +// getCreateDNSRecordParam is a function that returns the appropriate Record Param based on the cloudFlareChange passed in +func getCreateDNSRecordParam(cfc cloudFlareChange) cloudflare.CreateDNSRecordParams { + return cloudflare.CreateDNSRecordParams{ Name: cfc.ResourceRecord.Name, TTL: cfc.ResourceRecord.TTL, Proxied: cfc.ResourceRecord.Proxied, @@ -334,7 +346,7 @@ func (p *CloudFlareProvider) submitChanges(ctx context.Context, changes []*cloud log.WithFields(logFields).Errorf("failed to find previous record: %v", change.ResourceRecord) continue } - recordParam := getRecordParam[cloudflare.UpdateDNSRecordParams](*change) + recordParam := getUpdateDNSRecordParam(*change) recordParam.ID = recordID err := p.Client.UpdateDNSRecord(ctx, resourceContainer, recordParam) if err != nil { @@ -351,7 +363,7 @@ func (p *CloudFlareProvider) submitChanges(ctx context.Context, changes []*cloud log.WithFields(logFields).Errorf("failed to delete record: %v", err) } } else if change.Action == cloudFlareCreate { - recordParam := getRecordParam[cloudflare.CreateDNSRecordParams](*change) + recordParam := getCreateDNSRecordParam(*change) _, err := p.Client.CreateDNSRecord(ctx, resourceContainer, recordParam) if err != nil { log.WithFields(logFields).Errorf("failed to create record: %v", err) diff --git a/provider/cloudflare/cloudflare_test.go b/provider/cloudflare/cloudflare_test.go index 6d1d47b40..5040404d2 100644 --- a/provider/cloudflare/cloudflare_test.go +++ b/provider/cloudflare/cloudflare_test.go @@ -130,7 +130,7 @@ func getDNSRecordFromRecordParams(rp any) cloudflare.DNSRecord { } } -func (m *mockCloudFlareClient) CreateDNSRecord(ctx context.Context, rc *cloudflare.ResourceContainer, rp cloudflare.CreateDNSRecordParams) (*cloudflare.DNSRecordResponse, error) { +func (m *mockCloudFlareClient) CreateDNSRecord(ctx context.Context, rc *cloudflare.ResourceContainer, rp cloudflare.CreateDNSRecordParams) (cloudflare.DNSRecord, error) { recordData := getDNSRecordFromRecordParams(rp) m.Actions = append(m.Actions, MockAction{ Name: "Create", @@ -141,7 +141,7 @@ func (m *mockCloudFlareClient) CreateDNSRecord(ctx context.Context, rc *cloudfla if zone, ok := m.Records[rc.Identifier]; ok { zone[rp.ID] = recordData } - return nil, nil + return cloudflare.DNSRecord{}, nil } func (m *mockCloudFlareClient) ListDNSRecords(ctx context.Context, rc *cloudflare.ResourceContainer, rp cloudflare.ListDNSRecordsParams) ([]cloudflare.DNSRecord, *cloudflare.ResultInfo, error) { @@ -680,7 +680,7 @@ func TestCloudflareProvider(t *testing.T) { _ = os.Unsetenv("CF_API_TOKEN") tokenFile := "/tmp/cf_api_token" - if err := os.WriteFile(tokenFile, []byte("abc123def"), 0644); err != nil { + if err := os.WriteFile(tokenFile, []byte("abc123def"), 0o644); err != nil { t.Errorf("failed to write token file, %s", err) } _ = os.Setenv("CF_API_TOKEN", tokenFile) diff --git a/provider/ibmcloud/ibmcloud.go b/provider/ibmcloud/ibmcloud.go index 1340edfd2..c8560db01 100644 --- a/provider/ibmcloud/ibmcloud.go +++ b/provider/ibmcloud/ibmcloud.go @@ -757,7 +757,7 @@ func (p *IBMCloudProvider) groupPrivateRecords(records []dnssvcsv1.ResourceRecor for _, records := range groups { targets := make([]string, len(records)) for i, record := range records { - data := record.Rdata.(map[string]interface{}) + data := record.Rdata log.Debugf("record data: %v", data) switch *record.Type { case "A": @@ -820,18 +820,18 @@ func (p *IBMCloudProvider) newIBMCloudChange(action string, endpoint *endpoint.E } if p.privateZone { - var rData interface{} + rData := make(map[string]interface{}) switch endpoint.RecordType { case "A": - rData = &dnssvcsv1.ResourceRecordInputRdataRdataARecord{ + rData[dnssvcsv1.CreateResourceRecordOptions_Type_A] = &dnssvcsv1.ResourceRecordInputRdataRdataARecord{ Ip: core.StringPtr(target), } case "CNAME": - rData = &dnssvcsv1.ResourceRecordInputRdataRdataCnameRecord{ + rData[dnssvcsv1.CreateResourceRecordOptions_Type_Cname] = &dnssvcsv1.ResourceRecordInputRdataRdataCnameRecord{ Cname: core.StringPtr(target), } case "TXT": - rData = &dnssvcsv1.ResourceRecordInputRdataRdataTxtRecord{ + rData[dnssvcsv1.CreateResourceRecordOptions_Type_Txt] = &dnssvcsv1.ResourceRecordInputRdataRdataTxtRecord{ Text: core.StringPtr(target), } } @@ -869,15 +869,15 @@ func (p *IBMCloudProvider) createRecord(ctx context.Context, zoneID string, chan } switch *change.PrivateResourceRecord.Type { case "A": - data, _ := change.PrivateResourceRecord.Rdata.(*dnssvcsv1.ResourceRecordInputRdataRdataARecord) + data, _ := change.PrivateResourceRecord.Rdata[dnssvcsv1.CreateResourceRecordOptions_Type_A].(*dnssvcsv1.ResourceRecordInputRdataRdataARecord) aData, _ := p.Client.NewResourceRecordInputRdataRdataARecord(*data.Ip) createResourceRecordOptions.SetRdata(aData) case "CNAME": - data, _ := change.PrivateResourceRecord.Rdata.(*dnssvcsv1.ResourceRecordInputRdataRdataCnameRecord) + data, _ := change.PrivateResourceRecord.Rdata[dnssvcsv1.CreateResourceRecordOptions_Type_Cname].(*dnssvcsv1.ResourceRecordInputRdataRdataCnameRecord) cnameData, _ := p.Client.NewResourceRecordInputRdataRdataCnameRecord(*data.Cname) createResourceRecordOptions.SetRdata(cnameData) case "TXT": - data, _ := change.PrivateResourceRecord.Rdata.(*dnssvcsv1.ResourceRecordInputRdataRdataTxtRecord) + data, _ := change.PrivateResourceRecord.Rdata[dnssvcsv1.CreateResourceRecordOptions_Type_Txt].(*dnssvcsv1.ResourceRecordInputRdataRdataTxtRecord) txtData, _ := p.Client.NewResourceRecordInputRdataRdataTxtRecord(*data.Text) createResourceRecordOptions.SetRdata(txtData) } @@ -910,15 +910,15 @@ func (p *IBMCloudProvider) updateRecord(ctx context.Context, zoneID, recordID st } switch *change.PrivateResourceRecord.Type { case "A": - data, _ := change.PrivateResourceRecord.Rdata.(*dnssvcsv1.ResourceRecordInputRdataRdataARecord) + data, _ := change.PrivateResourceRecord.Rdata[dnssvcsv1.CreateResourceRecordOptions_Type_A].(*dnssvcsv1.ResourceRecordInputRdataRdataARecord) aData, _ := p.Client.NewResourceRecordUpdateInputRdataRdataARecord(*data.Ip) updateResourceRecordOptions.SetRdata(aData) case "CNAME": - data, _ := change.PrivateResourceRecord.Rdata.(*dnssvcsv1.ResourceRecordInputRdataRdataCnameRecord) + data, _ := change.PrivateResourceRecord.Rdata[dnssvcsv1.CreateResourceRecordOptions_Type_Cname].(*dnssvcsv1.ResourceRecordInputRdataRdataCnameRecord) cnameData, _ := p.Client.NewResourceRecordUpdateInputRdataRdataCnameRecord(*data.Cname) updateResourceRecordOptions.SetRdata(cnameData) case "TXT": - data, _ := change.PrivateResourceRecord.Rdata.(*dnssvcsv1.ResourceRecordInputRdataRdataTxtRecord) + data, _ := change.PrivateResourceRecord.Rdata[dnssvcsv1.CreateResourceRecordOptions_Type_Txt].(*dnssvcsv1.ResourceRecordInputRdataRdataTxtRecord) txtData, _ := p.Client.NewResourceRecordUpdateInputRdataRdataTxtRecord(*data.Text) updateResourceRecordOptions.SetRdata(txtData) } diff --git a/provider/infoblox/infoblox.go b/provider/infoblox/infoblox.go index bea932166..0286eb7eb 100644 --- a/provider/infoblox/infoblox.go +++ b/provider/infoblox/infoblox.go @@ -307,12 +307,9 @@ func (p *ProviderConfig) Records(ctx context.Context) (endpoints []*endpoint.End } var resT []ibclient.RecordTXT - objT := ibclient.NewRecordTXT( - ibclient.RecordTXT{ - Zone: zone.Fqdn, - View: p.view, - }, - ) + objT := ibclient.NewEmptyRecordTXT() + objT.Zone = zone.Fqdn + objT.View = p.view err = p.client.GetObject(objT, "", searchParams, &resT) if err != nil && !isNotFoundError(err) { return nil, fmt.Errorf("could not fetch TXT records from zone '%s': %w", zone.Fqdn, err) @@ -603,13 +600,10 @@ func (p *ProviderConfig) recordSet(ep *endpoint.Endpoint, getObject bool, target if target, err2 := strconv.Unquote(ep.Targets[0]); err2 == nil && !strings.Contains(ep.Targets[0], " ") { ep.Targets = endpoint.Targets{target} } - obj := ibclient.NewRecordTXT( - ibclient.RecordTXT{ - Name: ep.DNSName, - Text: ep.Targets[0], - View: p.view, - }, - ) + obj := ibclient.NewEmptyRecordTXT() + obj.Name = ep.DNSName + obj.Text = ep.Targets[0] + obj.View = p.view if getObject { queryParams := ibclient.NewQueryParams(false, map[string]string{"name": obj.Name}) err = p.client.GetObject(obj, "", queryParams, &res) diff --git a/provider/infoblox/infoblox_test.go b/provider/infoblox/infoblox_test.go index 13b5e0b52..9dc3ed416 100644 --- a/provider/infoblox/infoblox_test.go +++ b/provider/infoblox/infoblox_test.go @@ -254,11 +254,8 @@ func (client *mockIBConnector) DeleteObject(ref string) (refRes string, err erro } case "record:txt": var records []ibclient.RecordTXT - obj := ibclient.NewRecordTXT( - ibclient.RecordTXT{ - Name: result[2], - }, - ) + obj := ibclient.NewEmptyRecordTXT() + obj.Name = result[2] client.GetObject(obj, ref, nil, &records) for _, record := range records { client.deletedEndpoints = append( @@ -355,13 +352,11 @@ func createMockInfobloxObject(name, recordType, value string) ibclient.IBObject obj.Canonical = value return obj case endpoint.RecordTypeTXT: - return ibclient.NewRecordTXT( - ibclient.RecordTXT{ - Ref: ref, - Name: name, - Text: value, - }, - ) + obj := ibclient.NewEmptyRecordTXT() + obj.Name = name + obj.Ref = ref + obj.Text = value + return obj case "HOST": obj := ibclient.NewEmptyHostRecord() obj.Name = name @@ -738,7 +733,6 @@ func TestExtendedRequestNameRegExBuilder(t *testing.T) { assert.True(t, req.URL.Query().Get("name~") == "") } - func TestExtendedRequestMaxResultsBuilder(t *testing.T) { hostCfg := ibclient.HostConfig{ Host: "localhost", diff --git a/provider/rfc2136/rfc2136.go b/provider/rfc2136/rfc2136.go index b46e41033..54a5211a4 100644 --- a/provider/rfc2136/rfc2136.go +++ b/provider/rfc2136/rfc2136.go @@ -389,7 +389,6 @@ func (r rfc2136Provider) SendMessage(msg *dns.Msg) error { log.Debugf("SendMessage") c := new(dns.Client) - c.SingleInflight = true if !r.insecure { if r.gssTsig { diff --git a/provider/tencentcloud/cloudapi/mockapi.go b/provider/tencentcloud/cloudapi/mockapi.go index 707579f00..3484ddc12 100644 --- a/provider/tencentcloud/cloudapi/mockapi.go +++ b/provider/tencentcloud/cloudapi/mockapi.go @@ -135,11 +135,12 @@ func (api *mockAPIService) DescribePrivateZoneRecordList(request *privatedns.Des func (api *mockAPIService) DescribeDomainList(request *dnspod.DescribeDomainListRequest) (response *dnspod.DescribeDomainListResponse, err error) { response = dnspod.NewDescribeDomainListResponse() - response.Response = &struct { - DomainCountInfo *dnspod.DomainCountInfo `json:"DomainCountInfo,omitempty" name:"DomainCountInfo"` - DomainList []*dnspod.DomainListItem `json:"DomainList,omitempty" name:"DomainList"` - RequestId *string `json:"RequestId,omitempty" name:"RequestId"` - }{} + response.Response = &dnspod.DescribeDomainListResponseParams{ + DomainCountInfo: &dnspod.DomainCountInfo{ + AllTotal: common.Uint64Ptr(uint64(len(api.dnspodDomains))), + }, + DomainList: api.dnspodDomains, + } response.Response.DomainList = api.dnspodDomains response.Response.DomainCountInfo = &dnspod.DomainCountInfo{ AllTotal: common.Uint64Ptr(uint64(len(api.dnspodDomains))), @@ -149,11 +150,7 @@ func (api *mockAPIService) DescribeDomainList(request *dnspod.DescribeDomainList func (api *mockAPIService) DescribeRecordList(request *dnspod.DescribeRecordListRequest) (response *dnspod.DescribeRecordListResponse, err error) { response = dnspod.NewDescribeRecordListResponse() - response.Response = &struct { - RecordCountInfo *dnspod.RecordCountInfo `json:"RecordCountInfo,omitempty" name:"RecordCountInfo"` - RecordList []*dnspod.RecordListItem `json:"RecordList,omitempty" name:"RecordList"` - RequestId *string `json:"RequestId,omitempty" name:"RequestId"` - }{} + response.Response = &dnspod.DescribeRecordListResponseParams{} if _, exist := api.dnspodRecords[*request.Domain]; !exist { response.Response.RecordList = make([]*dnspod.RecordListItem, 0) response.Response.RecordCountInfo = &dnspod.RecordCountInfo{ diff --git a/source/istio_gateway.go b/source/istio_gateway.go index 4f5a68ddf..76c1094cf 100644 --- a/source/istio_gateway.go +++ b/source/istio_gateway.go @@ -149,7 +149,7 @@ func (sc *gatewaySource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, e // apply template if host is missing on gateway if (sc.combineFQDNAnnotation || len(gwHostnames) == 0) && sc.fqdnTemplate != nil { - iHostnames, err := execTemplate(sc.fqdnTemplate, &gateway) + iHostnames, err := execTemplate(sc.fqdnTemplate, gateway) if err != nil { return nil, err } @@ -196,7 +196,7 @@ func (sc *gatewaySource) AddEventHandler(ctx context.Context, handler func()) { } // filterByAnnotations filters a list of configs by a given annotation selector. -func (sc *gatewaySource) filterByAnnotations(gateways []networkingv1alpha3.Gateway) ([]networkingv1alpha3.Gateway, error) { +func (sc *gatewaySource) filterByAnnotations(gateways []*networkingv1alpha3.Gateway) ([]*networkingv1alpha3.Gateway, error) { labelSelector, err := metav1.ParseToLabelSelector(sc.annotationFilter) if err != nil { return nil, err @@ -211,7 +211,7 @@ func (sc *gatewaySource) filterByAnnotations(gateways []networkingv1alpha3.Gatew return gateways, nil } - var filteredList []networkingv1alpha3.Gateway + var filteredList []*networkingv1alpha3.Gateway for _, gw := range gateways { // convert the annotations to an equivalent label selector @@ -226,13 +226,13 @@ func (sc *gatewaySource) filterByAnnotations(gateways []networkingv1alpha3.Gatew return filteredList, nil } -func (sc *gatewaySource) setResourceLabel(gateway networkingv1alpha3.Gateway, endpoints []*endpoint.Endpoint) { +func (sc *gatewaySource) setResourceLabel(gateway *networkingv1alpha3.Gateway, endpoints []*endpoint.Endpoint) { for _, ep := range endpoints { ep.Labels[endpoint.ResourceLabelKey] = fmt.Sprintf("gateway/%s/%s", gateway.Namespace, gateway.Name) } } -func (sc *gatewaySource) targetsFromGateway(gateway networkingv1alpha3.Gateway) (targets endpoint.Targets, err error) { +func (sc *gatewaySource) targetsFromGateway(gateway *networkingv1alpha3.Gateway) (targets endpoint.Targets, err error) { targets = getTargetsFromTargetAnnotation(gateway.Annotations) if len(targets) > 0 { return @@ -262,7 +262,7 @@ func (sc *gatewaySource) targetsFromGateway(gateway networkingv1alpha3.Gateway) } // endpointsFromGatewayConfig extracts the endpoints from an Istio Gateway Config object -func (sc *gatewaySource) endpointsFromGateway(hostnames []string, gateway networkingv1alpha3.Gateway) ([]*endpoint.Endpoint, error) { +func (sc *gatewaySource) endpointsFromGateway(hostnames []string, gateway *networkingv1alpha3.Gateway) ([]*endpoint.Endpoint, error) { var endpoints []*endpoint.Endpoint annotations := gateway.Annotations @@ -289,7 +289,7 @@ func (sc *gatewaySource) endpointsFromGateway(hostnames []string, gateway networ return endpoints, nil } -func (sc *gatewaySource) hostNamesFromGateway(gateway networkingv1alpha3.Gateway) ([]string, error) { +func (sc *gatewaySource) hostNamesFromGateway(gateway *networkingv1alpha3.Gateway) ([]string, error) { var hostnames []string for _, server := range gateway.Spec.Servers { for _, host := range server.Hosts { diff --git a/source/istio_gateway_test.go b/source/istio_gateway_test.go index 535972a34..ebbabd0bb 100644 --- a/source/istio_gateway_test.go +++ b/source/istio_gateway_test.go @@ -1192,7 +1192,7 @@ func testGatewayEndpoints(t *testing.T) { fakeIstioClient := istiofake.NewSimpleClientset() for _, config := range ti.configItems { gatewayCfg := config.Config() - _, err := fakeIstioClient.NetworkingV1alpha3().Gateways(ti.targetNamespace).Create(context.Background(), &gatewayCfg, metav1.CreateOptions{}) + _, err := fakeIstioClient.NetworkingV1alpha3().Gateways(ti.targetNamespace).Create(context.Background(), gatewayCfg, metav1.CreateOptions{}) require.NoError(t, err) } @@ -1301,7 +1301,7 @@ type fakeGatewayConfig struct { selector map[string]string } -func (c fakeGatewayConfig) Config() networkingv1alpha3.Gateway { +func (c fakeGatewayConfig) Config() *networkingv1alpha3.Gateway { gw := networkingv1alpha3.Gateway{ ObjectMeta: metav1.ObjectMeta{ Name: c.name, @@ -1323,5 +1323,5 @@ func (c fakeGatewayConfig) Config() networkingv1alpha3.Gateway { gw.Spec.Servers = servers - return gw + return &gw } diff --git a/source/istio_virtualservice_test.go b/source/istio_virtualservice_test.go index a510094e7..63103fb72 100644 --- a/source/istio_virtualservice_test.go +++ b/source/istio_virtualservice_test.go @@ -71,7 +71,7 @@ func (suite *VirtualServiceSuite) SetupTest() { suite.NoError(err, "should succeed") } - suite.gwconfig = (fakeGatewayConfig{ + suite.gwconfig = *(fakeGatewayConfig{ name: "foo-gateway-with-targets", namespace: "istio-system", dnsnames: [][]string{{"*"}}, @@ -362,7 +362,7 @@ func testVirtualServiceBindsToGateway(t *testing.T) { t.Run(ti.title, func(t *testing.T) { vsconfig := ti.vsconfig.Config() gwconfig := ti.gwconfig.Config() - require.Equal(t, ti.expected, virtualServiceBindsToGateway(vsconfig, &gwconfig, ti.vsHost)) + require.Equal(t, ti.expected, virtualServiceBindsToGateway(vsconfig, gwconfig, ti.vsHost)) }) } } @@ -1479,7 +1479,7 @@ func testVirtualServiceEndpoints(t *testing.T) { t.Run(ti.title, func(t *testing.T) { t.Parallel() - var gateways []networkingv1alpha3.Gateway + var gateways []*networkingv1alpha3.Gateway var virtualservices []*networkingv1alpha3.VirtualService for _, gwItem := range ti.gwConfigs { @@ -1500,7 +1500,7 @@ func testVirtualServiceEndpoints(t *testing.T) { fakeIstioClient := istiofake.NewSimpleClientset() for _, gateway := range gateways { - _, err := fakeIstioClient.NetworkingV1alpha3().Gateways(gateway.Namespace).Create(context.Background(), &gateway, metav1.CreateOptions{}) + _, err := fakeIstioClient.NetworkingV1alpha3().Gateways(gateway.Namespace).Create(context.Background(), gateway, metav1.CreateOptions{}) require.NoError(t, err) } @@ -1579,7 +1579,7 @@ func newTestVirtualServiceSource(loadBalancerList []fakeIngressGatewayService, g for _, gw := range gwList { gwObj := gw.Config() - _, err := fakeIstioClient.NetworkingV1alpha3().Gateways(gw.namespace).Create(context.Background(), &gwObj, metav1.CreateOptions{}) + _, err := fakeIstioClient.NetworkingV1alpha3().Gateways(gw.namespace).Create(context.Background(), gwObj, metav1.CreateOptions{}) if err != nil { return nil, err } diff --git a/source/openshift_route.go b/source/openshift_route.go index ec061c108..14e0b632c 100644 --- a/source/openshift_route.go +++ b/source/openshift_route.go @@ -21,6 +21,7 @@ import ( "fmt" "sort" "text/template" + "time" routev1 "github.com/openshift/api/route/v1" versioned "github.com/openshift/client-go/route/clientset/versioned" @@ -71,7 +72,7 @@ func NewOcpRouteSource( // Use a shared informer to listen for add/update/delete of Routes in the specified namespace. // Set resync period to 0, to prevent processing when nothing has changed. - informerFactory := extInformers.NewSharedInformerFactoryWithOptions(ocpClient, 0, extInformers.WithNamespace(namespace)) + informerFactory := extInformers.NewFilteredSharedInformerFactory(ocpClient, 0*time.Second, namespace, nil) informer := informerFactory.Route().V1().Routes() // Add default resource event handlers to properly initialize informer. diff --git a/source/source.go b/source/source.go index 5e3cdcf78..cf43ac465 100644 --- a/source/source.go +++ b/source/source.go @@ -338,9 +338,9 @@ func matchLabelSelector(selector labels.Selector, srcAnnotations map[string]stri type eventHandlerFunc func() -func (fn eventHandlerFunc) OnAdd(obj interface{}) { fn() } -func (fn eventHandlerFunc) OnUpdate(oldObj, newObj interface{}) { fn() } -func (fn eventHandlerFunc) OnDelete(obj interface{}) { fn() } +func (fn eventHandlerFunc) OnAdd(obj interface{}, isInInitialList bool) { fn() } +func (fn eventHandlerFunc) OnUpdate(oldObj, newObj interface{}) { fn() } +func (fn eventHandlerFunc) OnDelete(obj interface{}) { fn() } type informerFactory interface { WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool