Connection draining for graceful backend removal. Allows backends to be drained by stopping new connections while allowing existing connections to complete.
Connection draining for graceful backend removal. Allows backends to be drained by stopping new connections while allowing existing connections to complete.
(drain-backend! proxy-name
target-group
target
&
{:keys [timeout-ms on-complete] :or {timeout-ms 30000}})Start draining a backend target.
proxy-name: Name of the proxy containing the target target-group: TargetGroup record containing the target target: Target to drain - "ip:port" string, {:ip :port} map, or WeightedTarget opts: :timeout-ms - Drain timeout (default 30000ms) :on-complete - Callback fn called with status when drain completes
Returns DrainState or throws if target not found/already draining.
Start draining a backend target.
proxy-name: Name of the proxy containing the target
target-group: TargetGroup record containing the target
target: Target to drain - "ip:port" string, {:ip :port} map, or WeightedTarget
opts:
:timeout-ms - Drain timeout (default 30000ms)
:on-complete - Callback fn called with status when drain completes
Returns DrainState or throws if target not found/already draining.(draining? target)Check if a target is currently draining.
Check if a target is currently draining.
(format-drain-status status)Format drain status for display.
Format drain status for display.
(get-all-draining)Get all currently draining backends.
Returns seq of drain status maps.
Get all currently draining backends. Returns seq of drain status maps.
(get-connections-for-target conntrack-map target-id)Get the number of active connections to a specific target. Uses conntrack/stats-by-target to count connections.
Get the number of active connections to a specific target. Uses conntrack/stats-by-target to count connections.
(get-drain-status target)Get current drain status for a backend.
Returns map with :target-id :status :elapsed-ms :current-connections or nil if not draining.
Get current drain status for a backend. Returns map with :target-id :status :elapsed-ms :current-connections or nil if not draining.
(init! conntrack-map
update-weights-fn
&
{:keys [check-interval-ms] :or {check-interval-ms 1000}})Initialize the drain module with required resources. conntrack-map: BPF conntrack map for connection counting update-weights-fn: Function (fn [proxy-name new-target-group]) to update BPF maps opts: :check-interval-ms - How often to check drain status (default 1000ms)
Initialize the drain module with required resources. conntrack-map: BPF conntrack map for connection counting update-weights-fn: Function (fn [proxy-name new-target-group]) to update BPF maps opts: :check-interval-ms - How often to check drain status (default 1000ms)
(normalize-target target)Normalize target to target-id string. Accepts: "ip:port" string, {:ip :port} map, or WeightedTarget record.
Normalize target to target-id string.
Accepts: "ip:port" string, {:ip :port} map, or WeightedTarget record.(parse-target-id id)Parse a target ID string into {:ip :port}. Returns IP as u32 and port as int.
Parse a target ID string into {:ip :port}.
Returns IP as u32 and port as int.(print-drain-status)Print all draining backends.
Print all draining backends.
(stop-drain-watcher!)Stop the drain watcher.
Stop the drain watcher.
(target-id ip port)Create a target ID string from IP and port. IP can be a string or u32 value.
Create a target ID string from IP and port. IP can be a string or u32 value.
(undrain-backend! proxy-name target-group target)Cancel draining and restore traffic to a backend.
proxy-name: Name of the proxy target-group: TargetGroup record containing the target target: Target to undrain
Returns true if undrain succeeded, false if target wasn't draining.
Cancel draining and restore traffic to a backend. proxy-name: Name of the proxy target-group: TargetGroup record containing the target target: Target to undrain Returns true if undrain succeeded, false if target wasn't draining.
(wait-for-drain! target)Block until drain completes or times out.
Returns :completed, :timeout, or :cancelled.
Block until drain completes or times out. Returns :completed, :timeout, or :cancelled.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |