Skip to content

Instantly share code, notes, and snippets.

@bcwaldon
bcwaldon / gist:42ec473c093311c4bf15
Created April 30, 2015 01:53
TCP proxy testing
package main
import (
"fmt"
"io"
"net"
"os"
"strings"
"sync"
)
@bcwaldon
bcwaldon / user-data
Created February 18, 2015 20:39
kubernetes cloud-config
#cloud-config
coreos:
etcd:
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
public-ip: $private_ipv4
@bcwaldon
bcwaldon / gist:0ff9ecc53a09220fc988
Last active August 29, 2015 14:14
fleet.socket ListenStream drop-in
#cloud-config
coreos:
units:
- name: fleet.socket
command: start
drop-ins:
- name: 30-ListenStream.conf
content: |
[Socket]
ListenStream=127.0.0.1:49153
$ ; start up the discovery service
$ etcd -name discovery -addr 127.0.0.1:4000 -peer-addr 127.0.0.1:7000
...
$ ; choose the discovery token
$ export UUID=$(uuidgen)
$ echo $UUID
40134540-b53c-46b3-b34f-33b4f0ae3a9c
$ ; start three nodes
#cloud-config
coreos:
etcd:
discovery: https://discovery.etcd.io/6e1e0ce9fd5ff0fdbf74aa120b0df6a7
core@core-01 ~/fleet $ etcdctl set /foo bar
bar
core@core-01 ~/fleet $ etcdctl get /foo
bar
core@core-01 ~/fleet $ etcdctl get /Foo
Error: 100: Key not found (/Foo) [10403]
core@core-01 ~/fleet $ etcdctl get /FOO
Error: 100: Key not found (/FOO) [10404]
$ systemctl cat hello.service
# /etc/systemd/system/hello.service
[Service]
EnvironmentFile=/etc/environment
ExecStart=/usr/bin/etcdctl set /ez/server/test.example.com/%m "{\"host\": \"test.example.com\", \"ip\": \"${COREOS_PUBLIC_IPV4}\"}"
$ systemctl start hello.service
$ etcdctl get /ez/server/test.example.com/671a23809cf840f2b9c78f90ac2d4f55
{"host": "test.example.com", "ip": "172.17.8.101"}
#cloud-config
coreos:
units:
- name: oneoff-thing.service
command: start
content: |
[Service]
Type=oneshot
ExecStart=/bin/bash echo foo
ExecStart=/bin/bash echo bar