The purpose of this charm is to operate a VNF via SSH. For this, the charm should know the hostname of the VNF (ip address), and the username. The charm will be in a blocked state until it has the hostname, username, and the credentials for SSH-ing to the VNF. Both hostname and username are set via config, with `ssh-hostname` and `ssh-username` respectively.
There are two ways of specifying the credentials: password, keys. (See next section)
## Usage
This charm works for both LXD and K8s. By default, it will work on LXD. To make it work in K8s, just change the following in the `metadata.yaml`
```yaml
series:
# - focal
# - bionic
# - xenial
-kubernetes
deployment:
mode:operator
```
### Prepare the environment:
- LXD:
```bash
sudo snap install juju --classic
juju bootstrap lxd
juju add-model test
```
- K8s:
```bash
sudo snap install juju --classic
sudo snap install microk8s --classic
sudo microk8s.status --wait-ready
sudo microk8s.enable storage dns
juju bootstrap microk8s
juju add-model test
```
### Deploying charm:
```bash
charmcraft build
juju deploy ./sshproxy.charm
```
### Configuring the charm:
First of all, set the username and hostname of the VNF:
```bash
juju config sshproxy ssh-hostname=<hostname>\
ssh-username=<username>
```
#### Mirrors
To workaround this [bug](https://bugs.launchpad.net/juju/+bug/1929399), use the following configurations of the charm to specify the urls of apt and security mirrors.
```bash
juju config sshproxy apt-mirror=<apt-mirror> \
security-apt-mirror=<security-apt-mirror>
```
### Credentials
There are two ways to set up the credentials for the charm to be able to SSH the VNF.