Skip to content

Abuelodelanada/charm-dev-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Charm development utils

A repository to collect initiatives around making the life of a charm author easier.

cloud-init

In the cloud-init directory you will find the following cloud-init scripts to launch reusable VMs to everyday charm development:

  • charm-dev-juju-3.4.yaml
  • charm-dev-juju-3.3.yaml
  • charm-dev-juju-3.2.yaml
  • charm-dev-juju-3.1.yaml
  • charm-dev-juju-2.9.yaml
  • charm-dev-juju-latest-edge.yaml

These script will create a VM with:

How to launch a VM using cloud-init script

Let's say you need to launch a VM using Multipass that runs juju 3.4/stable with:

  • 4G RAM
  • 3 CPUs
  • 30G disk
  • and mounting your repos directory inside the ubuntu user home directory

you may run:

multipass launch --cloud-init charm-dev-juju-3.4.yaml \
--timeout 1200 \
--name charm-dev-juju-34 \
--memory 4G \
--cpus 3 \
--disk 30G \
--mount /home/jose/trabajos/canonical/repos:/home/ubuntu/repos

Once the VM is ready you will see:

Launched: charm-dev-juju-34
Mounted '/home/jose/trabajos/canonical/repos' into 'charm-dev-juju-34:/home/ubuntu/repos'

Now you can jump into the new VM:

multipass shell charm-dev-juju-34
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-92-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

 * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
   just raised the bar for easy, resilient and secure K8s cluster deployment.

   https://ubuntu.com/engage/secure-kubernetes-at-the-edge

Expanded Security Maintenance for Applications is not enabled.

8 updates can be applied immediately.
8 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


╭─ubuntu@charm-dev-juju-34 ~ [lxd:null]
╰─$ 

And voilà, you have a VM with all you need to start developing Charmed Operators!

zsh_themes

In the zsh_themes directory you will find a juju.zsh-theme that uses the juju plugin to show a prompt with juju information about controller and model.

prompt