From dd48d4ed75bf13b29175035a32379e8e9d28439c Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Mon, 18 Nov 2024 23:48:34 +0100 Subject: [PATCH 1/2] fix(build): use `tini` to reap zombie processes Signed-off-by: Hidde Beydals --- Dockerfile | 4 +++- kargo-base.apko.yaml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 79edd5c75..16e3cb41b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,7 +79,7 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.4.15 && \ #################################################################################################### FROM alpine:latest AS back-end-dev -RUN apk update && apk add ca-certificates git gpg gpg-agent openssh-client +RUN apk update && apk add ca-certificates git gpg gpg-agent openssh-client tini COPY bin/credential-helper /usr/local/bin/credential-helper COPY bin/controlplane/kargo /usr/local/bin/kargo @@ -87,6 +87,7 @@ COPY bin/controlplane/kargo /usr/local/bin/kargo RUN adduser -D -H -u 1000 kargo USER 1000:0 +ENTRYPOINT ["/sbin/tini", "--"] CMD ["/usr/local/bin/kargo"] #################################################################################################### @@ -119,4 +120,5 @@ FROM ${BASE_IMAGE}:latest-${TARGETARCH} AS final COPY --from=back-end-builder /kargo/bin/ /usr/local/bin/ COPY --from=tools /tools/ /usr/local/bin/ +ENTRYPOINT ["/sbin/tini", "--"] CMD ["/usr/local/bin/kargo"] diff --git a/kargo-base.apko.yaml b/kargo-base.apko.yaml index 451ded016..49feb0e9a 100644 --- a/kargo-base.apko.yaml +++ b/kargo-base.apko.yaml @@ -11,6 +11,7 @@ contents: - gpg-agent~2 - helm~3 # Required for Kustomize Helm plugin - openssh-client~9 + - tini accounts: groups: From ad2208986e0d314f0821d76614eaccfbdcf1346b Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Tue, 19 Nov 2024 00:36:36 +0100 Subject: [PATCH 2/2] fix(chart): make use of `tini` within `command`s Signed-off-by: Hidde Beydals --- charts/kargo/templates/controller/deployment.yaml | 3 ++- charts/kargo/templates/garbage-collector/cron-job.yaml | 3 ++- charts/kargo/templates/management-controller/deployment.yaml | 3 ++- charts/kargo/templates/webhooks-server/deployment.yaml | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/charts/kargo/templates/controller/deployment.yaml b/charts/kargo/templates/controller/deployment.yaml index 3f5fe5478..88631e9a1 100644 --- a/charts/kargo/templates/controller/deployment.yaml +++ b/charts/kargo/templates/controller/deployment.yaml @@ -57,7 +57,8 @@ spec: - name: controller image: {{ include "kargo.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} - command: ["/usr/local/bin/kargo", "controller"] + command: ["/sbin/tini", "--", "/usr/local/bin/kargo"] + args: ["controller"] env: - name: GOMEMLIMIT valueFrom: diff --git a/charts/kargo/templates/garbage-collector/cron-job.yaml b/charts/kargo/templates/garbage-collector/cron-job.yaml index db27005b6..0943061c5 100644 --- a/charts/kargo/templates/garbage-collector/cron-job.yaml +++ b/charts/kargo/templates/garbage-collector/cron-job.yaml @@ -56,7 +56,8 @@ spec: - name: garbage-collector image: {{ include "kargo.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} - command: ["/usr/local/bin/kargo", "garbage-collector"] + command: ["/sbin/tini", "--", "/usr/local/bin/kargo"] + args: ["garbage-collector"] env: - name: GOMEMLIMIT valueFrom: diff --git a/charts/kargo/templates/management-controller/deployment.yaml b/charts/kargo/templates/management-controller/deployment.yaml index 05081f720..b0f39f671 100644 --- a/charts/kargo/templates/management-controller/deployment.yaml +++ b/charts/kargo/templates/management-controller/deployment.yaml @@ -57,7 +57,8 @@ spec: - name: management-controller image: {{ include "kargo.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} - command: ["/usr/local/bin/kargo", "management-controller"] + command: ["/sbin/tini", "--", "/usr/local/bin/kargo"] + args: ["management-controller"] env: - name: GOMEMLIMIT valueFrom: diff --git a/charts/kargo/templates/webhooks-server/deployment.yaml b/charts/kargo/templates/webhooks-server/deployment.yaml index b4e86dd99..ffde69802 100644 --- a/charts/kargo/templates/webhooks-server/deployment.yaml +++ b/charts/kargo/templates/webhooks-server/deployment.yaml @@ -57,7 +57,8 @@ spec: - name: webhooks-server image: {{ include "kargo.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} - command: ["/usr/local/bin/kargo", "webhooks-server"] + command: ["/sbin/tini", "--", "/usr/local/bin/kargo"] + args: ["webhooks-server"] env: - name: GOMEMLIMIT valueFrom: