Skip to content

TiProxy does not support lifecycle hooks (preStop) causing downtime during config updates #6596

@Dr1m91

Description

@Dr1m91

Hello!
We have encountered an availability issue related to TiProxy when running TiDB in Kubernetes.
TiProxy v1.3.2
TiDB-operator v1.6.3

Problem Description:
When updating the TiProxy configuration in a TiDB cluster managed by TiDB Operator, i consistently observe short but real downtime for applications connecting through TiProxy.

Unlike TiDB, the TiProxy component currently does not support any lifecycle hooks in the CRD.
Specifically, the field:
spec.tiproxy.lifecycle
is not present in the CRD schema, so i cannot define a preStop hook.

This makes it impossible to perform a graceful shutdown or introduce a delay before the pod is terminated. As a result, during rolling updates, even with multiple replicas, there is a brief accessibility loss when a TiProxy pod is killed immediately.

To mitigate the problem, i tried to add a preStop hook:

spec:
  tiproxy:
    lifecycle:
      preStop:
        exec:
          command: ["/bin/sh", "-c", "sleep 30"]

This works correctly for spec.tidb.lifecycle but fails for TiProxy.

Feature Request:

Would it be possible to add lifecycle hook support to TiProxy, similar to what already exists for TiDB?
preStop support would allow us to delay shutdown and avoid losing connection during regular updates.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions