OpenLDAP

  • By openldap-charmers
Channel Revision Published Runs on
latest/stable 7 08 Apr 2021
Ubuntu 20.04
juju deploy openldap-charmers-openldap
Show information

Platform:

For any problems with this charm, please report bugs here.

The code for this charm can be downloaded as follows:

git clone https://git.launchpad.net/charm-k8s-openldap

Docker images for this charm are built via a Launchpad OCI Recipe, and published on dockerhub under the openldapcharmers namespace, tagged with the version of OpenLDAP that they were built with.

To run tests, simply run make test from within the charm code directory.

Local Deployment

Notes for deploying a test setup locally using microk8s:

sudo snap install juju --classic
sudo snap install juju-wait --classic
sudo snap install microk8s --classic
sudo snap alias microk8s.kubectl kubectl
sudo snap install charmcraft
git clone https://git.launchpad.net/charm-k8s-openldap
make -C charm-k8s-openldap openldap.charm

microk8s.reset  # Warning! Clean slate!
microk8s.enable dns dashboard registry storage
microk8s.status --wait-ready
microk8s.config | juju add-k8s myk8s --client

# Build your OpenLDAP image (optional)
make image-build
docker tag openldap:focal-latest localhost:32000/openldap:focal-latest
docker push localhost:32000/openldap:focal-latest

juju bootstrap myk8s
juju add-model openldap-test
# Deploy with a local image
juju deploy ./charm-k8s-openldap/openldap.charm --resource openldap-image=localhost:32000/openldap:focal-latest 
# Or deploy with the image on dockerhub
juju deploy ./charm-k8s-openldap/openldap.charm --resource openldap-image=openldapcharmers/openldap:2.4.50 
juju wait
juju status

The charm will not function without a database, so you will need to deploy cs:postgresql somewhere.

If postgresql is deployed in the same model you plan to use for openldap, simply use juju relate openldap postgresql:db . (This deployment style is recommended for testing purposes only.)

Cross-model relations are also supported. Create a suitable model on a different cloud, for example, LXD or OpenStack.

juju switch database
juju deploy cs:postgresql
juju offer postgresql:db

In most k8s deployments, traffic to external services from worker pods will be SNATed by some part of the infrastructure. You will need to know what the source addresses or address range is for the next step.

juju switch openldap-test
juju find-offers  # note down offer URL; example used below:
juju relate openldap admin/database.postgresql --via 10.9.8.0/24

(In the case of postgresql, --via is needed so that the charm can configure pga_hba.conf to let the k8s pods connect to the database.)