Skip to content

Instantly share code, notes, and snippets.

View celebdor's full-sized avatar

Antoni Segura Puimedon celebdor

View GitHub Profile
from kombu import Connection, Exchange, Queue
from kombu.mixins import ConsumerMixin
rabbit_url = "amqp://stackrabbit:pass@10.16.144.168:5672/"
class Worker(ConsumerMixin):
def __init__(self, connection, queues):
self.connection = connection
self.queues = queues
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
app: redis
tier: backend
role: master
spec:
ports:
@celebdor
celebdor / bm_precreate_kuryr_pool.py
Created September 28, 2017 08:00
Creates N ports for each of the hypervisors in the deployment for later usage of Kuryr-Kubernetes baremetal vif pool
#!/usr/bin/env python
import sys
import os_client_config
from pprint import pprint
neutron = os_client_config.make_client('network', cloud='envvars')
nova = os_client_config.make_client('compute', cloud='envvars')
@celebdor
celebdor / clean_downed_subports.py
Created September 22, 2017 13:23
Cleans Kuryr's downed subports by detaching them from the trunks and removing them
#!/usr/bin/env python
# coding: utf-8
from collections import defaultdict
import os_client_config
neutron = os_client_config.make_client('network', cloud='envvars')
ports = neutron.list_ports(device_owner='compute:kuryr')['ports']
@celebdor
celebdor / port_bulk_create.py
Created September 19, 2017 14:42
Creates N ports in Network X in a single op (with compute:kuryr) as device owner
#!/usr/bin/env python
# coding: utf-8
import os_client_config
import sys
network_id = sys.argv[1]
port_amount = int(sys.argv[2])
neutron = os_client_config.make_client('network', cloud='envvars')
ports = [{'device_owner': 'compute:kuryr', 'name': 'bulkport-%i' % i, 'network_id': network_id} for i in range(port_amount)]
@celebdor
celebdor / splitter.py
Created September 19, 2017 11:39
Binds kuryr owned DOWN ports to the available trunk ports
import itertools
import sys
import os
import os_client_config
neutron = os_client_config.make_client('network', cloud='envvars')
trunks = neutron.list_trunks()['trunks']
#!/usr/bin/env python
# coding: utf-8
import datetime
import sys
from kubernetes import client, config
config.load_kube_config()
v1 = client.CoreV1Api()
try:
#!/usr/bin/env python
# coding: utf-8
from kubernetes import client, config
config.load_kube_config()
v1 = client.CoreV1Api()
ret = v1.list_namespaced_pod(namespace='default')
print '"Pod name","Pod creation","Pod running"'
@celebdor
celebdor / sharing.pub
Created August 4, 2017 13:40
SSH pubkey for sharing
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSqWRhDRsl/sUddHiXEEfIEpqkB4Wy9llnzT84f/3KWPqP8UdTC9KPWqVN4uP6h0/BVPVGKsZx1aPkBywrDMbBHwZhGx0QCVcKm14oL8ACC6ctcExIux68Hvjd0YnTmYqK81fI0mCjul2aAqVk5nbWO/tqEBro/xh8BiMSmLsgfPYTmlF5YSH2Mtb+EmvS222A1QNA2FYpIQpNAVYjwxwWX5b9Z3j7CwtXB9O4XWJcSojWFW9c925wxiva4oppH8j4N+I7X4/pItRkHjA8u/VNcFiMc8BrLEcDGM8Jltr7s+4pRP7sZd76lU0hm3/pPVwI7ny7mK9Eh42vvwSQILDZ celebdor@s21
[[local|localrc]]
RECLONE=no
LOGFILE=~/stack.sh.log
LOG_COLOR=False
ENABLED_SERVICES=""
# Credentials
DATABASE_PASSWORD=pass