From 0bef16b389e8db38fa39c3fb57b4217bbabadff7 Mon Sep 17 00:00:00 2001 From: Joel Thomas Samuel Date: Thu, 4 Jun 2026 14:29:32 +0530 Subject: [PATCH 1/5] SPOTCON-37414 Add API specifications for the ARS Recommendation Application History endpoint Define and document the API specifications for the ARS Recommendation Application History endpoint, including request/response structures, validation rules, and integration requirements. --- .../ocean/rightsizing/parameters/limit.yaml | 11 ++++++ .../rightsizing/parameters/namespace.yaml | 9 +++++ .../ocean/rightsizing/parameters/offset.yaml | 11 ++++++ .../rightsizing/parameters/workloadName.yaml | 9 +++++ .../rightsizing/parameters/workloadType.yaml | 13 +++++++ ...izingRecommendationApplicationHistory.yaml | 25 ++++++++++++ ...ommendationApplicationHistoryResponse.yaml | 39 +++++++++++++++++++ .../oceanRightsizingComputeResource.yaml | 16 ++++++++ ...izingRecommendationApplicationHistory.yaml | 10 +++++ ...htsizingRecommendationApplicationItem.yaml | 37 ++++++++++++++++++ api/spot.yaml | 2 + 11 files changed, 182 insertions(+) create mode 100644 api/services/ocean/rightsizing/parameters/limit.yaml create mode 100644 api/services/ocean/rightsizing/parameters/namespace.yaml create mode 100644 api/services/ocean/rightsizing/parameters/offset.yaml create mode 100644 api/services/ocean/rightsizing/parameters/workloadName.yaml create mode 100644 api/services/ocean/rightsizing/parameters/workloadType.yaml create mode 100644 api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationApplicationHistory.yaml create mode 100644 api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationApplicationHistoryResponse.yaml create mode 100644 api/services/ocean/rightsizing/schemas/oceanRightsizingComputeResource.yaml create mode 100644 api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationHistory.yaml create mode 100644 api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationItem.yaml diff --git a/api/services/ocean/rightsizing/parameters/limit.yaml b/api/services/ocean/rightsizing/parameters/limit.yaml new file mode 100644 index 000000000..c06ae00c5 --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/limit.yaml @@ -0,0 +1,11 @@ +in: query +name: limit +schema: + type: integer + format: int16 + default: 100 +required: false +example: 100 +description: > + Number of entries to return. + diff --git a/api/services/ocean/rightsizing/parameters/namespace.yaml b/api/services/ocean/rightsizing/parameters/namespace.yaml new file mode 100644 index 000000000..58397dd3d --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/namespace.yaml @@ -0,0 +1,9 @@ +in: path +name: namespace +schema: + type: string +required: true +example: kube-system +description: > + Kubernetes namespace. + diff --git a/api/services/ocean/rightsizing/parameters/offset.yaml b/api/services/ocean/rightsizing/parameters/offset.yaml new file mode 100644 index 000000000..d30cf5eda --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/offset.yaml @@ -0,0 +1,11 @@ +in: query +name: offset +schema: + type: integer + format: int16 + default: 0 +required: false +example: 0 +description: > + Number of entries to skip before returning page. + diff --git a/api/services/ocean/rightsizing/parameters/workloadName.yaml b/api/services/ocean/rightsizing/parameters/workloadName.yaml new file mode 100644 index 000000000..b37533fc7 --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/workloadName.yaml @@ -0,0 +1,9 @@ +in: path +name: workloadName +schema: + type: string +required: true +example: redis-controller +description: > + Kubernetes workload name. + diff --git a/api/services/ocean/rightsizing/parameters/workloadType.yaml b/api/services/ocean/rightsizing/parameters/workloadType.yaml new file mode 100644 index 000000000..95186c30e --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/workloadType.yaml @@ -0,0 +1,13 @@ +in: path +name: workloadType +schema: + type: string + enum: + - deployment + - daemonSet + - statefulSet +required: true +example: deployment +description: > + Workload type as defined in kubernetes. + diff --git a/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationApplicationHistory.yaml b/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationApplicationHistory.yaml new file mode 100644 index 000000000..74e12e96a --- /dev/null +++ b/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationApplicationHistory.yaml @@ -0,0 +1,25 @@ +get: + summary: "Get Workload Recommendation Application History" + description: | + Returns a set of recommendation application history records associated with workload. + operationId: "getWorkloadRecommendationHistory" + tags: + - "Ocean Automatic Rightsizing" + parameters: + - $ref: "../parameters/oceanId.yaml" + - $ref: "../parameters/namespace.yaml" + - $ref: "../parameters/workloadType.yaml" + - $ref: "../parameters/workloadName.yaml" + - $ref: "../../../../commons/parameters/accountId.yaml" + - $ref: "../parameters/offset.yaml" + - $ref: "../parameters/limit.yaml" + responses: + 200: + $ref: "../responses/oceanRightsizingRecommendationApplicationHistoryResponse.yaml" + 400: + description: "Invalid request provided" + 404: + description: "Non existent resource has been queried" + 422: + description: "Business rule violated" + diff --git a/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationApplicationHistoryResponse.yaml b/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationApplicationHistoryResponse.yaml new file mode 100644 index 000000000..0049b87da --- /dev/null +++ b/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationApplicationHistoryResponse.yaml @@ -0,0 +1,39 @@ +description: "Ocean Rightsizing Recommendation Application History Response" +content: + application/json: + schema: + allOf: + - $ref: "../../../../commons/schemas/responseItemWrapper.yaml" + - type: object + properties: + request: + type: object + properties: + url: + example: "/ocean/o-abcd1234/rightSizing/namespaces/kube-system/deployment/redis-controller/recommendation-application-history" + method: + example: "GET" + response: + type: object + properties: + items: + type: array + items: + $ref: "../schemas/oceanRightsizingRecommendationApplicationHistory.yaml" + example: + - page: + - containerName: "my-app-container" + actionType: "APPLIED" + currentResources: + cpu: 4000 + memory: 16000 + recommendedResources: + cpu: 2000 + memory: 8000 + occurredAt: 1776178797289 + ruleName: "my-app-rule" + count: + example: 1 + kind: + example: "mcs:ocean:rightSizing:recommendationApplicationHistory" + diff --git a/api/services/ocean/rightsizing/schemas/oceanRightsizingComputeResource.yaml b/api/services/ocean/rightsizing/schemas/oceanRightsizingComputeResource.yaml new file mode 100644 index 000000000..1e12cc50e --- /dev/null +++ b/api/services/ocean/rightsizing/schemas/oceanRightsizingComputeResource.yaml @@ -0,0 +1,16 @@ +type: object +title: Compute Resource +description: > + Represents CPU and memory resource values. +properties: + cpu: + type: integer + format: int32 + description: CPU resource value in millicores. + example: 4000 + memory: + type: integer + format: int32 + description: Memory resource value in MiB. + example: 16000 + diff --git a/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationHistory.yaml b/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationHistory.yaml new file mode 100644 index 000000000..208d8a838 --- /dev/null +++ b/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationHistory.yaml @@ -0,0 +1,10 @@ +type: object +title: Recommendation Application History +description: > + A page of recommendation application history records. +properties: + page: + type: array + items: + $ref: "../schemas/oceanRightsizingRecommendationApplicationItem.yaml" + diff --git a/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationItem.yaml b/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationItem.yaml new file mode 100644 index 000000000..bee0d6b22 --- /dev/null +++ b/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationItem.yaml @@ -0,0 +1,37 @@ +type: object +title: Recommendation Application Item +description: > + A single recommendation application history record for a container. +properties: + containerName: + type: string + description: Name of the container. + example: "depression-container" + actionType: + type: string + description: The type of action that was taken or the reason it was not applied. + enum: + - APPLIED + - CPU_ONLY_APPLIED + - MEMORY_ONLY_APPLIED + - OUTSIDE_OF_TIME_WINDOW + - THRESHOLD_NOT_MET + - HPA_RESTRICTED + - UNSUPPORTED_HPA + - INVALID_HPA + - PRELIMINARY_RESTRICTED + example: "APPLIED" + currentResources: + $ref: "../schemas/oceanRightsizingComputeResource.yaml" + recommendedResources: + $ref: "../schemas/oceanRightsizingComputeResource.yaml" + occurredAt: + type: integer + format: int64 + description: Timestamp (epoch millis) when the action occurred. + example: 1776178797289 + ruleName: + type: string + description: Name of the rightsizing rule that triggered this action. + example: "one-to-rule-them-all" + diff --git a/api/spot.yaml b/api/spot.yaml index 221ec41f3..a9d4e01cf 100644 --- a/api/spot.yaml +++ b/api/spot.yaml @@ -973,6 +973,8 @@ paths: $ref: services/ocean/rightsizing/paths/oceanRightsizingClusterConfiguration.yaml /ocean/{oceanId}/rightSizing/savings: $ref: services/ocean/rightsizing/paths/oceanRightsizingSavings.yaml + /ocean/{oceanId}/rightSizing/namespaces/{namespace}/{workloadType}/{workloadName}/recommendation-application-history: + $ref: services/ocean/rightsizing/paths/oceanRightsizingRecommendationApplicationHistory.yaml /security/v1/compliances: $ref: services/security/v1/paths/compliances.yaml /security/v1/compliances/count: From e7b7d016c377b7f50a03d3564a9457ddc8137cfb Mon Sep 17 00:00:00 2001 From: Joel Thomas Samuel Date: Thu, 4 Jun 2026 14:46:29 +0530 Subject: [PATCH 2/5] SPOTCON-37414 Add API specifications for the ARS Recommendation Application History endpoint --- api/services/ocean/rightsizing/parameters/limit.yaml | 5 +++-- api/services/ocean/rightsizing/parameters/offset.yaml | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/services/ocean/rightsizing/parameters/limit.yaml b/api/services/ocean/rightsizing/parameters/limit.yaml index c06ae00c5..3b88d1081 100644 --- a/api/services/ocean/rightsizing/parameters/limit.yaml +++ b/api/services/ocean/rightsizing/parameters/limit.yaml @@ -4,8 +4,9 @@ schema: type: integer format: int16 default: 100 + minimum: 1 + maximum: 200 required: false example: 100 description: > - Number of entries to return. - + Number of entries to return. \ No newline at end of file diff --git a/api/services/ocean/rightsizing/parameters/offset.yaml b/api/services/ocean/rightsizing/parameters/offset.yaml index d30cf5eda..44a3668f4 100644 --- a/api/services/ocean/rightsizing/parameters/offset.yaml +++ b/api/services/ocean/rightsizing/parameters/offset.yaml @@ -4,8 +4,8 @@ schema: type: integer format: int16 default: 0 + minimum: 0 + example: 0 required: false -example: 0 description: > - Number of entries to skip before returning page. - + Number of entries to skip before returning page. \ No newline at end of file From db6b100c2434ee5def298fb2e81faa74c30a14a9 Mon Sep 17 00:00:00 2001 From: Joel Thomas Samuel Date: Mon, 29 Jun 2026 11:53:53 +0530 Subject: [PATCH 3/5] SPOTCON-37414 Add API specifications for the ARS Recommendation Application History endpoint --- api/commons/schemas/responseItemWrapper.yaml | 8 ++++---- .../ocean/rightsizing/parameters/workloadType.yaml | 2 ++ ...ghtsizingRecommendationApplicationHistoryResponse.yaml | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/api/commons/schemas/responseItemWrapper.yaml b/api/commons/schemas/responseItemWrapper.yaml index 8e2da6d0e..abd3b26c1 100644 --- a/api/commons/schemas/responseItemWrapper.yaml +++ b/api/commons/schemas/responseItemWrapper.yaml @@ -5,6 +5,10 @@ allOf: response: type: "object" properties: + kind: + type: "string" + description: > + The data type of each item in the response. items: type: "array" description: > @@ -16,7 +20,3 @@ allOf: example: 1 description: > Size of the data object array. - kind: - type: "string" - description: > - The data type of each item in the response. diff --git a/api/services/ocean/rightsizing/parameters/workloadType.yaml b/api/services/ocean/rightsizing/parameters/workloadType.yaml index 95186c30e..8dd1195a4 100644 --- a/api/services/ocean/rightsizing/parameters/workloadType.yaml +++ b/api/services/ocean/rightsizing/parameters/workloadType.yaml @@ -6,6 +6,8 @@ schema: - deployment - daemonSet - statefulSet + - replicaSet + - rollout required: true example: deployment description: > diff --git a/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationApplicationHistoryResponse.yaml b/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationApplicationHistoryResponse.yaml index 0049b87da..a440f5dae 100644 --- a/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationApplicationHistoryResponse.yaml +++ b/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationApplicationHistoryResponse.yaml @@ -16,6 +16,8 @@ content: response: type: object properties: + kind: + example: "mcs:ocean:rightSizing:recommendationApplicationHistory" items: type: array items: @@ -34,6 +36,4 @@ content: ruleName: "my-app-rule" count: example: 1 - kind: - example: "mcs:ocean:rightSizing:recommendationApplicationHistory" From dd901732e67351164e85e1800459348760e2ac80 Mon Sep 17 00:00:00 2001 From: Joel Thomas Samuel Date: Tue, 30 Jun 2026 18:30:18 +0530 Subject: [PATCH 4/5] Removed replicaSet --- api/services/ocean/rightsizing/parameters/workloadType.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/api/services/ocean/rightsizing/parameters/workloadType.yaml b/api/services/ocean/rightsizing/parameters/workloadType.yaml index 8dd1195a4..f2a186ae6 100644 --- a/api/services/ocean/rightsizing/parameters/workloadType.yaml +++ b/api/services/ocean/rightsizing/parameters/workloadType.yaml @@ -6,7 +6,6 @@ schema: - deployment - daemonSet - statefulSet - - replicaSet - rollout required: true example: deployment From 19ebb79ae4ba08867dfe97be043290e616f44745 Mon Sep 17 00:00:00 2001 From: Joel Thomas Samuel Date: Tue, 30 Jun 2026 21:37:41 +0530 Subject: [PATCH 5/5] Fixed Naming --- .../oceanRightsizingRecommendationApplicationHistory.yaml | 2 +- .../oceanRightsizingRecommendationApplicationItem.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationApplicationHistory.yaml b/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationApplicationHistory.yaml index 74e12e96a..1ed816e58 100644 --- a/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationApplicationHistory.yaml +++ b/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationApplicationHistory.yaml @@ -2,7 +2,7 @@ get: summary: "Get Workload Recommendation Application History" description: | Returns a set of recommendation application history records associated with workload. - operationId: "getWorkloadRecommendationHistory" + operationId: "getWorkloadRecommendationApplicationHistory" tags: - "Ocean Automatic Rightsizing" parameters: diff --git a/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationItem.yaml b/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationItem.yaml index bee0d6b22..5984f7998 100644 --- a/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationItem.yaml +++ b/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationApplicationItem.yaml @@ -6,7 +6,7 @@ properties: containerName: type: string description: Name of the container. - example: "depression-container" + example: "my-app-container" actionType: type: string description: The type of action that was taken or the reason it was not applied. @@ -33,5 +33,5 @@ properties: ruleName: type: string description: Name of the rightsizing rule that triggered this action. - example: "one-to-rule-them-all" + example: "my-app-rule"