Skip to content

Instantly share code, notes, and snippets.

View marcoceppi's full-sized avatar
.

Marco Ceppi marcoceppi

.
View GitHub Profile
params = {
'kubeconfig': kubeconfig,
'server': server,
'certificate-authority': ca,
'enbed-tls': 'false',
}
cmd = ['kubectl', 'config', 'set-cluster'] + ['{}={}'.format(k, v) for k, v in params.items()]
@marcoceppi
marcoceppi / k8s.yaml
Last active September 21, 2016 10:34
series: xenial
services:
"kubernetes-master":
charm: "cs:~lazypower/kubernetes-master-3"
num_units: 1
annotations:
"gui-x": "288"
"gui-y": "432"
etcd:
charm: "cs:~lazypower/etcd-23"
series: trusty
services:
"oai-hss":
charm: "cs:~marcoceppi/trusty/oai-hss-0"
num_units: 1
annotations:
"gui-x": "1457.9127197265625"
"gui-y": "416.4136657714844"
to:
- "kvm:1"
#!/usr/bin/env python3
import sys
sys.path.append('lib')
from charms.reactive import main
from charms.reactive import set_state
from charmhelpers.core.hookenv import action_fail
"""
`set_state` only works here because it's flushed to disk inside the `main()`
requires:
- 'interface:juju-info'
machines=$(juju status --format json | python -c "import sys; import json; f = json.loads(sys.stdin.read()); print('\n'.join(f.get('machines', {}).keys()))")
for MACHINE_ID in $machines; do
echo "Machine $MACHINE_ID"
juju run --machine=$MACHINE_ID 'sudo initctl list | grep juju | xargs sudo status'
done

Assumptions: the charm name is fluentd

Submitting a layered charm

Register an account on launchpad, if you don't already have one. You'll need the name later in the process.

  1. Create a launchpad branch of the deployable charm
[~/charms/layers/fluentd] $ charm build
@when('leadership.is_leader')
def add_leader_config():
render_master_config()
@when_not('leadership.is_leader')
def add_slave_config():
render_slave_config()
@when('leadership.is_leader')
@marcoceppi
marcoceppi / blog.md
Last active March 1, 2016 19:59
you knows it

The Juju core team have been diligently ramping up to Juju 2.0. As a result they have been steadily releasing new alphas and betas of juju for testing and feedback. However, for some that's not quite fast enough! If you're looking to try out, or contribute to juju, odds are you're going to want to compile from source. This article aims to cover how to do this and manage all the versions of juju you have floating around your system - compiled versions of juju, stable version of juju, and the released development versions.

GO LANG, Go!

Install golang on your favorite (Ubuntu)* operating system

sudo apt-get install golang-go git-core mercurial bzr