Kamailio-operator docs - Quick Start

This page serves to provide instructions on how to start using the kamailio-operator charm.

Quick Start

To test the deploy of the charm locally, use MicroK8s:

# Install/Setup MicroK8s    
     
$ sudo snap install --classic microk8s    
$ sudo usermod -aG microk8s $(whoami)    
$ sudo microk8s status --wait-ready    
$ sudo microk8s enable storage dns ingress    
$ sudo snap alias microk8s.kubectl kubectl    
$ newgrp microk8s    
     
# Install Charmcraft    
$ sudo snap install charmcraft    
     
# Install Juju 2.9+    
$ sudo snap install juju --classic    
     
# Bootstrap MicroK8s    
$ juju bootstrap microk8s micro    
$ juju add-model development    
     
# Build the charm and deploy    
$ git clone https://github.com/gmeszaros/charm-kamailio  
$ cd charm-kamailio
$ charmcraft pack    
$ juju deploy ./kamailio_ubuntu-20.04-amd64.charm  --resource kamailio-image=kamailio/kamailio:5.3.3-stretch
  
$ juju deploy nginx-ingress-integrator --config ingress-class="public"

# Relate kamailio and ingress integrator
$ juju add-relation kamailio nginx-ingress-integrator

# Add an entry to /etc/hosts
$ echo "127.0.1.1 kamailio.juju" | sudo tee -a /etc/hosts

# Wait for the deployment to complete
$ watch -n1 --color juju status --color

Debugging

Create a bash session to inspect the kamailio container with:

$ kubectl -n development exec -it -c kamailio kamailio-0 -- bash

Testing

# Install python3-virtualenv
$ sudo apt update && sudo apt install -y python3-virtualenv

# Create a virtualenv for the charm code
$ virtualenv venv

# Activate the venv
$ source ./venv/bin/activate

# Install dependencies
$ pip install -r requirements-dev.txt

# Run the tests
$ ./run_tests

Publishing and Releasing a new version

See Juju | Publishing and Juju | Resources for additional documentation. As a short summary:

$ charmcraft login
$ charmcraft pack
$ chamcraft upload

# be sure to also git commit/code review/push to the upstream  
# source so the changes are in version control