Skip to content

Commit

Permalink
gh-434 : apt-get is recommended over apt in scripting
Browse files Browse the repository at this point in the history
  • Loading branch information
nik-netlox committed Nov 13, 2023
1 parent 1591bee commit aab2cde
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ RUN mkdir -p /opt/loxilb && \
mkdir -p /etc/bash_completion.d/

# Update Ubuntu Software repository
RUN apt update && apt install -y wget
RUN apt-get update && apt-get install -y wget

# Env for golang
ENV PATH="${PATH}:/usr/local/go/bin"

# Install loxilb related packages
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && echo $arch && if [ "$arch" = "arm64" ] ; then apt install -y gcc-multilib-arm-linux-gnueabihf; else apt update && apt install -y gcc-multilib;fi && \
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && echo $arch && if [ "$arch" = "arm64" ] ; then apt-get install -y gcc-multilib-arm-linux-gnueabihf; else apt-get update && apt-get install -y gcc-multilib;fi && \
# Arch specific packages - GoLang
wget https://go.dev/dl/go1.18.linux-${arch}.tar.gz && tar -xzf go1.18.linux-${arch}.tar.gz --directory /usr/local/ && rm go1.18.linux-${arch}.tar.gz && \
# Dev and util packages
apt install -y clang llvm libelf-dev libpcap-dev vim net-tools \
apt-get install -y clang llvm libelf-dev libpcap-dev vim net-tools \
elfutils dwarves git libbsd-dev bridge-utils wget unzip build-essential \
bison flex sudo iproute2 pkg-config tcpdump iputils-ping keepalived curl bash-completion && \
# Install loxilb's custom ntc tool
Expand Down Expand Up @@ -61,7 +61,7 @@ RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && echo $arch && i
elfutils dwarves git bison flex wget unzip && apt-get -y autoremove && \
apt-get install -y libllvm10 && \
# cleanup unnecessary packages
if [ "$arch" = "arm64" ] ; then apt purge -y gcc-multilib-arm-linux-gnueabihf; else apt update && apt purge -y gcc-multilib;fi && \
if [ "$arch" = "arm64" ] ; then apt purge -y gcc-multilib-arm-linux-gnueabihf; else apt-get update && apt purge -y gcc-multilib;fi && \
rm -rf /var/lib/apt/lists/* && apt clean && \
echo "if [ -f /etc/bash_completion ] && ! shopt -oq posix; then" >> /root/.bashrc && \
echo " . /etc/bash_completion" >> /root/.bashrc && \
Expand Down
4 changes: 2 additions & 2 deletions cicd/docker-k3s-lb/loxilb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu
apt-get install -y docker-ce
sudo docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged --entrypoint /root/loxilb-io/loxilb/loxilb -dit -v /dev/log:/dev/log --name loxilb ghcr.io/loxilb-io/loxilb:latest

#docker exec -i loxilb apt update
#docker exec -i loxilb apt-get update
#docker exec -i loxilb apt-get -y install clang-10 llvm libelf-dev gcc-multilib libpcap-dev linux-tools-$(uname -r) elfutils dwarves git libbsd-dev bridge-utils unzip build-essential bison flex iperf iproute2 nodejs socat ethtool

# Create mac-vlan on top of underlying eth1 interface
Expand All @@ -24,7 +24,7 @@ docker network connect llbnet loxilb --ip=192.168.163.247

# Start a docker to simulate e2 sctp endpoint
docker run -u root --cap-add SYS_ADMIN -dit --privileged --name e2 eyes852/ubuntu-iperf-test:0.5
docker exec -i e2 apt update
docker exec -i e2 apt-get update
docker exec -i e2 apt-get -y install lksctp-tools

# Turn tx checksum offload "off" in the end-point pod for LB to work properly
Expand Down
8 changes: 4 additions & 4 deletions cicd/ipsec2/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ $dexec llb2 ip route add 31.31.31.0/24 via 77.77.77.2 dev vti100
$dexec llb2 ip route add 32.32.32.0/24 via 77.77.77.2 dev vti100
$dexec llb2 loxicmd create lb 20.20.20.1 --tcp=2020:8080 --endpoints=25.25.25.1:1,26.26.26.1:1

$dexec llb1 apt update
$dexec llb1 apt install -y strongswan strongswan-swanctl systemctl
$dexec llb1 apt-get update
$dexec llb1 apt-get install -y strongswan strongswan-swanctl systemctl
docker cp llb1_ipsec_config/ipsec.conf llb1:/etc/
docker cp llb1_ipsec_config/ipsec.secrets llb1:/etc/
docker cp llb1_ipsec_config/charon.conf llb1:/etc/strongswan.d/
$dexec llb1 systemctl restart strongswan-starter

$dexec llb2 apt update
$dexec llb2 apt install -y strongswan strongswan-swanctl systemctl
$dexec llb2 apt-get update
$dexec llb2 apt-get install -y strongswan strongswan-swanctl systemctl
docker cp llb2_ipsec_config/ipsec.conf llb2:/etc/
docker cp llb2_ipsec_config/ipsec.secrets llb2:/etc/
docker cp llb2_ipsec_config/charon.conf llb2:/etc/strongswan.d/
Expand Down
2 changes: 1 addition & 1 deletion cicd/k0s-weave/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ else
fi
# Install Bird to work with k0s
sudo apt install bird2 --yes
sudo apt-get install bird2 --yes
sleep 5
Expand Down
2 changes: 1 addition & 1 deletion cicd/k3s-calico-dual-stack/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ else
fi

# Install Bird to work with k3s
sudo apt install bird2 --yes
sudo apt-get install bird2 --yes

sleep 5

Expand Down
2 changes: 1 addition & 1 deletion cicd/k3s-calico/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ else
fi

# Install Bird to work with k3s
sudo apt install bird2 --yes
sudo apt-get install bird2 --yes

sleep 5

Expand Down
2 changes: 1 addition & 1 deletion cicd/k3s-cilium/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ else
fi

# Install Bird to work with k3s
sudo apt install bird2 --yes
sudo apt-get install bird2 --yes

sleep 5

Expand Down
2 changes: 1 addition & 1 deletion cicd/k3s-flannel-incluster-l2/host.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sudo apt install lksctp-tools
sudo apt-get install lksctp-tools
sudo ip route add 123.123.123.0/24 via 192.168.90.10
echo "Host is up"
2 changes: 1 addition & 1 deletion cicd/k3s-flannel-incluster/host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ chmod 777 sctp_socat_client
chmod 777 udp_client
echo "123.123.123.1 k8s-svc" >> /etc/hosts

sudo apt install -y bird2 socat lksctp-tools
sudo apt-get install -y bird2 socat lksctp-tools

sleep 5

Expand Down
2 changes: 1 addition & 1 deletion cicd/k3s-flannel/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ else
fi

# Install Bird to work with k3s
sudo apt install bird2 --yes
sudo apt-get install bird2 --yes

sleep 5

Expand Down
2 changes: 1 addition & 1 deletion cicd/k3s-sctpmh-2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM ubuntu:20.04
WORKDIR /

# Install any needed packages specified in requirements.txt
RUN apt update
RUN apt-get update
RUN apt-get -y install lksctp-tools

# Make port 9999 available to the world outside this container
Expand Down
2 changes: 1 addition & 1 deletion cicd/k3s-sctpmh-2/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ else
fi

# Install Bird to work with k3s
sudo apt install bird2 --yes
sudo apt-get install bird2 --yes

sleep 5

Expand Down
2 changes: 1 addition & 1 deletion cicd/k3s-sctpmh/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM ubuntu:20.04
WORKDIR /

# Install any needed packages specified in requirements.txt
RUN apt update
RUN apt-get update
RUN apt-get -y install lksctp-tools

# Make port 9999 available to the world outside this container
Expand Down
2 changes: 1 addition & 1 deletion cicd/k3s-sctpmh/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ else
fi

# Install Bird to work with k3s
sudo apt install bird2 --yes
sudo apt-get install bird2 --yes

sleep 5

Expand Down
4 changes: 2 additions & 2 deletions cicd/k8s-nat64/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Vagrant.configure("2") do |config|
# Disable swap for each vm
config.vm.provision "0", type: "shell", inline: "swapoff -a"
config.vm.provision "shell", inline: <<-SHELL
apt update
apt-get update
mkdir -p $HOME/.kube
hostnamectl set-hostname node"#{i}"
SHELL
Expand All @@ -125,7 +125,7 @@ Vagrant.configure("2") do |config|
if config.vm.hostname == "node1" || config.vm.hostname == "k8slx-01"
config.vm.provision "shell", privileged: false, inline: <<-SHELL
git clone https://github.com/kubernetes-sigs/kubespray.git
sudo apt update; sudo apt install -y python3-pip sshpass; sudo pip install -r kubespray/requirements.txt
sudo apt-get update; sudo apt-get install -y python3-pip sshpass; sudo pip install -r kubespray/requirements.txt
cp -rfp kubespray/inventory/sample kubespray/inventory/mycluster
CONFIG_FILE=kubespray/inventory/mycluster/hosts.yml python3 kubespray/contrib/inventory_builder/inventory.py 192.168.59.211 192.168.59.212 192.168.59.213 192.168.59.214
ssh-keygen -b 2048 -t rsa -f /home/vagrant/.ssh/id_rsa -q -N ""
Expand Down
4 changes: 2 additions & 2 deletions cicd/k8s/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Vagrant.configure("2") do |config|
# Disable swap for each vm
config.vm.provision "0", type: "shell", inline: "swapoff -a"
config.vm.provision "shell", inline: <<-SHELL
apt update
apt-get update
mkdir -p $HOME/.kube
hostnamectl set-hostname node"#{i}"
SHELL
Expand All @@ -125,7 +125,7 @@ Vagrant.configure("2") do |config|
if config.vm.hostname == "node1" || config.vm.hostname == "k8slx-01"
config.vm.provision "shell", privileged: false, inline: <<-SHELL
git clone https://github.com/kubernetes-sigs/kubespray.git
sudo apt update; sudo apt install -y python3-pip sshpass; sudo pip install -r kubespray/requirements.txt
sudo apt-get update; sudo apt-get install -y python3-pip sshpass; sudo pip install -r kubespray/requirements.txt
cp -rfp kubespray/inventory/sample kubespray/inventory/mycluster
CONFIG_FILE=kubespray/inventory/mycluster/hosts.yml python3 kubespray/contrib/inventory_builder/inventory.py 192.168.59.211 192.168.59.212 192.168.59.213 192.168.59.214
ssh-keygen -b 2048 -t rsa -f /home/vagrant/.ssh/id_rsa -q -N ""
Expand Down
2 changes: 1 addition & 1 deletion cicd/sync/loxilb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu
apt-get install -y docker-ce
docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged --entrypoint /bin/bash -dit -v /dev/log:/dev/log --net=host --name loxilb ghcr.io/loxilb-io/loxilb:latest

docker exec -it loxilb apt update
docker exec -it loxilb apt-get update
docker exec -it loxilb apt-get -y install clang-10 llvm libelf-dev gcc-multilib libpcap-dev linux-tools-$(uname -r) elfutils dwarves git libbsd-dev bridge-utils unzip build-essential bison flex iperf iproute2 nodejs socat ethtool
docker exec -it loxilb git clone https://github.com/loxilb-io/loxilb.git --recurse-submodules

Expand Down

0 comments on commit aab2cde

Please sign in to comment.