Skip to content

Commit 756b3ec

Browse files
committed
feat: add resource recommendation APIs and update openapi.yaml
1 parent cfc1d0e commit 756b3ec

File tree

2 files changed

+601
-172
lines changed

2 files changed

+601
-172
lines changed
Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
openapi: 3.1.0
2+
info:
3+
title: Title
4+
description: Title
5+
version: 1.0.0
6+
servers:
7+
- url: http://localhost:8080/orchestrator
8+
description: Devtron API Server
9+
paths:
10+
/k8s/resource/recommended:
11+
post:
12+
summary: Get Resource Recommendation for a particular resource
13+
description: This API will fetch resource recommendations for a specific Kubernetes resource
14+
operationId: GetResourceRecommendation
15+
security: [ ]
16+
requestBody:
17+
description: A JSON object containing the details required to fetch cluster resource recommendations
18+
required: true
19+
content:
20+
application/json:
21+
schema:
22+
$ref: '#/components/schemas/ResourceRequestObject'
23+
responses:
24+
'200':
25+
description: Resource recommendation response
26+
content:
27+
application/json:
28+
schema:
29+
$ref: '#/components/schemas/ResourceGetResponse'
30+
/k8s/resource/recommendation/sync:
31+
post:
32+
summary: Sync Cluster Resource Recommendations
33+
description: This API will be used to sync resource recommendations for a cluster
34+
operationId: SyncClusterResourceRecommendations
35+
security: [ ]
36+
requestBody:
37+
description: A JSON object containing the details required to sync cluster resource recommendations
38+
required: true
39+
content:
40+
application/json:
41+
schema:
42+
$ref: '#/components/schemas/SyncResourceRecommendation'
43+
responses:
44+
'200':
45+
description: Cluster resource recommendation sync response
46+
content:
47+
application/json:
48+
schema:
49+
type: string
50+
description: A message indicating the sync status
51+
tags:
52+
- Resource Recommendation
53+
/k8s/resource/{clusterId}/recommendation/details:
54+
get:
55+
summary: Get Cluster Resource Recommendation Details
56+
description: This API will fetch resource recommendations metadata for a cluster
57+
operationId: GetClusterResourceRecommendationDetails
58+
security: [ ]
59+
parameters:
60+
- name: clusterId
61+
in: path
62+
required: true
63+
description: ID of the target cluster
64+
schema:
65+
type: number
66+
responses:
67+
'200':
68+
description: Cluster resource recommendation details response
69+
content:
70+
application/json:
71+
schema:
72+
$ref: '#/components/schemas/ResourceRecommendationDetails'
73+
tags:
74+
- Resource Recommendation
75+
/k8s/resource/recommendation/list:
76+
post:
77+
summary: Get Cluster Resource Recommendation List
78+
description: This API will be used for fetching all workloads and their resource recommendations
79+
operationId: GetClusterResourceRecommendationList
80+
security: [ ]
81+
requestBody:
82+
description: A JSON object containing the details required to fetch cluster resource recommendations
83+
required: true
84+
content:
85+
application/json:
86+
schema:
87+
$ref: '#/components/schemas/ResourceRequestObject'
88+
responses:
89+
'200':
90+
description: Cluster resource recommendation list response
91+
content:
92+
application/json:
93+
schema:
94+
$ref: '#/components/schemas/ClusterResourceRecommendationList'
95+
tags:
96+
- Resource Recommendation
97+
98+
components:
99+
schemas:
100+
ManifestResponse:
101+
type: object
102+
required:
103+
- manifest
104+
properties:
105+
recommendedManifest:
106+
description: Recommended manifest for the resource
107+
$ref: '#/components/schemas/K8sManifest'
108+
manifest:
109+
description: Current manifest for the resource
110+
$ref: '#/components/schemas/K8sManifest'
111+
SyncResourceRecommendation:
112+
type: object
113+
description: Request object for syncing resource recommendations for a cluster
114+
required:
115+
- clusterId
116+
properties:
117+
clusterId:
118+
type: number
119+
description: ID of the target cluster
120+
ResourceRecommendationDetails:
121+
type: object
122+
description: Details of resource recommendations for a cluster
123+
required:
124+
- supportedGVKs
125+
properties:
126+
supportedGVKs:
127+
type: array
128+
description: List of supported workload Group, Version, and Kind (GVK) for resource recommendations
129+
items:
130+
$ref: '#/components/schemas/GroupVersionKind'
131+
lastScannedOn:
132+
type: string
133+
format: date-time
134+
description: Timestamp of the last scan for resource recommendations
135+
ResourceRequestObject:
136+
type: object
137+
required:
138+
- clusterId
139+
properties:
140+
clusterId:
141+
type: number
142+
description: id of the target cluster
143+
k8sRequest:
144+
$ref: '#/components/schemas/K8sRequestObject'
145+
K8sRequestObject:
146+
type: object
147+
description: Kubernetes request object containing resource identifiers for filtering
148+
properties:
149+
resourceIdentifier:
150+
type: object
151+
description: Resource identifier filter for the Kubernetes resource
152+
allOf:
153+
- $ref: '#/components/schemas/GroupVersionKind'
154+
properties:
155+
namespace:
156+
type: string
157+
description: Namespace of the Kubernetes resource for filtering
158+
GroupVersionKind:
159+
type: object
160+
description: Group, Version, and Kind of the Kubernetes resource
161+
properties:
162+
group:
163+
type: string
164+
description: Group of the Kubernetes resource
165+
version:
166+
type: string
167+
description: Version of the Kubernetes resource
168+
kind:
169+
type: string
170+
description: Kind of the Kubernetes resource
171+
ClusterResourceRecommendationList:
172+
type: object
173+
properties:
174+
headers:
175+
type: array
176+
items:
177+
type: string
178+
enum:
179+
- name
180+
- namespace
181+
- kind
182+
- apiVersion
183+
- containerName
184+
- cpuRequest
185+
- cpuLimit
186+
- memoryRequest
187+
- memoryLimit
188+
data:
189+
type: array
190+
items:
191+
type: object
192+
properties:
193+
name:
194+
type: string
195+
description: name of the workload resource
196+
namespace:
197+
type: string
198+
description: namespace of the workload resource
199+
kind:
200+
type: string
201+
description: kind of the workload resource
202+
apiVersion:
203+
type: string
204+
description: apiVersion of the workload resource
205+
containerName:
206+
type: string
207+
description: name of the container in the workload resource
208+
cpuRequest:
209+
$ref: '#/components/schemas/ResourceRecommendation'
210+
cpuLimit:
211+
$ref: '#/components/schemas/ResourceRecommendation'
212+
memoryRequest:
213+
$ref: '#/components/schemas/ResourceRecommendation'
214+
memoryLimit:
215+
$ref: '#/components/schemas/ResourceRecommendation'
216+
ResourceRecommendation:
217+
type: object
218+
description: Resource recommendation details for a workload
219+
required:
220+
- current
221+
properties:
222+
delta:
223+
type: number
224+
format: float64
225+
description: percentage of change in resource recommendation
226+
current:
227+
type: string
228+
description: current value of the resource recommendation
229+
recommended:
230+
type: string
231+
description: recommended value of the resource recommendation
232+
ResourceGetResponse:
233+
type: object
234+
properties:
235+
manifestResponse:
236+
$ref: '#/components/schemas/ManifestResponse'
237+
secretViewAccess:
238+
type: boolean
239+
description: Indicates whether a user can see obscured secret values or not.
240+
required:
241+
- manifestResponse
242+
- secretViewAccess
243+
ManifestResponse:
244+
type: object
245+
required:
246+
- manifest
247+
properties:
248+
recommendedManifest:
249+
description: Recommended manifest for the resource
250+
$ref: '#/components/schemas/K8sManifest'
251+
manifest:
252+
description: Current manifest for the resource
253+
$ref: '#/components/schemas/K8sManifest'
254+
K8sManifest:
255+
type: object
256+
description: Kubernetes manifest of the resource
257+
additionalProperties: true

0 commit comments

Comments
 (0)