Documentation
¶
Index ¶
- Constants
- func MergeSecurityGroups(cloudSG SecurityGroup, specPorts []InstancePort, specSourceRanges []string) ([]IngressRule, []IngressRule)
- func SortImagesByCreationTime(images []Image)
- func ToSaneVolumeSize(volSizeSpec string) int32
- type BootImageSpec
- type CloudAttributes
- type CloudClient
- type CloudInstance
- type ContainerInstance
- type Image
- type IngressRule
- type InstancePort
- type LoadBalancer
- type MockCloudClient
- func (m *MockCloudClient) AddIAMPermissions(node *api.Node, permissions string) error
- func (m *MockCloudClient) AddInstanceTags(string, map[string]string) error
- func (e *MockCloudClient) AddInstances(insts ...CloudInstance)
- func (e *MockCloudClient) AddRoute(destinationCIDR, instanceID string) error
- func (m *MockCloudClient) AttachSecurityGroups(node *api.Node, groups []string) error
- func (e *MockCloudClient) ConnectWithPublicIPs() bool
- func (e *MockCloudClient) CreateSGName(svcName string) string
- func (m *MockCloudClient) EnsureContainerInstanceCluster() error
- func (c *MockCloudClient) EnsureMilpaSecurityGroups([]string, []string) error
- func (m *MockCloudClient) GetAttributes() CloudAttributes
- func (m *MockCloudClient) GetBootSecurityGroupIDs() []string
- func (m *MockCloudClient) GetContainerInstancesStatuses(instIDs []string) (map[string][]api.UnitStatus, error)
- func (e *MockCloudClient) GetDNSInfo() ([]string, []string, error)
- func (m *MockCloudClient) GetImage(spec BootImageSpec) (Image, error)
- func (m *MockCloudClient) GetRegistryAuth(image string) (string, string, error)
- func (e *MockCloudClient) GetVPCCIDRs() []string
- func (c *MockCloudClient) IsAvailable() (bool, error)
- func (m *MockCloudClient) ListContainerInstances() ([]ContainerInstance, error)
- func (m *MockCloudClient) ListContainerInstancesFilterID(insts []string) ([]ContainerInstance, error)
- func (c *MockCloudClient) ListInstances() ([]CloudInstance, error)
- func (c *MockCloudClient) ListInstancesFilterID(iid []string) ([]CloudInstance, error)
- func (e *MockCloudClient) ModifySourceDestinationCheck(iid string, enable bool) error
- func (e *MockCloudClient) RemoveRoute(destinationCIDR, nextHop string) error
- func (m *MockCloudClient) ResizeVolume(node *api.Node, size int64) (error, bool)
- func (m *MockCloudClient) SetBootSecurityGroupIDs([]string)
- func (m *MockCloudClient) SetSustainedCPU(n *api.Node, enabled bool) error
- func (m *MockCloudClient) StartContainerInstance(pod *api.Pod) (string, error)
- func (m *MockCloudClient) StartNode(node *api.Node, image Image, metadata string) (string, error)
- func (m *MockCloudClient) StartSpotNode(node *api.Node, image Image, metadata string) (string, error)
- func (m *MockCloudClient) StopContainerInstance(instID string) error
- func (m *MockCloudClient) StopInstance(instanceID string) error
- func (m *MockCloudClient) WaitForContainerInstanceRunning(pod *api.Pod) (*api.Pod, error)
- func (m *MockCloudClient) WaitForRunning(node *api.Node) ([]api.NetworkAddress, error)
- type NoCapacityError
- type SecurityGroup
- type SecurityGroupIdentifier
- type SortableSliceOfPorts
- type SubnetAddressAffinity
- type SubnetAttributes
- type UnsupportedInstanceError
Constants ¶
View Source
const ControllerTagKey = "KipControllerID"
View Source
const MilpaAPISGName = "CellSecurityGroup"
View Source
const NameTagKey = "Name"
View Source
const NamespaceTagKey = "KipNamespace"
View Source
const NametagTagKey = "KipNametag"
View Source
const PodNameTagKey = "KipPodName"
View Source
const ProviderAWS = "aws"
View Source
const ProviderAzure = "azure"
View Source
const ProviderGCE = "gce"
View Source
const PublicCIDR = "0.0.0.0/0"
View Source
const RestAPIPort = 6421
Variables ¶
This section is empty.
Functions ¶
func MergeSecurityGroups ¶
func MergeSecurityGroups(cloudSG SecurityGroup, specPorts []InstancePort, specSourceRanges []string) ([]IngressRule, []IngressRule)
func SortImagesByCreationTime ¶
func SortImagesByCreationTime(images []Image)
func ToSaneVolumeSize ¶
Types ¶
type BootImageSpec ¶
func (*BootImageSpec) String ¶
func (bis *BootImageSpec) String() string
type CloudAttributes ¶
type CloudClient ¶
type CloudClient interface {
SetBootSecurityGroupIDs([]string)
GetBootSecurityGroupIDs() []string
StartNode(*api.Node, Image, string) (string, error)
StartSpotNode(*api.Node, Image, string) (string, error)
// This should always be called from a goroutine as it can take a while
StopInstance(instanceID string) error
WaitForRunning(node *api.Node) ([]api.NetworkAddress, error)
EnsureMilpaSecurityGroups([]string, []string) error
AttachSecurityGroups(node *api.Node, groups []string) error
AddIAMPermissions(node *api.Node, permissions string) error
ListInstancesFilterID([]string) ([]CloudInstance, error)
ListInstances() ([]CloudInstance, error)
ResizeVolume(node *api.Node, size int64) (error, bool)
GetRegistryAuth(string) (string, string, error)
GetImage(spec BootImageSpec) (Image, error)
SetSustainedCPU(*api.Node, bool) error
AddInstanceTags(string, map[string]string) error
ConnectWithPublicIPs() bool
ModifySourceDestinationCheck(string, bool) error
RemoveRoute(string, string) error
AddRoute(string, string) error
GetVPCCIDRs() []string
GetDNSInfo() ([]string, []string, error)
GetAttributes() CloudAttributes
IsAvailable() (bool, error)
}
type CloudInstance ¶
type ContainerInstance ¶
type ContainerInstance struct {
ID string
}
type IngressRule ¶
Diffing rules got a little nasty... We take the cross of the service ports and sourceRanges and each value becomes an IngressRule
func MakeIngressRules ¶
func MakeIngressRules(ports []InstancePort, sourceRanges []string) []IngressRule
func NewIngressRule ¶
func NewIngressRule(port InstancePort, source string) IngressRule
type InstancePort ¶
type InstancePort struct {
// Name of the Service port.
Name string `json:"name"`
// Protocol. Can be "TCP", "UDP" or "ICMP".
Protocol api.Protocol `json:"protocol"`
// Port number. Not used for "ICMP".
Port int `json:"port"`
// portRangeSize is the contiguous ports number that are exposed
// by this service. Given port = 80 and portRangeSize = 100, the
// InstancePort will represent a range of ports from 80-179 (100
// ports in total). In this case, port means the starting port of
// a range.
PortRangeSize int `json:"portRangeSize,omitempty"`
}
Service port definition. This is a TCP or UDP port that a Service uses.
type LoadBalancer ¶
type MockCloudClient ¶
type MockCloudClient struct {
Instances map[string]CloudInstance
ContainerInstances map[string]ContainerInstance
ControllerID string
InsideVPC bool
VPCCIDRs []string
Subnet SubnetAttributes
Starter func(node *api.Node, image Image, metadata string) (string, error)
SpotStarter func(node *api.Node, image Image, metadata string) (string, error)
Stopper func(instanceID string) error
Waiter func(node *api.Node) ([]api.NetworkAddress, error)
Lister func() ([]CloudInstance, error)
Resizer func(node *api.Node, size int64) (error, bool)
ContainerAuthorizer func(string) (string, string, error)
ImageGetter func(BootImageSpec) (Image, error)
InstanceListerFilter func([]string) ([]CloudInstance, error)
InstanceLister func() ([]CloudInstance, error)
DNSInfoGetter func() ([]string, []string, error)
RouteRemover func(string, string) error
RouteAdder func(string, string) error
AvailabilityChecker func() (bool, error)
// Container Instance Funcs
ContainerClusterEnsurer func() error
ContainerInstanceLister func() ([]ContainerInstance, error)
ContainerInstanceListerFilter func(instIDs []string) ([]ContainerInstance, error)
ContainerInstancesStatusesGetter func(instIDs []string) (map[string][]api.UnitStatus, error)
ContainerInstanceRunner func(*api.Pod) (string, error)
ContainerInstanceStopper func(string) error
ContainerInstanceWaiter func(*api.Pod) (*api.Pod, error)
}
func NewMockClient ¶
func NewMockClient() *MockCloudClient
func (*MockCloudClient) AddIAMPermissions ¶ added in v0.0.15
func (m *MockCloudClient) AddIAMPermissions(node *api.Node, permissions string) error
func (*MockCloudClient) AddInstanceTags ¶
func (m *MockCloudClient) AddInstanceTags(string, map[string]string) error
func (*MockCloudClient) AddInstances ¶
func (e *MockCloudClient) AddInstances(insts ...CloudInstance)
func (*MockCloudClient) AddRoute ¶
func (e *MockCloudClient) AddRoute(destinationCIDR, instanceID string) error
func (*MockCloudClient) AttachSecurityGroups ¶
func (m *MockCloudClient) AttachSecurityGroups(node *api.Node, groups []string) error
func (*MockCloudClient) ConnectWithPublicIPs ¶
func (e *MockCloudClient) ConnectWithPublicIPs() bool
func (*MockCloudClient) CreateSGName ¶
func (e *MockCloudClient) CreateSGName(svcName string) string
func (*MockCloudClient) EnsureContainerInstanceCluster ¶
func (m *MockCloudClient) EnsureContainerInstanceCluster() error
func (*MockCloudClient) EnsureMilpaSecurityGroups ¶
func (c *MockCloudClient) EnsureMilpaSecurityGroups([]string, []string) error
func (*MockCloudClient) GetAttributes ¶
func (m *MockCloudClient) GetAttributes() CloudAttributes
func (*MockCloudClient) GetBootSecurityGroupIDs ¶
func (m *MockCloudClient) GetBootSecurityGroupIDs() []string
func (*MockCloudClient) GetContainerInstancesStatuses ¶
func (m *MockCloudClient) GetContainerInstancesStatuses(instIDs []string) (map[string][]api.UnitStatus, error)
func (*MockCloudClient) GetDNSInfo ¶
func (e *MockCloudClient) GetDNSInfo() ([]string, []string, error)
func (*MockCloudClient) GetImage ¶ added in v0.0.3
func (m *MockCloudClient) GetImage(spec BootImageSpec) (Image, error)
func (*MockCloudClient) GetRegistryAuth ¶
func (m *MockCloudClient) GetRegistryAuth(image string) (string, string, error)
func (*MockCloudClient) GetVPCCIDRs ¶
func (e *MockCloudClient) GetVPCCIDRs() []string
func (*MockCloudClient) IsAvailable ¶
func (c *MockCloudClient) IsAvailable() (bool, error)
func (*MockCloudClient) ListContainerInstances ¶
func (m *MockCloudClient) ListContainerInstances() ([]ContainerInstance, error)
func (*MockCloudClient) ListContainerInstancesFilterID ¶
func (m *MockCloudClient) ListContainerInstancesFilterID(insts []string) ([]ContainerInstance, error)
func (*MockCloudClient) ListInstances ¶
func (c *MockCloudClient) ListInstances() ([]CloudInstance, error)
func (*MockCloudClient) ListInstancesFilterID ¶
func (c *MockCloudClient) ListInstancesFilterID(iid []string) ([]CloudInstance, error)
func (*MockCloudClient) ModifySourceDestinationCheck ¶
func (e *MockCloudClient) ModifySourceDestinationCheck(iid string, enable bool) error
func (*MockCloudClient) RemoveRoute ¶
func (e *MockCloudClient) RemoveRoute(destinationCIDR, nextHop string) error
func (*MockCloudClient) ResizeVolume ¶
func (*MockCloudClient) SetBootSecurityGroupIDs ¶
func (m *MockCloudClient) SetBootSecurityGroupIDs([]string)
func (*MockCloudClient) SetSustainedCPU ¶
func (m *MockCloudClient) SetSustainedCPU(n *api.Node, enabled bool) error
func (*MockCloudClient) StartContainerInstance ¶
func (m *MockCloudClient) StartContainerInstance(pod *api.Pod) (string, error)
func (*MockCloudClient) StartSpotNode ¶
func (*MockCloudClient) StopContainerInstance ¶
func (m *MockCloudClient) StopContainerInstance(instID string) error
func (*MockCloudClient) StopInstance ¶
func (m *MockCloudClient) StopInstance(instanceID string) error
func (*MockCloudClient) WaitForContainerInstanceRunning ¶
func (*MockCloudClient) WaitForRunning ¶
func (m *MockCloudClient) WaitForRunning(node *api.Node) ([]api.NetworkAddress, error)
type NoCapacityError ¶
type NoCapacityError struct {
// If both AZ and SubnetID are empty, we have no capacity
// for this instance in the entire region
OriginalError string
AZ string
SubnetID string
}
func (*NoCapacityError) Error ¶
func (e *NoCapacityError) Error() string
type SecurityGroup ¶
type SecurityGroup struct {
ID string
Name string
Ports []InstancePort
SourceRanges []string
}
func NewSecurityGroup ¶
func NewSecurityGroup(id, name string, ports []InstancePort, sources []string) SecurityGroup
type SecurityGroupIdentifier ¶
List instances only gives us security identifier
type SortableSliceOfPorts ¶
type SortableSliceOfPorts []InstancePort
Allow ports to be sorted
func (SortableSliceOfPorts) Len ¶
func (p SortableSliceOfPorts) Len() int
func (SortableSliceOfPorts) Less ¶
func (p SortableSliceOfPorts) Less(i, j int) bool
func (SortableSliceOfPorts) Swap ¶
func (p SortableSliceOfPorts) Swap(i, j int)
type SubnetAddressAffinity ¶
type SubnetAddressAffinity string
const ( PublicAddress SubnetAddressAffinity = "Public" PrivateAddress SubnetAddressAffinity = "Private" AnyAddress SubnetAddressAffinity = "Any" )
type SubnetAttributes ¶
type SubnetAttributes struct {
Name string
ID string
CIDR string
AZ string
// In AWS subnets we use the subnets private/public address by default
// flag to decide where to launch public and private nodes. We store
// that info in AddressAffinity. In Azure, it's likely we don't have
// that type of affinity (there's some interesting NAT options in azure)
// so we don't really care what subnet our public and private addresses
// go in. Also, this is half baked so if you have an idea of a better
// way to specify placement, knock yourself out.
AddressAffinity SubnetAddressAffinity
// In AWS and Azure (pretty sure...), we can get availability
// stats However, they're harder to come by in GCE. That said, in
// GCE you can resize your subnets and we can always query
// instances and bucket them.
AvailableAddresses int
}
type UnsupportedInstanceError ¶
type UnsupportedInstanceError struct {
OriginalError string
}
func (*UnsupportedInstanceError) Error ¶
func (e *UnsupportedInstanceError) Error() string
Click to show internal directories.
Click to hide internal directories.