Documentation
¶
Overview ¶
Copyright 2021 k0s authors
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 2021 k0s authors ¶
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 2021 k0s authors ¶
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
- func WaitForCalicoReady(kc *kubernetes.Clientset) error
- func WaitForMetricsReady(c *rest.Config) error
- type FootlooseSuite
- func (s *FootlooseSuite) ControllerNode(idx int) string
- func (s *FootlooseSuite) GetFileFromController(controllerIdx int, path string) string
- func (s *FootlooseSuite) GetHTTPStatus(node string, port int, path string) (int, error)
- func (s *FootlooseSuite) GetJoinToken(role string, extraArgs ...string) (string, error)
- func (s *FootlooseSuite) GetKubeConfig(node string, k0sKubeconfigArgs ...string) (*rest.Config, error)
- func (s *FootlooseSuite) GetNodeLabels(node string, kc *kubernetes.Clientset) (map[string]string, error)
- func (s *FootlooseSuite) InitController(idx int, k0sArgs ...string) error
- func (s *FootlooseSuite) KubeClient(node string, k0sKubeconfigArgs ...string) (*kubernetes.Clientset, error)
- func (s *FootlooseSuite) MachineForName(name string) (*cluster.Machine, error)
- func (s *FootlooseSuite) PutFile(node, path, content string)
- func (s *FootlooseSuite) RunWorkers(args ...string) error
- func (s *FootlooseSuite) SSH(node string) (*SSHConnection, error)
- func (s *FootlooseSuite) SetupSuite()
- func (s *FootlooseSuite) TearDownSuite()
- func (s *FootlooseSuite) WaitForKubeAPI(node string, k0sKubeconfigArgs ...string) error
- func (s *FootlooseSuite) WaitForNodeReady(node string, kc *kubernetes.Clientset) error
- func (s *FootlooseSuite) WaitJoinAPI(node string) error
- func (s *FootlooseSuite) WorkerNode(idx int) string
- type SSHConnection
- type TerraformMachineData
- type VMSuite
- func (s *VMSuite) GetConfig()
- func (s *VMSuite) GetJoinToken(role string) (string, error)
- func (s *VMSuite) InitMainController() error
- func (s *VMSuite) KubeClient(node string) (*kubernetes.Clientset, error)
- func (s *VMSuite) RunWorkers() error
- func (s *VMSuite) SSH(ip string) (*SSHConnection, error)
- func (s *VMSuite) WaitForKubeAPI(node string) error
- func (s *VMSuite) WaitForNodeReady(node string, kc *kubernetes.Clientset) error
Constants ¶
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
func WaitForMetricsReady ¶ added in v0.12.0
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) ControllerNode ¶ added in v0.12.1
func (s *FootlooseSuite) ControllerNode(idx int) string
ControllerNode gets the node name of given controller index
func (*FootlooseSuite) GetFileFromController ¶
func (s *FootlooseSuite) GetFileFromController(controllerIdx int, path string) string
GetFile gets file from the controller with given index
func (*FootlooseSuite) GetHTTPStatus ¶ added in v0.12.1
func (*FootlooseSuite) GetJoinToken ¶
func (s *FootlooseSuite) GetJoinToken(role string, extraArgs ...string) (string, error)
GetJoinToken generates join token for the asked role
func (*FootlooseSuite) GetKubeConfig ¶ added in v0.12.1
func (s *FootlooseSuite) GetKubeConfig(node string, k0sKubeconfigArgs ...string) (*rest.Config, error)
KubeClient return kube client by loading the admin access config from given node
func (*FootlooseSuite) GetNodeLabels ¶ added in v0.11.0
func (s *FootlooseSuite) GetNodeLabels(node string, kc *kubernetes.Clientset) (map[string]string, error)
GetNodeLabels return the labels of given node
func (*FootlooseSuite) InitController ¶ added in v0.12.1
func (s *FootlooseSuite) InitController(idx int, k0sArgs ...string) error
InitController initializes a controller
func (*FootlooseSuite) KubeClient ¶
func (s *FootlooseSuite) KubeClient(node string, k0sKubeconfigArgs ...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) PutFile ¶ added in v0.12.1
func (s *FootlooseSuite) PutFile(node, path, content string)
PutFile writes content to file on given node
func (*FootlooseSuite) RunWorkers ¶
func (s *FootlooseSuite) RunWorkers(args ...string) 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, k0sKubeconfigArgs ...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
func (*FootlooseSuite) WaitJoinAPI ¶ added in v0.12.1
func (s *FootlooseSuite) WaitJoinAPI(node string) error
WaitJoinApi waits untill we see k0s join api up-and-running on a given node Timeouts with error return in 5 mins
func (*FootlooseSuite) WorkerNode ¶ added in v0.12.1
func (s *FootlooseSuite) WorkerNode(idx int) string
WorkerNode gets the node name of given worker index
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) GetJoinToken ¶
GetJoinToken generates join token for the asked role
func (*VMSuite) InitMainController ¶
InitMainController inits first controller 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 ¶
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 ¶
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