You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+119Lines changed: 119 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -365,6 +365,125 @@ identity:
365
365
type: AzureWorkloadIdentityCredentials
366
366
```
367
367
368
+
## Operations support
369
+
function-msgraph support every kind of [operations](https://docs.crossplane.io/latest/operations/operation/) but it only allows targeting Composite Resources
370
+
Function omits the input.skipQueryWhenTargetHasData parameter when running in operation mode to enforce compability with Cron/Watch modes.
371
+
CronOperations and WatchOperations are the most useful in context of graph queries, please check [examples](./example/operations/).
372
+
### Operations and Compositions Working Together
373
+
374
+
**Important**: Operations and Compositions work in conjunction to provide a self-healing mechanism:
375
+
376
+
1. **Operations Role (Drift Detection)**:
377
+
- Query Microsoft Graph API on schedule/watch events
378
+
- Compare results with current XR status
379
+
- Set drift detection annotations (but don't update status directly)
380
+
381
+
2. **Compositions Role (Drift Correction)**:
382
+
- Run when XR is reconciled (triggered by annotation changes)
383
+
- Check drift detection annotation
384
+
- If drift detected, ignore `skipQueryWhenTargetHasData` flag and update status
385
+
- Reset drift annotation to "false" after successful update
386
+
387
+
This creates a **two-phase self-healing system** where Operations monitor for changes and Compositions perform the actual data updates.
388
+
### Operations results
389
+
function-msgraph operations result in two annotations set on the XR:
function-msgraph/last-execution sets RFC3339 timestamp informing about last succesful Operation run.
400
+
function-msgraph/last-execution-query-drift-detected sets a boolean if there's a drift between input.target field's value and query result, which is used by function-msgraph in Composition context for self-healing. skipQueryWhenTargetHasData input parameter is ommited when drift detected annotation is set which leads to XR update and after that next Operation run sets the annotation back to "false".
401
+
402
+
### CronOperation
403
+
CronOperation may be used to forcefully update XR's status in a predefined interval.
404
+
That functionality may be especially useful for XRs that are business critical and should have the data refreshed without worrying about throttling.
405
+
Supports only singular resource reference.
406
+
407
+
```yaml
408
+
apiVersion: ops.crossplane.io/v1alpha1
409
+
kind: CronOperation
410
+
metadata:
411
+
name: update-user-validation-for-critical-xr
412
+
spec:
413
+
schedule: "*/5 * * * *" # Every 5 minutes
414
+
concurrencyPolicy: Forbid
415
+
successfulHistoryLimit: 5
416
+
failedHistoryLimit: 3
417
+
operationTemplate:
418
+
spec:
419
+
mode: Pipeline
420
+
pipeline:
421
+
- step: user-validation
422
+
functionRef:
423
+
name: function-msgraph
424
+
input:
425
+
apiVersion: msgraph.fn.crossplane.io/v1alpha1
426
+
kind: Input
427
+
queryType: UserValidation
428
+
# Replace these with actual users in your directory
0 commit comments