Skip to content

cluster-controller: drop unused node_direct join from node_drain::store #885

Open

Description

@SamGanYX

Problem

node_api_row in crates/libs/cluster/controller/server/src/node_drain/store.rs:545-571 queries a source node's OwnedNodeApiTarget with LEFT JOIN node_direct nd ON nd.node_id = n.id to populate direct_endpoint. Because of that join, node_drain/store.rs carries an exception in architecture-baseline.toml under [pattern_ratchet.direct_tables].

However, the node-drain reconciler is Kubernetes-only (SubstrateCapabilities::DIRECT.supports_node_drain is false), and its sole consumer of node_api_row is promotion_node_api_client (store.rs:2634), which passes target directly to self.substrate.kubernetes() (KubernetesSubstrate::resolve_node_api_endpoint). KubernetesSubstrate addresses nodes exclusively via NodeAddressing::SubstrateNodeId (nk.k8s_node_name) and never reads direct_endpoint.

Why it matters

ARCHITECTURE.toml fences node_direct to the Direct substrate (crates/libs/api/src/controllers/substrate/direct*). Keeping an unused LEFT JOIN node_direct in a Kubernetes-only reconciler pays an unnecessary join on every uncached source-node lookup during drain and keeps node_drain/store.rs in [pattern_ratchet.direct_tables].

Proposed approach

  1. Remove LEFT JOIN node_direct nd ON nd.node_id = n.id from node_api_row in crates/libs/cluster/controller/server/src/node_drain/store.rs and set direct_endpoint: None on the returned OwnedNodeApiTarget.
  2. Remove "crates/libs/cluster/controller/server/src/node_drain/store.rs" = 1 from [pattern_ratchet.direct_tables] in architecture-baseline.toml (cargo arch --write-baseline=direct_tables).

Severity

Low (removes an unused table join and ratchets down pattern_ratchet.direct_tables by one file).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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