Skip to content

Commit fc0aee0

Browse files
committed
Keep pgAdmin configuration writable
The init container should have permission to write and replace these files. Kubernetes ensures the application container cannot write to them. Issue: PGO-1280
1 parent ed52367 commit fc0aee0

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

internal/controller/standalone_pgadmin/pod.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,11 @@ with open('` + configMountPath + `/` + gunicornConfigFilePath + `') as _f:
430430

431431
script := strings.Join([]string{
432432
// Use the initContainer to create this path to avoid the error noted here:
433-
// - https://github.com/kubernetes/kubernetes/issues/121294
434-
`mkdir -p /etc/pgadmin/conf.d`,
435-
// Write the system configuration into a read-only file.
436-
`(umask a-w && echo "$1" > ` + scriptMountPath + `/config_system.py` + `)`,
437-
// Write the server configuration into a read-only file.
438-
`(umask a-w && echo "$2" > ` + scriptMountPath + `/gunicorn_config.py` + `)`,
433+
// - https://issue.k8s.io/121294
434+
`mkdir -p ` + configMountPath,
435+
// Write the system and server configurations.
436+
`echo "$1" > ` + scriptMountPath + `/config_system.py`,
437+
`echo "$2" > ` + scriptMountPath + `/gunicorn_config.py`,
439438
}, "\n")
440439

441440
return append([]string{"bash", "-ceu", "--", script, "startup"}, args...)

internal/controller/standalone_pgadmin/pod_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ initContainers:
139139
- --
140140
- |-
141141
mkdir -p /etc/pgadmin/conf.d
142-
(umask a-w && echo "$1" > /etc/pgadmin/config_system.py)
143-
(umask a-w && echo "$2" > /etc/pgadmin/gunicorn_config.py)
142+
echo "$1" > /etc/pgadmin/config_system.py
143+
echo "$2" > /etc/pgadmin/gunicorn_config.py
144144
- startup
145145
- |
146146
import glob, json, re, os
@@ -328,8 +328,8 @@ initContainers:
328328
- --
329329
- |-
330330
mkdir -p /etc/pgadmin/conf.d
331-
(umask a-w && echo "$1" > /etc/pgadmin/config_system.py)
332-
(umask a-w && echo "$2" > /etc/pgadmin/gunicorn_config.py)
331+
echo "$1" > /etc/pgadmin/config_system.py
332+
echo "$2" > /etc/pgadmin/gunicorn_config.py
333333
- startup
334334
- |
335335
import glob, json, re, os

0 commit comments

Comments
 (0)