From cf5f6a8ca87a9de26b04270592fc3392195b67f0 Mon Sep 17 00:00:00 2001 From: dongmen <20351731+asddongmen@users.noreply.github.com> Date: Thu, 25 Jul 2024 20:16:11 +0800 Subject: [PATCH] api: add status api to support tidb operator (#128) Signed-off-by: dongmen <414110582@qq.com> --- api/v2/api.go | 3 +++ dockerfile | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/api/v2/api.go b/api/v2/api.go index d7d2f266f..2df3c258a 100644 --- a/api/v2/api.go +++ b/api/v2/api.go @@ -36,6 +36,9 @@ func RegisterOpenAPIV2Routes(router *gin.Engine, api OpenAPIV2) { v2.Use(middleware.LogMiddleware()) v2.GET("status", api.serverStatus) + // For compatibility with the old API, + // TiDB Operator relies on this API to determine whether the TiCDC node is healthy. + router.GET("/status", api.serverStatus) coordinatorMiddleware := middleware.ForwardToCoordinatorMiddleware(api.server) diff --git a/dockerfile b/dockerfile index 007006515..5c99617d1 100644 --- a/dockerfile +++ b/dockerfile @@ -3,11 +3,12 @@ RUN apk add --no-cache git make bash WORKDIR /go/src/tigate COPY . . ENV CDC_ENABLE_VENDOR=0 -RUN make cdc + +RUN --mount=type=cache,target=/root/.cache/go-build,target=/go/pkg/mod make cdc FROM alpine:3.15 RUN apk add --no-cache tzdata bash curl socat EXPOSE 8301 EXPOSE 8300 COPY --from=builder /go/src/tigate/bin/cdc /cdc -CMD [ "cdc" ] \ No newline at end of file +CMD [ "/cdc" ] \ No newline at end of file