helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

[pgadmin4] Creating users from code

Open KarlisAG opened this issue 1 year ago • 3 comments

Describe the solution you'd like Create pgadmin4 users from the Helm chart with secrets with the main pod

Describe alternatives you've considered Create pgadmin4 users from the Helm chart with secrets with sidecar

Additional context I am wondering if it is possible to create users, aside from admin, without using UI, so they are pre-made? Currently we are facing issues when using multiple environments or when the chart is deleted then the users get lost. It would be nice if we could define them in Helm chart, similar to admin, where it just takes the password from existing secret and can prepare them. So it would be easy to replicate in multiple environments and so there is no need to make all users again manually in case of disaster recovery scenario.

Maybe others have faced similar issues and have some other workaround that they can share?

KarlisAG avatar Nov 24 '23 08:11 KarlisAG

Hi there! We are facing the same issue. I am trying to execute preconfigured users with cli (you can use the config_local.py to execute from python with the "os" library in the chart), example:

/usr/bin/python3 ./setup.py add-user [email protected] password

Traceback (most recent call last):
  File "/pgadmin4/./setup.py", line 24, in <module>
    import config
  File "/pgadmin4/config.py", line 32, in <module>
    from pgadmin.utils import env, IS_WIN, fs_short_path
  File "/pgadmin4/pgadmin/__init__.py", line 24, in <module>
    from flask import Flask, abort, request, current_app, session, url_for
ModuleNotFoundError: No module named 'flask'

I followed this guide and it should work. Should I open a dedicated issue? Is it a pgadmin application bug? Thanks

dcristobalhMad avatar Jan 26 '24 11:01 dcristobalhMad

This chart is using the official pgadmin4 docker image, these issue are related to that image and not based on the helm chart.

rowanruseler avatar Jan 29 '24 12:01 rowanruseler

This chart is using the official pgadmin4 docker image, these issue are related to that image and not based on the helm chart.

Thanks for your quick response :+1:

dcristobalhMad avatar Feb 03 '24 14:02 dcristobalhMad