added initcontainer

This commit is contained in:
2026-01-07 19:13:13 +01:00
parent 85a95bdff6
commit 246a6b383a
+27 -7
View File
@@ -92,6 +92,29 @@ spec:
app.kubernetes.io/name: romm app.kubernetes.io/name: romm
app.kubernetes.io/version: "4.5.0" app.kubernetes.io/version: "4.5.0"
spec: spec:
securityContext:
fsGroup: 1000
initContainers:
- name: init-config
image: busybox:1.36
command:
- sh
- -c
- |
# Copy the template to the PVC only if it doesn't exist
if [ ! -f /romm/config/config.yml ]; then
echo "Creating initial config.yml from template..."
cp /tmp/template/config.yml /romm/config/config.yml
# Ensure the ROMM user (1000) owns the file
chown 1000:1000 /romm/config/config.yml
else
echo "config.yml already exists, skipping copy."
fi
volumeMounts:
- name: config-template
mountPath: /tmp/template
- name: config-storage
mountPath: /romm/config
containers: containers:
- name: romm - name: romm
image: rommapp/romm:4.5.0 image: rommapp/romm:4.5.0
@@ -189,11 +212,8 @@ spec:
mountPath: /romm/library mountPath: /romm/library
- name: resources - name: resources
mountPath: /romm/resources mountPath: /romm/resources
- name: config - name: config-storage
mountPath: /romm/config mountPath: /romm/config
- name: config-file
mountPath: /romm/config/config.yml
subPath: config.yml
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /api/heartbeat path: /api/heartbeat
@@ -214,12 +234,12 @@ spec:
- name: resources - name: resources
persistentVolumeClaim: persistentVolumeClaim:
claimName: romm-resources claimName: romm-resources
- name: config - name: config-storage
persistentVolumeClaim: persistentVolumeClaim:
claimName: romm-config claimName: romm-config
- name: config-file - name: config-template
configMap: configMap:
name: romm-config-file name: romm-config-template
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service