Skip to content

Commit 82d2e50

Browse files
committed
feat: playbook agents
* playbook run listener support playbook_run as the parent not just notification_send [skip ci]
1 parent 4e54e54 commit 82d2e50

20 files changed

+560
-127
lines changed

api/v1/playbook_actions.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@ type AIAction struct {
382382
AIActionClient `json:",inline" yaml:",inline"`
383383
AIActionContext `json:",inline" yaml:",inline" template:"true"`
384384

385+
PlaybookAgents []types.ResourceSelector `json:"playbookAgents,omitempty"`
386+
385387
// Specify selectors for playbooks. The LLM will recommend the best suited playbooks
386388
// in response to the prompt.
387389
RecommendPlaybooks []types.ResourceSelector `json:"recommendPlaybooks,omitempty"`

api/v1/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crds/mission-control.flanksource.com_incidentrules.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ spec:
7474
type: string
7575
fieldSelector:
7676
type: string
77-
healths:
78-
description: Healths filter resources by the health
79-
items:
80-
type: string
81-
type: array
77+
health:
78+
description: |-
79+
Health filters resources by the health.
80+
Multiple healths can be provided separated by comma.
81+
type: string
8282
id:
8383
type: string
8484
includeDeleted:

config/crds/mission-control.flanksource.com_notificationsilences.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ spec:
6868
type: string
6969
fieldSelector:
7070
type: string
71-
healths:
72-
description: Healths filter resources by the health
73-
items:
74-
type: string
75-
type: array
71+
health:
72+
description: |-
73+
Health filters resources by the health.
74+
Multiple healths can be provided separated by comma.
75+
type: string
7676
id:
7777
type: string
7878
includeDeleted:

config/crds/mission-control.flanksource.com_permissions.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ spec:
8282
type: string
8383
fieldSelector:
8484
type: string
85-
healths:
86-
description: Healths filter resources by the health
87-
items:
88-
type: string
89-
type: array
85+
health:
86+
description: |-
87+
Health filters resources by the health.
88+
Multiple healths can be provided separated by comma.
89+
type: string
9090
id:
9191
type: string
9292
includeDeleted:
@@ -142,11 +142,11 @@ spec:
142142
type: string
143143
fieldSelector:
144144
type: string
145-
healths:
146-
description: Healths filter resources by the health
147-
items:
148-
type: string
149-
type: array
145+
health:
146+
description: |-
147+
Health filters resources by the health.
148+
Multiple healths can be provided separated by comma.
149+
type: string
150150
id:
151151
type: string
152152
includeDeleted:
@@ -202,11 +202,11 @@ spec:
202202
type: string
203203
fieldSelector:
204204
type: string
205-
healths:
206-
description: Healths filter resources by the health
207-
items:
208-
type: string
209-
type: array
205+
health:
206+
description: |-
207+
Health filters resources by the health.
208+
Multiple healths can be provided separated by comma.
209+
type: string
210210
id:
211211
type: string
212212
includeDeleted:

config/crds/mission-control.flanksource.com_playbooks.yaml

Lines changed: 80 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,66 @@ spec:
136136
Model name based on the backend chosen.
137137
Example: gpt-4o for openai, claude-3-5-sonnet-latest for Anthropic, llama3.1:8b for Ollama
138138
type: string
139+
playbookAgents:
140+
items:
141+
properties:
142+
agent:
143+
description: |-
144+
Agent can be the agent id or the name of the agent.
145+
Additionally, the special "self" value can be used to select resources without an agent.
146+
type: string
147+
cache:
148+
description: |-
149+
Cache directives
150+
'no-cache' (should not fetch from cache but can be cached)
151+
'no-store' (should not cache)
152+
'max-age=X' (cache for X duration)
153+
type: string
154+
fieldSelector:
155+
type: string
156+
health:
157+
description: |-
158+
Health filters resources by the health.
159+
Multiple healths can be provided separated by comma.
160+
type: string
161+
id:
162+
type: string
163+
includeDeleted:
164+
type: boolean
165+
labelSelector:
166+
type: string
167+
limit:
168+
type: integer
169+
name:
170+
type: string
171+
namespace:
172+
type: string
173+
scope:
174+
description: |-
175+
Scope is the reference for parent of the resource to select.
176+
For config items, the scope is the scraper id
177+
For checks, it's canaries and
178+
For components, it's topology.
179+
It can either be a uuid or namespace/name
180+
type: string
181+
search:
182+
description: Search query that applies to the resource
183+
name, tag & labels.
184+
type: string
185+
statuses:
186+
description: Statuses filter resources by the status
187+
items:
188+
type: string
189+
type: array
190+
tagSelector:
191+
type: string
192+
types:
193+
description: Types filter resources by the type
194+
items:
195+
type: string
196+
type: array
197+
type: object
198+
type: array
139199
prompt:
140200
description: Prompt is the human prompt
141201
type: string
@@ -159,11 +219,11 @@ spec:
159219
type: string
160220
fieldSelector:
161221
type: string
162-
healths:
163-
description: Healths filter resources by the health
164-
items:
165-
type: string
166-
type: array
222+
health:
223+
description: |-
224+
Health filters resources by the health.
225+
Multiple healths can be provided separated by comma.
226+
type: string
167227
id:
168228
type: string
169229
includeDeleted:
@@ -1478,11 +1538,11 @@ spec:
14781538
type: string
14791539
fieldSelector:
14801540
type: string
1481-
healths:
1482-
description: Healths filter resources by the health
1483-
items:
1484-
type: string
1485-
type: array
1541+
health:
1542+
description: |-
1543+
Health filters resources by the health.
1544+
Multiple healths can be provided separated by comma.
1545+
type: string
14861546
id:
14871547
type: string
14881548
includeDeleted:
@@ -1539,11 +1599,11 @@ spec:
15391599
type: string
15401600
fieldSelector:
15411601
type: string
1542-
healths:
1543-
description: Healths filter resources by the health
1544-
items:
1545-
type: string
1546-
type: array
1602+
health:
1603+
description: |-
1604+
Health filters resources by the health.
1605+
Multiple healths can be provided separated by comma.
1606+
type: string
15471607
id:
15481608
type: string
15491609
includeDeleted:
@@ -1600,11 +1660,11 @@ spec:
16001660
type: string
16011661
fieldSelector:
16021662
type: string
1603-
healths:
1604-
description: Healths filter resources by the health
1605-
items:
1606-
type: string
1607-
type: array
1663+
health:
1664+
description: |-
1665+
Health filters resources by the health.
1666+
Multiple healths can be provided separated by comma.
1667+
type: string
16081668
id:
16091669
type: string
16101670
includeDeleted:

config/schemas/incident-rules.schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,14 @@
479479
"fieldSelector": {
480480
"type": "string"
481481
},
482+
"health": {
483+
"type": "string"
484+
},
482485
"types": {
483486
"$ref": "#/$defs/Items"
484487
},
485488
"statuses": {
486489
"$ref": "#/$defs/Items"
487-
},
488-
"healths": {
489-
"$ref": "#/$defs/Items"
490490
}
491491
},
492492
"additionalProperties": false,

