-
Notifications
You must be signed in to change notification settings - Fork 8
/
minikube-ingress-dns-macos
executable file
·52 lines (40 loc) · 1.25 KB
/
minikube-ingress-dns-macos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
# minikube-ingress-dns-macos
# Copyright (c) 2017 Kazuki Suda <[email protected]>
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
set -e -o pipefail; [[ -n "$DEBUG" ]] && set -x
command minikube $@
if [[ "$1" == "stop" ]]; then
brew services stop dnsmasq
exit
fi
if [[ "$1" == "delete" ]]; then
brew services stop dnsmasq
$(dirname $0)/clean_macos
exit
fi
[[ "$1" != "start" ]] && exit
source $(dirname $0)/common.sh
# The file path of dnsmasq.conf
dnsmasq_config_file=/usr/local/etc/dnsmasq.conf
write_to_dnsmasq_config_file() {
cat > $dnsmasq_config_file
}
# The way of restarting dnsmasq in this environment
restart_dnsmasq() {
brew services restart dnsmasq
}
# To configure additional resolvers for minikube ingress dns domain
if [[ ! -f "/etc/resolver/${MINIKUBE_INGRESS_DNS_DOMAIN}" ]]; then
echoinfo "Configure the additional resolver for ${MINIKUBE_INGRESS_DNS_DOMAIN}"
exe sudo mkdir -p /etc/resolver/
tmpfile=$(mktemp)
echo "nameserver 127.0.0.1" > $tmpfile
echo "port 5354" >> $tmpfile
exe sudo mv $tmpfile /etc/resolver/${MINIKUBE_INGRESS_DNS_DOMAIN}
fi
# Setup dnsmasq for ingress lb in minikube
minikube_ingress_dns
# vim: ft=sh ts=2 sts=2 sw=2