Skip to content

Commit

Permalink
Merge pull request #7825 from goto-opensource/fix/1.30-backport-oci-f…
Browse files Browse the repository at this point in the history
…ix-scale-from-zero-with-instance-type-selector

fix(oci): scale from zero with instance type selector (backport to 1.30)
  • Loading branch information
k8s-ci-robot authored Feb 18, 2025
2 parents a9697cd + 5bd7dca commit 7a309c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cluster-autoscaler/cloudprovider/oci/common/oci_shape.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ func (osf *shapeGetterImpl) GetNodePoolShape(np *oke.NodePool) (*Shape, error) {
shapeName := *np.NodeShape
if np.NodeShapeConfig != nil {
return &Shape{
CPU: *np.NodeShapeConfig.Ocpus * 2,
Name: shapeName,
CPU: *np.NodeShapeConfig.Ocpus * 2,
// num_bytes * kilo * mega * giga
MemoryInBytes: *np.NodeShapeConfig.MemoryInGBs * 1024 * 1024 * 1024,
GPU: 0,
Expand Down Expand Up @@ -113,6 +114,7 @@ func (osf *shapeGetterImpl) GetNodePoolShape(np *oke.NodePool) (*Shape, error) {
// Update the cache based on latest results
for _, s := range resp.Items {
osf.cache[*s.Shape] = &Shape{
Name: shapeName,
CPU: getFloat32(s.Ocpus) * 2, // convert ocpu to vcpu
GPU: getInt(s.Gpus),
MemoryInBytes: getFloat32(s.MemoryInGBs) * 1024 * 1024 * 1024,
Expand Down
2 changes: 2 additions & 0 deletions cluster-autoscaler/cloudprovider/oci/common/oci_shape_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func TestNodePoolGetShape(t *testing.T) {
"basic shape": {
shape: "VM.Standard1.2",
expected: &Shape{
Name: "VM.Standard1.2",
CPU: 4,
MemoryInBytes: 16 * 1024 * 1024 * 1024,
GPU: 0,
Expand All @@ -107,6 +108,7 @@ func TestNodePoolGetShape(t *testing.T) {
MemoryInGBs: common.Float32(64),
},
expected: &Shape{
Name: "VM.Standard.E3.Flex",
CPU: 8,
MemoryInBytes: 4 * 16 * 1024 * 1024 * 1024,
GPU: 0,
Expand Down

0 comments on commit 7a309c7

Please sign in to comment.