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

dev: Update vagrant configuration #2413

Closed
wants to merge 2 commits into from
Closed
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
85 changes: 50 additions & 35 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,60 @@
$VM_MEMORY = (ENV['VM_MEMORY'] || 8912)
$VM_CPUS = (ENV['VM_CPUS'] || 2)
$GO_VERSION = (ENV['GO_VERSION'] || "1.22.0")

$go_install = <<-'SCRIPT'
# Install golang
GO_VERSION=$1
curl -O https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz && \
rm -rf /usr/local/go \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to delete existing go on users. This is on the host?

Could we check if go version is correct first and then give a readable warning with instructions on how to do this? And/or prompt to replace?

&& tar -C /usr/local -xzf go$GO_VERSION.linux-amd64.tar.gz \
&& rm -rf go$GO_VERSION.linux-amd64.tar.gz && \
echo 'export PATH=$PATH:/usr/local/go/bin:/home/vagrant/go/bin' >> /home/vagrant/.bashrc
SCRIPT

# Mostly copied from .github/workflows/gotests.yml to install dependencies
$dependencies = <<-'SCRIPT'
cd /home/vagrant/go/src/github.com/cilium/tetragon
apt-get update
apt-get install -y build-essential clang conntrack libcap-dev libelf-dev net-tools

# Install crictl
VERSION="v1.22.0"
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz
sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-$VERSION-linux-amd64.tar.gz

#install kind
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.12.0/kind-linux-amd64
chmod +x ./kind
mv ./kind /usr/local/bin/

#install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/

#install helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

# install unzip
apt install unzip
SCRIPT

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/jammy64"
config.vm.disk :disk, size: "50GB"
config.vm.provision :docker
config.vm.network "private_network", ip: "192.168.56.11"
config.vm.synced_folder ".", "/home/vagrant/go/src/github.com/cilium/tetragon", create: true
config.ssh.extra_args = ["-t", "cd /home/vagrant/go/src/github.com/cilium/tetragon; bash --login"]
config.vm.provider "virtualbox" do |v|
v.memory = 8192
v.cpus = 2
v.memory = $VM_MEMORY
v.cpus = $VM_CPUS
end

# Mostly copied from .github/workflows/gotests.yml to install dependencies
config.vm.provision "shell", inline: <<-SHELL
cd /home/vagrant/go/src/github.com/cilium/tetragon
apt-get update
apt-get install -y build-essential clang conntrack libcap-dev libelf-dev net-tools
snap install go --channel=1.18/stable --classic

# Install crictl
VERSION="v1.22.0"
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz
sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-$VERSION-linux-amd64.tar.gz

#install kind
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.12.0/kind-linux-amd64
chmod +x ./kind
mv ./kind /usr/local/bin/

#install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/

#install helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

# install unzip
apt install unzip

SHELL
config.vm.provision :docker
config.vm.provision "shell", inline: $go_install, args: $GO_VERSION
config.vm.provision "shell", inline: $dependencies
end
Loading