Documentation ¶
Index ¶
- func BuildOCI(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, ...) cloudprovider.CloudProvider
- type ComputeClient
- type ComputeMgmtClient
- type InstancePoolManager
- type InstancePoolManagerImpl
- func (m *InstancePoolManagerImpl) Cleanup() error
- func (m *InstancePoolManagerImpl) DeleteInstances(instancePool InstancePoolNodeGroup, instances []ocicommon.OciRef) error
- func (m *InstancePoolManagerImpl) GetInstancePoolForInstance(instanceDetails ocicommon.OciRef) (*InstancePoolNodeGroup, error)
- func (m *InstancePoolManagerImpl) GetInstancePoolNodes(ip InstancePoolNodeGroup) ([]cloudprovider.Instance, error)
- func (m *InstancePoolManagerImpl) GetInstancePoolSize(ip InstancePoolNodeGroup) (int, error)
- func (m *InstancePoolManagerImpl) GetInstancePoolTemplateNode(ip InstancePoolNodeGroup) (*apiv1.Node, error)
- func (m *InstancePoolManagerImpl) GetInstancePools() []*InstancePoolNodeGroup
- func (m *InstancePoolManagerImpl) Refresh() error
- func (m *InstancePoolManagerImpl) SetInstancePoolSize(np InstancePoolNodeGroup, size int) error
- type InstancePoolNodeGroup
- func (ip *InstancePoolNodeGroup) AtomicIncreaseSize(delta int) error
- func (ip *InstancePoolNodeGroup) Autoprovisioned() bool
- func (ip *InstancePoolNodeGroup) Belongs(node *apiv1.Node) (bool, error)
- func (ip *InstancePoolNodeGroup) Create() (cloudprovider.NodeGroup, error)
- func (ip *InstancePoolNodeGroup) Debug() string
- func (ip *InstancePoolNodeGroup) DecreaseTargetSize(delta int) error
- func (ip *InstancePoolNodeGroup) Delete() error
- func (ip *InstancePoolNodeGroup) DeleteNodes(nodes []*apiv1.Node) error
- func (ip *InstancePoolNodeGroup) Exist() bool
- func (ip *InstancePoolNodeGroup) ForceDeleteNodes(nodes []*apiv1.Node) error
- func (ip *InstancePoolNodeGroup) GetOptions(defaults config.NodeGroupAutoscalingOptions) (*config.NodeGroupAutoscalingOptions, error)
- func (ip *InstancePoolNodeGroup) Id() string
- func (ip *InstancePoolNodeGroup) IncreaseSize(delta int) error
- func (ip *InstancePoolNodeGroup) MaxSize() int
- func (ip *InstancePoolNodeGroup) MinSize() int
- func (ip *InstancePoolNodeGroup) Nodes() ([]cloudprovider.Instance, error)
- func (ip *InstancePoolNodeGroup) TargetSize() (int, error)
- func (ip *InstancePoolNodeGroup) TemplateNodeInfo() (*framework.NodeInfo, error)
- type OciCloudProvider
- func (ocp *OciCloudProvider) Cleanup() error
- func (ocp *OciCloudProvider) GPULabel() string
- func (ocp *OciCloudProvider) GetAvailableGPUTypes() map[string]struct{}
- func (ocp *OciCloudProvider) GetAvailableMachineTypes() ([]string, error)
- func (ocp *OciCloudProvider) GetNodeGpuConfig(node *apiv1.Node) *cloudprovider.GpuConfig
- func (ocp *OciCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
- func (ocp *OciCloudProvider) HasInstance(node *apiv1.Node) (bool, error)
- func (ocp *OciCloudProvider) Name() string
- func (ocp *OciCloudProvider) NewNodeGroup(machineType string, labels map[string]string, systemLabels map[string]string, ...) (cloudprovider.NodeGroup, error)
- func (ocp *OciCloudProvider) NodeGroupForNode(n *apiv1.Node) (cloudprovider.NodeGroup, error)
- func (ocp *OciCloudProvider) NodeGroups() []cloudprovider.NodeGroup
- func (ocp *OciCloudProvider) Pricing() (cloudprovider.PricingModel, caerrors.AutoscalerError)
- func (ocp *OciCloudProvider) Refresh() error
- type VirtualNetworkClient
- type WorkRequestClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildOCI ¶
func BuildOCI(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider
BuildOCI constructs the OciCloudProvider object that implements the could provider interface (InstancePoolManager).
Types ¶
type ComputeClient ¶
type ComputeClient interface {
ListVnicAttachments(ctx context.Context, request core.ListVnicAttachmentsRequest) (core.ListVnicAttachmentsResponse, error)
}
ComputeClient wraps core.ComputeClient exposing the functions we actually require.
type ComputeMgmtClient ¶
type ComputeMgmtClient interface { GetInstancePool(context.Context, core.GetInstancePoolRequest) (core.GetInstancePoolResponse, error) UpdateInstancePool(context.Context, core.UpdateInstancePoolRequest) (core.UpdateInstancePoolResponse, error) GetInstancePoolInstance(context.Context, core.GetInstancePoolInstanceRequest) (core.GetInstancePoolInstanceResponse, error) ListInstancePoolInstances(context.Context, core.ListInstancePoolInstancesRequest) (core.ListInstancePoolInstancesResponse, error) DetachInstancePoolInstance(context.Context, core.DetachInstancePoolInstanceRequest) (core.DetachInstancePoolInstanceResponse, error) }
ComputeMgmtClient wraps core.ComputeManagementClient exposing the functions we actually require.
type InstancePoolManager ¶
type InstancePoolManager interface { // Refresh triggers refresh of cached resources. Refresh() error // Cleanup cleans up open resources before the cloud provider is destroyed, i.e. go routines etc. Cleanup() error // GetInstancePools returns list of registered InstancePools. GetInstancePools() []*InstancePoolNodeGroup // GetInstancePoolNodes returns InstancePool nodes. GetInstancePoolNodes(ip InstancePoolNodeGroup) ([]cloudprovider.Instance, error) // GetInstancePoolForInstance returns InstancePool to which the given instance belongs. GetInstancePoolForInstance(instance ocicommon.OciRef) (*InstancePoolNodeGroup, error) // GetInstancePoolTemplateNode returns a template node for InstancePool. GetInstancePoolTemplateNode(ip InstancePoolNodeGroup) (*apiv1.Node, error) // GetInstancePoolSize gets the InstancePool size. GetInstancePoolSize(ip InstancePoolNodeGroup) (int, error) // SetInstancePoolSize sets the InstancePool size. SetInstancePoolSize(ip InstancePoolNodeGroup, size int) error // DeleteInstances deletes the given instances. All instances must be controlled by the same InstancePool. DeleteInstances(ip InstancePoolNodeGroup, instances []ocicommon.OciRef) error }
InstancePoolManager defines the operations required for an *instance-pool based* autoscaler.
func CreateInstancePoolManager ¶
func CreateInstancePoolManager(cloudConfigPath string, discoveryOpts cloudprovider.NodeGroupDiscoveryOptions, kubeClient kubernetes.Interface) (InstancePoolManager, error)
CreateInstancePoolManager constructs the InstancePoolManager object.
type InstancePoolManagerImpl ¶
type InstancePoolManagerImpl struct { ShapeGetter ocicommon.ShapeGetter // contains filtered or unexported fields }
InstancePoolManagerImpl is the implementation of an instance-pool based autoscaler on OCI.
func (*InstancePoolManagerImpl) Cleanup ¶
func (m *InstancePoolManagerImpl) Cleanup() error
Cleanup cleans up open resources before the cloud provider is destroyed, i.e. go routines etc.
func (*InstancePoolManagerImpl) DeleteInstances ¶
func (m *InstancePoolManagerImpl) DeleteInstances(instancePool InstancePoolNodeGroup, instances []ocicommon.OciRef) error
DeleteInstances deletes the given instances. All instances must be controlled by the same instance-pool.
func (*InstancePoolManagerImpl) GetInstancePoolForInstance ¶
func (m *InstancePoolManagerImpl) GetInstancePoolForInstance(instanceDetails ocicommon.OciRef) (*InstancePoolNodeGroup, error)
GetInstancePoolForInstance returns InstancePool to which the given instance belongs. If PoolID is not set on the specified OciRef, we will look for a match.
func (*InstancePoolManagerImpl) GetInstancePoolNodes ¶
func (m *InstancePoolManagerImpl) GetInstancePoolNodes(ip InstancePoolNodeGroup) ([]cloudprovider.Instance, error)
GetInstancePoolNodes returns InstancePool nodes that are not in a terminal state.
func (*InstancePoolManagerImpl) GetInstancePoolSize ¶
func (m *InstancePoolManagerImpl) GetInstancePoolSize(ip InstancePoolNodeGroup) (int, error)
GetInstancePoolSize gets the instance-pool size.
func (*InstancePoolManagerImpl) GetInstancePoolTemplateNode ¶
func (m *InstancePoolManagerImpl) GetInstancePoolTemplateNode(ip InstancePoolNodeGroup) (*apiv1.Node, error)
GetInstancePoolTemplateNode returns a template node for the InstancePool.
func (*InstancePoolManagerImpl) GetInstancePools ¶
func (m *InstancePoolManagerImpl) GetInstancePools() []*InstancePoolNodeGroup
GetInstancePools returns list of registered InstancePools.
func (*InstancePoolManagerImpl) Refresh ¶
func (m *InstancePoolManagerImpl) Refresh() error
Refresh triggers refresh of cached resources.
func (*InstancePoolManagerImpl) SetInstancePoolSize ¶
func (m *InstancePoolManagerImpl) SetInstancePoolSize(np InstancePoolNodeGroup, size int) error
SetInstancePoolSize sets instance-pool size.
type InstancePoolNodeGroup ¶
type InstancePoolNodeGroup struct {
// contains filtered or unexported fields
}
InstancePoolNodeGroup implements the NodeGroup interface using OCI instance pools.
func (*InstancePoolNodeGroup) AtomicIncreaseSize ¶
func (ip *InstancePoolNodeGroup) AtomicIncreaseSize(delta int) error
AtomicIncreaseSize is not implemented.
func (*InstancePoolNodeGroup) Autoprovisioned ¶
func (ip *InstancePoolNodeGroup) Autoprovisioned() bool
Autoprovisioned returns true if the instance-pool based node group is autoprovisioned. An autoprovisioned group was created by CA and can be deleted when scaled to 0.
func (*InstancePoolNodeGroup) Belongs ¶
func (ip *InstancePoolNodeGroup) Belongs(node *apiv1.Node) (bool, error)
Belongs returns true if the given node belongs to the InstancePoolNodeGroup.
func (*InstancePoolNodeGroup) Create ¶
func (ip *InstancePoolNodeGroup) Create() (cloudprovider.NodeGroup, error)
Create creates the instance-pool based node group on the cloud provider side. Implementation optional.
func (*InstancePoolNodeGroup) Debug ¶
func (ip *InstancePoolNodeGroup) Debug() string
Debug returns a string containing all information regarding this instance-pool.
func (*InstancePoolNodeGroup) DecreaseTargetSize ¶
func (ip *InstancePoolNodeGroup) DecreaseTargetSize(delta int) error
DecreaseTargetSize decreases the target size of the instance-pool based 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. It is assumed that cloud provider will not delete the existing nodes when there is an option to just decrease the target. Implementation required.
func (*InstancePoolNodeGroup) Delete ¶
func (ip *InstancePoolNodeGroup) Delete() error
Delete deletes the instance-pool based node group on the cloud provider side. This will be executed only for autoprovisioned instance-pools, once their size drops to 0. Implementation optional.
func (*InstancePoolNodeGroup) DeleteNodes ¶
func (ip *InstancePoolNodeGroup) DeleteNodes(nodes []*apiv1.Node) error
DeleteNodes deletes nodes from this instance-pool. Error is returned either on failure or if the given node doesn't belong to this instance-pool. This function should wait until instance-pool size is updated. Implementation required.
func (*InstancePoolNodeGroup) Exist ¶
func (ip *InstancePoolNodeGroup) Exist() bool
Exist checks if the instance-pool based node group really exists on the cloud provider side. Allows to tell the theoretical instance-pool from the real one. Implementation required.
func (*InstancePoolNodeGroup) ForceDeleteNodes ¶
func (ip *InstancePoolNodeGroup) ForceDeleteNodes(nodes []*apiv1.Node) error
ForceDeleteNodes deletes nodes from the group regardless of constraints.
func (*InstancePoolNodeGroup) GetOptions ¶
func (ip *InstancePoolNodeGroup) GetOptions(defaults config.NodeGroupAutoscalingOptions) (*config.NodeGroupAutoscalingOptions, error)
GetOptions returns NodeGroupAutoscalingOptions that should be used for this particular InstancePoolNodeGroup. Returning a nil will result in using default options.
func (*InstancePoolNodeGroup) Id ¶
func (ip *InstancePoolNodeGroup) Id() string
Id returns an unique identifier of the instance-pool based node group.
func (*InstancePoolNodeGroup) IncreaseSize ¶
func (ip *InstancePoolNodeGroup) IncreaseSize(delta int) error
IncreaseSize increases the size of the instance-pool based node group. To delete a node you need to explicitly name it and use DeleteNode. This function should wait until instance-pool size is updated. Implementation required.
func (*InstancePoolNodeGroup) MaxSize ¶
func (ip *InstancePoolNodeGroup) MaxSize() int
MaxSize returns maximum size of the instance-pool based node group.
func (*InstancePoolNodeGroup) MinSize ¶
func (ip *InstancePoolNodeGroup) MinSize() int
MinSize returns minimum size of the instance-pool based node group.
func (*InstancePoolNodeGroup) Nodes ¶
func (ip *InstancePoolNodeGroup) Nodes() ([]cloudprovider.Instance, error)
Nodes returns a list of all nodes that belong to this instance-pool. It is required that Instance objects returned by this method have Id field set. Other fields are optional. This list should include also instances that might have not become a kubernetes node yet.
func (*InstancePoolNodeGroup) TargetSize ¶
func (ip *InstancePoolNodeGroup) TargetSize() (int, error)
TargetSize returns the current target size of the instance-pool based 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). Implementation required.
func (*InstancePoolNodeGroup) TemplateNodeInfo ¶
func (ip *InstancePoolNodeGroup) TemplateNodeInfo() (*framework.NodeInfo, error)
TemplateNodeInfo returns a framework.NodeInfo structure of an empty (as if just started) node. This will be used in scale-up simulations to predict what would a new node look like if a instance-pool was expanded. The returned NodeInfo is expected to have a fully populated Node object, with all of the labels, capacity and allocatable information as well as all pods that are started on the node by default, using manifest (most likely only kube-proxy). Implementation optional.
type OciCloudProvider ¶
type OciCloudProvider struct {
// contains filtered or unexported fields
}
OciCloudProvider implements the CloudProvider interface for OCI. It contains an instance pool manager to interact with OCI instance pools.
func (*OciCloudProvider) Cleanup ¶
func (ocp *OciCloudProvider) Cleanup() error
Cleanup cleans up open resources before the cloud provider is destroyed, i.e. go routines etc.
func (*OciCloudProvider) GPULabel ¶
func (ocp *OciCloudProvider) GPULabel() string
GPULabel returns the label added to nodes with GPU resource.
func (*OciCloudProvider) GetAvailableGPUTypes ¶
func (ocp *OciCloudProvider) GetAvailableGPUTypes() map[string]struct{}
GetAvailableGPUTypes return all available GPU types cloud provider supports.
func (*OciCloudProvider) GetAvailableMachineTypes ¶
func (ocp *OciCloudProvider) GetAvailableMachineTypes() ([]string, error)
GetAvailableMachineTypes getInstancePool all machine types that can be requested from the cloud provider. Implementation optional.
func (*OciCloudProvider) GetNodeGpuConfig ¶
func (ocp *OciCloudProvider) 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 (*OciCloudProvider) GetResourceLimiter ¶
func (ocp *OciCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
GetResourceLimiter returns struct containing limits (max, min) for resources (cores, memory etc.).
func (*OciCloudProvider) HasInstance ¶
func (ocp *OciCloudProvider) HasInstance(node *apiv1.Node) (bool, error)
HasInstance returns whether a given node has a corresponding instance in this cloud provider
func (*OciCloudProvider) Name ¶
func (ocp *OciCloudProvider) Name() string
Name returns name of the cloud provider.
func (*OciCloudProvider) NewNodeGroup ¶
func (ocp *OciCloudProvider) 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. Implementation optional.
func (*OciCloudProvider) NodeGroupForNode ¶
func (ocp *OciCloudProvider) NodeGroupForNode(n *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. Must be implemented.
func (*OciCloudProvider) NodeGroups ¶
func (ocp *OciCloudProvider) NodeGroups() []cloudprovider.NodeGroup
NodeGroups returns all node groups configured for this cloud provider.
func (*OciCloudProvider) Pricing ¶
func (ocp *OciCloudProvider) Pricing() (cloudprovider.PricingModel, caerrors.AutoscalerError)
Pricing returns pricing model for this cloud provider or error if not available. Implementation optional.
func (*OciCloudProvider) Refresh ¶
func (ocp *OciCloudProvider) 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().
type VirtualNetworkClient ¶
type VirtualNetworkClient interface {
GetVnic(context.Context, core.GetVnicRequest) (core.GetVnicResponse, error)
}
VirtualNetworkClient wraps core.VirtualNetworkClient exposing the functions we actually require.
type WorkRequestClient ¶
type WorkRequestClient interface { GetWorkRequest(context.Context, workrequests.GetWorkRequestRequest) (workrequests.GetWorkRequestResponse, error) ListWorkRequests(context.Context, workrequests.ListWorkRequestsRequest) (workrequests.ListWorkRequestsResponse, error) ListWorkRequestErrors(context.Context, workrequests.ListWorkRequestErrorsRequest) (workrequests.ListWorkRequestErrorsResponse, error) }
WorkRequestClient wraps workrequests.WorkRequestClient exposing the functions we actually require.