nodepools

package
v0.0.0-...-eeb2ccb Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsConflict

func IsConflict(err error) bool

IsConflict checks if the error is a conflict

func ReasonForError

func ReasonForError(err error) metav1.StatusReason

ReasonForError returns the error's reason

Types

type APIStatus

type APIStatus interface {
	Status() metav1.Status
}

APIStatus allows the conversion of errors into status objects

type NodePool

type NodePool interface {
	cloudprovider.NodeGroup
}

NodePool implements the NodeGroup interface via an OCI Node Pool

type NodePoolManager

type NodePoolManager 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

	// GetNodePools returns list of registered NodePools.
	GetNodePools() []NodePool
	// GetNodePoolNodes returns NodePool nodes.
	GetNodePoolNodes(np NodePool) ([]cloudprovider.Instance, error)
	// GetNodePoolNodes returns NodePool nodes.
	GetExistingNodePoolSizeViaCompute(np NodePool) (int, error)
	// GetNodePoolForInstance returns NodePool to which the given instance belongs.
	GetNodePoolForInstance(instance ocicommon.OciRef) (NodePool, error)
	// GetNodePoolTemplateNode returns a template node for NodePool.
	GetNodePoolTemplateNode(np NodePool) (*apiv1.Node, error)
	// GetNodePoolSize gets NodePool size.
	GetNodePoolSize(np NodePool) (int, error)
	// SetNodePoolSize sets NodePool size.
	SetNodePoolSize(np NodePool, size int) error
	// DeleteInstances deletes the given instances. All instances must be controlled by the same NodePool.
	DeleteInstances(np NodePool, instances []ocicommon.OciRef) error
	// Invalidate node pool cache and refresh it
	InvalidateAndRefreshCache() error
	// Taint with ToBeDeletedByClusterAutoscaler to avoid unexpected CA restarts scheduling pods on a node intended to be deleted before restart
	TaintToPreventFurtherSchedulingOnRestart(nodes []*apiv1.Node, client kubernetes.Interface) error
}

NodePoolManager defines the operations required for an *instance-pool based* autoscaler.

func CreateNodePoolManager

func CreateNodePoolManager(cloudConfigPath string, nodeGroupAutoDiscoveryList []string, discoveryOpts cloudprovider.NodeGroupDiscoveryOptions, kubeClient kubernetes.Interface) (NodePoolManager, error)

CreateNodePoolManager creates an NodePoolManager that can manage autoscaling node pools

type OciCloudProvider

type OciCloudProvider struct {
	// contains filtered or unexported fields
}

OciCloudProvider creates a cloud provider object that is compatible with node pools

func NewOciCloudProvider

func NewOciCloudProvider(manager NodePoolManager, rl *cloudprovider.ResourceLimiter) *OciCloudProvider

NewOciCloudProvider creates a new CloudProvider implementation that supports OKE Node 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 get 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

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 RegisteredTaintsGetter

type RegisteredTaintsGetter interface {
	Get(*oke.NodePool) ([]apiv1.Taint, error)
}

RegisteredTaintsGetter returns the initial registered taints for the node pool.

func CreateRegisteredTaintsGetter

func CreateRegisteredTaintsGetter() RegisteredTaintsGetter

CreateRegisteredTaintsGetter creates a client that can retrieve the defined taints on a node pool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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