-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rancher:master' into fmoral2.800-control
- Loading branch information
Showing
9 changed files
with
161 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
ENV['TEST_INSTALL_SH'] ||= '../../../install.sh' | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.box = 'opensuse/Leap-15.4.x86_64' | ||
config.vm.boot_timeout = ENV['TEST_VM_BOOT_TIMEOUT'] || 600 # seconds | ||
config.vm.synced_folder '.', '/vagrant', type: 'rsync', disabled: false | ||
%w[libvirt virtualbox vmware_desktop].each do |p| | ||
config.vm.provider p do |v, o| | ||
v.cpus = ENV['TEST_VM_CPUS'] || 2 | ||
v.memory = ENV['TEST_VM_MEMORY'] || 3072 | ||
end | ||
end | ||
|
||
external_env = "" | ||
ENV.select{|k,v| k.start_with?('RKE2_') || k.start_with?('INSTALL_RKE2_')}.each {|key,value| external_env << "#{key.to_s}=#{value.to_s}"} | ||
|
||
config.vm.define "install-leap-15.4", primary: true do |test| | ||
test.vm.hostname = 'smoke' | ||
test.vm.provision 'rke2-upload-installer', type: 'file', run: 'always', source: ENV['TEST_INSTALL_SH'], destination: 'install.sh' | ||
test.vm.provision"rke2-install", type: 'rke2', run: "once" do |rke2| | ||
rke2.installer_url = 'file:///home/vagrant/install.sh' | ||
rke2.env = %W[ #{external_env} INSTALL_RKE2_TYPE=server] | ||
rke2.config = <<~YAML | ||
token: 'vagrant' | ||
YAML | ||
rke2.config_mode = '0644' # side-step https://github.com/k3s-io/k3s/issues/4321 | ||
end | ||
test.vm.provision "rke2-wait-for-node", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh| | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
echo 'Waiting for node (and static pods) to be ready ...' | ||
time { | ||
timeout 240 bash -c 'while ! (kubectl wait --for condition=ready node/$(hostnamectl --static) 2>/dev/null); do sleep 5; done' | ||
timeout 240 bash -c 'while ! (kubectl wait --for condition=ready -n kube-system pod/etcd-$(hostnamectl --static) 2>/dev/null); do sleep 5; done' | ||
timeout 240 bash -c 'while ! (kubectl wait --for condition=ready -n kube-system pod/kube-apiserver-$(hostnamectl --static) 2>/dev/null); do sleep 5; done' | ||
timeout 240 bash -c 'while ! (kubectl wait --for condition=ready -n kube-system pod/kube-scheduler-$(hostnamectl --static) 2>/dev/null); do sleep 5; done' | ||
timeout 240 bash -c 'while ! (kubectl wait --for condition=ready -n kube-system pod/kube-proxy-$(hostnamectl --static) 2>/dev/null); do sleep 5; done' | ||
timeout 240 bash -c 'while ! (kubectl wait --for condition=ready -n kube-system pod/kube-controller-manager-$(hostnamectl --static) 2>/dev/null); do sleep 5; done' | ||
timeout 240 bash -c 'while ! (kubectl wait --for condition=ready -n kube-system pod/cloud-controller-manager-$(hostnamectl --static) 2>/dev/null); do sleep 5; done' | ||
} | ||
kubectl get node,all -A -o wide | ||
SHELL | ||
end | ||
test.vm.provision "rke2-wait-for-canal", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh| | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
time { | ||
timeout 240 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s daemonset/rke2-canal 2>/dev/null); do sleep 5; done' | ||
} | ||
SHELL | ||
end | ||
test.vm.provision "rke2-wait-for-coredns", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh| | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
time { | ||
timeout 240 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/rke2-coredns-rke2-coredns 2>/dev/null); do sleep 5; done' | ||
timeout 240 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/rke2-coredns-rke2-coredns-autoscaler 2>/dev/null); do sleep 5; done' | ||
} | ||
SHELL | ||
end | ||
test.vm.provision "rke2-wait-for-ingress-nginx", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh| | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
time { | ||
timeout 240 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s daemonset/rke2-ingress-nginx-controller 2>/dev/null); do sleep 5; done' | ||
} | ||
SHELL | ||
end | ||
test.vm.provision "rke2-wait-for-metrics-server", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh| | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
time { | ||
timeout 240 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/rke2-metrics-server 2>/dev/null); do sleep 5; done' | ||
} | ||
SHELL | ||
end | ||
test.vm.provision "rke2-status", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh| | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
set -eux -o pipefail | ||
kubectl get node,all -A -o wide | ||
SHELL | ||
end | ||
test.vm.provision "rke2-procps", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh| | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
set -eux -o pipefail | ||
ps auxZ | grep -E 'etcd|kube|rke2|container|spc_t|unconfined_t' | grep -v grep | ||
SHELL | ||
end | ||
end | ||
|
||
config.vm.provision "install-packages", type: "shell", run: "once" do |sh| | ||
sh.upload_path = "/tmp/vagrant-install-packages" | ||
sh.env = { | ||
'INSTALL_PACKAGES': ENV['INSTALL_PACKAGES'], | ||
} | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
set -eux -o pipefail | ||
zypper install -y \ | ||
curl \ | ||
iptables \ | ||
less \ | ||
lsof \ | ||
socat \ | ||
restorecond \ | ||
policycoreutils | ||
${INSTALL_PACKAGES} | ||
SHELL | ||
end | ||
|
||
config.vm.provision "selinux-status", type: "shell", run: "once", inline: "sestatus -v" | ||
config.vm.provision "rke2-profile-env", type: "shell", run: "once" do |sh| | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
cat <<-EOF > /etc/profile.d/rke2.sh | ||
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml PATH=/usr/local/bin:$PATH:/var/lib/rancher/rke2/bin | ||
EOF | ||
SHELL | ||
end | ||
|
||
end |