-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for ALPINE_NO_RESOLVER env var
When this env var is passed to the container, then the container DNS server will not be started, but resolv.conf will still be changed to have the nameserver 127.0.0.1. This is a specific workaround making it possible to run multiple Alpine-Kubernetes images in a single Pod that shares a common network port stack so that only one DNS server can bind to localhost port 53.
- Loading branch information
Jan Broer
committed
Feb 6, 2016
1 parent
29f70c4
commit 0a4e5a1
Showing
6 changed files
with
123 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
#!/usr/bin/execlineb -P | ||
|
||
with-contenv | ||
backtick -D "" -n ALPINE_NO_RESOLVER { printcontenv ALPINE_NO_RESOLVER } | ||
importas -u ALPINE_NO_RESOLVER ALPINE_NO_RESOLVER | ||
ifelse { s6-test -n ${ALPINE_NO_RESOLVER} } | ||
{ | ||
fdmove -c 2 1 | ||
/sbin/kubernetes_multi_pod.sh | ||
} | ||
fdmove -c 2 1 | ||
go-dnsmasq --default-resolver --append-search-domains --hostsfile=/etc/hosts | ||
go-dnsmasq --default-resolver --append-search-domains --hostsfile=/etc/hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/ash | ||
|
||
# Program that changes the systems primary nameserver to 127.0.0.1 | ||
# and restores the original resolv.conf on exit | ||
|
||
RESOLV=/etc/resolv.conf | ||
BACKUP=/etc/resolv.conf.orig | ||
|
||
clean_up() { | ||
if [ -f "$BACKUP" ] | ||
then | ||
cat $BACKUP > $RESOLV | ||
echo "[Alpine-Kubernetes] Restored resolv.conf" | ||
fi | ||
exit | ||
} | ||
|
||
trap clean_up SIGHUP SIGINT SIGTERM | ||
|
||
echo "[Alpine-Kubernetes] Changed nameserver to 127.0.0.1" | ||
|
||
if [ ! -f "$RESOLV" ] | ||
then | ||
echo "Could not stat $RESOLV" | ||
exit 1 | ||
fi | ||
|
||
cp $RESOLV $BACKUP | ||
|
||
echo '# Created by Alpine-Kubernetes' > $RESOLV | ||
echo 'nameserver 127.0.0.1' >> $RESOLV | ||
|
||
tail -f /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
#!/usr/bin/execlineb -P | ||
|
||
with-contenv | ||
backtick -D "" -n ALPINE_NO_RESOLVER { printcontenv ALPINE_NO_RESOLVER } | ||
importas -u ALPINE_NO_RESOLVER ALPINE_NO_RESOLVER | ||
ifelse { s6-test -n ${ALPINE_NO_RESOLVER} } | ||
{ | ||
fdmove -c 2 1 | ||
/sbin/kubernetes_multi_pod.sh | ||
} | ||
fdmove -c 2 1 | ||
go-dnsmasq --default-resolver --append-search-domains --hostsfile=/etc/hosts | ||
go-dnsmasq --default-resolver --append-search-domains --hostsfile=/etc/hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/ash | ||
|
||
# Program that changes the systems primary nameserver to 127.0.0.1 | ||
# and restores the original resolv.conf on exit | ||
|
||
RESOLV=/etc/resolv.conf | ||
BACKUP=/etc/resolv.conf.orig | ||
|
||
clean_up() { | ||
if [ -f "$BACKUP" ] | ||
then | ||
cat $BACKUP > $RESOLV | ||
echo "[Alpine-Kubernetes] Restored resolv.conf" | ||
fi | ||
exit | ||
} | ||
|
||
trap clean_up SIGHUP SIGINT SIGTERM | ||
|
||
echo "[Alpine-Kubernetes] Changed nameserver to 127.0.0.1" | ||
|
||
if [ ! -f "$RESOLV" ] | ||
then | ||
echo "Could not stat $RESOLV" | ||
exit 1 | ||
fi | ||
|
||
cp $RESOLV $BACKUP | ||
|
||
echo '# Created by Alpine-Kubernetes' > $RESOLV | ||
echo 'nameserver 127.0.0.1' >> $RESOLV | ||
|
||
tail -f /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
#!/usr/bin/execlineb -P | ||
|
||
with-contenv | ||
backtick -D "" -n ALPINE_NO_RESOLVER { printcontenv ALPINE_NO_RESOLVER } | ||
importas -u ALPINE_NO_RESOLVER ALPINE_NO_RESOLVER | ||
ifelse { s6-test -n ${ALPINE_NO_RESOLVER} } | ||
{ | ||
fdmove -c 2 1 | ||
/sbin/kubernetes_multi_pod.sh | ||
} | ||
fdmove -c 2 1 | ||
go-dnsmasq --default-resolver --append-search-domains --hostsfile=/etc/hosts | ||
go-dnsmasq --default-resolver --append-search-domains --hostsfile=/etc/hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/ash | ||
|
||
# Program that changes the systems primary nameserver to 127.0.0.1 | ||
# and restores the original resolv.conf on exit | ||
|
||
RESOLV=/etc/resolv.conf | ||
BACKUP=/etc/resolv.conf.orig | ||
|
||
clean_up() { | ||
if [ -f "$BACKUP" ] | ||
then | ||
cat $BACKUP > $RESOLV | ||
echo "[Alpine-Kubernetes] Restored resolv.conf" | ||
fi | ||
exit | ||
} | ||
|
||
trap clean_up SIGHUP SIGINT SIGTERM | ||
|
||
echo "[Alpine-Kubernetes] Changed nameserver to 127.0.0.1" | ||
|
||
if [ ! -f "$RESOLV" ] | ||
then | ||
echo "Could not stat $RESOLV" | ||
exit 1 | ||
fi | ||
|
||
cp $RESOLV $BACKUP | ||
|
||
echo '# Created by Alpine-Kubernetes' > $RESOLV | ||
echo 'nameserver 127.0.0.1' >> $RESOLV | ||
|
||
tail -f /dev/null |