Joxit / helm-charts

Official Helm Chart Repository for Joxit Applications
https://helm.joxit.dev/
MIT License
12 stars 7 forks source link

Add PVC initialization job to resolve permission issues #17

Open chris2k20 opened 4 months ago

chris2k20 commented 4 months ago

Description:

Currently, the registry deployment encounters "permission denied" errors when accessing the Persistent Volume Claim (PVC). To resolve this, we need to add a initialization job to the Helm chart that sets the correct permissions on the PVC before the main registry container starts.

Proposed solution: Add a Kubernetes Job to the Helm chart that runs before the main deployment and sets the correct permissions on the PVC or init container.

Example Job (to be adapted for Helm):

apiVersion: batch/v1
kind: Job
metadata:
  name: registry-pvc-init
spec:
  template:
    spec:
      restartPolicy: OnFailure
      initContainers:
      - name: init-pvc
        image: busybox
        command:
        - /bin/sh
        - -c
        - |
          mkdir -p /mnt/registry/docker
          chown 101:101 /mnt/registry/docker
        volumeMounts:
        - name: registry-storage
          mountPath: /mnt/registry
      containers:
      - name: dummy
        image: busybox
        command: ["sh", "-c", "echo 'Job completed' && sleep 5"]
      volumes:
      - name: registry-storage
        persistentVolumeClaim:
          claimName: registry-docker-registry-ui

Thx for your work!!!