Skip to content

CKS remove-node revokes the wrong firewall rule, leaving the node's rule behind #14799

Open

Description

@bhouse-nexthop
ISSUE TYPE
  • Bug Report
COMPONENT NAME
CKS (Kubernetes service), removeNodesFromKubernetesCluster
CLOUDSTACK VERSION
4.22, main
SUMMARY

When a node is removed from a CKS cluster, KubernetesClusterRemoveWorker.removeNodePortForwardingRules finds the node's firewall rule with FirewallRulesDao.findByNetworkIdAndPorts. That lookup matches on network and ports only: no purpose, public IP, protocol or state.

it can return result
a PF or LB rule on the same port revokeIngressFirewallRule fails with Unable to find <id> having purpose [Firewall, Ipv6Firewall]; the node's firewall rule stays
a firewall rule on another public IP of the network that rule is revoked instead; the node's firewall rule stays
nothing NPE, logged; the operation still reports success

The error is caught and only logged, so the removal reports success and the rule is left behind. A later add-node that reuses the port then hits a rule conflict.

The add-node revert path had the same lookup; that is fixed in #14775.

STEPS TO REPRODUCE
1. CKS cluster on an isolated network; add an external node (addNodesToKubernetesCluster)
2. Have another rule on the node's SSH public port on the network (e.g. a PF/LB or firewall rule on a second public IP)
3. removeNodesFromKubernetesCluster for that node
EXPECTED RESULTS
The node's SSH firewall and PF rules on the cluster public IP are removed; other rules are untouched.
ACTUAL RESULTS
The wrong rule is revoked, or the revoke fails with "Unable to find <id> having purpose [Firewall, Ipv6Firewall]".
The node's firewall rule stays on the cluster public IP.

Activity

  1. github-actions commented on Nov 30, 2026

    @github-actions

    Warning

    threat detection engine error
    The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

    What happened

    The threat detection engine failed to produce results.

    Review the workflow run logs for details.

    🎯 Triage report

    On remove, KubernetesClusterRemoveWorker.removeNodePortForwardingRules finds the node's firewall rule with findByNetworkIdAndPorts, which filters on network and ports only. It can return a port-forwarding or load-balancer rule on the same port, or a firewall rule on another public IP. The revoke then fails or revokes the wrong rule. The error is only logged, so the removal reports success and the node's own rule stays behind, which later blocks an add that reuses the port.

    📊 Assessment

    Dimension Value Reasoning
    Type type:bug Wrong rule matched on remove, with reproduction steps
    Component component:cks KubernetesClusterRemoveWorker rule lookup
    Severity Severity:Minor Stale rule left and the wrong rule revoked in some cases; the operation reports success
    Labels type:bug, component:cks, Severity:Minor Based on the issue text
    Coding agent Suitable Fix direction is specific: match the rule by purpose, public IP and port

    🔗 Similar issues

    💡 Notes and suggestions
    • Reproduction: isolated-network cluster, an external node added, another rule on the same SSH port on a second public IP, then remove the node.
    • The reporter says Remove only the new rules when CKS add-node fails #14775 fixed the add-node revert path. Check that the same fix covers remove.

    Generated by Daily Issue Triage · copilot · haiku55 · ~8 AIC · ⊞ 3.8K · ◷

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/daily-issue-triage.md@139fa09ef17cde4135e696ff8e7af09bc5ddfa6e
    
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