2021-10-29 16:47:37 +00:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
#
|
|
|
|
|
2022-03-15 17:29:56 +00:00
|
|
|
ENV['TEST_INSTALL_SH'] ||= '../../../install.sh'
|
2021-10-29 16:47:37 +00:00
|
|
|
|
|
|
|
Vagrant.configure("2") do |config|
|
2024-02-29 23:41:56 +00:00
|
|
|
config.vagrant.plugins = ["vagrant-k3s"]
|
2022-03-18 16:01:04 +00:00
|
|
|
config.vm.box = "generic/rocky8"
|
2021-11-15 18:50:38 +00:00
|
|
|
config.vm.boot_timeout = ENV['TEST_VM_BOOT_TIMEOUT'] || 600 # seconds
|
|
|
|
config.vm.synced_folder '.', '/vagrant', disabled: true
|
2021-10-29 16:47:37 +00:00
|
|
|
|
2024-02-29 23:41:56 +00:00
|
|
|
# Load in helper functions
|
|
|
|
load "../install_util.rb"
|
|
|
|
|
2022-03-18 16:01:04 +00:00
|
|
|
config.vm.define 'install-rocky-8', primary: true do |test|
|
2021-11-15 18:50:38 +00:00
|
|
|
test.vm.hostname = 'smoke'
|
2022-03-18 16:01:04 +00:00
|
|
|
test.vm.provision "disable-firewall", type: "shell", inline: "systemctl stop firewalld"
|
2024-02-29 23:41:56 +00:00
|
|
|
test.vm.provision "add-bin-path", type: "shell", inline: "echo \"export PATH=/usr/local/bin:\$PATH\" >> ~/.bashrc"
|
2021-10-29 16:47:37 +00:00
|
|
|
test.vm.provision 'k3s-upload', type: 'file', run: 'always', source: ENV['TEST_INSTALL_SH'], destination: 'install.sh'
|
|
|
|
test.vm.provision 'k3s-install', type: 'k3s', run: 'once' do |k3s|
|
|
|
|
k3s.installer_url = 'file:///home/vagrant/install.sh'
|
|
|
|
k3s.args = %w[server]
|
2021-11-15 18:50:38 +00:00
|
|
|
k3s.env = ENV.select{|k,v| k.start_with?('K3S_') || k.start_with?('INSTALL_K3S_')}.merge({
|
|
|
|
:INSTALL_K3S_NAME => 'server',
|
|
|
|
})
|
2022-08-15 21:31:37 +00:00
|
|
|
k3s.config = <<~YAML
|
|
|
|
selinux: true
|
|
|
|
token: 'vagrant'
|
|
|
|
YAML
|
2021-10-29 16:47:37 +00:00
|
|
|
k3s.config_mode = '0644' # side-step https://github.com/k3s-io/k3s/issues/4321
|
|
|
|
end
|
2024-02-29 23:41:56 +00:00
|
|
|
waitForNodeReady(test.vm)
|
|
|
|
|
|
|
|
waitForCoreDns(test.vm)
|
|
|
|
|
|
|
|
waitForLocalStorage(test.vm)
|
|
|
|
|
|
|
|
waitForMetricsServer(test.vm)
|
|
|
|
|
|
|
|
waitForTraefik(test.vm)
|
|
|
|
|
|
|
|
kubectlStatus(test.vm)
|
|
|
|
|
|
|
|
checkK3sProcesses(test.vm)
|
|
|
|
|
2021-10-29 16:47:37 +00:00
|
|
|
end
|
|
|
|
|
2021-11-15 18:50:38 +00:00
|
|
|
config.vm.provision 'selinux-status', type: 'shell', run: 'once', inline: 'sestatus'
|
|
|
|
|
|
|
|
%w[libvirt virtualbox vmware_desktop].each do |p|
|
2021-10-29 16:47:37 +00:00
|
|
|
config.vm.provider p do |v|
|
|
|
|
v.cpus = ENV['TEST_VM_CPUS'] || 2
|
|
|
|
v.memory = ENV['TEST_VM_MEMORY'] || 2048
|
|
|
|
end
|
|
|
|
end
|
|
|
|
config.vm.provider :virtualbox do |v,o|
|
|
|
|
v.gui = false
|
|
|
|
v.check_guest_additions = false
|
|
|
|
end
|
2021-11-15 18:50:38 +00:00
|
|
|
end
|