Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
sudo snap install yq
tmpfile=$(mktemp /tmp/action-out.XXXXXX)
tmpfile_ca=$(mktemp /tmp/ca.XXXXXX)
juju run openidc-server/0 get-test-client-data --format json > $tmpfile
URL=$(cat $tmpfile | yq '.openidc-server/0.results.url')
CERT=$(cat $tmpfile | yq '.openidc-server/0.results.ca')
CLIENT=$(cat $tmpfile | yq '.openidc-server/0.results.client')
CLIENT_SECRET=$(cat $tmpfile | yq '.openidc-server/0.results.client-secret')
USER=$(cat $tmpfile | yq '.openidc-server/0.results.user')

Single node networking

This reference explains how network access to guests is achieved when deploying microstack using local access to the guests (normal for a single node deployment).

If the defaults are chosen sunbeam will have setup an external subnet within OpenStack which will be used to allocate floating IPs.

$ openstack subnet show -c allocation_pools -c cidr external-subnet
+------------------+-------------------------+
| Field | Value |

Do and don'ts

  • Any event that relates to the setup of the unit or application invoke the configure_charm method
  • Unit setup should be in configure_unit
  • Application setup should be in configure_application
  • Do not defer events (unless you really have to)
  • When writing a relation handle keep in mind the the handler may be used by other charms to avoid calling back to specific charm methods in the body of the handler. Instead have the charm pass eveything when the handler is initialaised. This is not always possible.

Dev tips

Debugging microstack

microstack brings together a number of seperate technologies. This guide attempts to show where to start looking.

Microk8s

Microk8s has its own debugging guide which is more in depth. Below are some commands which are oftern useful.

Check that microk8s is up and happy

Key Value
Summary Install and run OpenStack on Linux in minutes, using the next generation of MicroStack.
Categories cloud
Difficulty 3
Authors Tytus Kurek tytus.kurek@canonical.com , Liam Young liam.young@canonical.com

Overview

Duration: 1:00

machines:
'0':
series: bionic
'1':
series: bionic
'2':
series: bionic
relations:
- - placement:shared-db
- mysql:shared-db

Bug 1882113

This assumes that the masakari charms smoke test was run using the openstack provider.

Check that all the segments are online (you may have to install python-masakariclient into your client venv):

` $ openstack segment host list 08b44816-01ce-4470-a047-98114f906a84
+--------------------------------------+------------------------------------------------------+---------+--------------------+----------+----------------+--------------------------------------+
| uuid | name | type | control_attributes | reserved | on_maintenance | failover_segment_id |

@gnuoy
gnuoy / requesting-osd-settings.txt
Created March 25, 2020 14:25
Requesting OSD settings
A ceph client may require that ceph is configured with particular settings. In
the case of the ceph iscsi gateway the osd timeout value needs to be lowered
for detecting down OSDs to reduce the possibility of initiator timeouts. To
facilitate this the existing ceph-client and osd relations could be extended
to pass on the request from a client.
1) The client charm sets a new 'osd-settings' option. The value is a json
encoded dictionary of settings e.g.
{"osd-settings": {"osd heartbeat grace": 20, "osd heartbeat interval": 5}}
source ~/clientsrc
. ~/novarc_auto
unset OS_DOMAIN_NAME
image_name="trusty"
image_name="bionic"
prefix="_$(date +'%d%m%y%H%M%S')"
vol_name="bootvol${prefix}"
server_name="server${prefix}"
#!/usr/bin/env python
import requests_oauthlib
url = 'http://10.0.0.205/MAAS'
mac_url = '{}/api/2.0/machines/?format=json'.format(url)
api_key = 'YOUR MAAS API KEY'
_keys = api_key.split(':')
consumer_key = _keys[0]
access_token = _keys[1]