Skip to content

Instantly share code, notes, and snippets.

@mikebryant
Last active July 17, 2018 20:35

Revisions

  1. mikebryant revised this gist Feb 23, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion weave-net-rmpeers.yaml
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ spec:
    spec:
    containers:
    - name: rmpeers
    image: hub.docker.tech.lastmile.com/mikebryant/rmpeers:v5
    image: hub.docker.tech.lastmile.com/mikebryant/rmpeers:v6
    resources:
    requests:
    cpu: "0.01"
  2. mikebryant revised this gist Feb 23, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rmpeers
    Original file line number Diff line number Diff line change
    @@ -5,8 +5,8 @@ set -u
    set -x

    while true; do
    kubectl get node -o custom-columns=name:.metadata.name --no-headers > /tmp/node-names
    curl -H "Accept: application/json" http://localhost:6784/report | jq -r .IPAM.Entries[].Nickname > /tmp/nicknames
    kubectl get node -o custom-columns=name:.metadata.name --no-headers > /tmp/node-names
    grep -v -f /tmp/node-names /tmp/nicknames | xargs -n 1 -I '{}' curl -H "Accept: application/json" -X DELETE 'http://localhost:6784/peer/{}'
    sleep 60
    done
  3. mikebryant created this gist Feb 23, 2017.
    9 changes: 9 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    FROM mirror-hub.docker.tech.lastmile.com/alpine:3.5

    RUN apk add --no-cache curl jq

    RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.5.3/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl

    COPY rmpeers /

    CMD ["/rmpeers"]
    12 changes: 12 additions & 0 deletions rmpeers
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/sh

    set -e
    set -u
    set -x

    while true; do
    kubectl get node -o custom-columns=name:.metadata.name --no-headers > /tmp/node-names
    curl -H "Accept: application/json" http://localhost:6784/report | jq -r .IPAM.Entries[].Nickname > /tmp/nicknames
    grep -v -f /tmp/node-names /tmp/nicknames | xargs -n 1 -I '{}' curl -H "Accept: application/json" -X DELETE 'http://localhost:6784/peer/{}'
    sleep 60
    done
    47 changes: 47 additions & 0 deletions weave-net-rmpeers.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
    name: weave-net-rmpeers
    namespace: kube-system
    spec:
    replicas: 1
    strategy:
    rollingUpdate:
    maxSurge: 0
    maxUnavailable: 1
    template:
    metadata:
    labels:
    app: weave-net-rmpeers
    spec:
    containers:
    - name: rmpeers
    image: hub.docker.tech.lastmile.com/mikebryant/rmpeers:v5
    resources:
    requests:
    cpu: "0.01"
    memory: "20Mi"
    limits:
    cpu: "0.1"
    memory: "20Mi"
    volumeMounts:
    - name: fence
    mountPath: /unused
    hostNetwork: true
    volumes:
    - name: fence
    persistentVolumeClaim:
    claimName: weave-net-rmpeers-fence
    ---
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
    name: weave-net-rmpeers-fence
    namespace: kube-system
    spec:
    accessModes:
    - ReadWriteOnce
    resources:
    requests:
    storage: 10Gi