Documentation ¶
Index ¶
- Constants
- func BuildKwok(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, ...) cloudprovider.CloudProvider
- func LoadNodeTemplatesFromConfigMap(configMapName string, kubeClient kubernetes.Interface) ([]*apiv1.Node, error)
- type ConfigMapConfig
- type GPUConfig
- type GroupingConfig
- type KwokCloudProvider
- func (kwok *KwokCloudProvider) Cleanup() error
- func (kwok *KwokCloudProvider) GPULabel() string
- func (kwok *KwokCloudProvider) GetAvailableGPUTypes() map[string]struct{}
- func (kwok *KwokCloudProvider) GetAvailableMachineTypes() ([]string, error)
- func (kwok *KwokCloudProvider) GetNodeGpuConfig(node *apiv1.Node) *cloudprovider.GpuConfig
- func (kwok *KwokCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
- func (kwok *KwokCloudProvider) HasInstance(node *apiv1.Node) (bool, error)
- func (kwok *KwokCloudProvider) Name() string
- func (kwok *KwokCloudProvider) NewNodeGroup(machineType string, labels map[string]string, systemLabels map[string]string, ...) (cloudprovider.NodeGroup, error)
- func (kwok *KwokCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.NodeGroup, error)
- func (kwok *KwokCloudProvider) NodeGroups() []cloudprovider.NodeGroup
- func (kwok *KwokCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError)
- func (kwok *KwokCloudProvider) Refresh() error
- type KwokConfig
- type KwokProviderConfig
- type NodeConfig
- type NodeGroup
- func (nodeGroup *NodeGroup) AtomicIncreaseSize(delta int) error
- func (nodeGroup *NodeGroup) Autoprovisioned() bool
- func (nodeGroup *NodeGroup) Create() (cloudprovider.NodeGroup, error)
- func (nodeGroup *NodeGroup) Debug() string
- func (nodeGroup *NodeGroup) DecreaseTargetSize(delta int) error
- func (nodeGroup *NodeGroup) Delete() error
- func (nodeGroup *NodeGroup) DeleteNodes(nodes []*apiv1.Node) error
- func (nodeGroup *NodeGroup) Exist() bool
- func (nodeGroup *NodeGroup) ForceDeleteNodes(nodes []*apiv1.Node) error
- func (nodeGroup *NodeGroup) GetOptions(defaults config.NodeGroupAutoscalingOptions) (*config.NodeGroupAutoscalingOptions, error)
- func (nodeGroup *NodeGroup) Id() string
- func (nodeGroup *NodeGroup) IncreaseSize(delta int) error
- func (nodeGroup *NodeGroup) MaxSize() int
- func (nodeGroup *NodeGroup) MinSize() int
- func (nodeGroup *NodeGroup) Nodes() ([]cloudprovider.Instance, error)
- func (nodeGroup *NodeGroup) TargetSize() (int, error)
- func (nodeGroup *NodeGroup) TemplateNodeInfo() (*framework.NodeInfo, error)
- type NodegroupsConfig
Constants ¶
const ( // ProviderName is the cloud provider name for kwok ProviderName = "kwok" //NGNameAnnotation is the annotation kwok provider uses to track the nodegroups NGNameAnnotation = "cluster-autoscaler.kwok.nodegroup/name" // NGMinSizeAnnotation is annotation on template nodes which specify min size of the nodegroup NGMinSizeAnnotation = "cluster-autoscaler.kwok.nodegroup/min-count" // NGMaxSizeAnnotation is annotation on template nodes which specify max size of the nodegroup NGMaxSizeAnnotation = "cluster-autoscaler.kwok.nodegroup/max-count" // NGDesiredSizeAnnotation is annotation on template nodes which specify desired size of the nodegroup NGDesiredSizeAnnotation = "cluster-autoscaler.kwok.nodegroup/desired-count" // KwokManagedAnnotation is the default annotation // that kwok manages to decide if it should manage // a node it sees in the cluster KwokManagedAnnotation = "kwok.x-k8s.io/node" )
Variables ¶
This section is empty.
Functions ¶
func BuildKwok ¶
func BuildKwok(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, informerFactory informers.SharedInformerFactory) cloudprovider.CloudProvider
BuildKwok builds kwok cloud provider.
func LoadNodeTemplatesFromConfigMap ¶
func LoadNodeTemplatesFromConfigMap(configMapName string, kubeClient kubernetes.Interface) ([]*apiv1.Node, error)
LoadNodeTemplatesFromConfigMap loads template nodes from a k8s configmap check https://github.com/vadafoss/node-templates for more info on the parsing logic
Types ¶
type ConfigMapConfig ¶
type ConfigMapConfig struct { Name string `json:"name" yaml:"name"` Key string `json:"key" yaml:"key"` }
ConfigMapConfig allows setting the kwok provider configmap name
type GPUConfig ¶
type GPUConfig struct { GPULabelKey string `json:"gpuLabelKey" yaml:"gpuLabelKey"` AvailableGPUTypes map[string]struct{} `json:"availableGPUTypes" yaml:"availableGPUTypes"` }
GPUConfig defines GPU related config for the node
type GroupingConfig ¶
type GroupingConfig struct {
// contains filtered or unexported fields
}
GroupingConfig defines different
type KwokCloudProvider ¶
type KwokCloudProvider struct {
// contains filtered or unexported fields
}
KwokCloudProvider implements CloudProvider interface for kwok
func BuildKwokProvider ¶
func BuildKwokProvider(ko *kwokOptions) (*KwokCloudProvider, error)
BuildKwokProvider builds the kwok provider
func (*KwokCloudProvider) Cleanup ¶
func (kwok *KwokCloudProvider) Cleanup() error
Cleanup cleans up all resources before the cloud provider is removed
func (*KwokCloudProvider) GPULabel ¶
func (kwok *KwokCloudProvider) GPULabel() string
GPULabel returns the label added to nodes with GPU resource.
func (*KwokCloudProvider) GetAvailableGPUTypes ¶
func (kwok *KwokCloudProvider) GetAvailableGPUTypes() map[string]struct{}
GetAvailableGPUTypes return all available GPU types cloud provider supports
func (*KwokCloudProvider) GetAvailableMachineTypes ¶
func (kwok *KwokCloudProvider) GetAvailableMachineTypes() ([]string, error)
GetAvailableMachineTypes get all machine types that can be requested from the cloud provider. Implementation optional.
func (*KwokCloudProvider) GetNodeGpuConfig ¶
func (kwok *KwokCloudProvider) 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 (*KwokCloudProvider) GetResourceLimiter ¶
func (kwok *KwokCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
GetResourceLimiter returns struct containing limits (max, min) for resources (cores, memory etc.).
func (*KwokCloudProvider) HasInstance ¶
func (kwok *KwokCloudProvider) HasInstance(node *apiv1.Node) (bool, error)
HasInstance returns whether a given node has a corresponding instance in this cloud provider Since there is no underlying cloud provider instance, return true
func (*KwokCloudProvider) Name ¶
func (kwok *KwokCloudProvider) Name() string
Name returns name of the cloud provider.
func (*KwokCloudProvider) NewNodeGroup ¶
func (kwok *KwokCloudProvider) 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.
func (*KwokCloudProvider) NodeGroupForNode ¶
func (kwok *KwokCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.NodeGroup, error)
NodeGroupForNode returns the node group for the given node.
func (*KwokCloudProvider) NodeGroups ¶
func (kwok *KwokCloudProvider) NodeGroups() []cloudprovider.NodeGroup
NodeGroups returns all node groups configured for this cloud provider.
func (*KwokCloudProvider) Pricing ¶
func (kwok *KwokCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError)
Pricing returns pricing model for this cloud provider or error if not available.
func (*KwokCloudProvider) Refresh ¶
func (kwok *KwokCloudProvider) 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 KwokConfig ¶
type KwokConfig struct { }
KwokConfig is the struct to define kwok specific config (needs to be implemented; currently empty)
type KwokProviderConfig ¶
type KwokProviderConfig struct { APIVersion string `json:"apiVersion" yaml:"apiVersion"` ReadNodesFrom string `json:"readNodesFrom" yaml:"readNodesFrom"` Nodegroups *NodegroupsConfig `json:"nodegroups" yaml:"nodegroups"` Nodes *NodeConfig `json:"nodes" yaml:"nodes"` ConfigMap *ConfigMapConfig `json:"configmap" yaml:"configmap"` Kwok *KwokConfig `json:"kwok" yaml:"kwok"` // contains filtered or unexported fields }
KwokProviderConfig is the struct to hold kwok provider config
func LoadConfigFile ¶
func LoadConfigFile(kubeClient kubeclient.Interface) (*KwokProviderConfig, error)
LoadConfigFile loads kwok provider config from k8s configmap
type NodeConfig ¶
type NodeConfig struct { GPUConfig *GPUConfig `json:"gpuConfig" yaml:"gpuConfig"` SkipTaint bool `json:"skipTaint" yaml:"skipTaint"` }
NodeConfig defines config options for the nodes
type NodeGroup ¶
type NodeGroup struct {
// contains filtered or unexported fields
}
NodeGroup implements NodeGroup interface.
func (*NodeGroup) AtomicIncreaseSize ¶
AtomicIncreaseSize is not implemented.
func (*NodeGroup) Autoprovisioned ¶
Autoprovisioned returns true if the node group is autoprovisioned.
func (*NodeGroup) Create ¶
func (nodeGroup *NodeGroup) Create() (cloudprovider.NodeGroup, error)
Create creates the node group on the cloud provider side. Left unimplemented because Create is not used anywhere in the core autoscaler as of writing this
func (*NodeGroup) DecreaseTargetSize ¶
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 (*NodeGroup) Delete ¶
Delete deletes the node group on the cloud provider side. Left unimplemented because Delete is not used anywhere in the core autoscaler as of writing this
func (*NodeGroup) DeleteNodes ¶
DeleteNodes deletes the specified nodes from the node group.
func (*NodeGroup) Exist ¶
Exist checks if the node group really exists on the cloud provider side. Since kwok nodegroup is not backed by anything on cloud provider side We can safely return `true` here
func (*NodeGroup) ForceDeleteNodes ¶
ForceDeleteNodes deletes nodes from the group regardless of constraints.
func (*NodeGroup) GetOptions ¶
func (nodeGroup *NodeGroup) 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 (*NodeGroup) IncreaseSize ¶
IncreaseSize increases NodeGroup size.
func (*NodeGroup) Nodes ¶
func (nodeGroup *NodeGroup) Nodes() ([]cloudprovider.Instance, error)
Nodes returns a list of all nodes that belong to this node group.
func (*NodeGroup) TargetSize ¶
TargetSize returns the current TARGET size of the node group. It is possible that the number is different from the number of nodes registered in Kubernetes.
type NodegroupsConfig ¶
type NodegroupsConfig struct { FromNodeLabelKey string `json:"fromNodeLabelKey" yaml:"fromNodeLabelKey"` FromNodeLabelAnnotation string `json:"fromNodeLabelAnnotation" yaml:"fromNodeLabelAnnotation"` }
NodegroupsConfig defines options for creating nodegroups