From 6caccaa9813ad948d85ef82547910ca5c690115b Mon Sep 17 00:00:00 2001 From: Arbian Shkodra Date: Sun, 17 May 2026 15:47:14 +0200 Subject: [PATCH 1/2] fix(cloud): make HasClusterID() return true to silence deprecation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The kubernetes/cloud-provider library deprecated --allow-untagged-cloud and emits a startup warning whenever the flag is set: Flag --allow-untagged-cloud has been deprecated, This flag is deprecated and will be removed in a future release. A cluster-id will be required on cloud instances. For Hetzner specifically, no ClusterID is ever consumed by the cloud provider — issue #1119 closed Jan 2026 with maintainer confirmation: "We don't use cluster-ids anywhere in the code. Neither has allow-untagged-cloud any relevance for us. ... You can safely ignore this message from the logs." Because HasClusterID() was hardcoded to return false, operators were forced to pass --allow-untagged-cloud just to get past the fail-fast check in main.go:73-80 — which then triggered the deprecation warning from upstream. The flag is functionally a no-op for Hetzner, but its presence is what causes the warning. Returning true here states the truth (Hetzner does not use ClusterID, treats every cluster as "tagged enough" for its purposes) and lets operators omit the flag entirely, which silences the warning at its source. Behavior is otherwise unchanged. Closes #1119 --- hcloud/cloud.go | 9 ++++++++- hcloud/cloud_test.go | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hcloud/cloud.go b/hcloud/cloud.go index 621ee7a19..0b0586ecd 100644 --- a/hcloud/cloud.go +++ b/hcloud/cloud.go @@ -226,7 +226,14 @@ func (c *cloud) ProviderName() string { } func (c *cloud) HasClusterID() bool { - return false + // Hetzner does not consume the kubernetes/cloud-provider ClusterID for + // any tagging or reconciliation — see issue #1119, where this was + // confirmed by maintainers. Returning true lets operators omit the + // `--allow-untagged-cloud` flag entirely, which in turn silences the + // upstream deprecation warning ("Flag --allow-untagged-cloud has been + // deprecated, ... A cluster-id will be required on cloud instances.") + // emitted by k8s.io/cloud-provider when the flag is set. + return true } // serverIsAttachedToNetwork checks if the server where the master is running on is attached to the configured private network diff --git a/hcloud/cloud_test.go b/hcloud/cloud_test.go index 71634ee5f..69c50e73e 100644 --- a/hcloud/cloud_test.go +++ b/hcloud/cloud_test.go @@ -240,8 +240,8 @@ func TestCloud(t *testing.T) { }) t.Run("HasClusterID", func(t *testing.T) { - if cloud.HasClusterID() { - t.Error("HasClusterID should be false") + if !cloud.HasClusterID() { + t.Error("HasClusterID should be true so operators can omit --allow-untagged-cloud (see issue #1119)") } }) From 43b4e29dcee00ec507c93f7165fc360b2dc73445 Mon Sep 17 00:00:00 2001 From: Arbian Shkodra Date: Fri, 29 May 2026 11:59:13 +0200 Subject: [PATCH 2/2] fix(main): drop forced --allow-untagged-cloud requirement Per review on #1244, keep HasClusterID() returning false (it is part of the upstream cloud-provider interface) and instead remove the fail-fast in cloudInitializer that forced operators to pass --allow-untagged-cloud. That forced flag was the only thing that triggered the upstream pflag deprecation warning. With the requirement gone, operators omit the flag and the warning disappears at its source, without changing the interface. This reverts the cloud.go/cloud_test.go changes from 6caccaa9. Co-Authored-By: Claude Opus 4.8 (1M context) --- hcloud/cloud.go | 9 +-------- hcloud/cloud_test.go | 4 ++-- main.go | 15 ++++++++------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/hcloud/cloud.go b/hcloud/cloud.go index a09d1b2c5..ab1bd4cdf 100644 --- a/hcloud/cloud.go +++ b/hcloud/cloud.go @@ -231,14 +231,7 @@ func (c *cloud) ProviderName() string { } func (c *cloud) HasClusterID() bool { - // Hetzner does not consume the kubernetes/cloud-provider ClusterID for - // any tagging or reconciliation — see issue #1119, where this was - // confirmed by maintainers. Returning true lets operators omit the - // `--allow-untagged-cloud` flag entirely, which in turn silences the - // upstream deprecation warning ("Flag --allow-untagged-cloud has been - // deprecated, ... A cluster-id will be required on cloud instances.") - // emitted by k8s.io/cloud-provider when the flag is set. - return true + return false } // serverIsAttachedToNetwork checks if the server where the master is running on is attached to the configured private network diff --git a/hcloud/cloud_test.go b/hcloud/cloud_test.go index 8bec571be..28e363c95 100644 --- a/hcloud/cloud_test.go +++ b/hcloud/cloud_test.go @@ -240,8 +240,8 @@ func TestCloud(t *testing.T) { }) t.Run("HasClusterID", func(t *testing.T) { - if !cloud.HasClusterID() { - t.Error("HasClusterID should be true so operators can omit --allow-untagged-cloud (see issue #1119)") + if cloud.HasClusterID() { + t.Error("HasClusterID should be false") } }) diff --git a/main.go b/main.go index 61dd5eb2e..930ca0cb9 100644 --- a/main.go +++ b/main.go @@ -72,13 +72,14 @@ func cloudInitializer(config *config.CompletedConfig) cloudprovider.Interface { klog.Fatalf("Cloud provider is nil") } - if !cloud.HasClusterID() { - if config.ComponentConfig.KubeCloudShared.AllowUntaggedCloud { - klog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. Please tag your cluster to avoid any future issues") - } else { - klog.Fatalf("no ClusterID found. A ClusterID is required for the cloud provider to function properly. This check can be bypassed by setting the allow-untagged-cloud option") - } - } + // Hetzner does not consume the kubernetes/cloud-provider ClusterID for any + // tagging or reconciliation, so HasClusterID() returns false (see issue + // #1119). We intentionally skip the upstream fail-fast that would otherwise + // require operators to set --allow-untagged-cloud. Forcing that flag was the + // only thing that triggered the upstream deprecation warning ("Flag + // --allow-untagged-cloud has been deprecated, ... A cluster-id will be + // required on cloud instances."); by no longer requiring it, operators can + // omit the flag and the warning goes away at its source. return cloud }