Skip to content

Instantly share code, notes, and snippets.

@superbrothers
Last active April 15, 2017 04:28
Show Gist options
  • Save superbrothers/55c0170d87bdbf005329a852496f4598 to your computer and use it in GitHub Desktop.
Save superbrothers/55c0170d87bdbf005329a852496f4598 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
function minikube_dnsmasq_macos() {
local ip
case $1 in
start)
command minikube "$@"
ip="$(minikube ip)"
echo "The IP address of running a cluster: ${ip}"
echo "Configuring dnsmasq for minikube.dev..."
echo "address=/minikube.dev/$(minikube ip)" > /usr/local/etc/dnsmasq.conf
if [[ ! -f "/etc/resolver/minikube.dev" ]]; then
sudo mkdir -p /etc/resolver/
sudo bash -c "echo 'nameserver 127.0.0.1' > /etc/resolver/minikube.dev"
fi
echo "Restarting dnsmasq..."
sudo brew services start dnsmasq
dig +noall +answer minikube.dev
;;
*)
command minikube "$@"
;;
esac
}
function minikube_dnsmasq_ubuntu16() {
local ip
case $1 in
start)
command minikube "$@"
ip="$(minikube ip)"
echo "The IP address of running a cluster: ${ip}"
echo "Configuring dnsmasq for minikube.dev..."
sudo bash -c "echo address=/minikube.dev/`minikube ip` > /etc/NetworkManager/dnsmasq.d/minikube.conf"
echo "Restarting dnsmasq..."
sudo systemctl restart NetworkManager
dig +noall +answer minikube.dev
;;
*)
command minikube "$@"
;;
esac
}
function minikube_dnsmasq_ubuntu14() {
local ip
case $1 in
start)
command minikube "$@"
ip="$(minikube ip)"
echo "The IP address of running a cluster: ${ip}"
echo "Configuring dnsmasq for minikube.dev..."
sudo bash -c "echo address=/minikube.dev/`minikube ip` > /etc/NetworkManager/dnsmasq.d/minikube.conf"
echo "Restarting dnsmasq..."
sudo restart network-manager
dig +noall +answer minikube.dev
;;
*)
command minikube "$@"
;;
esac
}
# vim: ft=sh ts=2 st=2 sw=2 :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment