Skip to content

Instantly share code, notes, and snippets.

View diegows's full-sized avatar
🏡
Working from home!

Diego Woitasen diegows

🏡
Working from home!
View GitHub Profile

Keybase proof

I hereby claim:

  • I am diegows on github.
  • I am diegows (https://keybase.io/diegows) on keybase.
  • I have a public key ASBqPwzFYpkxlzwC40CZ4EyQEXb-MFNj6m0_4gYPSTP0Wgo

To claim this, I am signing this object:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/upstream-hash-by: "$arg_predictorid"
nginx.ingress.kubernetes.io/upstream-hash-by-subset: "true"
nginx.ingress.kubernetes.io/upstream-hash-by-subset-size: "3"
name: nginxhello-ingress
namespace: default
spec:
@diegows
diegows / lb_hash_subset.py
Created September 21, 2018 02:38
Hash load balance to a sub set of nodes
import collections
import random
from hash_ring import HashRing
from pprint import pprint
nodes = range(10)
nodes_dist = []
for i in range(len(nodes)):
# env | grep -i proxy
http_proxy=http://10.12.61.56:8080
ftp_proxy=http://10.12.61.56:8080
https_proxy=http://10.12.61.56:8080
diegows@diegows-laptop:/tmp$ bash -x test.sh ; echo $?
+ '[' -f /bin/false ']'
+ /bin/false
+ echo 1
1
0
diegows@diegows-laptop:/tmp$
varnish:
vhost:
example.com:
- backend1
- backend2
- backend3
example2.com:
- backend4
- backend5
- backend6
@diegows
diegows / gist:1c0acf87bfb10d488f3b
Created February 10, 2015 21:50
/etc/yum.repos.d/yourapp.repo
[yourapp]
name=yourapp
baseurl=file:///youapp_pkgs/
gpgcheck=0
enabled=1
heat_template_version: 2013-05-23
description: Test Template
parameters:
ImageID:
type: string
description: Image use to boot a server
NetID:
type: string
2014-12-15 11:00:05,235 [salt.loaded.int.module.saltutil][INFO ] Copying '/var/cache/salt/minion/files/base/_modules/openstack.py' to '/var/cache/salt/minion/extmods/modules/openstack.py'
2014-12-15 11:00:05,271 [salt.minion ][INFO ] Returning information for job: 20141215110003484516
2014-12-15 11:00:05,572 [salt.loader ][WARNING ] Failed to import module openstack, this is due most likely to a syntax error. Traceback raised:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 903, in load_modules
), fn_, path, desc
File "/var/cache/salt/minion/extmods/modules/openstack.py", line 3, in <module>
mine_get = __salt__['mine.get']
NameError: name '__salt__' is not defined
{% for region in [ "eu-west-1", "sa-east-1", "ap-northeast-1", "us-west-2", "ap-southeast-1" ] %}
locust-secgroup-{{ region }}:
boto_secgroup.present:
- name: locust
- description: locust
- rules:
- ip_protocol: tcp
to_port:
- 80