Browse Source

e2e/docker-dns-srv: initial commit

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
Gyu-Ho Lee 8 years ago
parent
commit
85bbd0cead

+ 18 - 0
e2e/docker-dns-srv/Dockerfile

@@ -0,0 +1,18 @@
+FROM golang:1.9-stretch
+LABEL Description="Image for etcd DNS SRV testing"
+
+RUN apt update -y \
+  && apt install -y \
+  bind9 \
+  dnsutils
+
+RUN mkdir /var/bind
+RUN chown bind /var/bind
+ADD Procfile /Procfile
+ADD run.sh /run.sh
+
+ADD etcd.zone named.conf /etc/bind/
+ADD resolv.conf /etc/resolv.conf
+
+RUN go get github.com/mattn/goreman
+CMD ["/run.sh"]

+ 5 - 0
e2e/docker-dns-srv/Procfile

@@ -0,0 +1,5 @@
+etcd1: ./etcd --name m1 --listen-client-urls http://127.0.0.1:2379 --advertise-client-urls http://m1.etcd-srv.local:2379 --listen-peer-urls http://127.0.0.1:2380 --initial-advertise-peer-urls=http://m1.etcd-srv.local:2380 --initial-cluster-token tkn --discovery-srv=etcd-srv.local --initial-cluster-state new
+
+etcd2: ./etcd --name m2 --listen-client-urls http://127.0.0.1:22379 --advertise-client-urls http://m2.etcd-srv.local:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls=http://m2.etcd-srv.local:22380 --initial-cluster-token tkn --discovery-srv=etcd-srv.local --initial-cluster-state new
+
+etcd3: ./etcd --name m3 --listen-client-urls http://127.0.0.1:32379 --advertise-client-urls http://m3.etcd-srv.local:32379 --listen-peer-urls http://127.0.0.1:32380 --initial-advertise-peer-urls=http://m3.etcd-srv.local:32380 --initial-cluster-token tkn --discovery-srv=etcd-srv.local --initial-cluster-state new

+ 22 - 0
e2e/docker-dns-srv/etcd.zone

@@ -0,0 +1,22 @@
+etcd-srv.local.	IN	SOA	bindhostname. admin.etcd-srv.local. (
+1452607488
+10800
+3600
+604800
+38400 )
+etcd-srv.local.	IN	NS	bindhostname.
+m1.etcd-srv.local.	300	IN	A	127.0.0.1
+m2.etcd-srv.local.	300	IN	A	127.0.0.1
+m3.etcd-srv.local.	300	IN	A	127.0.0.1
+_etcd-client._tcp	300	IN	SRV	0 0 2379 m1.etcd-srv.local.
+_etcd-client._tcp	300	IN	SRV	0 0 22379 m2.etcd-srv.local.
+_etcd-client._tcp	300	IN	SRV	0 0 32379 m3.etcd-srv.local.
+_etcd-client-ssl._tcp	300	IN	SRV	0 0 2379 m1.etcd-srv.local.
+_etcd-client-ssl._tcp	300	IN	SRV	0 0 22379 m2.etcd-srv.local.
+_etcd-client-ssl._tcp	300	IN	SRV	0 0 32379 m3.etcd-srv.local.
+_etcd-server._tcp	300	IN	SRV	0 0 2380 m1.etcd-srv.local.
+_etcd-server._tcp	300	IN	SRV	0 0 22380 m2.etcd-srv.local.
+_etcd-server._tcp	300	IN	SRV	0 0 32380 m3.etcd-srv.local.
+_etcd-server-ssl._tcp	300	IN	SRV	0 0 2380 m1.etcd-srv.local.
+_etcd-server-ssl._tcp	300	IN	SRV	0 0 22380 m2.etcd-srv.local.
+_etcd-server-ssl._tcp	300	IN	SRV	0 0 32380 m3.etcd-srv.local.

+ 18 - 0
e2e/docker-dns-srv/named.conf

@@ -0,0 +1,18 @@
+options {
+        directory "/var/bind";
+        listen-on { 127.0.0.1; };
+        listen-on-v6 { none; };
+        allow-transfer {
+                none;
+        };
+        // If you have problems and are behind a firewall:
+        query-source address * port 53;
+        pid-file "/var/run/named/named.pid";
+        allow-recursion { none; };
+        recursion no;
+};
+
+zone "etcd-srv.local" IN {
+      type master;
+      file "/etc/bind/etcd.zone";
+};

+ 1 - 0
e2e/docker-dns-srv/resolv.conf

@@ -0,0 +1 @@
+nameserver 127.0.0.1

+ 9 - 0
e2e/docker-dns-srv/run.sh

@@ -0,0 +1,9 @@
+#!/bin/sh
+
+/etc/init.d/bind9 start
+# get rid of hosts so go lookup won't resolve 127.0.0.1 to localhost
+cat /dev/null >/etc/hosts
+goreman -f /Procfile start &
+sleep 5s
+./etcdctl --discovery-srv etcd-srv.local set foo bar
+ETCDCTL_API=3 ./etcdctl --discovery-srv etcd-srv.local put foo bar