From 5a066a1825b1a10015bb481ccc164a65f508fe6d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:28:15 +0200 Subject: [PATCH] feat: upgrade to hcloud-go v2 e4352ec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/hetznercloud/hcloud-go](https://togithub.com/hetznercloud/hcloud-go) | require | major | `v1.46.1` -> `v2.0.0` | --- ### Release Notes <details> <summary>hetznercloud/hcloud-go (github.com/hetznercloud/hcloud-go)</summary> ### [`v2.0.0`](https://togithub.com/hetznercloud/hcloud-go/releases/tag/v2.0.0) [Compare Source](https://togithub.com/hetznercloud/hcloud-go/compare/v1.48.0...v2.0.0) ##### ⚠ BREAKING CHANGES - use int64 for ID fields ([#​282](https://togithub.com/hetznercloud/hcloud-go/issues/282)) ##### Features - make ListOpts.Values method public ([#​285](https://togithub.com/hetznercloud/hcloud-go/issues/285)) ([c82ea59](https://togithub.com/hetznercloud/hcloud-go/commit/c82ea5971d94b812fd9302bfc4151f4ebfa43413)) - use int64 for ID fields ([#​282](https://togithub.com/hetznercloud/hcloud-go/issues/282)) ([359c389](https://togithub.com/hetznercloud/hcloud-go/commit/359c3894641f2dcca4a049537e256a20853b5ad9)) ##### Bug Fixes - **action:** show accurate progress in WatchOverallProgress ([#​281](https://togithub.com/hetznercloud/hcloud-go/issues/281)) ([cae9e57](https://togithub.com/hetznercloud/hcloud-go/commit/cae9e5789b20bdb7d9213ba88897435ee1abce86)) - **iso:** invalid field include_wildcard_architecture ([188b68a](https://togithub.com/hetznercloud/hcloud-go/commit/188b68ad674066d302b2614432cf4f7d5b47f41a)) ### [`v1.48.0`](https://togithub.com/hetznercloud/hcloud-go/releases/tag/v1.48.0) [Compare Source](https://togithub.com/hetznercloud/hcloud-go/compare/v1.47.0...v1.48.0) ##### Features - make ListOpts.Values method public ([#​285](https://togithub.com/hetznercloud/hcloud-go/issues/285)) ([c82ea59](https://togithub.com/hetznercloud/hcloud-go/commit/c82ea5971d94b812fd9302bfc4151f4ebfa43413)) ##### Bug Fixes - **action:** show accurate progress in WatchOverallProgress ([#​281](https://togithub.com/hetznercloud/hcloud-go/issues/281)) ([cae9e57](https://togithub.com/hetznercloud/hcloud-go/commit/cae9e5789b20bdb7d9213ba88897435ee1abce86)) - **iso:** invalid field include_wildcard_architecture ([188b68a](https://togithub.com/hetznercloud/hcloud-go/commit/188b68ad674066d302b2614432cf4f7d5b47f41a)) ### [`v1.47.0`](https://togithub.com/hetznercloud/hcloud-go/releases/tag/v1.47.0) [Compare Source](https://togithub.com/hetznercloud/hcloud-go/compare/v1.46.1...v1.47.0) ##### Features - **network:** add field expose_routes_to_vswitch ([#​277](https://togithub.com/hetznercloud/hcloud-go/issues/277)) ([e73c52d](https://togithub.com/hetznercloud/hcloud-go/commit/e73c52dce563e00c8ccba7528fd054936a52b64c)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/hetznercloud/hcloud-cloud-controller-manager). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi41LjMiLCJ1cGRhdGVkSW5WZXIiOiIzNi41LjMiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Julian Tölle <julian.toelle@hetzner-cloud.de> --- go.mod | 12 +++--- go.sum | 38 +++++++------------ hcloud/cloud.go | 10 ++--- hcloud/cloud_test.go | 4 +- hcloud/instances.go | 8 ++-- hcloud/instances_test.go | 6 +-- hcloud/load_balancers.go | 4 +- hcloud/load_balancers_test.go | 2 +- hcloud/routes.go | 6 +-- hcloud/routes_test.go | 4 +- hcloud/testing.go | 2 +- hcloud/util.go | 6 +-- internal/annotation/load_balancer.go | 2 +- internal/annotation/load_balancer_test.go | 2 +- internal/annotation/name.go | 8 ++-- internal/annotation/name_test.go | 2 +- internal/annotation/testing.go | 2 +- internal/hcops/action.go | 2 +- internal/hcops/certificates.go | 2 +- internal/hcops/certificates_test.go | 2 +- internal/hcops/load_balancer.go | 20 +++++----- internal/hcops/load_balancer_internal_test.go | 2 +- internal/hcops/load_balancer_test.go | 28 +++++++------- internal/hcops/mocks.go | 4 +- internal/hcops/network.go | 4 +- internal/hcops/server.go | 2 +- internal/hcops/server_test.go | 2 +- internal/hcops/testing.go | 14 +++---- internal/mocks/action.go | 2 +- internal/mocks/casts.go | 2 +- internal/mocks/certificates.go | 2 +- internal/mocks/loadbalancer.go | 4 +- internal/mocks/network.go | 4 +- internal/mocks/server.go | 2 +- tests/e2e/e2e_test.go | 2 +- tests/e2e/testing.go | 2 +- 36 files changed, 105 insertions(+), 115 deletions(-) diff --git a/go.mod b/go.mod index c6c056f5..eef435a8 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/hetznercloud/hcloud-cloud-controller-manager go 1.20 require ( - github.com/hetznercloud/hcloud-go v1.46.1 + github.com/hetznercloud/hcloud-go/v2 v2.0.0 github.com/prometheus/client_golang v1.16.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 @@ -82,13 +82,13 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.19.0 // indirect - golang.org/x/crypto v0.10.0 // indirect - golang.org/x/net v0.11.0 // indirect + golang.org/x/crypto v0.11.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/oauth2 v0.5.0 // indirect golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/term v0.9.0 // indirect - golang.org/x/text v0.10.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/term v0.10.0 // indirect + golang.org/x/text v0.11.0 // indirect golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd // indirect diff --git a/go.sum b/go.sum index 7295f53f..abeae176 100644 --- a/go.sum +++ b/go.sum @@ -201,10 +201,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QG github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hetznercloud/hcloud-go v1.45.1 h1:nl0OOklFfQT5J6AaNIOhl5Ruh3fhmGmhvZEqHbibVuk= -github.com/hetznercloud/hcloud-go v1.45.1/go.mod h1:aAUGxSfSnB8/lVXHNEDxtCT1jykaul8kqjD7f5KQXF8= -github.com/hetznercloud/hcloud-go v1.46.1 h1:uX5SC+tnwy+0ouCkgravx8oIrddRFsJdUkQBxZk/tCQ= -github.com/hetznercloud/hcloud-go v1.46.1/go.mod h1:aQ19P39nEahvh4kQgyCgYUaglFGMe5KJO7sI418YdFI= +github.com/hetznercloud/hcloud-go/v2 v2.0.0 h1:Sg1DJ+MAKvbYAqaBaq9tPbwXBS2ckPIaMtVdUjKu+4g= +github.com/hetznercloud/hcloud-go/v2 v2.0.0/go.mod h1:4iUG2NG8b61IAwNx6UsMWQ6IfIf/i1RsG0BbsKAyR5Q= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -260,7 +258,7 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= @@ -340,10 +338,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -402,10 +398,8 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -456,25 +450,19 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= -golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= +golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/hcloud/cloud.go b/hcloud/cloud.go index d5b4d06e..f427db68 100644 --- a/hcloud/cloud.go +++ b/hcloud/cloud.go @@ -30,8 +30,8 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/hcops" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/metrics" - "github.com/hetznercloud/hcloud-go/hcloud" - "github.com/hetznercloud/hcloud-go/hcloud/metadata" + "github.com/hetznercloud/hcloud-go/v2/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud/metadata" ) const ( @@ -63,7 +63,7 @@ type cloud struct { instances *instances routes *routes loadBalancer *loadBalancers - networkID int + networkID int64 } func newCloud(_ io.Reader) (cloudprovider.Interface, error) { @@ -103,7 +103,7 @@ func newCloud(_ io.Reader) (cloudprovider.Interface, error) { client := hcloud.NewClient(opts...) metadataClient := metadata.NewClient() - var networkID int + var networkID int64 if v, ok := os.LookupEnv(hcloudNetworkENVVar); ok { n, _, err := client.Network.Get(context.Background(), v) if err != nil { @@ -253,7 +253,7 @@ func loadBalancerDefaultsFromEnv() (hcops.LoadBalancerDefaults, bool, bool, erro // serverIsAttachedToNetwork checks if the server where the master is running on is attached to the configured private network // We use this measurement to protect users against some parts of misconfiguration, like configuring a master in a not attached // network. -func serverIsAttachedToNetwork(metadataClient *metadata.Client, networkID int) (bool, error) { +func serverIsAttachedToNetwork(metadataClient *metadata.Client, networkID int64) (bool, error) { const op = "serverIsAttachedToNetwork" metrics.OperationCalled.WithLabelValues(op).Inc() diff --git a/hcloud/cloud_test.go b/hcloud/cloud_test.go index 67c88fa4..e04f6b1b 100644 --- a/hcloud/cloud_test.go +++ b/hcloud/cloud_test.go @@ -28,8 +28,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/hcops" - "github.com/hetznercloud/hcloud-go/hcloud" - "github.com/hetznercloud/hcloud-go/hcloud/schema" + "github.com/hetznercloud/hcloud-go/v2/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud/schema" ) type testEnv struct { diff --git a/hcloud/instances.go b/hcloud/instances.go index 5794283f..caa00d32 100644 --- a/hcloud/instances.go +++ b/hcloud/instances.go @@ -24,7 +24,7 @@ import ( cloudprovider "k8s.io/cloud-provider" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/metrics" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) type addressFamily int @@ -38,10 +38,10 @@ const ( type instances struct { client *hcloud.Client addressFamily addressFamily - networkID int + networkID int64 } -func newInstances(client *hcloud.Client, addressFamily addressFamily, networkID int) *instances { +func newInstances(client *hcloud.Client, addressFamily addressFamily, networkID int64) *instances { return &instances{client, addressFamily, networkID} } @@ -118,7 +118,7 @@ func (i *instances) InstanceMetadata(ctx context.Context, node *corev1.Node) (*c }, nil } -func nodeAddresses(addressFamily addressFamily, networkID int, server *hcloud.Server) []corev1.NodeAddress { +func nodeAddresses(addressFamily addressFamily, networkID int64, server *hcloud.Server) []corev1.NodeAddress { var addresses []corev1.NodeAddress addresses = append( addresses, diff --git a/hcloud/instances_test.go b/hcloud/instances_test.go index cd221ddd..5276f99e 100644 --- a/hcloud/instances_test.go +++ b/hcloud/instances_test.go @@ -28,8 +28,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" cloudprovider "k8s.io/cloud-provider" - "github.com/hetznercloud/hcloud-go/hcloud" - "github.com/hetznercloud/hcloud-go/hcloud/schema" + "github.com/hetznercloud/hcloud-go/v2/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud/schema" ) // TestInstances_InstanceExists also tests [lookupServer]. The other tests @@ -218,7 +218,7 @@ func TestNodeAddresses(t *testing.T) { name string addressFamily addressFamily server *hcloud.Server - privateNetwork int + privateNetwork int64 expected []corev1.NodeAddress }{ { diff --git a/hcloud/load_balancers.go b/hcloud/load_balancers.go index 9783b5bf..a60a3163 100644 --- a/hcloud/load_balancers.go +++ b/hcloud/load_balancers.go @@ -12,14 +12,14 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/annotation" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/hcops" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/metrics" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) // LoadBalancerOps defines the Load Balancer related operations required by // the hcloud-cloud-controller-manager. type LoadBalancerOps interface { GetByName(ctx context.Context, name string) (*hcloud.LoadBalancer, error) - GetByID(ctx context.Context, id int) (*hcloud.LoadBalancer, error) + GetByID(ctx context.Context, id int64) (*hcloud.LoadBalancer, error) GetByK8SServiceUID(ctx context.Context, svc *corev1.Service) (*hcloud.LoadBalancer, error) Create(ctx context.Context, lbName string, service *corev1.Service) (*hcloud.LoadBalancer, error) Delete(ctx context.Context, lb *hcloud.LoadBalancer) error diff --git a/hcloud/load_balancers_test.go b/hcloud/load_balancers_test.go index 574c0590..db6de804 100644 --- a/hcloud/load_balancers_test.go +++ b/hcloud/load_balancers_test.go @@ -10,7 +10,7 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/annotation" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/hcops" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func TestLoadBalancers_GetLoadBalancer(t *testing.T) { diff --git a/hcloud/routes.go b/hcloud/routes.go index 424efcb3..4883dcd1 100644 --- a/hcloud/routes.go +++ b/hcloud/routes.go @@ -13,7 +13,7 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/hcops" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/metrics" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) type routes struct { @@ -22,7 +22,7 @@ type routes struct { serverCache *hcops.AllServersCache } -func newRoutes(client *hcloud.Client, networkID int) (*routes, error) { +func newRoutes(client *hcloud.Client, networkID int64) (*routes, error) { const op = "hcloud/newRoutes" metrics.OperationCalled.WithLabelValues(op).Inc() @@ -262,7 +262,7 @@ func (r *routes) checkIfRouteAlreadyExists(ctx context.Context, route *cloudprov return false, nil } -func findServerPrivateNetByID(srv *hcloud.Server, id int) (hcloud.ServerPrivateNet, bool) { +func findServerPrivateNetByID(srv *hcloud.Server, id int64) (hcloud.ServerPrivateNet, bool) { for _, n := range srv.PrivateNet { if n.Network.ID == id { return n, true diff --git a/hcloud/routes_test.go b/hcloud/routes_test.go index 69f49e3c..a0f67e18 100644 --- a/hcloud/routes_test.go +++ b/hcloud/routes_test.go @@ -8,8 +8,8 @@ import ( cloudprovider "k8s.io/cloud-provider" - "github.com/hetznercloud/hcloud-go/hcloud" - "github.com/hetznercloud/hcloud-go/hcloud/schema" + "github.com/hetznercloud/hcloud-go/v2/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud/schema" ) func TestRoutes_CreateRoute(t *testing.T) { diff --git a/hcloud/testing.go b/hcloud/testing.go index c04b9133..1d05321b 100644 --- a/hcloud/testing.go +++ b/hcloud/testing.go @@ -12,7 +12,7 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/annotation" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/hcops" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/mocks" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) // Setenv prepares the environment for testing the diff --git a/hcloud/util.go b/hcloud/util.go index 5364c34f..dca2ea88 100644 --- a/hcloud/util.go +++ b/hcloud/util.go @@ -26,7 +26,7 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/metrics" ) -func providerIDToServerID(providerID string) (int, error) { +func providerIDToServerID(providerID string) (int64, error) { const op = "hcloud/providerIDToServerID" metrics.OperationCalled.WithLabelValues(op).Inc() @@ -41,13 +41,13 @@ func providerIDToServerID(providerID string) (int, error) { return 0, fmt.Errorf("%s: missing serverID: %s", op, providerID) } - id, err := strconv.Atoi(idString) + id, err := strconv.ParseInt(idString, 10, 64) if err != nil { return 0, fmt.Errorf("%s: invalid serverID: %s", op, providerID) } return id, nil } -func serverIDToProviderID(serverID int) string { +func serverIDToProviderID(serverID int64) string { return fmt.Sprintf("%s://%d", providerName, serverID) } diff --git a/internal/annotation/load_balancer.go b/internal/annotation/load_balancer.go index 95237a54..016f5702 100644 --- a/internal/annotation/load_balancer.go +++ b/internal/annotation/load_balancer.go @@ -6,7 +6,7 @@ import ( corev1 "k8s.io/api/core/v1" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/metrics" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) const ( diff --git a/internal/annotation/load_balancer_test.go b/internal/annotation/load_balancer_test.go index 17a8714b..d8ee624a 100644 --- a/internal/annotation/load_balancer_test.go +++ b/internal/annotation/load_balancer_test.go @@ -9,7 +9,7 @@ import ( corev1 "k8s.io/api/core/v1" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/annotation" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func TestLBToService_AddAnnotations(t *testing.T) { diff --git a/internal/annotation/name.go b/internal/annotation/name.go index a25dd48c..814ea061 100644 --- a/internal/annotation/name.go +++ b/internal/annotation/name.go @@ -11,7 +11,7 @@ import ( corev1 "k8s.io/api/core/v1" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/metrics" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) // ErrNotSet signals that an annotation was not set. @@ -36,6 +36,8 @@ func (s Name) AnnotateService(svc *corev1.Service, v interface{}) error { svc.ObjectMeta.Annotations[k] = strconv.FormatBool(vt) case int: svc.ObjectMeta.Annotations[k] = strconv.Itoa(vt) + case int64: + svc.ObjectMeta.Annotations[k] = strconv.FormatInt(vt, 10) case string: svc.ObjectMeta.Annotations[k] = vt case []string: @@ -49,7 +51,7 @@ func (s Name) AnnotateService(svc *corev1.Service, v interface{}) error { idsOrNames[i] = c.Name continue } - idsOrNames[i] = strconv.Itoa(c.ID) + idsOrNames[i] = strconv.FormatInt(c.ID, 10) } svc.ObjectMeta.Annotations[k] = strings.Join(idsOrNames, ",") case hcloud.NetworkZone: @@ -289,7 +291,7 @@ func (s Name) CertificatesFromService(svc *corev1.Service) ([]*hcloud.Certificat cs = make([]*hcloud.Certificate, len(ss)) for i, s := range ss { - id, err := strconv.Atoi(s) + id, err := strconv.ParseInt(s, 10, 64) if err != nil { // If we could not parse the string as an integer we assume it // is a name not an id. diff --git a/internal/annotation/name_test.go b/internal/annotation/name_test.go index cdb1421d..2d57e28d 100644 --- a/internal/annotation/name_test.go +++ b/internal/annotation/name_test.go @@ -13,7 +13,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/annotation" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) const ann annotation.Name = "some/annotation" diff --git a/internal/annotation/testing.go b/internal/annotation/testing.go index 5c9b66dc..320d8de0 100644 --- a/internal/annotation/testing.go +++ b/internal/annotation/testing.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) // AssertServiceAnnotated asserts that svc has been annotated with all diff --git a/internal/hcops/action.go b/internal/hcops/action.go index f02c3441..ed67aefc 100644 --- a/internal/hcops/action.go +++ b/internal/hcops/action.go @@ -3,7 +3,7 @@ package hcops import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) type HCloudActionClient interface { diff --git a/internal/hcops/certificates.go b/internal/hcops/certificates.go index d946ddb1..83311c10 100644 --- a/internal/hcops/certificates.go +++ b/internal/hcops/certificates.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/metrics" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) // HCloudCertificateClient defines the hcloud-go function related to diff --git a/internal/hcops/certificates_test.go b/internal/hcops/certificates_test.go index 35a03b70..3eeabe22 100644 --- a/internal/hcops/certificates_test.go +++ b/internal/hcops/certificates_test.go @@ -11,7 +11,7 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/hcops" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/mocks" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func TestCertificateOps_GetCertificateByNameOrID(t *testing.T) { diff --git a/internal/hcops/load_balancer.go b/internal/hcops/load_balancer.go index a186db55..ee420f64 100644 --- a/internal/hcops/load_balancer.go +++ b/internal/hcops/load_balancer.go @@ -14,7 +14,7 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/annotation" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/metrics" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) // LabelServiceUID is a label added to the Hetzner Cloud backend to uniquely @@ -24,7 +24,7 @@ const LabelServiceUID = "hcloud-ccm/service-uid" // HCloudLoadBalancerClient defines the hcloud-go functions required by the // Load Balancer operations type. type HCloudLoadBalancerClient interface { - GetByID(ctx context.Context, id int) (*hcloud.LoadBalancer, *hcloud.Response, error) + GetByID(ctx context.Context, id int64) (*hcloud.LoadBalancer, *hcloud.Response, error) GetByName(ctx context.Context, name string) (*hcloud.LoadBalancer, *hcloud.Response, error) Create(ctx context.Context, opts hcloud.LoadBalancerCreateOpts) (hcloud.LoadBalancerCreateResult, *hcloud.Response, error) @@ -70,7 +70,7 @@ type LoadBalancerOps struct { NetworkClient HCloudNetworkClient CertOps *CertificateOps RetryDelay time.Duration - NetworkID int + NetworkID int64 Defaults LoadBalancerDefaults } @@ -135,7 +135,7 @@ func (l *LoadBalancerOps) GetByName(ctx context.Context, name string) (*hcloud.L // // If no Load Balancer with id could be found, a wrapped ErrNotFound is // returned. -func (l *LoadBalancerOps) GetByID(ctx context.Context, id int) (*hcloud.LoadBalancer, error) { +func (l *LoadBalancerOps) GetByID(ctx context.Context, id int64) (*hcloud.LoadBalancer, error) { const op = "hcops/LoadBalancerOps.GetByName" metrics.OperationCalled.WithLabelValues(op).Inc() @@ -572,14 +572,14 @@ func (l *LoadBalancerOps) ReconcileHCLBTargets( var ( // Set of all K8S server IDs currently assigned as nodes to this // cluster. - k8sNodeIDs = make(map[int]bool) - k8sNodeNames = make(map[int]string) + k8sNodeIDs = make(map[int64]bool) + k8sNodeNames = make(map[int64]string) // Set of server IDs assigned as targets to the HC Load Balancer. Some // of the entries may get deleted during reconcilement. In this case // the hclbTargetIDs[id] is always false. If hclbTargetIDs[id] is true, // the node with this server id is assigned to the K8S cluster. - hclbTargetIDs = make(map[int]bool) + hclbTargetIDs = make(map[int64]bool) changed bool ) @@ -1205,7 +1205,7 @@ func (b *hclbServiceOptsBuilder) buildUpdateServiceOpts() (hcloud.LoadBalancerUp } // TODO this is a copy of the function in hcloud/utils.go => refactor. -func providerIDToServerID(providerID string) (int, error) { +func providerIDToServerID(providerID string) (int64, error) { const op = "hcops/providerIDToServerID" metrics.OperationCalled.WithLabelValues(op).Inc() @@ -1219,14 +1219,14 @@ func providerIDToServerID(providerID string) (int, error) { return 0, fmt.Errorf("%s: missing serverID: %s", op, providerID) } - id, err := strconv.Atoi(idString) + id, err := strconv.ParseInt(idString, 10, 64) if err != nil { return 0, fmt.Errorf("%s: invalid serverID: %s", op, providerID) } return id, nil } -func lbAttached(lb *hcloud.LoadBalancer, nwID int) bool { +func lbAttached(lb *hcloud.LoadBalancer, nwID int64) bool { for _, nw := range lb.PrivateNet { if nw.Network.ID == nwID { return true diff --git a/internal/hcops/load_balancer_internal_test.go b/internal/hcops/load_balancer_internal_test.go index e8792adb..d0955e6d 100644 --- a/internal/hcops/load_balancer_internal_test.go +++ b/internal/hcops/load_balancer_internal_test.go @@ -13,7 +13,7 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/annotation" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/mocks" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func TestHCLBServiceOptsBuilder(t *testing.T) { diff --git a/internal/hcops/load_balancer_test.go b/internal/hcops/load_balancer_test.go index 35723446..e220be6c 100644 --- a/internal/hcops/load_balancer_test.go +++ b/internal/hcops/load_balancer_test.go @@ -16,7 +16,7 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/annotation" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/hcops" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) var errTestLbClient = errors.New("lb client failed") @@ -94,7 +94,7 @@ func TestLoadBalancerOps_GetByName(t *testing.T) { func TestLoadBalancerOps_GetByID(t *testing.T) { tests := []struct { name string - lbID int + lbID int64 mock func(t *testing.T, fx *hcops.LoadBalancerOpsFixture) lb *hcloud.LoadBalancer err error @@ -105,7 +105,7 @@ func TestLoadBalancerOps_GetByID(t *testing.T) { mock: func(t *testing.T, fx *hcops.LoadBalancerOpsFixture) { err := hcloud.Error{Code: hcloud.ErrorCodeNotFound} fx.LBClient. - On("GetByID", fx.Ctx, 1). + On("GetByID", fx.Ctx, int64(1)). Return(nil, nil, err) }, err: hcops.ErrNotFound, @@ -115,7 +115,7 @@ func TestLoadBalancerOps_GetByID(t *testing.T) { lbID: 2, mock: func(t *testing.T, fx *hcops.LoadBalancerOpsFixture) { fx.LBClient. - On("GetByID", fx.Ctx, 2). + On("GetByID", fx.Ctx, int64(2)). Return(nil, nil, nil) }, err: hcops.ErrNotFound, @@ -126,7 +126,7 @@ func TestLoadBalancerOps_GetByID(t *testing.T) { mock: func(t *testing.T, fx *hcops.LoadBalancerOpsFixture) { lb := &hcloud.LoadBalancer{ID: 3} fx.LBClient. - On("GetByID", fx.Ctx, 3). + On("GetByID", fx.Ctx, int64(3)). Return(lb, nil, nil) }, lb: &hcloud.LoadBalancer{ID: 3}, @@ -136,7 +136,7 @@ func TestLoadBalancerOps_GetByID(t *testing.T) { lbID: 4, mock: func(t *testing.T, fx *hcops.LoadBalancerOpsFixture) { fx.LBClient. - On("GetByID", fx.Ctx, 4). + On("GetByID", fx.Ctx, int64(4)). Return(nil, nil, errTestLbClient) }, err: errTestLbClient, @@ -771,7 +771,7 @@ func TestLoadBalancerOps_ReconcileHCLB(t *testing.T) { }, }, mock: func(t *testing.T, tt *LBReconcilementTestCase) { - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} newRDNS := "new-name-lb.example.com" tt.fx.LBClient.On("ChangeDNSPtr", tt.fx.Ctx, tt.initialLB, net.ParseIP("1.2.3.4").String(), &newRDNS).Return(action, nil, nil) tt.fx.MockWatchProgress(action, nil) @@ -818,7 +818,7 @@ func TestLoadBalancerOps_ReconcileHCLB(t *testing.T) { }, }, mock: func(t *testing.T, tt *LBReconcilementTestCase) { - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} newRDNS := "new-name-lb.example.com" tt.fx.LBClient.On("ChangeDNSPtr", tt.fx.Ctx, tt.initialLB, net.ParseIP("fe80::1").String(), &newRDNS).Return(action, nil, nil) tt.fx.MockWatchProgress(action, nil) @@ -843,7 +843,7 @@ func TestLoadBalancerOps_ReconcileHCLB(t *testing.T) { opts := hcloud.LoadBalancerDetachFromNetworkOpts{ Network: &hcloud.Network{ID: 14, Name: "some-network"}, } - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} tt.fx.LBClient.On("DetachFromNetwork", tt.fx.Ctx, tt.initialLB, opts).Return(action, nil, nil) tt.fx.MockWatchProgress(action, nil) }, @@ -882,7 +882,7 @@ func TestLoadBalancerOps_ReconcileHCLB(t *testing.T) { tt.fx.LBOps.NetworkID = nw.ID opts := hcloud.LoadBalancerAttachToNetworkOpts{Network: nw} - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} tt.fx.LBClient.On("AttachToNetwork", tt.fx.Ctx, tt.initialLB, opts).Return(action, nil, nil) tt.fx.MockWatchProgress(action, nil) }, @@ -907,7 +907,7 @@ func TestLoadBalancerOps_ReconcileHCLB(t *testing.T) { Return(nil, nil, hcloud.Error{Code: hcloud.ErrorCodeConflict}). Once() - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} tt.fx.LBClient. On("AttachToNetwork", tt.fx.Ctx, tt.initialLB, opts). Return(action, nil, nil). @@ -936,7 +936,7 @@ func TestLoadBalancerOps_ReconcileHCLB(t *testing.T) { Return(nil, nil, hcloud.Error{Code: hcloud.ErrorCodeLocked}). Once() - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} tt.fx.LBClient. On("AttachToNetwork", tt.fx.Ctx, tt.initialLB, opts). Return(action, nil, nil). @@ -981,7 +981,7 @@ func TestLoadBalancerOps_ReconcileHCLB(t *testing.T) { }, }, mock: func(t *testing.T, tt *LBReconcilementTestCase) { - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} tt.fx.LBClient. On("DisablePublicInterface", tt.fx.Ctx, tt.initialLB). Return(action, nil, nil) @@ -1022,7 +1022,7 @@ func TestLoadBalancerOps_ReconcileHCLB(t *testing.T) { }, }, mock: func(t *testing.T, tt *LBReconcilementTestCase) { - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} tt.fx.LBClient. On("EnablePublicInterface", tt.fx.Ctx, tt.initialLB). Return(action, nil, nil) diff --git a/internal/hcops/mocks.go b/internal/hcops/mocks.go index f0cde9e9..77deff67 100644 --- a/internal/hcops/mocks.go +++ b/internal/hcops/mocks.go @@ -7,7 +7,7 @@ import ( corev1 "k8s.io/api/core/v1" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/mocks" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) type MockLoadBalancerOps struct { @@ -19,7 +19,7 @@ func (m *MockLoadBalancerOps) GetByName(ctx context.Context, name string) (*hclo return mocks.GetLoadBalancerPtr(args, 0), args.Error(1) } -func (m *MockLoadBalancerOps) GetByID(ctx context.Context, id int) (*hcloud.LoadBalancer, error) { +func (m *MockLoadBalancerOps) GetByID(ctx context.Context, id int64) (*hcloud.LoadBalancer, error) { args := m.Called(ctx, id) return mocks.GetLoadBalancerPtr(args, 0), args.Error(1) } diff --git a/internal/hcops/network.go b/internal/hcops/network.go index f4163647..831eb2ba 100644 --- a/internal/hcops/network.go +++ b/internal/hcops/network.go @@ -3,9 +3,9 @@ package hcops import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) type HCloudNetworkClient interface { - GetByID(ctx context.Context, id int) (*hcloud.Network, *hcloud.Response, error) + GetByID(ctx context.Context, id int64) (*hcloud.Network, *hcloud.Response, error) } diff --git a/internal/hcops/server.go b/internal/hcops/server.go index 1e25fc49..6a38031a 100644 --- a/internal/hcops/server.go +++ b/internal/hcops/server.go @@ -8,7 +8,7 @@ import ( "time" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/metrics" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) // AllServersCache caches the result of the LoadFunc and provides random access diff --git a/internal/hcops/server_test.go b/internal/hcops/server_test.go index 45cd98e9..53c5b9b5 100644 --- a/internal/hcops/server_test.go +++ b/internal/hcops/server_test.go @@ -12,7 +12,7 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/hcops" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/mocks" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func TestAllServersCache_CacheMiss(t *testing.T) { diff --git a/internal/hcops/testing.go b/internal/hcops/testing.go index fa8ca654..2ed223cb 100644 --- a/internal/hcops/testing.go +++ b/internal/hcops/testing.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/mocks" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) type LoadBalancerOpsFixture struct { @@ -54,7 +54,7 @@ func (fx *LoadBalancerOpsFixture) MockGetByID(lb *hcloud.LoadBalancer, err error func (fx *LoadBalancerOpsFixture) MockCreate( opts hcloud.LoadBalancerCreateOpts, lb *hcloud.LoadBalancer, err error, ) *hcloud.Action { - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} createResult := hcloud.LoadBalancerCreateResult{Action: action, LoadBalancer: lb} fx.LBClient.On("Create", fx.Ctx, opts).Return(createResult, nil, err) return action @@ -63,7 +63,7 @@ func (fx *LoadBalancerOpsFixture) MockCreate( func (fx *LoadBalancerOpsFixture) MockAddService( opts hcloud.LoadBalancerAddServiceOpts, lb *hcloud.LoadBalancer, err error, ) *hcloud.Action { - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} fx.LBClient.On("AddService", fx.Ctx, lb, opts).Return(action, nil, err) return action } @@ -71,13 +71,13 @@ func (fx *LoadBalancerOpsFixture) MockAddService( func (fx *LoadBalancerOpsFixture) MockUpdateService( opts hcloud.LoadBalancerUpdateServiceOpts, lb *hcloud.LoadBalancer, listenPort int, err error, ) *hcloud.Action { - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} fx.LBClient.On("UpdateService", fx.Ctx, lb, listenPort, opts).Return(action, nil, err) return action } func (fx *LoadBalancerOpsFixture) MockDeleteService(lb *hcloud.LoadBalancer, port int, err error) *hcloud.Action { - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} fx.LBClient.On("DeleteService", fx.Ctx, lb, port).Return(action, nil, err) return action } @@ -85,7 +85,7 @@ func (fx *LoadBalancerOpsFixture) MockDeleteService(lb *hcloud.LoadBalancer, por func (fx *LoadBalancerOpsFixture) MockAddServerTarget( lb *hcloud.LoadBalancer, opts hcloud.LoadBalancerAddServerTargetOpts, err error, ) *hcloud.Action { - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} fx.LBClient.On("AddServerTarget", fx.Ctx, lb, opts).Return(action, nil, err) return action } @@ -93,7 +93,7 @@ func (fx *LoadBalancerOpsFixture) MockAddServerTarget( func (fx *LoadBalancerOpsFixture) MockRemoveServerTarget( lb *hcloud.LoadBalancer, s *hcloud.Server, err error, ) *hcloud.Action { - action := &hcloud.Action{ID: rand.Int()} + action := &hcloud.Action{ID: rand.Int63()} fx.LBClient.On("RemoveServerTarget", fx.Ctx, lb, s).Return(action, nil, err) return action } diff --git a/internal/mocks/action.go b/internal/mocks/action.go index 53bb3f52..ef6d71bf 100644 --- a/internal/mocks/action.go +++ b/internal/mocks/action.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/mock" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) type ActionClient struct { diff --git a/internal/mocks/casts.go b/internal/mocks/casts.go index 04d9dace..8757463e 100644 --- a/internal/mocks/casts.go +++ b/internal/mocks/casts.go @@ -3,7 +3,7 @@ package mocks import ( "github.com/stretchr/testify/mock" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func getResponsePtr(args mock.Arguments, i int) *hcloud.Response { diff --git a/internal/mocks/certificates.go b/internal/mocks/certificates.go index e42d2ebd..8b6ec8b2 100644 --- a/internal/mocks/certificates.go +++ b/internal/mocks/certificates.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/mock" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) type CertificateClient struct { diff --git a/internal/mocks/loadbalancer.go b/internal/mocks/loadbalancer.go index c3cda588..643da086 100644 --- a/internal/mocks/loadbalancer.go +++ b/internal/mocks/loadbalancer.go @@ -5,14 +5,14 @@ import ( "github.com/stretchr/testify/mock" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) type LoadBalancerClient struct { mock.Mock } -func (m *LoadBalancerClient) GetByID(ctx context.Context, id int) (*hcloud.LoadBalancer, *hcloud.Response, error) { +func (m *LoadBalancerClient) GetByID(ctx context.Context, id int64) (*hcloud.LoadBalancer, *hcloud.Response, error) { args := m.Called(ctx, id) return GetLoadBalancerPtr(args, 0), getResponsePtr(args, 1), args.Error(2) } diff --git a/internal/mocks/network.go b/internal/mocks/network.go index 02235020..5d368933 100644 --- a/internal/mocks/network.go +++ b/internal/mocks/network.go @@ -5,14 +5,14 @@ import ( "github.com/stretchr/testify/mock" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) type NetworkClient struct { mock.Mock } -func (m *NetworkClient) GetByID(ctx context.Context, id int) (*hcloud.Network, *hcloud.Response, error) { +func (m *NetworkClient) GetByID(ctx context.Context, id int64) (*hcloud.Network, *hcloud.Response, error) { args := m.Called(ctx, id) return getNetworkPtr(args, 0), getResponsePtr(args, 1), args.Error(2) } diff --git a/internal/mocks/server.go b/internal/mocks/server.go index 8e6e48c5..e178f51a 100644 --- a/internal/mocks/server.go +++ b/internal/mocks/server.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/mock" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) // ServerClient is a mock implementation of the hcloud.ServerClient. diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index a1984226..e23f6c1c 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -17,7 +17,7 @@ import ( "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/annotation" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/hcops" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) var testCluster TestCluster diff --git a/tests/e2e/testing.go b/tests/e2e/testing.go index 5b035b49..ef4bf461 100644 --- a/tests/e2e/testing.go +++ b/tests/e2e/testing.go @@ -21,7 +21,7 @@ import ( "k8s.io/client-go/tools/clientcmd" "github.com/hetznercloud/hcloud-cloud-controller-manager/internal/testsupport" - "github.com/hetznercloud/hcloud-go/hcloud" + "github.com/hetznercloud/hcloud-go/v2/hcloud" ) var rng *rand.Rand -- GitLab