Merge pull request #6993 from goto-opensource/fix-scale-from-zero-with-instance-type-selector
OCI: Fixing scale from zero if the nodeSelector of workload contains 'node.kubernetes.io/instance-type'
This commit is contained in:
commit
bc6489b448
|
@ -83,6 +83,7 @@ func (osf *shapeGetterImpl) GetNodePoolShape(np *oke.NodePool, ephemeralStorage
|
||||||
shapeName := *np.NodeShape
|
shapeName := *np.NodeShape
|
||||||
if np.NodeShapeConfig != nil {
|
if np.NodeShapeConfig != nil {
|
||||||
return &Shape{
|
return &Shape{
|
||||||
|
Name: shapeName,
|
||||||
CPU: *np.NodeShapeConfig.Ocpus * 2,
|
CPU: *np.NodeShapeConfig.Ocpus * 2,
|
||||||
// num_bytes * kilo * mega * giga
|
// num_bytes * kilo * mega * giga
|
||||||
MemoryInBytes: *np.NodeShapeConfig.MemoryInGBs * 1024 * 1024 * 1024,
|
MemoryInBytes: *np.NodeShapeConfig.MemoryInGBs * 1024 * 1024 * 1024,
|
||||||
|
@ -115,6 +116,7 @@ func (osf *shapeGetterImpl) GetNodePoolShape(np *oke.NodePool, ephemeralStorage
|
||||||
// Update the cache based on latest results
|
// Update the cache based on latest results
|
||||||
for _, s := range resp.Items {
|
for _, s := range resp.Items {
|
||||||
osf.cache[*s.Shape] = &Shape{
|
osf.cache[*s.Shape] = &Shape{
|
||||||
|
Name: shapeName,
|
||||||
CPU: getFloat32(s.Ocpus) * 2, // convert ocpu to vcpu
|
CPU: getFloat32(s.Ocpus) * 2, // convert ocpu to vcpu
|
||||||
GPU: getInt(s.Gpus),
|
GPU: getInt(s.Gpus),
|
||||||
MemoryInBytes: getFloat32(s.MemoryInGBs) * 1024 * 1024 * 1024,
|
MemoryInBytes: getFloat32(s.MemoryInGBs) * 1024 * 1024 * 1024,
|
||||||
|
|
|
@ -95,6 +95,7 @@ func TestNodePoolGetShape(t *testing.T) {
|
||||||
"basic shape": {
|
"basic shape": {
|
||||||
shape: "VM.Standard1.2",
|
shape: "VM.Standard1.2",
|
||||||
expected: &Shape{
|
expected: &Shape{
|
||||||
|
Name: "VM.Standard1.2",
|
||||||
CPU: 4,
|
CPU: 4,
|
||||||
MemoryInBytes: 16 * 1024 * 1024 * 1024,
|
MemoryInBytes: 16 * 1024 * 1024 * 1024,
|
||||||
GPU: 0,
|
GPU: 0,
|
||||||
|
@ -108,6 +109,7 @@ func TestNodePoolGetShape(t *testing.T) {
|
||||||
MemoryInGBs: common.Float32(64),
|
MemoryInGBs: common.Float32(64),
|
||||||
},
|
},
|
||||||
expected: &Shape{
|
expected: &Shape{
|
||||||
|
Name: "VM.Standard.E3.Flex",
|
||||||
CPU: 8,
|
CPU: 8,
|
||||||
MemoryInBytes: 4 * 16 * 1024 * 1024 * 1024,
|
MemoryInBytes: 4 * 16 * 1024 * 1024 * 1024,
|
||||||
GPU: 0,
|
GPU: 0,
|
||||||
|
|
Loading…
Reference in New Issue