Documentation ¶
Index ¶
- func BuildFakeClient(nodes []*corev1.Node, pods []*corev1.Pod) (*fake.Clientset, <-chan string)
- func BuildTestNode(opts NodeOpts) *corev1.Node
- func BuildTestNodes(amount int, opts NodeOpts) []*corev1.Node
- func BuildTestPod(opts PodOpts) *corev1.Pod
- func BuildTestPods(amount int, opts PodOpts) []*corev1.Pod
- func NameFromChan(c <-chan string, timeout time.Duration) string
- func NewTestNodeWatcher(nodes []*v1.Node, opts NodeListerOptions) *nodeLister
- func NewTestPodWatcher(pods []*v1.Pod, opts PodListerOptions) *podLister
- type FlatScenario
- type MockAutoscalingService
- func (m MockAutoscalingService) DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGroupsInput) (*autoscaling.DescribeAutoScalingGroupsOutput, error)
- func (m MockAutoscalingService) SetDesiredCapacity(*autoscaling.SetDesiredCapacityInput) (*autoscaling.SetDesiredCapacityOutput, error)
- func (m MockAutoscalingService) TerminateInstanceInAutoScalingGroup(*autoscaling.TerminateInstanceInAutoScalingGroupInput) (*autoscaling.TerminateInstanceInAutoScalingGroupOutput, error)
- type MockEc2Service
- type NodeListerOptions
- type NodeOpts
- type PodListerOptions
- type PodOpts
- type Scenario
- type ScenarioOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFakeClient ¶
BuildFakeClient creates a fake client
func BuildTestNode ¶
BuildTestNode creates a node with specified capacity.
func BuildTestNodes ¶
BuildTestNodes creates multiple nodes with the same options
func BuildTestPod ¶
BuildTestPod builds a pod for testing
func BuildTestPods ¶
BuildTestPods creates multiple pods with the same options
func NameFromChan ¶
NameFromChan returns a name from a channel update fails if timeout
func NewTestNodeWatcher ¶
func NewTestNodeWatcher(nodes []*v1.Node, opts NodeListerOptions) *nodeLister
NewTestNodeWatcher creates a new mock NodeLister with the given nodes and options
func NewTestPodWatcher ¶
func NewTestPodWatcher(pods []*v1.Pod, opts PodListerOptions) *podLister
NewTestPodWatcher creates a new test PodLister with given pods and options
Types ¶
type FlatScenario ¶
type FlatScenario struct { Nodegroups []*atlassianv1.NodeGroup Nodes []*corev1.Node Pods []*corev1.Pod Daemonsets []*appsv1.DaemonSet ControllerRevisions []*appsv1.ControllerRevision }
FlatScenario is a scenario of nodegroups and related components flatted into a single list
func FlattenScenario ¶
func FlattenScenario(scenario *Scenario, includeKeys ...string) *FlatScenario
FlattenScenario turns a Scenario into a FlatScenario
func (*FlatScenario) NodeGroupList ¶
func (f *FlatScenario) NodeGroupList() atlassianv1.NodeGroupList
type MockAutoscalingService ¶
type MockAutoscalingService struct { autoscalingiface.AutoScalingAPI *client.Client DescribeAutoScalingGroupsOutput *autoscaling.DescribeAutoScalingGroupsOutput DescribeAutoScalingGroupsErr error SetDesiredCapacityOutput *autoscaling.SetDesiredCapacityOutput SetDesiredCapacityErr error TerminateInstanceInAutoScalingGroupOutput *autoscaling.TerminateInstanceInAutoScalingGroupOutput TerminateInstanceInAutoScalingGroupErr error }
MockAutoscalingService is a mock implementation of a cloud provider interface
func (MockAutoscalingService) DescribeAutoScalingGroups ¶
func (m MockAutoscalingService) DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGroupsInput) (*autoscaling.DescribeAutoScalingGroupsOutput, error)
DescribeAutoScalingGroups mock implementation for MockAutoscalingService
func (MockAutoscalingService) SetDesiredCapacity ¶
func (m MockAutoscalingService) SetDesiredCapacity(*autoscaling.SetDesiredCapacityInput) (*autoscaling.SetDesiredCapacityOutput, error)
SetDesiredCapacity mock implementation for MockAutoscalingService
func (MockAutoscalingService) TerminateInstanceInAutoScalingGroup ¶
func (m MockAutoscalingService) TerminateInstanceInAutoScalingGroup(*autoscaling.TerminateInstanceInAutoScalingGroupInput) (*autoscaling.TerminateInstanceInAutoScalingGroupOutput, error)
TerminateInstanceInAutoScalingGroup mock implementation for MockAutoscalingService
type MockEc2Service ¶
type MockEc2Service struct { ec2iface.EC2API *client.Client DescribeInstancesOutput *ec2.DescribeInstancesOutput DescribeInstancesErr error }
MockEc2Service mocks the EC2API for DescribeInstances
func (MockEc2Service) DescribeInstances ¶
func (m MockEc2Service) DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
DescribeInstances mock implementation for MockAutoscalingService
type NodeListerOptions ¶
type NodeListerOptions struct {
ReturnErrorOnList bool
}
NodeListerOptions options for creating test NodeLister
type NodeOpts ¶
type NodeOpts struct { Name string CPU int64 Mem int64 LabelKey string LabelValue string Creation time.Time Tainted bool }
NodeOpts minimal options for configuring a node object in testing
type PodListerOptions ¶
type PodListerOptions struct {
ReturnErrorOnList bool
}
PodListerOptions for creating a new test PodLister
type PodOpts ¶
type PodOpts struct { Name string Namespace string CPU []int64 Mem []int64 NodeSelectorKey string NodeSelectorValue string Owner string OwnerName string NodeAffinityKey string NodeAffinityValue string NodeAffinityOp corev1.NodeSelectorOperator NodeName string }
PodOpts are options for a pod
type Scenario ¶
type Scenario struct { Nodegroups map[string]*atlassianv1.NodeGroup Nodes map[string][]*corev1.Node Pods map[string][]*corev1.Pod Daemonsets map[string][]*appsv1.DaemonSet ControllerRevisions map[string][]*appsv1.ControllerRevision }
Scenario is a scenario of nodegroups and related components as a map to list
func BuildTestScenario ¶
func BuildTestScenario(opts ScenarioOpts) *Scenario
BuildTestScenario from a ScenarioOpts
func (*Scenario) Flatten ¶
func (s *Scenario) Flatten() *FlatScenario