Documentation ¶
Index ¶
- Constants
- func BuildOVHcloud(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, ...) cloudprovider.CloudProvider
- type ClientInterface
- type Config
- type NodeGroup
- func (ng *NodeGroup) AtomicIncreaseSize(delta int) error
- func (ng *NodeGroup) Autoprovisioned() bool
- func (ng *NodeGroup) Create() (cloudprovider.NodeGroup, error)
- func (ng *NodeGroup) Debug() string
- func (ng *NodeGroup) DecreaseTargetSize(delta int) error
- func (ng *NodeGroup) Delete() error
- func (ng *NodeGroup) DeleteNodes(nodes []*apiv1.Node) error
- func (ng *NodeGroup) Exist() bool
- func (ng *NodeGroup) ForceDeleteNodes(nodes []*apiv1.Node) error
- func (ng *NodeGroup) GetOptions(defaults config.NodeGroupAutoscalingOptions) (*config.NodeGroupAutoscalingOptions, error)
- func (ng *NodeGroup) Id() string
- func (ng *NodeGroup) IncreaseSize(delta int) error
- func (ng *NodeGroup) MaxSize() int
- func (ng *NodeGroup) MinSize() int
- func (ng *NodeGroup) Nodes() ([]cloudprovider.Instance, error)
- func (ng *NodeGroup) TargetSize() (int, error)
- func (ng *NodeGroup) TemplateNodeInfo() (*framework.NodeInfo, error)
- type OVHCloudProvider
- func (provider *OVHCloudProvider) Cleanup() error
- func (provider *OVHCloudProvider) GPULabel() string
- func (provider *OVHCloudProvider) GetAvailableGPUTypes() map[string]struct{}
- func (provider *OVHCloudProvider) GetAvailableMachineTypes() ([]string, error)
- func (provider *OVHCloudProvider) GetNodeGpuConfig(node *apiv1.Node) *cloudprovider.GpuConfig
- func (provider *OVHCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
- func (provider *OVHCloudProvider) HasInstance(node *apiv1.Node) (bool, error)
- func (provider *OVHCloudProvider) Name() string
- func (provider *OVHCloudProvider) NewNodeGroup(machineType string, labels map[string]string, systemLabels map[string]string, ...) (cloudprovider.NodeGroup, error)
- func (provider *OVHCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.NodeGroup, error)
- func (provider *OVHCloudProvider) NodeGroups() []cloudprovider.NodeGroup
- func (provider *OVHCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError)
- func (provider *OVHCloudProvider) Refresh() error
- type OvhCloudManager
Constants ¶
const ( // OpenStackAuthenticationType to request a keystone token credentials. OpenStackAuthenticationType = "openstack" // ApplicationConsumerAuthenticationType to consume an application key credentials. ApplicationConsumerAuthenticationType = "consumer" )
Authentication methods defines the way to interact with API.
const ( // GPULabel is the label added to nodes with GPU resource. GPULabel = "node.kubernetes.ovhcloud.com/gpu" // NodePoolLabel is the label added to nodes grouped by node group. // Should be soon prepend with `node.kubernetes.ovhcloud.com/` NodePoolLabel = "nodepool" // MachineAvailableState defines the state for available flavors for node resources. MachineAvailableState = "available" // GPUMachineCategory defines the default instance category for GPU resources. GPUMachineCategory = "t" )
Variables ¶
This section is empty.
Functions ¶
func BuildOVHcloud ¶
func BuildOVHcloud(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider
BuildOVHcloud builds the OVHcloud provider.
Types ¶
type ClientInterface ¶
type ClientInterface interface { // ListNodePools lists all the node pools found in a Kubernetes cluster. ListNodePools(ctx context.Context, projectID string, clusterID string) ([]sdk.NodePool, error) // ListNodePoolNodes lists all the nodes contained in a node pool. ListNodePoolNodes(ctx context.Context, projectID string, clusterID string, poolID string) ([]sdk.Node, error) // CreateNodePool fills and installs a new pool in a Kubernetes cluster. CreateNodePool(ctx context.Context, projectID string, clusterID string, opts *sdk.CreateNodePoolOpts) (*sdk.NodePool, error) // UpdateNodePool updates the details of an existing node pool. UpdateNodePool(ctx context.Context, projectID string, clusterID string, poolID string, opts *sdk.UpdateNodePoolOpts) (*sdk.NodePool, error) // DeleteNodePool deletes a specific pool. DeleteNodePool(ctx context.Context, projectID string, clusterID string, poolID string) (*sdk.NodePool, error) // ListClusterFlavors list all available flavors usable in a Kubernetes cluster. ListClusterFlavors(ctx context.Context, projectID string, clusterID string) ([]sdk.Flavor, error) }
ClientInterface defines all mandatory methods to be exposed as a client (mock or API)
type Config ¶
type Config struct { // ProjectID is the id associated with the cluster project tenant. ProjectID string `json:"project_id"` // ClusterID is the id associated with the cluster where CA is running. ClusterID string `json:"cluster_id"` // AuthenticationType is the authentication method used to call the API (should be openstack or consumer) AuthenticationType string `json:"authentication_type"` // OpenStack keystone credentials if CA is run without API consumer. // By default, this is used as it on cluster control plane. OpenStackAuthUrl string `json:"openstack_auth_url"` OpenStackUsername string `json:"openstack_username"` OpenStackPassword string `json:"openstack_password"` OpenStackDomain string `json:"openstack_domain"` // Application credentials if CA is run as API consumer without using OpenStack keystone. // Tokens can be created here: https://api.ovh.com/createToken/ ApplicationEndpoint string `json:"application_endpoint"` ApplicationKey string `json:"application_key"` ApplicationSecret string `json:"application_secret"` ApplicationConsumerKey string `json:"application_consumer_key"` }
Config is the configuration file content of OVHcloud provider
type NodeGroup ¶
type NodeGroup struct { sdk.NodePool Manager *OvhCloudManager CurrentSize int // contains filtered or unexported fields }
NodeGroup implements cloudprovider.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 (ng *NodeGroup) Create() (cloudprovider.NodeGroup, error)
Create creates the node group on the cloud provider side.
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. It is assumed that cloud provider will not delete the existing nodes if the size when there is an option to just decrease the target.
func (*NodeGroup) Delete ¶
Delete deletes the node group on the cloud provider side. This will be executed only for autoprovisioned node groups, once their size drops to 0.
func (*NodeGroup) DeleteNodes ¶
DeleteNodes deletes the nodes from the group.
func (*NodeGroup) Exist ¶
Exist checks if the node group really exists on the cloud provider side. Allows to tell the theoretical node group from the real one.
func (*NodeGroup) ForceDeleteNodes ¶
ForceDeleteNodes deletes nodes from the group regardless of constraints.
func (*NodeGroup) GetOptions ¶
func (ng *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 node pool size.
func (*NodeGroup) Nodes ¶
func (ng *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 pool. It is possible that the number is different from the number of nodes registered in Kubernetes.
type OVHCloudProvider ¶
type OVHCloudProvider struct {
// contains filtered or unexported fields
}
OVHCloudProvider implements CloudProvider interface.
func (*OVHCloudProvider) Cleanup ¶
func (provider *OVHCloudProvider) Cleanup() error
Cleanup cleans up open resources before the cloud provider is destroyed, i.e. go routines etc.
func (*OVHCloudProvider) GPULabel ¶
func (provider *OVHCloudProvider) GPULabel() string
GPULabel returns the label added to nodes with GPU resource.
func (*OVHCloudProvider) GetAvailableGPUTypes ¶
func (provider *OVHCloudProvider) GetAvailableGPUTypes() map[string]struct{}
GetAvailableGPUTypes return all available GPU types cloud provider supports.
func (*OVHCloudProvider) GetAvailableMachineTypes ¶
func (provider *OVHCloudProvider) GetAvailableMachineTypes() ([]string, error)
GetAvailableMachineTypes get all machine types that can be requested from the cloud provider. Implementation optional.
func (*OVHCloudProvider) GetNodeGpuConfig ¶
func (provider *OVHCloudProvider) 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 (*OVHCloudProvider) GetResourceLimiter ¶
func (provider *OVHCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
GetResourceLimiter returns struct containing limits (max, min) for resources (cores, memory etc.).
func (*OVHCloudProvider) HasInstance ¶
func (provider *OVHCloudProvider) HasInstance(node *apiv1.Node) (bool, error)
HasInstance returns whether a given node has a corresponding instance in this cloud provider
func (*OVHCloudProvider) Name ¶
func (provider *OVHCloudProvider) Name() string
Name returns name of the cloud provider.
func (*OVHCloudProvider) NewNodeGroup ¶
func (provider *OVHCloudProvider) 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 (*OVHCloudProvider) NodeGroupForNode ¶
func (provider *OVHCloudProvider) NodeGroupForNode(node *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 (*OVHCloudProvider) NodeGroups ¶
func (provider *OVHCloudProvider) NodeGroups() []cloudprovider.NodeGroup
NodeGroups returns all node groups configured for this cloud provider.
func (*OVHCloudProvider) Pricing ¶
func (provider *OVHCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError)
Pricing returns pricing model for this cloud provider or error if not available. Implementation optional.
func (*OVHCloudProvider) Refresh ¶
func (provider *OVHCloudProvider) 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 OvhCloudManager ¶
type OvhCloudManager struct { Client ClientInterface OpenStackProvider *sdk.OpenStackProvider ClusterID string ProjectID string NodePools []sdk.NodePool NodeGroupPerProviderID map[string]*NodeGroup NodeGroupPerProviderIDLock sync.RWMutex FlavorsCache map[string]sdk.Flavor FlavorsCacheExpirationTime time.Time }
OvhCloudManager defines current application context manager to interact with resources and API (or mock)
func NewManager ¶
func NewManager(configFile io.Reader) (*OvhCloudManager, error)
NewManager initializes an API client given a cloud provider configuration file
func (*OvhCloudManager) ReAuthenticate ¶
func (m *OvhCloudManager) ReAuthenticate() error
ReAuthenticate allows OpenStack keystone token to be revoked and re-created to call API