Skip to content

Commit

Permalink
Remove sockaddr and use native tools (#24665)
Browse files Browse the repository at this point in the history
* func: remove sockaddr and use native tools

* Update setup.sh
  • Loading branch information
Juanadelacuesta authored Dec 13, 2024
1 parent 614cb5c commit a9a0f71
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
4 changes: 2 additions & 2 deletions e2e/terraform/packer/ubuntu-jammy-amd64/dnsconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ do
done

# Use dnsmasq first and then docker bridge network for DNS resolution
DOCKER_BRIDGE_IP_ADDRESS=$(/usr/local/bin/sockaddr eval 'GetInterfaceIP "docker0"')
DOCKER_BRIDGE_IP_ADDRESS=$(docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}')
cat <<EOF > /tmp/resolv.conf
nameserver 127.0.0.1
nameserver $DOCKER_BRIDGE_IP_ADDRESS
Expand All @@ -30,7 +30,7 @@ cp /tmp/resolv.conf /etc/resolv.conf

# need to get the interface for dnsmasq config so that we can
# accomodate both "predictable" and old-style interface names
IFACE=$(/usr/local/bin/sockaddr eval 'GetDefaultInterfaces | attr "Name"')
IFACE=$(ip route | grep default | awk '{print $5}')

cat <<EOF > /tmp/dnsmasq
port=53
Expand Down
16 changes: 0 additions & 16 deletions e2e/terraform/packer/ubuntu-jammy-amd64/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ sudo apt-get install -y \
curl -o /tmp/hc-install.zip https://releases.hashicorp.com/hc-install/0.9.0/hc-install_0.9.0_linux_amd64.zip
sudo unzip -d /usr/local/bin /tmp/hc-install.zip

# Install sockaddr
aws s3 cp "s3://nomad-team-dev-test-binaries/tools/sockaddr_linux_amd64" /tmp/sockaddr
sudo mv /tmp/sockaddr /usr/local/bin
sudo chmod +x /usr/local/bin/sockaddr
sudo chown root:root /usr/local/bin/sockaddr

# Disable the firewall
sudo ufw disable || echo "ufw not installed"
Expand Down Expand Up @@ -169,14 +164,3 @@ echo "Updating boot parameters"
# enable cgroup_memory and swap
sudo sed -i 's/GRUB_CMDLINE_LINUX="[^"]*/& cgroup_enable=memory swapaccount=1/' /etc/default/grub
sudo update-grub

echo "Configuring user shell"
sudo tee -a /home/ubuntu/.bashrc << 'EOF'
IP_ADDRESS=$(/usr/local/bin/sockaddr eval 'GetPrivateIP')
export CONSUL_RPC_ADDR=$IP_ADDRESS:8400
export CONSUL_HTTP_ADDR=$IP_ADDRESS:8500
export VAULT_ADDR=http://$IP_ADDRESS:8200
export NOMAD_ADDR=http://$IP_ADDRESS:4646
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/bin
EOF

0 comments on commit a9a0f71

Please sign in to comment.