Question
Can I use udm cli on openDesk / nubus environments
Answer
Yes, you can setup udm locally and access it inside the cluster.
First of all, make sure your client has python3-venv, python3, python3-pip, jq installed depending on your operating systems preferred way.
Afterwards setup the venv for the udm client:
python3 -m venv ~/udm_venv
source ~/udm_venv/bin/activate
pip3 install python-ldap
pip3 install udm-rest-api-client
To use the udm-cli for different environments, you first of all need to setup a port-forward for the corresponding service:
kubectl -n ${NAMESPACE?} port-forward services/ums-udm-rest-api 9979:9979
Then you can simply open the virtual environment and setup an alias as follows:
source ~/udm_venv/bin/activate
alias udm='udm --username Administrator --bindpwd $(kubectl -n ${NAMESPACE?} get secret ums-nubus-credentials -o json | jq '.data.administrator_password' -r | base64 -d) --uri http://127.0.0.1:9979/udm/'
Now the udm cli should be operational for the Nubus Cluster:
$ udm users/user list --filter uid=Administrator
DN: uid=Administrator,cn=users,dc=swp-ldap,dc=internal
URL: http://127.0.0.1:9979/udm/users/user/uid%3DAdministrator%2Ccn%3Dusers%2Cdc%3Dswp-ldap%2Cdc%3Dinternal
Object-Type: users/user
Additional:
If you get the following traceback while install python-ldap on Ubuntu Clients, you have to install missing packages.
building '_ldap' extension
creating build/temp.linux-x86_64-cpython-310/Modules
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=3.4.5 "-DLDAPMODULE_AUTHOR=python-ldap project" "-DLDAPMODULE_LICENSE=Python style" -IModules -I/home/merdemiroglu/udm_venv/include -I/usr/include/python3.10 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-cpython-310/Modules/LDAPObject.o
In file included from Modules/LDAPObject.c:3:
Modules/common.h:15:10: fatal error: lber.h: No such file or directory
15 | #include <lber.h>
| ^~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for python-ldap
Failed to build python-ldap
ERROR: Could not build wheels for python-ldap, which is required to install pyproject.toml-based projects
To fix the failure, install the packages:
sudo apt install python-ldapsudo apt install python3-ldap
And try again:
source ~/udm_venv/bin/activatepip3 install python-ldappip3 install udm-rest-api-client