Skip to content

Instantly share code, notes, and snippets.

View dfilppi's full-sized avatar

DeWayne Filppi dfilppi

View GitHub Profile
@dfilppi
dfilppi / kub3-post-outputs.yaml
Created February 3, 2016 00:35
Example of outputs from Kubernetes blueprint
outputs:
kubernetes_info:
description: Kuberenetes master info
value:
url: {concat: ["http://",{ get_attribute: [ master_ip, floating_ip_address ]},":",{ get_property: [ master, master_port ]}]}
subprocess.Popen(['sudo','nohup','docker','-d','-H','unix:///var/run/docker-bootstrap.sock','-p','/var/run/docker-bootstrap.pid','--iptables=false','--ip-masq=false','--bridge=none','--graph=/var/lib/docker-bootstrap'],stdout=open('/dev/null'),stderr=open('/tmp/docker-bootstrap.log','w'),stdin=open('/dev/null'))
@dfilppi
dfilppi / cfy-fabexample.py
Last active October 29, 2015 16:49
Example fabric call
sudo("set -m;docker -d -H unix:///var/run/docker-bootstrap.sock -p /var/run/docker-bootstrap.pid --iptables=false --ip-masq=false --bridge=none --graph=/var/lib/docker-bootstrap 2> /var/log/docker-bootstrap.log 1> /dev/null </dev/null &",shell=True)
nodecellar:
type: cloudify.kubernetes.Microservice
properties:
config_path: service.yaml
config_overrides:
- { concat: ["['spec']['containers'][0]['ports'][0]['hostIP']=","'",{ get_property: [ master, ip]},"'"] }
- { concat: ["['spec']['containers'][0]['env'][0]['value']=","'",{ get_input: host_ip},"'"] }
- { concat: ["['spec']['containers'][0]['env'][1]['value']=","'",{ get_property: [ mongod1, port]},"'"] }
relationships:
- type: cloudify.kubernetes.relationships.connected_to_master
nodecellar:
type: cloudify.kubernetes.Microservice
properties:
config:
apiVersion: v1
kind: Pod
metadata:
name: nodecellar
spec:
restartPolicy: Never
@dfilppi
dfilppi / workflows.py
Created September 25, 2015 21:18
sample-kub-workflow
@workflow
def kube_run(**kwargs):
setfabenv(kwargs)
optstr=buildopts(kwargs,{"dry_run":"dry-run"},{"port":"not _val_ == -1"},["dry_run"],['name','master'])
ctx.logger.info("Running: {}".format(optstr))
run("./kubectl -s http://localhost:8080 run "+" "+kwargs['name']+optstr)
@dfilppi
dfilppi / cfy-kub-bare-sample.yaml
Created August 22, 2015 00:05
cfy-kub-bare-sample
master:
type: cloudify.kubernetes.master
properties:
ip: 10.67.79.129
ssh_username: ubuntu
ssh_keyfilename: /home/ubuntu/dfilppi-kp.pem
minion:
type: cloudify.kubernetes.node
@dfilppi
dfilppi / gist:cf02a605ff38a8964aad
Created June 30, 2015 17:45
cfy-coordinator-dbhosts2
dbhosts=""
for key,val in ctx.instance.runtime_properties.iteritems():
if ( key.startswith("mongod_host_")):
dbhosts=dbhosts+val+","
if len(dbhosts)>0:
dbhosts=dbhosts.rstrip(',')
@dfilppi
dfilppi / gist:b4859ea82c7ecb0f908c
Created June 30, 2015 17:37
cfy-coordinator-dbhosts
rtkey="mongod_host_{}".format(ctx.target.instance.id)
try:
ctx.source.instance.runtime_properties[rtkey]=rtval
ctx.source.instance.update()
except rest_exceptions.CloudifyClientError as e:
if 'conflict' in str(e):
ctx.operation.retry(
message='Backends updated concurrently, retrying.',
retry_after=random.randint(1,3))
else:
@dfilppi
dfilppi / gist:93d79d268f312e5c1a23
Created June 30, 2015 17:17
cfy-coordinator-detail
joiner:
type: cloudify.nodes.Compute
properties:
install_agent: false
interfaces:
cloudify.interfaces.lifecycle:
configure:
implementation: scripts/mongo/install-pymongo.sh
executor: central_deployment_agent
start: