From 6caccaa9813ad948d85ef82547910ca5c690115b Mon Sep 17 00:00:00 2001 From: Arbian Shkodra Date: Sun, 17 May 2026 15:47:14 +0200 Subject: [PATCH] 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)") } })