netbox-community / netbox-chart

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

StorageBackends not working with GoogleCloudStorage #394

Open pimvandenbroek opened 12 hours ago

pimvandenbroek commented 12 hours 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'
  GOOGLE_APPLICATION_CREDENTIALS: '/path/to/your/credentials.json'

Current Behavior & Steps to Reproduce

When uploading a file, you'll get:

There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'google.api_core.exceptions.Forbidden'>

403 POST https://storage.googleapis.com/upload/storage/v1/b/your-gcs-bucket-name/o?uploadType=multipart: {
  "error": {
    "code": 403,
    "message": "Access denied.",
    "errors": [
      {
        "message": "Access denied.",
        "domain": "global",
        "reason": "forbidden"
      }
    ]
  }
}
: ('Request failed with status code', 403, 'Expected one of', <HTTPStatus.OK: 200>)

Python version: 3.12.3
NetBox version: 4.1.4
Plugins: None installed
If further assistance is required, please post to the NetBox discussion forum on GitHub.

Expected Behavior

I expect that files were uploaded to GCS.

Multiple tests were done:

NetBox Logs

No response

D1StrX commented 12 hours ago

When using GS_CREDENTIALS: service_account.Credentials.from_service_account_file('/path/to/credentials.json') I see this error:

Server Error
There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'ValueError'>

This library only supports credentials from google-auth-library-python. See https://google-auth.readthedocs.io/en/latest/ for help on authentication with this library.

Python version: 3.12.3
NetBox version: 4.1.4
Plugins: None installed
LeoColomb commented 7 hours ago

Thanks for filing this issue, @pimvandenbroek.

  • Jumped into the netbox-pod, and did the same. This also worked fine
  • Created a django app, purely for uploading a file to gcloud storage. I had to add GOOGLE_APPLICATION_CREDENTIALS instead of GS_CREDENTIALS. After that file upload worked perfectly.

As far as I can understand from here, this is not related to the Helm chart per se, right? If so, I'd recommend opening a case to the related project, NetBox in that case, I guess.