Documentation ¶
Index ¶
- type HasInstance
- type OnNodeGroupCreateFunc
- type OnNodeGroupDeleteFunc
- type OnScaleDownFunc
- type OnScaleUpFunc
- type TestCloudProvider
- func NewTestAutoprovisioningCloudProvider(onScaleUp OnScaleUpFunc, onScaleDown OnScaleDownFunc, ...) *TestCloudProvider
- func NewTestCloudProvider(onScaleUp OnScaleUpFunc, onScaleDown OnScaleDownFunc) *TestCloudProvider
- func NewTestNodeDeletionDetectionCloudProvider(onScaleUp OnScaleUpFunc, onScaleDown OnScaleDownFunc, hasInstance HasInstance) *TestCloudProvider
- func (tcp *TestCloudProvider) AddAutoprovisionedNodeGroup(id string, min int, max int, size int, machineType string) *TestNodeGroup
- func (tcp *TestCloudProvider) AddNode(nodeGroupId string, node *apiv1.Node)
- func (tcp *TestCloudProvider) AddNodeGroup(id string, min int, max int, size int)
- func (tcp *TestCloudProvider) AddNodeGroupWithCustomOptions(id string, min int, max int, size int, ...)
- func (tcp *TestCloudProvider) AddUpcomingNodeGroup(id string, min int, max int, size int)
- func (tcp *TestCloudProvider) BuildNodeGroup(id string, min, max, size int, exists bool, autoprovisioned bool, ...) *TestNodeGroup
- func (tcp *TestCloudProvider) Cleanup() error
- func (tcp *TestCloudProvider) DeleteNode(node *apiv1.Node)
- func (tcp *TestCloudProvider) DeleteNodeGroup(id string)
- func (tcp *TestCloudProvider) GPULabel() string
- func (tcp *TestCloudProvider) GetAvailableGPUTypes() map[string]struct{}
- func (tcp *TestCloudProvider) GetAvailableMachineTypes() ([]string, error)
- func (tcp *TestCloudProvider) GetNodeGpuConfig(node *apiv1.Node) *cloudprovider.GpuConfig
- func (tcp *TestCloudProvider) GetNodeGroup(name string) cloudprovider.NodeGroup
- func (tcp *TestCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
- func (tcp *TestCloudProvider) HasInstance(node *apiv1.Node) (bool, error)
- func (tcp *TestCloudProvider) InsertNodeGroup(nodeGroup cloudprovider.NodeGroup)
- func (tcp *TestCloudProvider) Name() string
- func (tcp *TestCloudProvider) NewNodeGroup(machineType string, labels map[string]string, systemLabels map[string]string, ...) (cloudprovider.NodeGroup, error)
- func (tcp *TestCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.NodeGroup, error)
- func (tcp *TestCloudProvider) NodeGroups() []cloudprovider.NodeGroup
- func (tcp *TestCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError)
- func (tcp *TestCloudProvider) Refresh() error
- func (tcp *TestCloudProvider) SetPricingModel(priceModel cloudprovider.PricingModel)
- func (tcp *TestCloudProvider) SetResourceLimiter(resourceLimiter *cloudprovider.ResourceLimiter)
- type TestNodeGroup
- func (tng *TestNodeGroup) AtomicIncreaseSize(delta int) error
- func (tng *TestNodeGroup) Autoprovisioned() bool
- func (tng *TestNodeGroup) Create() (cloudprovider.NodeGroup, error)
- func (tng *TestNodeGroup) Debug() string
- func (tng *TestNodeGroup) DecreaseTargetSize(delta int) error
- func (tng *TestNodeGroup) Delete() error
- func (tng *TestNodeGroup) DeleteNodes(nodes []*apiv1.Node) error
- func (tng *TestNodeGroup) Exist() bool
- func (tng *TestNodeGroup) ForceDeleteNodes(nodes []*apiv1.Node) error
- func (tng *TestNodeGroup) GetOptions(defaults config.NodeGroupAutoscalingOptions) (*config.NodeGroupAutoscalingOptions, error)
- func (tng *TestNodeGroup) Id() string
- func (tng *TestNodeGroup) IncreaseSize(delta int) error
- func (tng *TestNodeGroup) Labels() map[string]string
- func (tng *TestNodeGroup) MachineType() string
- func (tng *TestNodeGroup) MaxSize() int
- func (tng *TestNodeGroup) MinSize() int
- func (tng *TestNodeGroup) Nodes() ([]cloudprovider.Instance, error)
- func (tng *TestNodeGroup) SetCloudProvider(provider *TestCloudProvider)
- func (tng *TestNodeGroup) SetOptions(opts *config.NodeGroupAutoscalingOptions)
- func (tng *TestNodeGroup) SetTargetSize(size int)
- func (tng *TestNodeGroup) Taints() []apiv1.Taint
- func (tng *TestNodeGroup) TargetSize() (int, error)
- func (tng *TestNodeGroup) TemplateNodeInfo() (*framework.NodeInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HasInstance ¶
HasInstance is a function called to determine if a node has been removed from the cloud provider.
type OnNodeGroupCreateFunc ¶
OnNodeGroupCreateFunc is a function called when a new node group is created.
type OnNodeGroupDeleteFunc ¶
OnNodeGroupDeleteFunc is a function called when a node group is deleted.
type OnScaleDownFunc ¶
OnScaleDownFunc is a function called on cluster scale down
type OnScaleUpFunc ¶
OnScaleUpFunc is a function called on node group increase in TestCloudProvider. First parameter is the NodeGroup id, second is the increase delta.
type TestCloudProvider ¶
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]*framework.NodeInfo) *TestCloudProvider
NewTestAutoprovisioningCloudProvider builds new TestCloudProvider with autoprovisioning support
func NewTestCloudProvider ¶
func NewTestCloudProvider(onScaleUp OnScaleUpFunc, onScaleDown OnScaleDownFunc) *TestCloudProvider
NewTestCloudProvider builds new TestCloudProvider
func NewTestNodeDeletionDetectionCloudProvider ¶
func NewTestNodeDeletionDetectionCloudProvider(onScaleUp OnScaleUpFunc, onScaleDown OnScaleDownFunc, hasInstance HasInstance) *TestCloudProvider
NewTestNodeDeletionDetectionCloudProvider builds new TestCloudProvider with deletion detection support
func (*TestCloudProvider) AddAutoprovisionedNodeGroup ¶
func (tcp *TestCloudProvider) AddAutoprovisionedNodeGroup(id string, min int, max int, size int, machineType string) *TestNodeGroup
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) AddNodeGroupWithCustomOptions ¶
func (tcp *TestCloudProvider) AddNodeGroupWithCustomOptions(id string, min int, max int, size int, opts *config.NodeGroupAutoscalingOptions)
AddNodeGroupWithCustomOptions adds node group with custom options to test cloud provider.
func (*TestCloudProvider) AddUpcomingNodeGroup ¶
func (tcp *TestCloudProvider) AddUpcomingNodeGroup(id string, min int, max int, size int)
AddUpcomingNodeGroup adds upcoming node group to test cloud provider.
func (*TestCloudProvider) BuildNodeGroup ¶
func (tcp *TestCloudProvider) BuildNodeGroup(id string, min, max, size int, exists bool, autoprovisioned bool, machineType string, opts *config.NodeGroupAutoscalingOptions) *TestNodeGroup
BuildNodeGroup returns a test node group.
func (*TestCloudProvider) Cleanup ¶
func (tcp *TestCloudProvider) Cleanup() error
Cleanup this is a function to close resources associated with the cloud provider
func (*TestCloudProvider) DeleteNode ¶
func (tcp *TestCloudProvider) DeleteNode(node *apiv1.Node)
DeleteNode delete the given node from the provider.
func (*TestCloudProvider) DeleteNodeGroup ¶
func (tcp *TestCloudProvider) DeleteNodeGroup(id string)
DeleteNodeGroup removes node group from test cloud provider.
func (*TestCloudProvider) GPULabel ¶
func (tcp *TestCloudProvider) GPULabel() string
GPULabel returns the label added to nodes with GPU resource.
func (*TestCloudProvider) GetAvailableGPUTypes ¶
func (tcp *TestCloudProvider) GetAvailableGPUTypes() map[string]struct{}
GetAvailableGPUTypes return all available GPU types cloud provider supports
func (*TestCloudProvider) GetAvailableMachineTypes ¶
func (tcp *TestCloudProvider) GetAvailableMachineTypes() ([]string, error)
GetAvailableMachineTypes get all machine types that can be requested from the cloud provider.
func (*TestCloudProvider) GetNodeGpuConfig ¶
func (tcp *TestCloudProvider) GetNodeGpuConfig(node *apiv1.Node) *cloudprovider.GpuConfig
GetNodeGpuConfig returns the label, type and resource name for the GPU added to node. If node doesn't have any GPUs, it returns nil.
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) HasInstance ¶
func (tcp *TestCloudProvider) HasInstance(node *apiv1.Node) (bool, error)
HasInstance returns true if the node has corresponding instance in cloud provider, or ErrNotImplemented to fall back to taint-based node deletion in clusterstate readiness calculation.
func (*TestCloudProvider) InsertNodeGroup ¶
func (tcp *TestCloudProvider) InsertNodeGroup(nodeGroup cloudprovider.NodeGroup)
InsertNodeGroup adds already created node group to test cloud provider.
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, taints []apiv1.Taint, 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 ¶
func (tcp *TestCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError)
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) SetPricingModel ¶
func (tcp *TestCloudProvider) SetPricingModel(priceModel cloudprovider.PricingModel)
SetPricingModel set given priceModel to test cloud provider
func (*TestCloudProvider) SetResourceLimiter ¶
func (tcp *TestCloudProvider) SetResourceLimiter(resourceLimiter *cloudprovider.ResourceLimiter)
SetResourceLimiter sets resource limiter.
type TestNodeGroup ¶
TestNodeGroup is a node group used by TestCloudProvider.
func NewTestNodeGroup ¶
func NewTestNodeGroup(id string, maxSize, minSize, targetSize int, exist, autoprovisioned bool, machineType string, labels map[string]string, taints []apiv1.Taint) *TestNodeGroup
NewTestNodeGroup creates a TestNodeGroup without setting up the realted TestCloudProvider. Useful for testing only.
func (*TestNodeGroup) AtomicIncreaseSize ¶
func (tng *TestNodeGroup) AtomicIncreaseSize(delta int) error
AtomicIncreaseSize is not implemented.
func (*TestNodeGroup) Autoprovisioned ¶
func (tng *TestNodeGroup) Autoprovisioned() bool
Autoprovisioned returns true if the node group is autoprovisioned.
func (*TestNodeGroup) Create ¶
func (tng *TestNodeGroup) Create() (cloudprovider.NodeGroup, 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) ForceDeleteNodes ¶
func (tng *TestNodeGroup) ForceDeleteNodes(nodes []*apiv1.Node) error
ForceDeleteNodes deletes nodes from the group regardless of constraints.
func (*TestNodeGroup) GetOptions ¶
func (tng *TestNodeGroup) GetOptions(defaults config.NodeGroupAutoscalingOptions) (*config.NodeGroupAutoscalingOptions, error)
GetOptions returns NodeGroupAutoscalingOptions that should be used for this particular NodeGroup. Returning a nil will result in using default options.
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) Labels ¶
func (tng *TestNodeGroup) Labels() map[string]string
Labels returns labels passed to the test node group when it was created.
func (*TestNodeGroup) MachineType ¶
func (tng *TestNodeGroup) MachineType() string
MachineType returns machine type passed to the test node group when it was created.
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() ([]cloudprovider.Instance, error)
Nodes returns a list of all nodes that belong to this node group.
func (*TestNodeGroup) SetCloudProvider ¶
func (tng *TestNodeGroup) SetCloudProvider(provider *TestCloudProvider)
SetCloudProvider sets the cloud provider for the node group.
func (*TestNodeGroup) SetOptions ¶
func (tng *TestNodeGroup) SetOptions(opts *config.NodeGroupAutoscalingOptions)
SetOptions allows changing options configured for TestNodeGroup.
func (*TestNodeGroup) SetTargetSize ¶
func (tng *TestNodeGroup) SetTargetSize(size int)
SetTargetSize sets target size for group. Function is used only in tests.
func (*TestNodeGroup) Taints ¶
func (tng *TestNodeGroup) Taints() []apiv1.Taint
Taints returns taintspassed to the test node group when it was created.
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() (*framework.NodeInfo, error)
TemplateNodeInfo returns a node template for this node group.