Skip to main content

Module failover

Module failover 

Source
Expand description

Kill-broker orchestration for the failover scenario.

This module uses the in-cluster kube API through the Job’s ServiceAccount. That ServiceAccount needs pods: get,list,delete in the target namespace, and it is mounted only when a failover scenario asks for it.

partition0_leader resolves the topic metadata first and then maps the partition leader’s broker id back to the matching StatefulSet pod. If that metadata probe fails, the caller can fall back to the first broker pod by name-sort for backwards-compatible smoke runs.

Functions§

kill_broker_pod
Deletes the requested broker pod.
kill_first_broker
Deletes the first broker pod in alphabetical order that matches the stack’s pod-name regex root. This stays as a compatibility wrapper for runs that do not target a partition.
partition0_leader_from_metadata
Queries the topic metadata and returns partition 0’s current leader broker id.
try_client
Discovers an in-cluster Kubernetes client, which uses the in-pod serviceAccount token.