diff --git a/api/services/ocean/aws/paths/allowedInstanceTypesByFilters.yaml b/api/services/ocean/aws/paths/allowedInstanceTypesByFilters.yaml new file mode 100644 index 000000000..a7b2eb968 --- /dev/null +++ b/api/services/ocean/aws/paths/allowedInstanceTypesByFilters.yaml @@ -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" diff --git a/api/services/ocean/aws/paths/instanceTypeFiltersSimulationForVng.yaml b/api/services/ocean/aws/paths/instanceTypeFiltersSimulationForVng.yaml new file mode 100644 index 000000000..bcca536cc --- /dev/null +++ b/api/services/ocean/aws/paths/instanceTypeFiltersSimulationForVng.yaml @@ -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" diff --git a/api/services/ocean/aws/responses/filteredInstanceTypesForVng.yaml b/api/services/ocean/aws/responses/filteredInstanceTypesForVng.yaml new file mode 100644 index 000000000..b561c265d --- /dev/null +++ b/api/services/ocean/aws/responses/filteredInstanceTypesForVng.yaml @@ -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" \ No newline at end of file diff --git a/api/services/ocean/aws/responses/oceanAllowedInstanceTypes.yaml b/api/services/ocean/aws/responses/oceanAllowedInstanceTypes.yaml index 0f8cbe682..e2cf8bc6b 100644 --- a/api/services/ocean/aws/responses/oceanAllowedInstanceTypes.yaml +++ b/api/services/ocean/aws/responses/oceanAllowedInstanceTypes.yaml @@ -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: diff --git a/api/services/ocean/aws/responses/oceanAllowedInstanceTypesByFilters.yaml b/api/services/ocean/aws/responses/oceanAllowedInstanceTypesByFilters.yaml new file mode 100644 index 000000000..5a323fc0c --- /dev/null +++ b/api/services/ocean/aws/responses/oceanAllowedInstanceTypesByFilters.yaml @@ -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" \ No newline at end of file diff --git a/api/services/ocean/aws/schemas/allowedInstanceTypesByFilters.yaml b/api/services/ocean/aws/schemas/allowedInstanceTypesByFilters.yaml new file mode 100644 index 000000000..a10fc8fc0 --- /dev/null +++ b/api/services/ocean/aws/schemas/allowedInstanceTypesByFilters.yaml @@ -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" ] \ No newline at end of file diff --git a/api/services/ocean/aws/schemas/oceanClusterLaunchSpec.yaml b/api/services/ocean/aws/schemas/oceanClusterLaunchSpec.yaml index edf07432d..5b7692a82 100644 --- a/api/services/ocean/aws/schemas/oceanClusterLaunchSpec.yaml +++ b/api/services/ocean/aws/schemas/oceanClusterLaunchSpec.yaml @@ -57,6 +57,8 @@ properties: items: type: string example: ["c3.2xlarge", "c4.2xlarge"] + instanceTypesFilters: + $ref: "./oceanInstanceTypesFiltersForVng.yaml" preferredSpotTypes: type: array description: | diff --git a/api/services/ocean/aws/schemas/oceanInstanceTypesFiltersForVng.yaml b/api/services/ocean/aws/schemas/oceanInstanceTypesFiltersForVng.yaml new file mode 100644 index 000000000..20071e876 --- /dev/null +++ b/api/services/ocean/aws/schemas/oceanInstanceTypesFiltersForVng.yaml @@ -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 \ No newline at end of file diff --git a/api/services/ocean/aws/schemas/oceanInstanceTypesFiltersForVngWrapper.yaml b/api/services/ocean/aws/schemas/oceanInstanceTypesFiltersForVngWrapper.yaml new file mode 100644 index 000000000..d26514053 --- /dev/null +++ b/api/services/ocean/aws/schemas/oceanInstanceTypesFiltersForVngWrapper.yaml @@ -0,0 +1,6 @@ +type: object +required: + - instanceTypesFilters +properties: + instanceTypesFilters: + $ref: "./oceanInstanceTypesFiltersForVng.yaml" \ No newline at end of file diff --git a/api/spot.yaml b/api/spot.yaml index 36cb55ad5..c85dd7d11 100644 --- a/api/spot.yaml +++ b/api/spot.yaml @@ -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: