test

package
v0.0.0-...-6b2d771 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OnNodeGroupCreateFunc

type OnNodeGroupCreateFunc func(string) error

OnNodeGroupCreateFunc is a fuction called when a new node group is created.

type OnNodeGroupDeleteFunc

type OnNodeGroupDeleteFunc func(string) error

OnNodeGroupDeleteFunc is a function called when a node group is deleted.

type OnScaleDownFunc

type OnScaleDownFunc func(string, string) error

OnScaleDownFunc is a function called on cluster scale down

type OnScaleUpFunc

type OnScaleUpFunc func(string, int) error

OnScaleUpFunc is a function called on node group increase in TestCloudProvider. First parameter is the NodeGroup id, second is the increase delta.

type TestCloudProvider

type TestCloudProvider struct {
	sync.Mutex
	// contains filtered or unexported fields
}

TestCloudProvider is a dummy cloud provider to be used in tests.

func NewTestAutoprovisioningCloudProvider

func NewTestAutoprovisioningCloudProvider(onScaleUp OnScaleUpFunc, onScaleDown OnScaleDownFunc,
	onNodeGroupCreate OnNodeGroupCreateFunc, onNodeGroupDelete OnNodeGroupDeleteFunc,
	machineTypes []string, machineTemplates map[string]*schedulercache.NodeInfo) *TestCloudProvider

NewTestAutoprovisioningCloudProvider builds new TestCloudProvider with autoprovisioning support

func NewTestCloudProvider

func NewTestCloudProvider(onScaleUp OnScaleUpFunc, onScaleDown OnScaleDownFunc) *TestCloudProvider

NewTestCloudProvider builds new TestCloudProvider

func (*TestCloudProvider) AddAutoprovisionedNodeGroup

func (tcp *TestCloudProvider) AddAutoprovisionedNodeGroup(id string, min int, max int, size int, machineType string)

AddAutoprovisionedNodeGroup adds node group to test cloud provider.

func (*TestCloudProvider) AddNode

func (tcp *TestCloudProvider) AddNode(nodeGroupId string, node *apiv1.Node)

AddNode adds the given node to the group.

func (*TestCloudProvider) AddNodeGroup

func (tcp *TestCloudProvider) AddNodeGroup(id string, min int, max int, size int)

AddNodeGroup adds node group to test cloud provider.

func (*TestCloudProvider) Cleanup

func (tcp *TestCloudProvider) Cleanup() error

Cleanup this is a function to close resources associated with the cloud provider

func (*TestCloudProvider) GetAvailableMachineTypes

func (tcp *TestCloudProvider) GetAvailableMachineTypes() ([]string, error)

GetAvailableMachineTypes get all machine types that can be requested from the cloud provider.

func (*TestCloudProvider) GetNodeGroup

func (tcp *TestCloudProvider) GetNodeGroup(name string) cloudprovider.NodeGroup

GetNodeGroup returns node group with the given name.

func (*TestCloudProvider) GetResourceLimiter

func (tcp *TestCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)

GetResourceLimiter returns struct containing limits (max, min) for resources (cores, memory etc.).

func (*TestCloudProvider) Name

func (tcp *TestCloudProvider) Name() string

Name returns name of the cloud provider.

func (*TestCloudProvider) NewNodeGroup

func (tcp *TestCloudProvider) NewNodeGroup(machineType string, labels map[string]string, systemLabels map[string]string,
	extraResources map[string]resource.Quantity) (cloudprovider.NodeGroup, error)

NewNodeGroup builds a theoretical node group based on the node definition provided. The node group is not automatically created on the cloud provider side. The node group is not returned by NodeGroups() until it is created.

func (*TestCloudProvider) NodeGroupForNode

func (tcp *TestCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.NodeGroup, error)

NodeGroupForNode returns the node group for the given node, nil if the node should not be processed by cluster autoscaler, or non-nil error if such occurred.

func (*TestCloudProvider) NodeGroups

