common

package
v0.7.0-beta2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Copyright 2020 Mirantis, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 Mirantis, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 Mirantis, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const DefaultTimeout = 9 * time.Minute // The default golang test timeout is 10mins

DefaultTimeout defines the default timeout for triggering custom teardown functionality

Variables

This section is empty.

Functions

func WaitForCalicoReady

func WaitForCalicoReady(kc *kubernetes.Clientset) error

WaitForCalicoReady waits to see all calico pods healthy

Types

type FootlooseSuite

type FootlooseSuite struct {
	suite.Suite

	Cluster *cluster.Cluster

	ControllerCount int
	WorkerCount     int
	ExtraVolumes    []config.Volume
	// contains filtered or unexported fields
}

FootlooseSuite defines all the common stuff we need to be able to run k0s testing on footloose

func (*FootlooseSuite) GetJoinToken

func (s *FootlooseSuite) GetJoinToken(role string) (string, error)

GetJoinToken generates join token for the asked role

func (*FootlooseSuite) InitMainController

func (s *FootlooseSuite) InitMainController() error

InitMainController inits first contorller assuming it's first controller in the cluster

func (*FootlooseSuite) JoinController

func (s *FootlooseSuite) JoinController(idx int, token string) error

JoinController joins the cluster with a given token

func (*FootlooseSuite) KubeClient

func (s *FootlooseSuite) KubeClient(node string) (*kubernetes.Clientset, error)

KubeClient return kube client by loading the admin access config from given node

func (*FootlooseSuite) MachineForName

func (s *FootlooseSuite) MachineForName(name string) (*cluster.Machine, error)

MachineForName gets the named machine details

func (*FootlooseSuite) RunWorkers

func (s *FootlooseSuite) RunWorkers() error

RunWorkers joins all the workers to the cluster

func (*FootlooseSuite) SSH

func (s *FootlooseSuite) SSH(node string) (*SSHConnection, error)

SSH establishes an SSH connection to the node

func (*FootlooseSuite) SetupSuite

func (s *FootlooseSuite) SetupSuite()

SetupSuite does all the setup work, namely boots up footloose cluster

func (*FootlooseSuite) TearDownSuite

func (s *FootlooseSuite) TearDownSuite()

TearDownSuite does the cleanup work, namely destroy the footloose boxes

func (*FootlooseSuite) WaitForKubeAPI

func (s *FootlooseSuite) WaitForKubeAPI(node string) error

WaitForKubeAPI waits until we see kube API online on given node. Timeouts with error return in 5 mins

func (*FootlooseSuite) WaitForNodeReady

func (s *FootlooseSuite) WaitForNodeReady(node string, kc *kubernetes.Clientset) error

WaitForNodeReady wait that we see the given node in "Ready" state in kubernetes API

type SSHConnection

type SSHConnection struct {
	Address string
	User    string
	Port    int
	KeyPath string
	// contains filtered or unexported fields
}

SSHConnection describes an SSH connection

func (*SSHConnection) Connect

func (c *SSHConnection) Connect() error

Connect opens the SSH connection

func (*SSHConnection) Disconnect

func (c *SSHConnection) Disconnect()

Disconnect closes the SSH connection

func (*SSHConnection) ExecWithOutput

func (c *SSHConnection) ExecWithOutput(cmd string) (string, error)

ExecWithOutput execs a command on the host and returns its output

type TerraformMachineData

type TerraformMachineData struct {
	Controllers struct {
		IP []string `json:"value"`
	} `json:"controller_external_ip"`
	Workers struct {
		IP []string `json:"value"`
	} `json:"worker_external_ip"`
}

TerraformMachineData is the Golang representation of the terraform output

type VMSuite

type VMSuite struct {
	suite.Suite

	ControllerIP string
	WorkerIPs    []string
	// contains filtered or unexported fields
}

VMSuite

func (*VMSuite) GetConfig

func (s *VMSuite) GetConfig()

func (*VMSuite) GetJoinToken

func (s *VMSuite) GetJoinToken(role string) (string, error)

GetJoinToken generates join token for the asked role

func (*VMSuite) InitMainController

func (s *VMSuite) InitMainController() error

InitMainController inits first contorller assuming it's first controller in the cluster

func (*VMSuite) KubeClient

func (s *VMSuite) KubeClient(node string) (*kubernetes.Clientset, error)

KubeClient return kube client by loading the admin access config from given node

func (*VMSuite) RunWorkers

func (s *VMSuite) RunWorkers() error

RunWorkers joins all the workers to the cluster

func (*VMSuite) SSH

func (s *VMSuite) SSH(ip string) (*SSHConnection, error)

SSH establishes an SSH connection to the node

func (*VMSuite) WaitForKubeAPI

func (s *VMSuite) WaitForKubeAPI(node string) error

WaitForKubeAPI waits until we see kube API online on given node. Timeouts with error return in 5 mins

func (*VMSuite) WaitForNodeReady

func (s *VMSuite) WaitForNodeReady(node string, kc *kubernetes.Clientset) error

WaitForNodeReady wait that we see the given node in "Ready" state in kubernetes API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL