add static hostname resolution for voltha-api and etcd ingress on k8s

* the default virtual hostnames exposed by the voltha-api and etcd
  ingresses are 'voltha.voltha.local' and 'voltha-infra.local' for our
  setups
* to allow connections to those ingress endpoints from the host where
  the k8s cluster itself is running on, we can just create /etc/hosts
  entries to resolve those hostnames to localhost (aka set them as
  aliases for 127.0.0.1)

Signed-off-by: Jan Klare <jan.klare@bisdn.de>
Change-Id: If31bf6f1583067006f83dfebe2488eb0a05d2bb0
diff --git a/packer/provision/basebuild.sh b/packer/provision/basebuild.sh
index 8e9b3e5..e222b6f 100644
--- a/packer/provision/basebuild.sh
+++ b/packer/provision/basebuild.sh
@@ -348,6 +348,14 @@
     mv /tmp/repo /usr/local/bin/repo
     chmod a+x /usr/local/bin/repo
 
+    # add host entries to /etc/hosts to allow resolving the virtual hosts
+    # used to expose the voltha api (voltha.voltha.local) and etcd
+    # (voltha-infra.local) inside of k8s via ingress to localhost
+    for INGRESS_HOST in voltha.voltha.local voltha-infra.local; do
+      echo "adding host entry for $INGRESS_HOST"
+      sed -i "s/^127.0.0.1[[:blank:]]\+localhost/& $INGRESS_HOST/" /etc/hosts
+    done
+
     # install helm
     HELM_VERSION="3.4.2"
     HELM_SHA256SUM="cacde7768420dd41111a4630e047c231afa01f67e49cc0c6429563e024da4b98"