Skip to content

Commit

Permalink
feat(ovh): fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ricoleabricot committed Jun 8, 2021
1 parent 21299c7 commit 3257372
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,16 @@ func newTestNodeGroup(t *testing.T, isGpu bool) cloudprovider.NodeGroup {
DesiredNodes: 3,
MinNodes: 1,
MaxNodes: 5,
Autoscaling: &sdk.NodePoolAutoscaling{
ScaleDownUtilizationThreshold: 3.2,
ScaleDownUnneededTimeSeconds: 10,
ScaleDownUnreadyTimeSeconds: 20,
},
},

CurrentSize: 3,
}

ng.NodePool.Autoscaling.ScaleDownUtilizationThreshold = 3.2
ng.NodePool.Autoscaling.ScaleDownUnneededTimeSeconds = 10
ng.NodePool.Autoscaling.ScaleDownUnreadyTimeSeconds = 20

return ng
}

Expand Down
25 changes: 14 additions & 11 deletions cluster-autoscaler/cloudprovider/ovhcloud/sdk/nodepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,24 @@ type NodePool struct {
AvailableNodes uint32 `json:"availableNodes"`
UpToDateNodes uint32 `json:"upToDateNodes"`

Autoscaling *struct {
CpuMin float32 `json:"cpuMin"`
CpuMax float32 `json:"cpuMax"`
Autoscaling *NodePoolAutoscaling `json:"autoscaling,omitempty"`

MemoryMin float32 `json:"memoryMin"`
MemoryMax float32 `json:"memoryMax"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}

ScaleDownUtilizationThreshold float32 `json:"scaleDownUtilizationThreshold"`
// NodePoolAutoscaling defines the node group autoscaling options from OVHcloud API
type NodePoolAutoscaling struct {
CpuMin float32 `json:"cpuMin"`
CpuMax float32 `json:"cpuMax"`

ScaleDownUnneededTimeSeconds int32 `json:"scaleDownUnneededTimeSeconds"`
ScaleDownUnreadyTimeSeconds int32 `json:"scaleDownUnreadyTimeSeconds"`
} `json:"autoscaling,omitempty"`
MemoryMin float32 `json:"memoryMin"`
MemoryMax float32 `json:"memoryMax"`

CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
ScaleDownUtilizationThreshold float32 `json:"scaleDownUtilizationThreshold"`

ScaleDownUnneededTimeSeconds int32 `json:"scaleDownUnneededTimeSeconds"`
ScaleDownUnreadyTimeSeconds int32 `json:"scaleDownUnreadyTimeSeconds"`
}

// ListNodePools allows to list all node pools available in a cluster
Expand Down

0 comments on commit 3257372

Please sign in to comment.