Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use same IP address for both boots and nginx #43

Merged
merged 2 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ services:
PACKET_VERSION: ${PACKET_VERSION:-ignored}
ROLLBAR_TOKEN: ${ROLLBAR_TOKEN:-ignored}
ROLLBAR_DISABLE: ${ROLLBAR_DISABLE:-1}
MIRROR_HOST: ${TINKERBELL_NGINX_IP:-127.0.0.1}
MIRROR_HOST: ${TINKERBELL_HOST_IP:-127.0.0.1}:8080
DNS_SERVERS: 8.8.8.8
PUBLIC_IP: $TINKERBELL_HOST_IP
BOOTP_BIND: $TINKERBELL_HOST_IP:67
Expand All @@ -151,7 +151,7 @@ services:
restart: unless-stopped
tty: true
ports:
- $TINKERBELL_NGINX_IP:80:80/tcp
- $TINKERBELL_HOST_IP:8080:80/tcp
volumes:
- ./state/webroot:/usr/share/nginx/html/

Expand Down
3 changes: 0 additions & 3 deletions generate-envrc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ export TINKERBELL_CIDR=29
# should be the second address.
export TINKERBELL_HOST_IP=192.168.1.1

# NGINX IP is used by provisioner to serve files required for iPXE boot
export TINKERBELL_NGINX_IP=192.168.1.2

# Tink server username and password
export TINKERBELL_TINK_USERNAME=admin
export TINKERBELL_TINK_PASSWORD="$tink_password"
Expand Down
38 changes: 10 additions & 28 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,12 @@ get_distro_version() (
)

is_network_configured() (
# Require the provisioner interface have both the host and nginx IP
# Require the provisioner interface have the host IP
if ! ip addr show "$TINKERBELL_NETWORK_INTERFACE" |
grep -q "$TINKERBELL_HOST_IP"; then
return 1
fi

if ! ip addr show "$TINKERBELL_NETWORK_INTERFACE" |
grep -q "$TINKERBELL_NGINX_IP"; then
return 1
fi

return 0
)

Expand Down Expand Up @@ -144,15 +139,13 @@ setup_networking_netplan() (
--arg interface "$TINKERBELL_NETWORK_INTERFACE" \
--arg cidr "$TINKERBELL_CIDR" \
--arg host_ip "$TINKERBELL_HOST_IP" \
--arg nginx_ip "$TINKERBELL_NGINX_IP" \
'{
network: {
renderer: "networkd",
ethernets: {
($interface): {
addresses: [
"\($host_ip)/\($cidr)",
"\($nginx_ip)/\($cidr)"
"\($host_ip)/\($cidr)"
]
}
}
Expand All @@ -179,33 +172,24 @@ setup_networking_ubuntu_legacy() (
echo ""
echo "$BLANK Then run the following commands:"
echo "$BLANK ip link set $TINKERBELL_NETWORK_INTERFACE nomaster"
echo "$BLANK ifdown $TINKERBELL_NETWORK_INTERFACE:0"
echo "$BLANK ifdown $TINKERBELL_NETWORK_INTERFACE:1"
echo "$BLANK ifup $TINKERBELL_NETWORK_INTERFACE:0"
echo "$BLANK ifup $TINKERBELL_NETWORK_INTERFACE:1"
echo "$BLANK ifdown $TINKERBELL_NETWORK_INTERFACE"
echo "$BLANK ifup $TINKERBELL_NETWORK_INTERFACE"
exit 1
else
generate_iface_config >>/etc/network/interfaces
ip link set "$TINKERBELL_NETWORK_INTERFACE" nomaster
ifdown "$TINKERBELL_NETWORK_INTERFACE:0"
ifdown "$TINKERBELL_NETWORK_INTERFACE:1"
ifup "$TINKERBELL_NETWORK_INTERFACE:0"
ifup "$TINKERBELL_NETWORK_INTERFACE:1"
ifdown "$TINKERBELL_NETWORK_INTERFACE"
ifup "$TINKERBELL_NETWORK_INTERFACE"
fi
)

generate_iface_config() (
cat <<EOF

auto $TINKERBELL_NETWORK_INTERFACE:0
iface $TINKERBELL_NETWORK_INTERFACE:0 inet static
auto $TINKERBELL_NETWORK_INTERFACE
iface $TINKERBELL_NETWORK_INTERFACE inet static
address $TINKERBELL_HOST_IP/$TINKERBELL_CIDR
pre-up sleep 4

auto $TINKERBELL_NETWORK_INTERFACE:1
iface $TINKERBELL_NETWORK_INTERFACE:1 inet static
address $TINKERBELL_NGINX_IP/$TINKERBELL_CIDR
pre-up sleep 4
EOF
)

Expand All @@ -221,10 +205,8 @@ ONBOOT=yes
HWADDR=$HWADDRESS
BOOTPROTO=static

IPADDR0=$TINKERBELL_HOST_IP
PREFIX0=$TINKERBELL_CIDR
IPADDR1=$TINKERBELL_NGINX_IP
PREFIX1=$TINKERBELL_CIDR
IPADDR=$TINKERBELL_HOST_IP
PREFIX=$TINKERBELL_CIDR
EOF
)

Expand Down