config/schemas/notificationsilence.schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,14 @@
228228
"fieldSelector": {
229229
"type": "string"
230230
},
231+
"health": {
232+
"type": "string"
233+
},
231234
"types": {
232235
"$ref": "#/$defs/Items"
233236
},
234237
"statuses": {
235238
"$ref": "#/$defs/Items"
236-
},
237-
"healths": {
238-
"$ref": "#/$defs/Items"
239239
}
240240
},
241241
"additionalProperties": false,

config/schemas/permission.schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,14 @@
281281
"fieldSelector": {
282282
"type": "string"
283283
},
284+
"health": {
285+
"type": "string"
286+
},
284287
"types": {
285288
"$ref": "#/$defs/Items"
286289
},
287290
"statuses": {
288291
"$ref": "#/$defs/Items"
289-
},
290-
"healths": {
291-
"$ref": "#/$defs/Items"
292292
}
293293
},
294294
"additionalProperties": false,

config/schemas/playbook-spec.schema.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
},
3636
"type": "array"
3737
},
38+
"playbookAgents": {
39+
"items": {
40+
"$ref": "#/$defs/ResourceSelector"
41+
},
42+
"type": "array"
43+
},
3844
"recommendPlaybooks": {
3945
"items": {
4046
"$ref": "#/$defs/ResourceSelector"
@@ -1031,14 +1037,14 @@
10311037
"fieldSelector": {
10321038
"type": "string"
10331039
},
1040+
"health": {
1041+
"type": "string"
1042+
},
10341043
"types": {
10351044
"$ref": "#/$defs/Items"
10361045
},
10371046
"statuses": {
10381047
"$ref": "#/$defs/Items"
1039-
},
1040-
"healths": {
1041-
"$ref": "#/$defs/Items"
10421048
}
10431049
},
10441050
"additionalProperties": false,

config/schemas/playbook.schema.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
},
3636
"type": "array"
3737
},
38+
"playbookAgents": {
39+
"items": {
40+
"$ref": "#/$defs/ResourceSelector"
41+
},
42+
"type": "array"
43+
},
3844
"recommendPlaybooks": {
3945
"items": {
4046
"$ref": "#/$defs/ResourceSelector"
@@ -1185,14 +1191,14 @@
11851191
"fieldSelector": {
11861192
"type": "string"
11871193
},
1194+
"health": {
1195+
"type": "string"
1196+
},
11881197
"types": {
11891198
"$ref": "#/$defs/Items"
11901199
},
11911200
"statuses": {
11921201
"$ref": "#/$defs/Items"
1193-
},
1194-
"healths": {
1195-
"$ref": "#/$defs/Items"
11961202
}
11971203
},
11981204
"additionalProperties": false,

0 commit comments

Comments
 (0)