From 97bacb984527679623eb2e6dfc629610647befef Mon Sep 17 00:00:00 2001 From: cshivaraj-patil Date: Mon, 29 Jun 2026 16:08:47 +0530 Subject: [PATCH 1/3] SPOTCON-37764 Updated OpenAPI documentation for Ocean Rightsizing Recommendation History API Updated OpenAPI documentation for Ocean Rightsizing Recommendation History API. Added endpoint definition, request parameters, response schema, examples, and aligned query parameter documentation with API behavior. --- .../parameters/containerNames.yaml | 14 +++++ .../rightsizing/parameters/fromDate.yaml | 10 ++++ .../rightsizing/parameters/namespace.yaml | 9 ++++ .../ocean/rightsizing/parameters/toDate.yaml | 10 ++++ .../rightsizing/parameters/workloadName.yaml | 9 ++++ .../rightsizing/parameters/workloadType.yaml | 9 ++++ ...oceanRightsizingRecommendationHistory.yaml | 22 ++++++++ ...htsizingRecommendationHistoryResponse.yaml | 51 +++++++++++++++++++ ...nRightsizingRecommendationHistoryItem.yaml | 44 ++++++++++++++++ api/spot.yaml | 2 + 10 files changed, 180 insertions(+) create mode 100644 api/services/ocean/rightsizing/parameters/containerNames.yaml create mode 100644 api/services/ocean/rightsizing/parameters/fromDate.yaml create mode 100644 api/services/ocean/rightsizing/parameters/namespace.yaml create mode 100644 api/services/ocean/rightsizing/parameters/toDate.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/oceanRightsizingRecommendationHistory.yaml create mode 100644 api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml create mode 100644 api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationHistoryItem.yaml diff --git a/api/services/ocean/rightsizing/parameters/containerNames.yaml b/api/services/ocean/rightsizing/parameters/containerNames.yaml new file mode 100644 index 000000000..960e0dd9b --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/containerNames.yaml @@ -0,0 +1,14 @@ +in: query +name: containerNames +required: true +description: > + List of container names to filter by. +style: form +explode: true +schema: + type: array + items: + type: string +example: + - app + - sidecar diff --git a/api/services/ocean/rightsizing/parameters/fromDate.yaml b/api/services/ocean/rightsizing/parameters/fromDate.yaml new file mode 100644 index 000000000..b9983dce5 --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/fromDate.yaml @@ -0,0 +1,10 @@ +in: query +name: fromDate +schema: + type: integer + format: int64 +required: true +example: 1717200000000 +description: > + Start time filter as Unix epoch timestamp in milliseconds. + diff --git a/api/services/ocean/rightsizing/parameters/namespace.yaml b/api/services/ocean/rightsizing/parameters/namespace.yaml new file mode 100644 index 000000000..dd226af72 --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/namespace.yaml @@ -0,0 +1,9 @@ +in: path +name: namespace +schema: + type: string +required: true +example: default +description: > + Namespace of the workload. + diff --git a/api/services/ocean/rightsizing/parameters/toDate.yaml b/api/services/ocean/rightsizing/parameters/toDate.yaml new file mode 100644 index 000000000..af743d770 --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/toDate.yaml @@ -0,0 +1,10 @@ +in: query +name: toDate +schema: + type: integer + format: int64 +required: false +example: 1719800000000 +description: > + End time filter as Unix epoch timestamp in milliseconds. + diff --git a/api/services/ocean/rightsizing/parameters/workloadName.yaml b/api/services/ocean/rightsizing/parameters/workloadName.yaml new file mode 100644 index 000000000..ccb22b366 --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/workloadName.yaml @@ -0,0 +1,9 @@ +in: path +name: workloadName +schema: + type: string +required: true +example: checkout-service +description: > + Name of the workload. + diff --git a/api/services/ocean/rightsizing/parameters/workloadType.yaml b/api/services/ocean/rightsizing/parameters/workloadType.yaml new file mode 100644 index 000000000..12c8bd0e0 --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/workloadType.yaml @@ -0,0 +1,9 @@ +in: path +name: workloadType +schema: + type: string +required: true +example: deployment +description: > + Type of the workload. + diff --git a/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationHistory.yaml b/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationHistory.yaml new file mode 100644 index 000000000..00fa6bdb3 --- /dev/null +++ b/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationHistory.yaml @@ -0,0 +1,22 @@ +get: + summary: "Get Ocean Rightsizing Recommendation History" + description: | + Get right-sizing recommendation history for a specific workload in an Ocean cluster. + operationId: "oceanRightsizingRecommendationHistory" + 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/fromDate.yaml" + - $ref: "../parameters/toDate.yaml" + - $ref: "../parameters/containerNames.yaml" + responses: + 200: + $ref: "../responses/oceanRightsizingRecommendationHistoryResponse.yaml" + 400: + description: "Bad Request" + diff --git a/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml b/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml new file mode 100644 index 000000000..f1464fe97 --- /dev/null +++ b/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml @@ -0,0 +1,51 @@ +description: "Ocean Rightsizing Recommendation 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/default/deployment/checkout-service/recommendation-history" + method: + example: "GET" + response: + type: object + properties: + items: + type: array + items: + $ref: "../schemas/oceanRightsizingRecommendationHistoryItem.yaml" + example: + - timestamp: 1717200000000 + namespace: "default" + workloadName: "checkout-service" + workloadType: "deployment" + containerName: "app" + requestedCPU: 500 + suggestedCPU: 350 + requestedMemory: 512 + suggestedMemory: 384 + monthlyMaxSavings: 34.17 + optimizationStatus: "NOT_OPTIMIZED" + appliedAt: "2026-05-17T10:20:32.000Z" + - timestamp: 1719800000000 + namespace: "default" + workloadName: "checkout-service" + workloadType: "deployment" + containerName: "app" + requestedCPU: 500 + suggestedCPU: 320 + requestedMemory: 512 + suggestedMemory: 360 + monthlyMaxSavings: 42.08 + optimizationStatus: "PARTLY_OPTIMIZED" + appliedAt: "2026-06-05T10:20:32.000Z" + count: + example: 2 + kind: + example: "mcs:ocean:rightSizing:clusterResourceRecommendationsHistory" \ No newline at end of file diff --git a/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationHistoryItem.yaml b/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationHistoryItem.yaml new file mode 100644 index 000000000..4c1076d07 --- /dev/null +++ b/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationHistoryItem.yaml @@ -0,0 +1,44 @@ +type: object +title: Ocean Rightsizing Recommendation History Item +description: > + Recommendation snapshot for a workload container at a specific point in time. +properties: + timestamp: + type: integer + format: int64 + description: Unix epoch timestamp in milliseconds. + namespace: + type: string + description: Namespace of the workload. + workloadName: + type: string + description: Name of the workload. + workloadType: + type: string + description: Type of the workload. + containerName: + type: string + description: Name of the container. + requestedCPU: + type: number + description: Current requested CPU. + suggestedCPU: + type: integer + description: Recommended CPU request. + requestedMemory: + type: number + description: Current requested memory. + suggestedMemory: + type: integer + description: Recommended memory request. + monthlyMaxSavings: + type: number + description: Estimated monthly maximum savings. + optimizationStatus: + type: string + description: Optimization status of the workload recommendation. + appliedAt: + type: string + format: date-time + description: Timestamp when recommendation was applied. + diff --git a/api/spot.yaml b/api/spot.yaml index ced9b16b7..6f3b0bec4 100644 --- a/api/spot.yaml +++ b/api/spot.yaml @@ -1025,6 +1025,8 @@ paths: $ref: services/ocean/rightsizing/paths/oceanRightsizingRuleDetachment.yaml /ocean/{oceanId}/rightSizing/recommendations: $ref: services/ocean/rightsizing/paths/oceanRightsizingRecommendations.yaml + /ocean/{oceanId}/rightSizing/namespaces/{namespace}/{workloadType}/{workloadName}/recommendation-history: + $ref: services/ocean/rightsizing/paths/oceanRightsizingRecommendationHistory.yaml /ocean/{oceanId}/rightSizing/rollbacks: $ref: services/ocean/rightsizing/paths/oceanRightsizingRollbacks.yaml /ocean/{oceanId}/rightSizing/rollbacks/acknowledge: From 99778a53a2a522c68e4040cdeaa2477074d6b2e9 Mon Sep 17 00:00:00 2001 From: cshivaraj-patil Date: Mon, 6 Jul 2026 16:56:56 +0530 Subject: [PATCH 2/3] Added cluster identifier as query parameter --- .../rightsizing/parameters/clusterIdentifierOptional.yaml | 8 ++++++++ .../paths/oceanRightsizingRecommendationHistory.yaml | 1 + .../oceanRightsizingRecommendationHistoryResponse.yaml | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 api/services/ocean/rightsizing/parameters/clusterIdentifierOptional.yaml diff --git a/api/services/ocean/rightsizing/parameters/clusterIdentifierOptional.yaml b/api/services/ocean/rightsizing/parameters/clusterIdentifierOptional.yaml new file mode 100644 index 000000000..54c700cb8 --- /dev/null +++ b/api/services/ocean/rightsizing/parameters/clusterIdentifierOptional.yaml @@ -0,0 +1,8 @@ +in: query +name: clusterIdentifier +schema: + type: string +required: false +example: dev-cluster +description: > + Identifier of the cluster from which recommendation history should be retrieved. diff --git a/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationHistory.yaml b/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationHistory.yaml index 00fa6bdb3..401f4df09 100644 --- a/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationHistory.yaml +++ b/api/services/ocean/rightsizing/paths/oceanRightsizingRecommendationHistory.yaml @@ -11,6 +11,7 @@ get: - $ref: "../parameters/workloadType.yaml" - $ref: "../parameters/workloadName.yaml" - $ref: "../../../../commons/parameters/accountId.yaml" + - $ref: "../parameters/clusterIdentifierOptional.yaml" - $ref: "../parameters/fromDate.yaml" - $ref: "../parameters/toDate.yaml" - $ref: "../parameters/containerNames.yaml" diff --git a/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml b/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml index f1464fe97..6f301d7ca 100644 --- a/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml +++ b/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml @@ -10,7 +10,7 @@ content: type: object properties: url: - example: "/ocean/o-abcd1234/rightSizing/namespaces/default/deployment/checkout-service/recommendation-history" + example: "/ocean/o-abcd1234/rightSizing/namespaces/default/deployment/checkout-service/recommendation-history?accountId=act-123456789&fromDate=1717200000000&clusterIdentifier=dev-cluster" method: example: "GET" response: From a32928a18bcdb6f3e5d6cf217358601caaa47ee6 Mon Sep 17 00:00:00 2001 From: cshivaraj-patil Date: Thu, 9 Jul 2026 14:29:24 +0530 Subject: [PATCH 3/3] Updated the recommendation history response schema --- ...htsizingRecommendationHistoryResponse.yaml | 52 ++++++------ ...nRightsizingRecommendationHistoryItem.yaml | 80 ++++++++++--------- 2 files changed, 68 insertions(+), 64 deletions(-) diff --git a/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml b/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml index 6f301d7ca..a0c782ef6 100644 --- a/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml +++ b/api/services/ocean/rightsizing/responses/oceanRightsizingRecommendationHistoryResponse.yaml @@ -19,33 +19,33 @@ content: items: type: array items: - $ref: "../schemas/oceanRightsizingRecommendationHistoryItem.yaml" + type: object + properties: + recommendations: + type: array + items: + $ref: "../schemas/oceanRightsizingRecommendationHistoryItem.yaml" example: - - timestamp: 1717200000000 - namespace: "default" - workloadName: "checkout-service" - workloadType: "deployment" - containerName: "app" - requestedCPU: 500 - suggestedCPU: 350 - requestedMemory: 512 - suggestedMemory: 384 - monthlyMaxSavings: 34.17 - optimizationStatus: "NOT_OPTIMIZED" - appliedAt: "2026-05-17T10:20:32.000Z" - - timestamp: 1719800000000 - namespace: "default" - workloadName: "checkout-service" - workloadType: "deployment" - containerName: "app" - requestedCPU: 500 - suggestedCPU: 320 - requestedMemory: 512 - suggestedMemory: 360 - monthlyMaxSavings: 42.08 - optimizationStatus: "PARTLY_OPTIMIZED" - appliedAt: "2026-06-05T10:20:32.000Z" + - recommendations: + - podCount: 1 + cpu: + requested: 0.01 + recommended: 0.01 + limit: 0.02 + p99: 0 + p95: 0 + p90: 0 + p85: 0 + memory: + requested: 32 + recommended: 32 + limit: 64 + p100: 7.59 + p95: 7.56 + p90: 7.56 + p85: 7.53 + recommendedAt: 1783313815984 count: - example: 2 + example: 1 kind: example: "mcs:ocean:rightSizing:clusterResourceRecommendationsHistory" \ No newline at end of file diff --git a/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationHistoryItem.yaml b/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationHistoryItem.yaml index 4c1076d07..2eff5618b 100644 --- a/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationHistoryItem.yaml +++ b/api/services/ocean/rightsizing/schemas/oceanRightsizingRecommendationHistoryItem.yaml @@ -1,44 +1,48 @@ type: object title: Ocean Rightsizing Recommendation History Item description: > - Recommendation snapshot for a workload container at a specific point in time. + Recommendation snapshot for a workload at a specific point in time. properties: - timestamp: + podCount: type: integer - format: int64 - description: Unix epoch timestamp in milliseconds. - namespace: - type: string - description: Namespace of the workload. - workloadName: - type: string - description: Name of the workload. - workloadType: - type: string - description: Type of the workload. - containerName: - type: string - description: Name of the container. - requestedCPU: - type: number - description: Current requested CPU. - suggestedCPU: - type: integer - description: Recommended CPU request. - requestedMemory: - type: number - description: Current requested memory. - suggestedMemory: + description: Number of pods in the workload at recommendation time. + cpu: + type: object + description: CPU recommendation details. + properties: + requested: + type: number + recommended: + type: number + limit: + type: number + p99: + type: number + p95: + type: number + p90: + type: number + p85: + type: number + memory: + type: object + description: Memory recommendation details. + properties: + requested: + type: number + recommended: + type: number + limit: + type: number + p100: + type: number + p95: + type: number + p90: + type: number + p85: + type: number + recommendedAt: type: integer - description: Recommended memory request. - monthlyMaxSavings: - type: number - description: Estimated monthly maximum savings. - optimizationStatus: - type: string - description: Optimization status of the workload recommendation. - appliedAt: - type: string - format: date-time - description: Timestamp when recommendation was applied. - + format: int64 + description: Unix epoch timestamp in milliseconds when the recommendation was generated.