mirror of
https://github.com/siderolabs/talos.git
synced 2026-05-04 12:01:12 +02:00
chore: update hcloud API SDK to v2
There are no functional changes, but SDK got updated to handle int -> int64 changes. v1 version is only supported to Sep 2023. See https://github.com/hetznercloud/hcloud-go#support Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
parent
6d71bb8df2
commit
a17272cdda
2
go.mod
2
go.mod
@ -66,7 +66,7 @@ require (
|
||||
github.com/hashicorp/go-getter/v2 v2.2.1
|
||||
github.com/hashicorp/go-multierror v1.1.1
|
||||
github.com/hashicorp/go-version v1.6.0
|
||||
github.com/hetznercloud/hcloud-go v1.48.0
|
||||
github.com/hetznercloud/hcloud-go/v2 v2.0.0
|
||||
github.com/insomniacslk/dhcp v0.0.0-20230720093626-5648422c16cd
|
||||
github.com/jsimonetti/rtnetlink v1.3.4
|
||||
github.com/jxskiss/base62 v1.1.0
|
||||
|
||||
6
go.sum
6
go.sum
@ -637,8 +637,8 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l
|
||||
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hetznercloud/hcloud-go v1.48.0 h1:b6x0ABNYJr8zVX9sE1kCNMU/sndzI8vmZjxEWEr+Gn0=
|
||||
github.com/hetznercloud/hcloud-go v1.48.0/go.mod h1:VzDWThl47lOnZXY0q5/LPFD+M62pfe/52TV+mOrpp9Q=
|
||||
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/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
|
||||
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
@ -949,7 +949,7 @@ github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
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/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
|
||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
"net/netip"
|
||||
"strconv"
|
||||
|
||||
"github.com/hetznercloud/hcloud-go/hcloud"
|
||||
"github.com/hetznercloud/hcloud-go/v2/hcloud"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/siderolabs/talos/pkg/download"
|
||||
@ -25,9 +25,9 @@ type HCloudHandler struct {
|
||||
logger *zap.Logger
|
||||
|
||||
vip string
|
||||
deviceID int
|
||||
floatingID int
|
||||
networkID int
|
||||
deviceID int64
|
||||
floatingID int64
|
||||
networkID int64
|
||||
}
|
||||
|
||||
// NewHCloudHandler creates new NewEHCloudHandler.
|
||||
@ -73,7 +73,7 @@ func (handler *HCloudHandler) Acquire(ctx context.Context) error {
|
||||
}
|
||||
|
||||
handler.logger.Info("cleared previous Hetzner Cloud IP alias", zap.String("vip", handler.vip),
|
||||
zap.Int("device_id", oldDeviceID), zap.String("status", string(action.Status)))
|
||||
zap.Int64("device_id", oldDeviceID), zap.String("status", string(action.Status)))
|
||||
}
|
||||
|
||||
netIP := net.ParseIP(handler.vip)
|
||||
@ -86,8 +86,8 @@ func (handler *HCloudHandler) Acquire(ctx context.Context) error {
|
||||
return fmt.Errorf("error change alias IPs %q to server %d: %w", handler.vip, handler.deviceID, err)
|
||||
}
|
||||
|
||||
handler.logger.Info("assigned Hetzner Cloud alias IP", zap.String("vip", handler.vip), zap.Int("device_id", handler.deviceID),
|
||||
zap.Int("network_id", handler.networkID), zap.String("status", string(action.Status)))
|
||||
handler.logger.Info("assigned Hetzner Cloud alias IP", zap.String("vip", handler.vip), zap.Int64("device_id", handler.deviceID),
|
||||
zap.Int64("network_id", handler.networkID), zap.String("status", string(action.Status)))
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -104,7 +104,7 @@ func (handler *HCloudHandler) Acquire(ctx context.Context) error {
|
||||
return fmt.Errorf("error assigning %q on server %d: %w", handler.vip, handler.deviceID, err)
|
||||
}
|
||||
|
||||
handler.logger.Info("assigned Hetzner Cloud floating IP", zap.String("vip", handler.vip), zap.Int("device_id", handler.deviceID), zap.String("status", string(action.Status)))
|
||||
handler.logger.Info("assigned Hetzner Cloud floating IP", zap.String("vip", handler.vip), zap.Int64("device_id", handler.deviceID), zap.String("status", string(action.Status)))
|
||||
handler.floatingID = floatip.ID
|
||||
|
||||
return nil
|
||||
@ -129,8 +129,8 @@ func (handler *HCloudHandler) Release(ctx context.Context) error {
|
||||
return fmt.Errorf("error remove alias IPs %q on server %d: %w", handler.vip, handler.deviceID, err)
|
||||
}
|
||||
|
||||
handler.logger.Info("unassigned Hetzner Cloud alias IP", zap.String("vip", handler.vip), zap.Int("device_id", handler.deviceID),
|
||||
zap.Int("network_id", handler.networkID), zap.String("status", string(action.Status)))
|
||||
handler.logger.Info("unassigned Hetzner Cloud alias IP", zap.String("vip", handler.vip), zap.Int64("device_id", handler.deviceID),
|
||||
zap.Int64("network_id", handler.networkID), zap.String("status", string(action.Status)))
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -142,7 +142,7 @@ func (handler *HCloudHandler) Release(ctx context.Context) error {
|
||||
}
|
||||
|
||||
if floatip.Server == nil || floatip.Server.ID != handler.deviceID {
|
||||
handler.logger.Info("unassigned Hetzner Cloud floating IP", zap.String("vip", handler.vip), zap.Int("device_id", handler.deviceID))
|
||||
handler.logger.Info("unassigned Hetzner Cloud floating IP", zap.String("vip", handler.vip), zap.Int64("device_id", handler.deviceID))
|
||||
}
|
||||
|
||||
handler.floatingID = 0
|
||||
@ -161,7 +161,7 @@ func GetNetworkAndDeviceIDs(ctx context.Context, spec *network.VIPHCloudSpec, vi
|
||||
return fmt.Errorf("error downloading instance-id: %w", err)
|
||||
}
|
||||
|
||||
spec.DeviceID, err = strconv.Atoi(string(metadataInstanceID))
|
||||
spec.DeviceID, err = strconv.ParseInt(string(metadataInstanceID), 10, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting instance-id id: %w", err)
|
||||
}
|
||||
@ -191,7 +191,7 @@ func GetNetworkAndDeviceIDs(ctx context.Context, spec *network.VIPHCloudSpec, vi
|
||||
return nil
|
||||
}
|
||||
|
||||
func findServerByAlias(serverList []*hcloud.Server, networkID int, vip string) (deviceID int) {
|
||||
func findServerByAlias(serverList []*hcloud.Server, networkID int64, vip string) (deviceID int64) {
|
||||
for _, server := range serverList {
|
||||
for _, network := range server.PrivateNet {
|
||||
if network.Network.ID == networkID {
|
||||
|
||||
@ -85,8 +85,8 @@ type VIPEquinixMetalSpec struct {
|
||||
//
|
||||
//gotagsrewrite:gen
|
||||
type VIPHCloudSpec struct {
|
||||
DeviceID int `yaml:"deviceID" protobuf:"1"`
|
||||
NetworkID int `yaml:"networkID" protobuf:"2"`
|
||||
DeviceID int64 `yaml:"deviceID" protobuf:"1"`
|
||||
NetworkID int64 `yaml:"networkID" protobuf:"2"`
|
||||
APIToken string `yaml:"apiToken" protobuf:"3"`
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user