Skip to content

Commit

Permalink
Change pgbackrest init for running containers
Browse files Browse the repository at this point in the history
In testing, we found that a running pgbackrest container wouldn't
get the permissions adjusted with a mkdir; so we're switching to
an install for now.
  • Loading branch information
benjaminjb authored and cbandy committed Feb 7, 2025
1 parent 836572d commit f2a80ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/pgbackrest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func MakePGBackrestLogDir(template *corev1.PodTemplateSpec,
}

container := corev1.Container{
Command: []string{"bash", "-c", "umask 000 && mkdir -m 777 -p " + pgBackRestLogPath},
Command: []string{"bash", "-c", "umask 000 && install -m 777 -d " + pgBackRestLogPath},
Image: config.PGBackRestContainerImage(cluster),
ImagePullPolicy: cluster.Spec.ImagePullPolicy,
Name: naming.ContainerPGBackRestLogDirInit,
Expand Down
2 changes: 1 addition & 1 deletion internal/pgbackrest/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func TestMakePGBackrestLogDir(t *testing.T) {
for _, c := range podTemplate.Spec.InitContainers {
if c.Name == naming.ContainerPGBackRestLogDirInit {
// ignore "bash -c", should skip repo with no volume
assert.Equal(t, "umask 000 && mkdir -m 777 -p /pgbackrest/repo2/log", c.Command[2])
assert.Equal(t, "umask 000 && install -m 777 -d /pgbackrest/repo2/log", c.Command[2])
assert.Equal(t, c.Image, "test-image")
assert.Equal(t, c.ImagePullPolicy, corev1.PullAlways)
assert.Assert(t, !cmp.DeepEqual(c.SecurityContext,
Expand Down

0 comments on commit f2a80ac

Please sign in to comment.