Skip to content

Commit b03f645

Browse files
committed
fix: runs entrypoint-wrapper.sh when possible
The current command param overrides the container entrypoint, so our wrapper never runs. Additionally, the wrapper itself needed a small fix to both ignore the original entrypoint file (no longer present) and to accept params . To make this backwards compatible, we first check if our entrypoint can run (via a version file). If so, we use it as entrypoint for the patroni binary. Otherwise, we execute patroni directly (previous behavior). Signed-off-by: Juliana Oliveira <[email protected]>
1 parent 308fe85 commit b03f645

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

internal/patroni/reconcile.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,14 @@ func InstancePod(ctx context.Context,
104104
}
105105
}
106106

107-
container.Command = []string{"patroni", configDirectory}
107+
// Use entrypoint wrapper if available (indicated by version file), otherwise run patroni directly.
108+
// The wrapper starts the OOM adjuster and shared memory cleanup before exec'ing to patroni.
109+
// Ref: https://github.com/superfly/mpg-postgres-image/pull/3
110+
container.Command = []string{
111+
"sh", "-c",
112+
`[ -f /usr/local/bin/.entrypoint-wrapper-version ] && exec /usr/local/bin/entrypoint-wrapper.sh "$@" || exec "$@"`,
113+
"--", "patroni", configDirectory,
114+
}
108115

109116
container.Env = append(container.Env,
110117
instanceEnvironment(inCluster, inClusterPodService, inPatroniLeaderService,

0 commit comments

Comments
 (0)