etcd: move main logic to etcd subpackage