Skip to content

Instantly share code, notes, and snippets.

@wkharold
wkharold / flanneld.out
Created February 3, 2015 17:52
journalctl -r -u flanneld.service
[minion@te-skytwnb426u5-0-7dvpfxiklxdf-kube-node-rwrmywrdzraa ~]$ sudo journalctl -r -u flanneld.service
-- Logs begin at Wed 2014-12-31 22:11:51 UTC, end at Tue 2015-02-03 17:50:28 UTC. --
Feb 03 17:31:02 te-skytwnb426u5-0-7dvpfxiklxdf-kube-node-rwrmywrdzraa.novalocal flanneld[931]: I0203 17:31:02.146924 931 udp.go:264] Subnet added: 10.100.19.0/24
Feb 03 17:31:01 te-skytwnb426u5-0-7dvpfxiklxdf-kube-node-rwrmywrdzraa.novalocal flanneld[931]: I0203 17:31:01.087847 931 udp.go:264] Subnet added: 10.100.66.0/24
Feb 03 17:31:01 te-skytwnb426u5-0-7dvpfxiklxdf-kube-node-rwrmywrdzraa.novalocal flanneld[931]: I0203 17:31:01.040972 931 udp.go:239] Watching for new subnet leases
Feb 03 17:31:01 te-skytwnb426u5-0-7dvpfxiklxdf-kube-node-rwrmywrdzraa.novalocal flanneld[931]: I0203 17:31:01.040934 931 main.go:201] UDP mode initialized
Feb 03 17:31:01 te-skytwnb426u5-0-7dvpfxiklxdf-kube-node-rwrmywrdzraa.novalocal flanneld[931]: I0203 17:31:00.999636 931 subnet.go:80] Subnet lease acquired: 10.100.1.0/24
@wkharold
wkharold / cloud-config.yaml
Created January 26, 2015 21:16
crate node cloud-config.yaml for CoreOS Easy Deployment/Testing Cluster
#cloud-config
coreos:
fleet:
etcd_servers: ETCD_IP_ADDR
metadata: role=db
units:
- name: fleet.service
command: start
- name: docker.service
@wkharold
wkharold / crate@.service
Created January 26, 2015 21:13
unit file for crate deployment in CoreOS Easy Development/Testing Cluster deployment
[Unit]
Description=crate
After=docker.service
Requires=docker.service
[Service]
TimeoutSec=3600
ExecStartPre=/bin/bash -c "/usr/bin/docker rm %p || exit 0"
ExecStartPre=/usr/bin/mkdir -p /mnt/data1/crate
ExecStartPre=/usr/bin/docker pull crate:latest
@wkharold
wkharold / etcdcmds.txt
Created December 16, 2014 20:50
Issue getting etcdctl to talk to non-local etcd
core@db01 ~ $ ping 10.240.169.79
PING 10.240.169.79 (10.240.169.79) 56(84) bytes of data.
64 bytes from 10.240.169.79: icmp_seq=1 ttl=64 time=0.849 ms
64 bytes from 10.240.169.79: icmp_seq=2 ttl=64 time=0.404 ms
^C
--- 10.240.169.79 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.404/0.626/0.849/0.223 ms
core@db01 ~ $ export ETCDCTL_PEERS="http://10.240.169.79:4001"
core@db01 ~ $ etcdctl --debug set /tmp/foo "bar"
/*** job.go ***/
// run executes the command associated with a job according to its schedule and
// records the results until it is told to stop.
func (j *job) run() {
j.history.Value = fmt.Sprintf("%s:started\n", time.Now().String())
j.history = j.history.Next()
for {
now := time.Now()
e, err := cronexpr.Parse(j.defn.schedule)
if err != nil {
/*** job.go ***/
// Read handles read operations on a jobfile using its associated reader.
func (jf jobfile) Read(fid *srv.FFid, buf []byte, offset uint64) (int, error) {
glog.V(4).Infof("Entering jobfile.Read(%v, %v, %)", fid, buf, offset)
defer glog.V(4).Infof("Exiting jobfile.Read(%v, %v, %v)", fid, buf, offset)
cont := jf.reader()
if offset > uint64(len(cont)) {
return 0, nil
/*** job.go ***/
type jobdef struct {
name string
schedule string
cmd string
state string
}
type jobreader func() []byte
type jobwriter func([]byte) (int, error)
/*** clone.go ***/
type clonefile struct {
srv.File
}
// Write handles writes to the clone file by attempting to parse the data being
// written into a job definition and if successful adding the corresponding job
// to the jobs directory.
func (k *clonefile) Write(fid *srv.FFid, data []byte, offset uint64) (int, error) {
glog.V(4).Infof("Entering clonefile.Write(%v, %v, %v)", fid, data, offset)
func main() {
// argument handling and initialization
root, err := mkjobfs()
if err != nil {
os.Exit(1)
}
// job database management
@wkharold
wkharold / gist:9861636
Last active August 29, 2015 13:57
mkjobfs
/*** jobd.go ***/
// mkjobfs creates the static portion of the jobd file hierarchy: the 'clone'
// file, and the 'jobs' directory at the root of the hierarchy.
func mkjobfs() (*srv.File, error) {
var err error
user := p.OsUsers.Uid2User(os.Geteuid())
root := new(srv.File)