ansible / galaxy-operator

Galaxy-Operator
GNU General Public License v2.0
8 stars 14 forks source link

No such file or directory: '/var/lib/pulp/media' #84

Open Svenum opened 6 months ago

Svenum commented 6 months ago

Version quay.io/ansible/galaxy-operator:2024.02.29

Describe the bug Every Pod is up and running but the api Pod has this error:

pulp [8224b4f3c07c49fca48ed93072f5a8ef]: pulpcore.app.views.status:ERROR: Failed to determine disk usage
Traceback (most recent call last):
  File "/venv/lib64/python3.11/site-packages/pulpcore/app/views/status.py", line 23, in _disk_usage
    return shutil.disk_usage(default_storage.location)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/shutil.py", line 1344, in disk_usage
    st = os.statvfs(path)
         ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/pulp/media'

To Reproduce Create an galaxy instance with the operator.

Expected behavior The API Pod should run and work.

Additional context My config:

---
apiVersion: galaxy.ansible.com/v1beta1
kind: Galaxy
metadata:
  name: galaxy
  namespace: galaxy
spec:
  hostname: galaxy-kube.example.com
  ingress_type: ingress
  storage_type: File
  file_storage_access_mode: ReadWriteOnce
  file_storage_size: 8Gi
  no_log: false
  api:
    replicas: 2
  content:
    replicas: 2
  web:
    replicas: 2
  worker:
    replicas: 2
  postgres_configuration_secret: galaxy-postgres-configuration
kurokobo commented 6 months ago

/var/lib/pulp/media is created in PV by init container for api pod: https://github.com/ansible/galaxy-operator/blob/10fbb425a4877d9a0e3b0c91f03b0dabf622a64b/roles/galaxy-api/templates/galaxy-api.deployment.yaml.j2#L254

Ensure your PVC galaxyt-file-storage (created by Operator) is writable by UID: 1000.

Svenum commented 6 months ago

The pvc has the user 0:700. (root:gid700) but the directory tmp and artifact are created by the api pod.

kurokobo commented 6 months ago

tmp and assets are backed by emptyDir:

https://github.com/ansible/galaxy-operator/blob/10fbb425a4877d9a0e3b0c91f03b0dabf622a64b/roles/galaxy-api/templates/galaxy-api.deployment.yaml.j2#L78-L81

https://github.com/ansible/galaxy-operator/blob/10fbb425a4877d9a0e3b0c91f03b0dabf622a64b/roles/galaxy-api/templates/galaxy-api.deployment.yaml.j2#L205-L208

So only media is on your PVC and has to be able to be written by 1000.

kurokobo commented 6 months ago

@rooftopcellist F.Y.I., perhaps mkdir for /var/lib/pulp/tmp in init container is not required.

kurokobo commented 6 months ago

@Svenum @rooftopcellist Uh-oh sorry ignore my comment above 😞

kurokobo commented 6 months ago

@Svenum I can't dive deeper this right away, but anyway, I had the same problem in the past, and I fixed it by making PVC writable by UID: 1000. In Pulp Operator, I had a user with UID 700, but in Galaxy Operator, I have UID 1000.

Svenum commented 6 months ago

Yes in the pod I have the user wirh the und 1000. But the problem is not solved if I make an chown on the folder. The pvc should have the right rights automatically

Svenum commented 6 months ago

The problem is, that I try to automate the installation of the Operator with ansible, and I dont want to do extra steps for the galaxy-operator.

grimlokason commented 2 months ago

Same issue here with default install by the operator, i had to manually create the folder /var/lib/pulp/media.