Skip to content

fix(cloud): make HasClusterID() return true to silence deprecation warning#1244

Open
arbianshkodra wants to merge 1 commit into
hetznercloud:mainfrom
arbianshkodra:fix/has-cluster-id-true
Open

fix(cloud): make HasClusterID() return true to silence deprecation warning#1244
arbianshkodra wants to merge 1 commit into
hetznercloud:mainfrom
arbianshkodra:fix/has-cluster-id-true

Conversation

@arbianshkodra
Copy link
Copy Markdown

What

Changes HasClusterID() in hcloud/cloud.go from returning false to returning true, and updates the corresponding test in hcloud/cloud_test.go.

Why

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, no ClusterID is ever consumed by the cloud provider — confirmed in #1119:

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. We may want to update our code here and don't emit any messages.
@lukasmetzner

Because HasClusterID() was hardcoded to false, operators were forced to pass --allow-untagged-cloud just to clear the fail-fast check in main.go:73-80, which then triggered the deprecation warning. The flag was functionally a no-op for Hetzner, but its presence was what caused 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. The deprecation warning goes away at its source — kubernetes/cloud-provider only emits it when the flag is set.

Behavior change

Before After
Operator must set --allow-untagged-cloud or HCCM crashes on startup Operator can omit the flag
Deprecation warning fires when the flag is set (every install today) No warning fires when the flag is omitted
HasClusterID() returns false (untruthful: Hetzner doesn't have or want a ClusterID, but the false return implies it should have one) HasClusterID() returns true (truthful: Hetzner is "tagged enough" for its own purposes)

Operators who keep --allow-untagged-cloud set will continue to see the deprecation warning (because the upstream library still notices the flag) — but they no longer need the flag.

Testing

  • go build ./... passes
  • go test ./hcloud/ -run TestCloud passes (test updated to assert the new expected behavior with a comment referencing HCCM: "--allow-untagged-cloud=false" and cluster labeling / tagging #1119)
  • Verified locally against a Hetzner cluster running v1.31.0 by patching the binary: with the flag dropped from helm values, pod comes up Ready and no deprecation warning is logged.

Closes #1119

…rning

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 hetznercloud#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 hetznercloud#1119
@arbianshkodra arbianshkodra requested a review from a team as a code owner May 17, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HCCM: "--allow-untagged-cloud=false" and cluster labeling / tagging

1 participant