Skip to content

Instantly share code, notes, and snippets.

@richardcase
Last active January 28, 2022 12:49
Show Gist options
  • Save richardcase/2cbefd04486c825bc89b8d9979b8cca6 to your computer and use it in GitHub Desktop.
Save richardcase/2cbefd04486c825bc89b8d9979b8cca6 to your computer and use it in GitHub Desktop.
Vagrantfile for EKSA Dev
network:
version: 2
renderer: networkd
ethernets:
eth1:
addresses:
- 192.168.9.5/24
gateway4: 192.168.9.1
nameservers:
search: [lab2]
addresses: [192.168.9.1]
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "eksctl-tool generate",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}/cmd/eksctl-anywhere",
"args": [
"generate",
"clusterconfig",
"testcluster",
"--provider",
"microvm",
],
"env": {
"MICROVM_PROVIDER": "true"
},
},
{
"name": "eksctl-tool create cluster",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}/cmd/eksctl-anywhere",
"args": [
"create",
"cluster",
"-f",
"${workspaceRoot}/_output/cluster.yaml",
"-v",
"8",
"--bundles-override",
"${workspaceRoot}/_output/bundle-override.yaml"
],
"env": {
"MICROVM_PROVIDER": "true",
"V1BETA1_BUNDLE": "true"
},
"buildFlags": "-ldflags='-X github.com/aws/eks-anywhere/pkg/version.gitVersion=v0.0.0-dev+build.1168 -X github.com/aws/eks-anywhere/pkg/cluster.releasesManifestURL=https://dev-release-prod-pdx.s3.us-west-2.amazonaws.com/eks-a-release.yaml'",
}
]
}
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2004"
config.ssh.forward_agent = true
config.vm.synced_folder "./", "/home/vagrant/eksa"
cpus = 4
memory = 8192
config.vm.provider :libvirt do |v, override|
# If you want to use a different storage pool.
# v.storage_pool_name = "vagrant"
v.cpus = cpus
v.memory = memory
override.vm.synced_folder "./", "/home/vagrant/eksa", mount_options: ["nolock"], type: "nfs"
end
config.vm.network "public_network",
:dev => "enx8cae4cd66035"
config.vm.provision "file", source: "99_config.yaml", destination: "/etc/netplan/99_config.yaml"
config.vm.provision "shell",
inline: "sudo netplan apply"
config.vm.provision "upgrade-packages", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eux -o pipefail
apt update
apt upgrade -y
SHELL
end
config.vm.provision "install-basic-packages", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eux -o pipefail
apt install -y \
make \
git \
gcc \
curl \
unzip \
ca-certificates \
gnupg \
apt-transport-https \
lsb-release
SHELL
end
config.vm.provision "install-docker", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eux -o pipefail
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io
usermod -aG docker vagrant
SHELL
end
config.vm.provision "install-kubectl", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eux -o pipefail
curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
apt-get update
apt-get install -y kubectl
SHELL
end
config.vm.provision "install-kind", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eux -o pipefail
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
chmod +x ./kind
mv ./kind /usr/local/bin
SHELL
end
config.vm.provision "install-clusterctl", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eux -o pipefail
curl -Lo ./clusterctl https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.0.2/clusterctl-linux-amd64
chmod +x ./clusterctl
mv ./clusterctl /usr/local/bin
SHELL
end
config.vm.provision "install-k9s", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eux -o pipefail
curl -Lo ./k9s.tar.gz https://github.com/derailed/k9s/releases/download/v0.25.18/k9s_Linux_x86_64.tar.gz
tar xvfz ./k9s.tar.gz
chmod +x ./k9s
mv ./k9s /usr/local/bin
SHELL
end
config.vm.provision "install-fzf", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eux -o pipefail
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install --all
echo "[ -f ~/.fzf.bash ] && source ~/.fzf.bash" >> /home/vagrant/.bashrc
SHELL
end
config.vm.provision "install-golang", type: "shell", run: "once" do |sh|
sh.env = {
'GO_VERSION': ENV['GO_VERSION'] || "1.16.13",
}
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eux -o pipefail
curl -fsSL "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | tar Cxz /usr/local
cat >> /etc/environment <<EOF
PATH=/usr/local/go/bin:$PATH
EOF
source /etc/environment
cat >> /etc/profile.d/sh.local <<EOF
GOPATH=\\$HOME/go
PATH=\\$GOPATH/bin:\\$PATH
export GOPATH PATH
EOF
source /etc/profile.d/sh.local
SHELL
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment