Skip to content

Refactor MQTT Schema Agent from bare Pod to Deployment #337

@ppawlowski

Description

@ppawlowski

Description

Problem

The MQTT Schema Agent is currently created as a Kubernetes Pod (via createNamespacedPod) rather than a Deployment. This makes standard Kubernetes cluster maintenance significantly harder:

  • Rolling restarts (e.g., kubectl rollout restart) do not work - bare pods are not rescheduled automatically
  • Node drain operations will terminate the pod and it will not be rescheduled, causing downtime
  • No self-healing - if the pod crashes or is evicted, it stays down until manually restarted through the FlowFuse
  • Inconsistency - Instance Pods are managed differently; agents should follow the same lifecycle patterns

Proposed Solution

Replace the bare Pod creation in createMQTTTopicAgent with a Kubernetes Deployment (with replicas: 1). The corresponding pod template should be updated to a Deployment spec wrapping the same container definition.

The stopBrokerAgent method would then delete the Deployment resource (and its managed ReplicaSet/Pod) rather than a bare pod.

The getBrokerAgentState and sendBrokerAgentCommand methods communicate with the agent over its in-cluster Service and should be unaffected by this change.

Benefits

  • Pods are automatically rescheduled after node drain/failure
  • Standard kubectl maintenance workflows apply (drain, cordon, rolling restart)
  • Consistent with how other workloads are managed in the cluster

Requested By

Internal initiative

Metadata

Metadata

Assignees

Labels

needs-triageNeeds looking at to decide what to do

Type

No type

Projects

Status

Todo

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions