netbox-community / netbox-chart

A Helm chart for NetBox
https://netbox.readthedocs.io/
Apache License 2.0
261 stars 153 forks source link

Configuring StorageBackend causes error #393

Closed pimvandenbroek closed 3 weeks ago

pimvandenbroek commented 3 weeks ago

The Helm chart version

netbox-5.0.0-beta.132

Environment Versions

Kubernetes 1.29
GKE

Custom chart values

# Use Google Cloud Storage backend
storageBackend: storages.backends.gcloud.GoogleCloudStorage
# Provide the necessary configuration for GCS
storageConfig:
  GS_BUCKET_NAME: 'your-gcs-bucket-name'
  GS_PROJECT_ID: 'your-google-cloud-project-id'
  GS_CREDENTIALS_JSON: '/path/to/your/credentials.json'  

  # Optional settings for customizing GCS behavior
  GS_DEFAULT_ACL: 'publicRead'  # Set default access control, e.g., 'publicRead' or 'private'
  GS_FILE_OVERWRITE: False      # Set to False if you want to prevent overwriting files

plugins: ["django-storages"]

Current Behavior & Steps to Reproduce

We've added the values above, mounted the credentials json using a secret. The file is mounted properly and found. However, when booting the following error occurs:

django.core.exceptions.ImproperlyConfigured: Unable to import plugin django-storages: Module not found. Check that the plugin module has been installed within the correct Python environment.

There is no option to install python modules.

Expected Behavior

I would expect that when the values.yaml has an option for storageBackends, which references to django-storages, that the packages is either already installed, either there is an option to install it. Currently no custom python packages can be installed.

I think using the initContainer would be a great place to install these packages. Either by checking if storageBackend is set, and if so installing django-storages[google/aws/azure], or by adding an option to install custom python packages. We can offcourse build our own docker image and include the package, but that seems counterintuitive.

NetBox Logs

django.core.exceptions.ImproperlyConfigured: Unable to import plugin django-storages: Module not found. Check that the plugin module has been installed within the correct Python environment.
[ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
⏳ Waiting on DB... (0s / 30s)
django.core.exceptions.ImproperlyConfigured: Unable to import plugin django-storages: Module not found. Check that the plugin module has been installed within the correct Python environment.
LeoColomb commented 3 weeks ago

Thanks for filing this issue, @pimvandenbroek. I'm going to close it as a duplicate of #173. The use case is very relevant, though, and it will probably help to consider correctly the referenced issue.