func (tcp *TestCloudProvider) NodeGroups() []cloudprovider.NodeGroup

NodeGroups returns all node groups configured for this cloud provider.

func (*TestCloudProvider) Pricing

Pricing returns pricing model for this cloud provider or error if not available.

func (*TestCloudProvider) Refresh

func (tcp *TestCloudProvider) Refresh() error

Refresh is called before every main loop and can be used to dynamically update cloud provider state. In particular the list of node groups returned by NodeGroups can change as a result of CloudProvider.Refresh().

func (*TestCloudProvider) SetResourceLimiter

func (tcp *TestCloudProvider) SetResourceLimiter(resourceLimiter *cloudprovider.ResourceLimiter)

SetResourceLimiter sets resource limiter.

type TestNodeGroup

type TestNodeGroup struct {
	sync.Mutex
	// contains filtered or unexported fields
}

TestNodeGroup is a node group used by TestCloudProvider.

func (*TestNodeGroup) Autoprovisioned

func (tng *TestNodeGroup) Autoprovisioned() bool

Autoprovisioned returns true if the node group is autoprovisioned.

func (*TestNodeGroup) Create

func (tng *TestNodeGroup) Create() error

Create creates the node group on the cloud provider side.

func (*TestNodeGroup) Debug

func (tng *TestNodeGroup) Debug() string

Debug returns a string containing all information regarding this node group.

func (*TestNodeGroup) DecreaseTargetSize

func (tng *TestNodeGroup) DecreaseTargetSize(delta int) error

DecreaseTargetSize decreases the target size of the node group. This function doesn't permit to delete any existing node and can be used only to reduce the request for new nodes that have not been yet fulfilled. Delta should be negative.

func (*TestNodeGroup) Delete

func (tng *TestNodeGroup) Delete() error

Delete deletes the node group on the cloud provider side. This will be executed only for autoprovisioned node groups, once their size drops to 0.

func (*TestNodeGroup) DeleteNodes

func (tng *TestNodeGroup) DeleteNodes(nodes []*apiv1.Node) error

DeleteNodes deletes nodes from this node group. Error is returned either on failure or if the given node doesn't belong to this node group. This function should wait until node group size is updated.

func (*TestNodeGroup) Exist

func (tng *TestNodeGroup) Exist() bool

Exist checks if the node group really exists on the cloud provider side. Allows to tell the theoretical node group from the real one.

func (*TestNodeGroup) Id

func (tng *TestNodeGroup) Id() string

Id returns an unique identifier of the node group.

func (*TestNodeGroup) IncreaseSize

func (tng *TestNodeGroup) IncreaseSize(delta int) error

IncreaseSize increases the size of the node group. To delete a node you need to explicitly name it and use DeleteNode. This function should wait until node group size is updated.

func (*TestNodeGroup) MaxSize

func (tng *TestNodeGroup) MaxSize() int

MaxSize returns maximum size of the node group.

func (*TestNodeGroup) MinSize

func (tng *TestNodeGroup) MinSize() int

MinSize returns minimum size of the node group.

func (*TestNodeGroup) Nodes

func (tng *TestNodeGroup) Nodes() ([]string, error)

Nodes returns a list of all nodes that belong to this node group.

func (*TestNodeGroup) SetTargetSize

func (tng *TestNodeGroup) SetTargetSize(size int)

SetTargetSize sets target size for group. Function is used only in tests.

func (*TestNodeGroup) TargetSize

func (tng *TestNodeGroup) TargetSize() (int, error)

TargetSize returns the current target size of the node group. It is possible that the number of nodes in Kubernetes is different at the moment but should be equal to Size() once everything stabilizes (new nodes finish startup and registration or removed nodes are deleted completely)

func (*TestNodeGroup) TemplateNodeInfo

func (tng *TestNodeGroup) TemplateNodeInfo() (*schedulercache.NodeInfo, error)

TemplateNodeInfo returns a node template for this node group.

Jump to

Keyboard shortcuts

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