Skip to content

Commit c053adb

Browse files
authored
Merge pull request #6847 from devtron-labs/main-specs-cut-v2
misc: api Specs added for lock config
2 parents 1d03c59 + 5595428 commit c053adb

File tree

8 files changed

+593
-588
lines changed

8 files changed

+593
-588
lines changed

specs/application/get-app.yaml

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,58 @@ paths:
201201
schema:
202202
$ref: '#/components/schemas/Error'
203203

204+
/orchestrator/app/other-env/min:
205+
get:
206+
description: Fetch minimal details of other environments for a specific application. Returns a list of environments where the application is deployed with minimal information including environment name, cluster details, and deployment status.
207+
operationId: FetchMinDetailOtherEnvironment
208+
parameters:
209+
- name: app-id
210+
in: query
211+
required: true
212+
description: The ID of the application to fetch environment details for
213+
schema:
214+
type: integer
215+
example: 26
216+
responses:
217+
'200':
218+
description: Successfully retrieved minimal environment details
219+
content:
220+
application/json:
221+
schema:
222+
type: object
223+
properties:
224+
code:
225+
type: integer
226+
description: HTTP status code
227+
example: 200
228+
status:
229+
type: string
230+
description: Response status
231+
example: "OK"
232+
result:
233+
type: array
234+
description: List of environments with minimal details
235+
items:
236+
$ref: '#/components/schemas/EnvironmentMinDetail'
237+
'400':
238+
description: Bad Request. Invalid app-id parameter.
239+
content:
240+
application/json:
241+
schema:
242+
$ref: '#/components/schemas/ErrorResponse'
243+
'403':
244+
description: Forbidden. User does not have permission to access this application.
245+
content:
246+
application/json:
247+
schema:
248+
$ref: '#/components/schemas/ErrorResponse'
249+
'500':
250+
description: Internal Server Error
251+
content:
252+
application/json:
253+
schema:
254+
$ref: '#/components/schemas/ErrorResponse'
255+
204256
components:
205257
schemas:
206258
App:
@@ -827,4 +879,48 @@ components:
827879
type: string
828880
description: Name of environment
829881
Values:
830-
$ref: '#/components/schemas/EnvironmentOverride'
882+
$ref: '#/components/schemas/EnvironmentOverride'
883+
884+
EnvironmentMinDetail:
885+
type: object
886+
description: Minimal environment details for an application deployment
887+
properties:
888+
environmentId:
889+
type: integer
890+
description: Unique identifier for the environment
891+
example: 1
892+
environmentName:
893+
type: string
894+
description: Name of the environment
895+
example: "production"
896+
clusterId:
897+
type: integer
898+
description: ID of the cluster where environment is deployed
899+
example: 1
900+
prod:
901+
type: boolean
902+
description: Whether this is a production environment
903+
example: true
904+
description:
905+
type: string
906+
description: Description of the environment
907+
maxLength: 40
908+
example: "Production environment"
909+
isVirtualEnvironment:
910+
type: boolean
911+
description: Whether this is a virtual environment
912+
example: false
913+
deploymentAppDeleteRequest:
914+
type: boolean
915+
description: Whether there is a pending delete request for the deployment
916+
example: false
917+
appMetrics:
918+
type: boolean
919+
nullable: true
920+
description: Whether application metrics are enabled
921+
example: true
922+
infraMetrics:
923+
type: boolean
924+
nullable: true
925+
description: Whether infrastructure metrics are enabled
926+
example: true
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
openapi: "3.0.0"
2+
info:
3+
version: 1.0.0
4+
title: Lock Configuration API
5+
description: API for managing deployment template lock configurations that restrict which paths can be modified in deployment templates
6+
paths:
7+
/orchestrator/config/lock:
8+
get:
9+
description: Get lock configuration for an application and environment. Returns paths that are locked or allowed for modification in deployment templates.
10+
parameters:
11+
- name: appId
12+
in: query
13+
required: false
14+
schema:
15+
type: integer
16+
description: Application ID. If not provided, returns global lock configuration.
17+
- name: envId
18+
in: query
19+
required: false
20+
schema:
21+
type: integer
22+
description: Environment ID. If not provided with appId, returns app-level lock configuration. Use -1 for base deployment template.
23+
responses:
24+
'200':
25+
description: Successfully retrieved lock configuration
26+
content:
27+
application/json:
28+
schema:
29+
$ref: '#/components/schemas/LockConfigResponse'
30+
examples:
31+
withLockConfig:
32+
summary: Lock configuration exists
33+
value:
34+
id: 1
35+
allowed: true
36+
config:
37+
- "spec.replicas"
38+
- "spec.template.spec.containers[0].resources"
39+
emptyLockConfig:
40+
summary: No lock configuration
41+
value:
42+
config: []
43+
'400':
44+
description: Bad Request. Invalid appId or envId parameter.
45+
content:
46+
application/json:
47+
schema:
48+
$ref: '#/components/schemas/Error'
49+
'401':
50+
description: Unauthorized. User not authenticated.
51+
content:
52+
application/json:
53+
schema:
54+
$ref: '#/components/schemas/Error'
55+
'403':
56+
description: Forbidden. User does not have required permissions (must be admin/manager or have config approver access).
57+
content:
58+
application/json:
59+
schema:
60+
$ref: '#/components/schemas/Error'
61+
'500':
62+
description: Internal Server Error
63+
content:
64+
application/json:
65+
schema:
66+
$ref: '#/components/schemas/Error'
67+
post:
68+
description: Create or update lock configuration. Requires super admin permissions.
69+
requestBody:
70+
description: Lock configuration request
71+
required: true
72+
content:
73+
application/json:
74+
schema:
75+
$ref: '#/components/schemas/LockConfigRequest'
76+
examples:
77+
allowSpecificPaths:
78+
summary: Allow only specific paths to be modified
79+
value:
80+
allowed: true
81+
config:
82+
- "spec.replicas"
83+
- "spec.template.spec.containers[0].image"
84+
denySpecificPaths:
85+
summary: Deny specific paths from being modified
86+
value:
87+
allowed: false
88+
config:
89+
- "spec.template.spec.securityContext"
90+
- "spec.template.spec.serviceAccountName"
91+
responses:
92+
'200':
93+
description: Successfully created/updated lock configuration
94+
content:
95+
application/json:
96+
schema:
97+
type: object
98+
properties:
99+
id:
100+
type: integer
101+
description: ID of the created/updated lock configuration
102+
'400':
103+
description: Bad Request. Validation error or invalid request body.
104+
content:
105+
application/json:
106+
schema:
107+
$ref: '#/components/schemas/Error'
108+
'401':
109+
description: Unauthorized. User not authenticated.
110+
content:
111+
application/json:
112+
schema:
113+
$ref: '#/components/schemas/Error'
114+
'403':
115+
description: Forbidden. User does not have super admin permissions.
116+
content:
117+
application/json:
118+
schema:
119+
$ref: '#/components/schemas/Error'
120+
'500':
121+
description: Internal Server Error
122+
content:
123+
application/json:
124+
schema:
125+
$ref: '#/components/schemas/Error'
126+
delete:
127+
description: Delete active lock configuration. Requires super admin permissions.
128+
responses:
129+
'200':
130+
description: Successfully deleted lock configuration
131+
'401':
132+
description: Unauthorized. User not authenticated.
133+
content:
134+
application/json:
135+
schema:
136+
$ref: '#/components/schemas/Error'
137+
'403':
138+
description: Forbidden. User does not have super admin permissions.
139+
content:
140+
application/json:
141+
schema:
142+
$ref: '#/components/schemas/Error'
143+
'500':
144+
description: Internal Server Error
145+
content:
146+
application/json:
147+
schema:
148+
$ref: '#/components/schemas/Error'
149+
components:
150+
schemas:
151+
LockConfigRequest:
152+
type: object
153+
required:
154+
- allowed
155+
- config
156+
properties:
157+
allowed:
158+
type: boolean
159+
description: If true, only paths in 'config' can be modified (allowlist). If false, paths in 'config' cannot be modified (denylist).
160+
config:
161+
type: array
162+
items:
163+
type: string
164+
description: List of JSON paths in the deployment template. Supports array indexing (e.g., "spec.containers[0].image")
165+
example:
166+
- "spec.replicas"
167+
- "spec.template.spec.containers[0].resources.limits.cpu"
168+
- "spec.template.spec.containers[0].resources.limits.memory"
169+
LockConfigResponse:
170+
type: object
171+
properties:
172+
id:
173+
type: integer
174+
description: Lock configuration ID
175+
allowed:
176+
type: boolean
177+
description: If true, only paths in 'config' can be modified (allowlist). If false, paths in 'config' cannot be modified (denylist).
178+
config:
179+
type: array
180+
items:
181+
type: string
182+
description: List of JSON paths that are locked or allowed
183+
example:
184+
- "spec.replicas"
185+
- "spec.template.spec.containers[0].resources"
186+
LockValidateErrorResponse:
187+
type: object
188+
description: Response when lock configuration validation fails
189+
properties:
190+
isLockConfigError:
191+
type: boolean
192+
description: Indicates if the error is due to lock configuration violation
193+
changedPaths:
194+
type: array
195+
items:
196+
type: string
197+
description: List of paths that were changed but are locked
198+
Error:
199+
required:
200+
- code
201+
- message
202+
properties:
203+
code:
204+
type: integer
205+
description: Error code
206+
message:
207+
type: string
208+
description: Error message
209+

0 commit comments

Comments
 (0)