Skip to content

Commit ca53831

Browse files
authored
Merge pull request #8554 from tloesch/deps-update-hcloud-go-2-24-0
deps(hetzner): update vendored hcloud-go to v2.24.0
2 parents a929235 + f40ff46 commit ca53831

File tree

23 files changed

+303
-268
lines changed

23 files changed

+303
-268
lines changed

cluster-autoscaler/cloudprovider/hetzner/hcloud-go/hcloud/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ func (c *Client) NewRequest(ctx context.Context, method, path string, body io.Re
304304
return nil, err
305305
}
306306
req.Header.Set("User-Agent", c.userAgent)
307+
req.Header.Set("Accept", "application/json")
307308

308309
if !c.tokenValid {
309310
return nil, errors.New("Authorization token contains invalid characters")

cluster-autoscaler/cloudprovider/hetzner/hcloud-go/hcloud/deprecation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ type DeprecationInfo struct {
2222
UnavailableAfter time.Time
2323
}
2424

25-
// DeprecatableResource implements the [Deprecatable] interface and can be embedded in structs for Resources that can be
26-
// deprecated.
25+
// DeprecatableResource implements the [Deprecatable] interface and can be embedded in structs for Resources that can
26+
// be deprecated.
2727
type DeprecatableResource struct {
2828
Deprecation *DeprecationInfo
2929
}

cluster-autoscaler/cloudprovider/hetzner/hcloud-go/hcloud/error.go

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,26 @@ const (
3030
ErrorCodeConflict ErrorCode = "conflict" // The resource has changed during the request, please retry
3131
ErrorCodeRobotUnavailable ErrorCode = "robot_unavailable" // Robot was not available. The caller may retry the operation after a short delay
3232
ErrorCodeResourceLocked ErrorCode = "resource_locked" // The resource is locked. The caller should contact support
33+
ErrorCodeServerError ErrorCode = "server_error" // Error within the API backend
34+
ErrorCodeTokenReadonly ErrorCode = "token_readonly" // The token is only allowed to perform GET requests
35+
ErrorCodeTimeout ErrorCode = "timeout" // The request could not be answered in time, please retry
3336
ErrorUnsupportedError ErrorCode = "unsupported_error" // The given resource does not support this
3437
ErrorDeprecatedAPIEndpoint ErrorCode = "deprecated_api_endpoint" // The request can not be answered because the API functionality was removed
3538

3639
// Server related error codes.
3740

38-
ErrorCodeInvalidServerType ErrorCode = "invalid_server_type" // The server type does not fit for the given server or is deprecated
39-
ErrorCodeServerNotStopped ErrorCode = "server_not_stopped" // The action requires a stopped server
40-
ErrorCodeNetworksOverlap ErrorCode = "networks_overlap" // The network IP range overlaps with one of the server networks
41-
ErrorCodePlacementError ErrorCode = "placement_error" // An error during the placement occurred
42-
ErrorCodeServerAlreadyAttached ErrorCode = "server_already_attached" // The server is already attached to the resource
41+
ErrorCodeInvalidServerType ErrorCode = "invalid_server_type" // The server type does not fit for the given server or is deprecated
42+
ErrorCodeServerNotStopped ErrorCode = "server_not_stopped" // The action requires a stopped server
43+
ErrorCodeNetworksOverlap ErrorCode = "networks_overlap" // The network IP range overlaps with one of the server networks
44+
ErrorCodePlacementError ErrorCode = "placement_error" // An error during the placement occurred
45+
ErrorCodeServerAlreadyAttached ErrorCode = "server_already_attached" // The server is already attached to the resource
46+
ErrorCodePrimaryIPAssigned ErrorCode = "primary_ip_assigned" // The specified Primary IP is already assigned to a server
47+
ErrorCodePrimaryIPDatacenterMismatch ErrorCode = "primary_ip_datacenter_mismatch" // The specified Primary IP is in a different datacenter
48+
ErrorCodePrimaryIPVersionMismatch ErrorCode = "primary_ip_version_mismatch" // The specified Primary IP has the wrong IP Version
49+
ErrorCodeServerHasIPv4 ErrorCode = "server_has_ipv4" // The Server already has an ipv4 address
50+
ErrorCodeServerHasIPv6 ErrorCode = "server_has_ipv6" // The Server already has an ipv6 address
51+
ErrorCodePrimaryIPAlreadyAssigned ErrorCode = "primary_ip_already_assigned" // Primary IP is already assigned to a different Server
52+
ErrorCodeServerIsLoadBalancerTarget ErrorCode = "server_is_load_balancer_target" // The Server IPv4 address is a loadbalancer target
4353

4454
// Load Balancer related error codes.
4555

@@ -52,6 +62,7 @@ const (
5262
ErrorCodeLoadBalancerAlreadyAttached ErrorCode = "load_balancer_already_attached" // The Load Balancer is already attached to a network
5363
ErrorCodeTargetsWithoutUsePrivateIP ErrorCode = "targets_without_use_private_ip" // The Load Balancer has targets that use the public IP instead of the private IP
5464
ErrorCodeLoadBalancerNotAttachedToNetwork ErrorCode = "load_balancer_not_attached_to_network" // The Load Balancer is not attached to a network
65+
ErrorCodeMissingIPv4 ErrorCode = "missing_ipv4" // The server that you are trying to add as a public target does not have a public IPv4 address
5566

5667
// Network related error codes.
5768

@@ -66,12 +77,14 @@ const (
6677

6778
// Firewall related error codes.
6879

69-
ErrorCodeFirewallAlreadyApplied ErrorCode = "firewall_already_applied" // Firewall was already applied on resource
70-
ErrorCodeFirewallAlreadyRemoved ErrorCode = "firewall_already_removed" // Firewall was already removed from the resource
71-
ErrorCodeIncompatibleNetworkType ErrorCode = "incompatible_network_type" // The Network type is incompatible for the given resource
72-
ErrorCodeResourceInUse ErrorCode = "resource_in_use" // Firewall must not be in use to be deleted
73-
ErrorCodeServerAlreadyAdded ErrorCode = "server_already_added" // Server added more than one time to resource
74-
ErrorCodeFirewallResourceNotFound ErrorCode = "firewall_resource_not_found" // Resource a firewall should be attached to / detached from not found
80+
ErrorCodeFirewallAlreadyApplied ErrorCode = "firewall_already_applied" // Firewall was already applied on resource
81+
ErrorCodeFirewallAlreadyRemoved ErrorCode = "firewall_already_removed" // Firewall was already removed from the resource
82+
ErrorCodeIncompatibleNetworkType ErrorCode = "incompatible_network_type" // The Network type is incompatible for the given resource
83+
ErrorCodeResourceInUse ErrorCode = "resource_in_use" // Firewall must not be in use to be deleted
84+
ErrorCodeServerAlreadyAdded ErrorCode = "server_already_added" // Server added more than one time to resource
85+
ErrorCodeFirewallResourceNotFound ErrorCode = "firewall_resource_not_found" // Resource a firewall should be attached to / detached from not found
86+
ErrorCodeFirewallManagedByLabelSelector ErrorCode = "firewall_managed_by_label_selector" // Firewall is applied via a Label Selector and cannot be removed manually
87+
ErrorCodePrivateNetOnlyServer ErrorCode = "private_net_only_server" // The Server the Firewall should be applied to has no public interface
7588

7689
// Certificate related error codes.
7790

@@ -82,6 +95,7 @@ const (
8295
ErrorCodeCATooManyDuplicateCertificates ErrorCode = "ca_too_many_duplicate_certificates" // Certificate Authority: Too many duplicate certificates
8396
ErrorCodeCloudNotVerifyDomainDelegatedToZone ErrorCode = "could_not_verify_domain_delegated_to_zone" // Could not verify domain delegated to zone
8497
ErrorCodeDNSZoneNotFound ErrorCode = "dns_zone_not_found" // DNS zone not found
98+
ErrorCodeDNSZoneIsSecondaryZone ErrorCode = "dns_zone_is_secondary_zone" // DNS zone is a secondary zone
8599

86100
// Deprecated error codes.
87101

cluster-autoscaler/cloudprovider/hetzner/hcloud-go/hcloud/exp/actionutil/actions.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package actionutil
33
import "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/hetzner/hcloud-go/hcloud"
44

55
// AppendNext return the action and the next actions in a new slice.
6+
//
7+
// Experimental: `exp` package is experimental, breaking changes may occur within minor releases.
68
func AppendNext(action *hcloud.Action, nextActions []*hcloud.Action) []*hcloud.Action {
79
all := make([]*hcloud.Action, 0, 1+len(nextActions))
810
all = append(all, action)

cluster-autoscaler/cloudprovider/hetzner/hcloud-go/hcloud/exp/ctxutil/ctxutil.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ type key struct{}
1212
var opPathKey = key{}
1313

1414
// SetOpPath processes the operation path and save it in the context before returning it.
15+
//
16+
// Experimental: `exp` package is experimental, breaking changes may occur within minor releases.
1517
func SetOpPath(ctx context.Context, path string) context.Context {
1618
path, _, _ = strings.Cut(path, "?")
1719
path = strings.ReplaceAll(path, "%d", "-")
@@ -21,6 +23,8 @@ func SetOpPath(ctx context.Context, path string) context.Context {
2123
}
2224

2325
// OpPath returns the operation path from the context.
26+
//
27+
// Experimental: `exp` package is experimental, breaking changes may occur within minor releases.
2428
func OpPath(ctx context.Context) string {
2529
result, ok := ctx.Value(opPathKey).(string)
2630
if !ok {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// Package exp is a namespace that holds experimental features for the `hcloud-go` library.
22
//
3-
// Breaking changes may occur without notice. Do not use in production!
3+
// Experimental: `exp` package is experimental, breaking changes may occur within minor releases.
44
package exp

cluster-autoscaler/cloudprovider/hetzner/hcloud-go/hcloud/exp/kit/envutil/env.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
// For both cases, the returned value may be empty.
1515
//
1616
// The value from the environment takes precedence over the value from the file.
17+
//
18+
// Experimental: `exp` package is experimental, breaking changes may occur within minor releases.
1719
func LookupEnvWithFile(key string) (string, error) {
1820
// Check if the value is set in the environment (e.g. HCLOUD_TOKEN)
1921
value, ok := os.LookupEnv(key)

cluster-autoscaler/cloudprovider/hetzner/hcloud-go/hcloud/exp/kit/randutil/id.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88

99
// GenerateID returns a hex encoded random string with a len of 8 chars similar to
1010
// "2873fce7".
11+
//
12+
// Experimental: `exp` package is experimental, breaking changes may occur within minor releases.
1113
func GenerateID() string {
1214
b := make([]byte, 4)
1315
_, err := rand.Read(b)

cluster-autoscaler/cloudprovider/hetzner/hcloud-go/hcloud/exp/kit/sshutil/ssh_key.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111

1212
// GenerateKeyPair generates a new ed25519 ssh key pair, and returns the private key and
1313
// the public key respectively.
14+
//
15+
// Experimental: `exp` package is experimental, breaking changes may occur within minor releases.
1416
func GenerateKeyPair() ([]byte, []byte, error) {
1517
pub, priv, err := ed25519.GenerateKey(nil)
1618
if err != nil {
@@ -54,6 +56,8 @@ type privateKeyWithPublicKey interface {
5456
}
5557

5658
// GeneratePublicKey generate a public key from the provided private key.
59+
//
60+
// Experimental: `exp` package is experimental, breaking changes may occur within minor releases.
5761
func GeneratePublicKey(privBytes []byte) ([]byte, error) {
5862
priv, err := ssh.ParseRawPrivateKey(privBytes)
5963
if err != nil {
@@ -74,6 +78,8 @@ func GeneratePublicKey(privBytes []byte) ([]byte, error) {
7478
}
7579

7680
// GetPublicKeyFingerprint generate the finger print for the provided public key.
81+
//
82+
// Experimental: `exp` package is experimental, breaking changes may occur within minor releases.
7783
func GetPublicKeyFingerprint(pubBytes []byte) (string, error) {
7884
pub, _, _, _, err := ssh.ParseAuthorizedKey(pubBytes)
7985
if err != nil {

cluster-autoscaler/cloudprovider/hetzner/hcloud-go/hcloud/exp/labelutil/selector.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import (
66
"strings"
77
)
88

9-
// Selector combines the label set into a [label selector](https://docs.hetzner.cloud/#label-selector) that only selects
9+
// Selector combines the label set into a [label selector](https://docs.hetzner.cloud/reference/cloud#label-selector) that only selects
1010
// resources have all specified labels set.
1111
//
1212
// The selector string can be used to filter resources when listing, for example with [hcloud.ServerClient.AllWithOpts()].
13+
//
14+
// Experimental: `exp` package is experimental, breaking changes may occur within minor releases.
1315
func Selector(labels map[string]string) string {
1416
selectors := make([]string, 0, len(labels))
1517

0 commit comments

Comments
 (0)