Skip to content

Commit

Permalink
instance types filters for vng (#531)
Browse files Browse the repository at this point in the history
 [src] add instance types filters in vng level
 [jira] CON-22542
---------

Co-authored-by: Moshe Dahan <75436598+dahanmoshe1991@users.noreply.github.com>
  • Loading branch information
guybarman and dahanmoshe1991 authored Oct 4, 2023
1 parent ce8ca09 commit 3a16638
Show file tree
Hide file tree
Showing 10 changed files with 236 additions and 1 deletion.
15 changes: 15 additions & 0 deletions api/services/ocean/aws/paths/allowedInstanceTypesByFilters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
get:
summary: "Allowed Instance Types By Filters For Virtual Node Group"
description: >
Returns the Virtual Node Group's instance types when instance types filters is set.
operationId: "oceanAwsGetAllowedInstanceTypesByFilters"
tags:
- "Ocean AWS"
parameters:
- $ref: "../../commons/parameters/oceanLaunchSpecId.yaml"
- $ref: "../../../../commons/parameters/accountId.yaml"
responses:
200:
$ref: "../responses/oceanAllowedInstanceTypesByFilters.yaml"
400:
description: "Bad Request"
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
post:
summary: "Instance Types Filters Simulation For Virtual Node Group"
description: >
Returns all instance types that match the given filters.
These instance types will be used if the Virtual Node Group is configured with these filters.
operationId: "oceanAwsInstanceTypeFiltersSimulationForVng"
tags:
- "Ocean AWS"
parameters:
- $ref: "../../commons/parameters/oceanLaunchSpecId.yaml"
- $ref: "../../../../commons/parameters/accountId.yaml"
requestBody:
required: false
content:
application/json:
schema:
allOf:
- $ref: "../schemas/oceanInstanceTypesFiltersForVngWrapper.yaml"
responses:
200:
$ref: "../responses/filteredInstanceTypesForVng.yaml"
400:
description: "Bad Request"
24 changes: 24 additions & 0 deletions api/services/ocean/aws/responses/filteredInstanceTypesForVng.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
description: Instance Types Filters Simulation For Virtual Node Group Response
content:
application/json:
schema:
allOf:
- $ref: "../../../../commons/schemas/responseItemWrapper.yaml"
- type: object
properties:
request:
type: object
properties:
url:
example: "/ocean/aws/k8s/launchspec/o-abcd1234/instanceTypeFiltersSimulation"
method:
example: "POST"
response:
type: object
properties:
items:
type: array
items:
$ref: "../schemas/filteredInstanceTypes.yaml"
kind:
example: "spotinst:ocean:aws:k8s:launchSpec:instanceTypesFilters:simulation"
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ content:
type: object
properties:
url:
example: "/ocean/aws/k8s/cluster/0-12345abc/allowedInstanceTypes"
example: "/ocean/aws/k8s/cluster/o-12345abc/allowedInstanceTypes"
method:
example: "GET"
response:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
description: Virtual Node Group Allowed Instance Types By Filters
content:
application/json:
schema:
allOf:
- $ref: "../../../../commons/schemas/responseItemWrapper.yaml"
- type: object
properties:
request:
type: object
properties:
url:
example: "/ocean/aws/k8s/launchSpec/ols-12345abc/allowedInstanceTypesByFilters"
method:
example: "GET"
response:
type: object
properties:
items:
type: array
items:
$ref: "../schemas/allowedInstanceTypesByFilters.yaml"
kind:
example: "spotinst:ocean:aws:k8s:launchSpec:allowedInstanceTypesByFilters"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type: object
properties:
instanceTypes:
type: array
description: >
The allowed Virtual Node Group's instance types when instance types filters is set.
items:
type: string
example: [ "c3.large", "c5.large" ]
2 changes: 2 additions & 0 deletions api/services/ocean/aws/schemas/oceanClusterLaunchSpec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ properties:
items:
type: string
example: ["c3.2xlarge", "c4.2xlarge"]
instanceTypesFilters:
$ref: "./oceanInstanceTypesFiltersForVng.yaml"
preferredSpotTypes:
type: array
description: |
Expand Down
128 changes: 128 additions & 0 deletions api/services/ocean/aws/schemas/oceanInstanceTypesFiltersForVng.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
type: object
description: |
List of instance types filters. The instance types that match with all filters compose the Virtual Node Group's instanceTypes parameter.\
The architectures that come from the Virtual Node Group's images will be taken into account when using this parameter.\
Cannot be configured together with Virtual Node Group's instanceTypes and with the Cluster's whitelist/blacklist/filters.
title: InstanceTypesFilters
properties:
minVcpu:
type: integer
description: |
Minimum number of vcpus available.
minimum: 0
example: 2
maxVcpu:
type: integer
description: |
Maximum number of vcpus available.
minimum: 1
example: 16
minMemoryGiB:
type: number
description: |
Minimum amount of Memory (GiB).
minimum: 0
example: 8
maxMemoryGiB:
type: number
description: |
Maximum amount of Memory (GiB).
minimum: 0
example: 16
minGpu:
type: integer
description: |
Minimum total number of GPUs.
minimum: 0
example: 0
maxGpu:
type: integer
description: |
Maximum total number of GPUs.
minimum: 1
example: 4
includeFamilies:
type: array
description: >
Types belonging to a family from the IncludeFamilies will be available for scaling (asterisk wildcard is also supported).
For example, C* will include instance types from these families: c5, c4, c4a, etc.
items:
type: string
example: [ "c5*", "g5"]
excludeFamilies:
type: array
description: >
Types belonging to a family from the ExcludeFamilies will not be available for scaling (asterisk wildcard is also supported).
For example, C* will exclude instance types from these families: c5, c4, c4a, etc.
items:
type: string
example: [ "t2", "R4*"]
excludeMetal:
type: boolean
default: false
description: |
In case excludeMetal is set to true, metal types will not be available for scaling.
example: true
isEnaSupported:
type: boolean
description: |
Ena is supported or not.
example: true
virtualizationTypes:
type: array
description: |
The filtered instance types will support at least one of the virtualization types from this list.
items:
type: string
enum: [ hvm, paravirtual ]
example: [ "hvm" ]
categories:
type: array
description: |
The filtered instance types will belong to one of the categories types from this list.
items:
type: string
enum: [ Accelerated_computing, Compute_optimized, General_purpose, Memory_optimized, Storage_optimized]
example: [ "Accelerated_computing", "Compute_optimized"]
minEnis:
type: integer
description: |
Minimum number of network interfaces (ENIs).
minimum: 0
example: 2
diskTypes:
type: array
description: |
The filtered instance types will have one of the disk type from this list.
items:
type: string
enum: [ NVMe, EBS, SSD, HDD ]
example: [ "NVMe", "EBS"]
hypervisor:
type: array
description: |
The filtered instance types will have a hypervisor type from this list.
items:
type: string
enum: [ nitro, xen ]
example: [ "nitro"]
rootDeviceTypes:
type: array
description: |
The filtered instance types will have a root device types from this list.
items:
type: string
enum: [ ebs, instance-store ]
example: [ "ebs" ]
minNetworkPerformance:
type: integer
description: |
Minimum Bandwidth in Gib/s of network performance.
minimum: 0
example: 2
maxNetworkPerformance:
type: integer
description: |
Maximum Bandwidth in Gib/s of network performance.
minimum: 1
example: 20
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: object
required:
- instanceTypesFilters
properties:
instanceTypesFilters:
$ref: "./oceanInstanceTypesFiltersForVng.yaml"
4 changes: 4 additions & 0 deletions api/spot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,10 @@ paths:
$ref: services/ocean/aws/paths/clusters-launchSpec.yaml
/ocean/aws/k8s/launchSpec/{oceanLaunchSpecId}:
$ref: services/ocean/aws/paths/cluster-launchSpec.yaml
/ocean/aws/k8s/launchSpec/{oceanLaunchSpecId}/instanceTypeFiltersSimulation:
$ref: services/ocean/aws/paths/instanceTypeFiltersSimulationForVng.yaml
/ocean/aws/k8s/launchSpec/{oceanLaunchSpecId}/allowedInstanceTypesByFilters:
$ref: services/ocean/aws/paths/allowedInstanceTypesByFilters.yaml
/ocean/aws/k8s/launchSpec/autoScalingGroup/import:
$ref: services/ocean/aws/paths/importASG-launchSpec.yaml
/ocean/aws/k8s/launchSpec/eksNodeGroup/import:
Expand Down

0 comments on commit 3a16638

Please sign in to comment.