isoping: build with Docker
This will let us deploy a minimal image with isoping to GKE. After
some research I've been able to get the container size down to 6 MiB.
I've pushed this to a manually configured GKE cluster and confirmed
that it works, too.
Also include Kubernetes configs for a small cluster running on GKE.
Change-Id: Ib061e3c8a85126009f8c40b4e93e3e7f2d18aae1
diff --git a/docker/.gitignore b/docker/.gitignore
new file mode 100644
index 0000000..b24a90e
--- /dev/null
+++ b/docker/.gitignore
@@ -0,0 +1,2 @@
+# docker client binary
+docker
\ No newline at end of file
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..beda7a4
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,3 @@
+FROM isoping-base
+EXPOSE 4948/udp
+CMD ["-t", "64"]
\ No newline at end of file
diff --git a/docker/Dockerfile.build b/docker/Dockerfile.build
new file mode 100644
index 0000000..a16fec9
--- /dev/null
+++ b/docker/Dockerfile.build
@@ -0,0 +1,29 @@
+FROM debian:jessie-slim
+RUN apt-get update && apt-get install -y \
+ build-essential \
+ git \
+ gperf \
+ libc-ares-dev \
+ libcurl4-openssl-dev \
+ libltdl7 \
+ libssl-dev \
+ python-dev \
+ python-setuptools
+
+RUN easy_install dockerize
+
+RUN mkdir /home/platform
+ADD . /home/platform
+RUN mv /home/platform/docker/docker /bin/docker
+WORKDIR /home/platform
+
+RUN git reset --hard HEAD
+RUN git clean -fx
+
+WORKDIR /home/platform/libstacktrace
+RUN make
+RUN make install
+
+WORKDIR /home/platform/cmds
+RUN make
+RUN make install
diff --git a/docker/build.sh b/docker/build.sh
new file mode 100755
index 0000000..1585497
--- /dev/null
+++ b/docker/build.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cp "$(which docker)" docker
+tar -czh .. | docker build -f docker/Dockerfile.build -t gfiber-cmds-build -
+docker run --rm -i -t -v /var/run/docker.sock:/var/run/docker.sock \
+ gfiber-cmds-build dockerize -t isoping-base /bin/isoping
+docker build -t isoping .
+
+docker tag isoping gcr.io/gfiber-isoping/isoping
+gcloud docker -- push gcr.io/gfiber-isoping/isoping
diff --git a/docker/isoping-deploy.yaml b/docker/isoping-deploy.yaml
new file mode 100644
index 0000000..bce9857
--- /dev/null
+++ b/docker/isoping-deploy.yaml
@@ -0,0 +1,14 @@
+apiVersion: extensions/v1beta1
+kind: Deployment
+metadata:
+ name: isoping
+spec:
+ replicas: 5
+ template:
+ metadata:
+ labels:
+ app: isoping
+ spec:
+ containers:
+ - name: isoping
+ image: gcr.io/gfiber-isoping/isoping
diff --git a/docker/isoping-svc.yaml b/docker/isoping-svc.yaml
new file mode 100644
index 0000000..93cf196
--- /dev/null
+++ b/docker/isoping-svc.yaml
@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: isoping
+spec:
+ ports:
+ - port: 4948
+ protocol: UDP
+ targetPort: 4948
+ selector:
+ app: isoping
+ sessionAffinity: ClientIP
+ type: LoadBalancer