mirror of https://github.com/k3s-io/k3s
Improve tailscale test & add extra log in e2e tests
Signed-off-by: Manuel Buil <mbuil@suse.com>pull/10259/head
parent
d53cf93ad8
commit
331ce70666
|
@ -1,8 +1,8 @@
|
|||
ENV['VAGRANT_NO_PARALLEL'] = 'no'
|
||||
NODE_ROLES = (ENV['E2E_NODE_ROLES'] ||
|
||||
["server-0", "agent-0" ])
|
||||
["server-0", "agent-0", "agent-1" ])
|
||||
NODE_BOXES = (ENV['E2E_NODE_BOXES'] ||
|
||||
['generic/ubuntu2310', 'generic/ubuntu2310'])
|
||||
['generic/ubuntu2310', 'generic/ubuntu2310', 'generic/ubuntu2310'])
|
||||
GITHUB_BRANCH = (ENV['E2E_GITHUB_BRANCH'] || "master")
|
||||
RELEASE_VERSION = (ENV['E2E_RELEASE_VERSION'] || "")
|
||||
GOCOVER = (ENV['E2E_GOCOVER'] || "")
|
||||
|
@ -45,13 +45,25 @@ def provision(vm, roles, role_num, node_num)
|
|||
end
|
||||
end
|
||||
if roles.include?("agent")
|
||||
vpn_auth = nil
|
||||
vpn_auth_method = nil
|
||||
auth_info = "name=tailscale,joinKey=#{TAILSCALE_KEY}"
|
||||
if role_num == 0
|
||||
vpn_auth_method = "vpn-auth"
|
||||
vpn_auth = auth_info
|
||||
else
|
||||
vpn_auth_method = "vpn-auth-file"
|
||||
File.write("./vpn-auth-file", auth_info)
|
||||
vm.provision "file", source: "./vpn-auth-file", destination: "/home/vagrant/vpn-auth-file"
|
||||
vpn_auth = "/home/vagrant/vpn-auth-file"
|
||||
end
|
||||
vm.provision :k3s, run: 'once' do |k3s|
|
||||
k3s.config_mode = '0644' # side-step https://github.com/k3s-io/k3s/issues/4321
|
||||
k3s.args = "agent "
|
||||
k3s.config = <<~YAML
|
||||
server: https://TAILSCALEIP:6443
|
||||
token: vagrant
|
||||
vpn-auth: "name=tailscale,joinKey=#{TAILSCALE_KEY}"
|
||||
#{vpn_auth_method}: #{vpn_auth}
|
||||
YAML
|
||||
k3s.env = ["K3S_KUBECONFIG_MODE=0644", "INSTALL_K3S_SKIP_START=true", install_type]
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
// Valid nodeOS: generic/ubuntu2310, opensuse/Leap-15.3.x86_64
|
||||
var nodeOS = flag.String("nodeOS", "generic/ubuntu2310", "VM operating system")
|
||||
var serverCount = flag.Int("serverCount", 1, "number of server nodes")
|
||||
var agentCount = flag.Int("agentCount", 1, "number of agent nodes")
|
||||
var agentCount = flag.Int("agentCount", 2, "number of agent nodes")
|
||||
var ci = flag.Bool("ci", false, "running on CI")
|
||||
var local = flag.Bool("local", false, "deploy a locally built K3s binary")
|
||||
|
||||
|
@ -82,6 +82,7 @@ var _ = Describe("Verify Tailscale Configuration", Ordered, func() {
|
|||
Eventually(func(g Gomega) {
|
||||
nodes, err := e2e.ParseNodes(kubeConfigFile, false)
|
||||
g.Expect(err).NotTo(HaveOccurred())
|
||||
g.Expect(len(nodes)).To(Equal(*agentCount + *serverCount))
|
||||
for _, node := range nodes {
|
||||
g.Expect(node.Status).Should(Equal("Ready"))
|
||||
}
|
||||
|
|
|
@ -121,6 +121,7 @@ func CreateCluster(nodeOS string, serverCount, agentCount int) ([]string, []stri
|
|||
errg, _ := errgroup.WithContext(context.Background())
|
||||
for _, node := range append(serverNodeNames[1:], agentNodeNames...) {
|
||||
cmd := fmt.Sprintf(`%s %s vagrant up %s &>> vagrant.log`, nodeEnvs, testOptions, node)
|
||||
fmt.Println(cmd)
|
||||
errg.Go(func() error {
|
||||
if _, err := RunCommand(cmd); err != nil {
|
||||
return newNodeError(cmd, node, err)
|
||||
|
|
Loading…
Reference in New Issue