@@ -475,6 +475,86 @@ Use caution with Operations that change resources managed by other controllers.
475
475
Operations force ownership when applying changes, which can cause conflicts.
476
476
{{</hint>}}
477
477
478
+ # # Test an operation
479
+
480
+ You can preview the output of any Operation using the Crossplane CLI. You
481
+ don't need a Crossplane control plane to do this. The Crossplane CLI uses Docker
482
+ Engine to run functions.
483
+
484
+ {{<hint "tip">}}
485
+ See the [Crossplane CLI docs]({{<ref "../cli">}}) to
486
+ learn how to install and use the Crossplane CLI.
487
+ {{< /hint >}}
488
+
489
+ {{<hint "important">}}
490
+ Running `crossplane alpha render op` requires [Docker](https://www.docker.com).
491
+ {{< /hint >}}
492
+
493
+ Provide an operation, composition functions, and any required resources to render
494
+ the output locally.
495
+
496
+ ` ` ` shell
497
+ crossplane alpha render op operation.yaml functions.yaml --required-resources=ingress.yaml
498
+ ` ` `
499
+
500
+ ` crossplane alpha render op` prints the Operation status and any resources the
501
+ operation functions created or modified. It shows what would happen if you
502
+ applied the Operation to a cluster.
503
+
504
+ ` ` ` yaml
505
+ ---
506
+ # Operation status showing function results
507
+ apiVersion: ops.crossplane.io/v1alpha1
508
+ kind: Operation
509
+ metadata:
510
+ name: ingress-cert-monitor
511
+ status:
512
+ conditions:
513
+ - type: Succeeded
514
+ status: "True"
515
+ reason: PipelineSuccess
516
+ pipeline:
517
+ - step: check-ingress-certificate
518
+ output:
519
+ certificateExpires: "Sep 29 08:34:02 2025 GMT"
520
+ daysUntilExpiry: 53
521
+ hostname: google.com
522
+ ingressName: example-app
523
+ status: ok
524
+ ---
525
+ # Modified Ingress resource with certificate annotations
526
+ apiVersion: networking.k8s.io/v1
527
+ kind: Ingress
528
+ metadata:
529
+ annotations:
530
+ cert-monitor.crossplane.io/expires: Sep 29 08:34:02 2025 GMT
531
+ cert-monitor.crossplane.io/days-until-expiry: "53"
532
+ cert-monitor.crossplane.io/status: ok
533
+ name: example-app
534
+ namespace: default
535
+ spec:
536
+ # ... ingress spec unchanged
537
+ ` ` `
538
+
539
+ Use `--required-resources` to provide resources that your operation functions
540
+ need access to. You can specify multiple files or use glob patterns :
541
+
542
+ ` ` ` shell
543
+ # Multiple specific files
544
+ crossplane alpha render op operation.yaml functions.yaml \
545
+ --required-resources=deployment.yaml,service.yaml,configmap.yaml
546
+
547
+ # Glob pattern for all YAML files in a directory
548
+ crossplane alpha render op operation.yaml functions.yaml \
549
+ --required-resources="resources/*.yaml"
550
+ ` ` `
551
+
552
+ {{<hint "tip">}}
553
+ Use the `crossplane alpha render op` command to test your Operations locally
554
+ before deploying them to a cluster. The command helps validate function logic
555
+ and required resource access patterns.
556
+ {{</hint>}}
557
+
478
558
# # Best practices
479
559
480
560
# ## Operation-specific practices
0 commit comments