Skip to content

v1beta2 Ready summary fails with empty condition list #2239

Description

@abdullah599

What happens today

Every object we manage (HetznerCluster, HCloudMachine, HetznerBareMetalHost and so on) reports a top level Ready condition, which is how a user sees whether the object is fully up. We do not set Ready by hand. In CAPI v1beta2 it is a summary of smaller sub conditions, where each sub condition reports one step, for example ServerCreated, ServerProvisioned and ServerAvailable on an HCloudMachine. Ready turns True once the steps it covers are True.

CAPI computes that with NewSummaryCondition, which each controller calls in its scope Close. We tell it what to summarize through a per resource SummaryOpts function (this one is HCloudMachine's). It has two parts:

  • ForConditionTypes is the list of sub conditions that make up Ready
  • IgnoreTypesIfMissing is the subset by which we tell CAPI to leave a missing one out instead of counting it as Unknown when computing Ready

The problem arises when every condition in ForConditionTypes is also in IgnoreTypesIfMissing and the object has none of them set yet, the summary has nothing to work with and returns summary can't be performed when the list of conditions to be summarized is empty. We hit this on a fresh HCloudMachine, whose SummaryOpts lists all five conditions in both lists. The same shape exists on HCloudRemediation and HetznerBareMetalMachine, so they can hit it too.

What should happen

Audit each resource's SummaryOpts and keep a condition in IgnoreTypesIfMissing only when a missing value does not mean the object is not ready. Every other condition, the real lifecycle steps and the token, stays required.

Two kinds of condition pass that test for us. The negative polarity ones are only set when that specific thing is happening (HCloudRateLimitExceeded, Deleting, RemediationSkipped, RobotRateLimitExceeded), so a missing value is the normal healthy case. The optional feature ones only exist when the feature is turned on (NetworkReady, LoadBalancerReady), so a cluster without that feature never sets them and a missing value is expected. Everything else is a real step of bringing the object up, so a missing value does mean it is not ready yet, and it stays required.

Proposed Solution:

Resource Required (keep in the summary) Ignore if missing
HetznerCluster HCloudTokenAvailable, PlacementGroupsSynced, ControlPlaneEndpointSet, TargetClusterReady, TargetClusterSecretReady HCloudRateLimitExceeded, Deleting, NetworkReady (optional feature), LoadBalancerReady (optional feature)
HCloudMachine HCloudTokenAvailable, ServerCreated, ServerProvisioned, ServerAvailable HCloudRateLimitExceeded
HCloudRemediation HCloudTokenAvailable HCloudRateLimitExceeded, RemediationSkipped
HetznerBareMetalHost RobotCredentialsAvailable, SSHKeysAvailable, RootDeviceHintsValidated, ProvisionSucceeded, NodeBootIDRetrieved ActionCompleted, RebootSucceeded, RobotRateLimitExceeded, Deleting
HetznerBareMetalMachine HCloudTokenAvailable, HostAssociated, HostReady, ServerAvailable Deleting
HetznerBareMetalRemediation none, no Ready summary none

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions