Skip to content

Commit 1938a5e

Browse files
committed
Update render documentation
Render has changed in three important ways that require docs updates: - It now uses `crossplane internal render` as its backend, the invocation of which can be customized. - `crossplane render` has moved to `crossplane composition render` (though the old name is a hidden alias for backward compatibility). - `crossplane alpha render op` has moved to `crossplane operation render` and, being an alpha command, is hidden by default. Fixes #1084
1 parent 274fcf1 commit 1938a5e

4 files changed

Lines changed: 62 additions & 41 deletions

File tree

content/master/composition/compositions.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,19 +344,20 @@ learn how to install and use the Crossplane CLI.
344344
{{< /hint >}}
345345
346346
{{<hint "important">}}
347-
Running `crossplane render` requires [Docker](https://www.docker.com).
347+
Running `crossplane composition render` requires
348+
[Docker](https://www.docker.com).
348349
{{< /hint >}}
349350

350351
Provide a composite resource, composition and composition functions to render
351352
the output locally.
352353

353354
```shell
354-
crossplane render xr.yaml composition.yaml functions.yaml
355+
crossplane composition render xr.yaml composition.yaml functions.yaml
355356
```
356357

357-
`crossplane render` prints resources as YAML to stdout. It prints the
358-
composite resource first, followed by the resources the composition functions
359-
created.
358+
`crossplane composition render` prints resources as YAML to stdout. It prints
359+
the composite resource first, followed by the resources the composition
360+
functions created.
360361

361362
```yaml
362363
---
@@ -387,8 +388,8 @@ spec:
387388

388389
{{<expand "The xr.yaml, composition.yaml and function.yaml files used in the example">}}
389390

390-
You can recreate the output below by running `crossplane render` with
391-
these files.
391+
You can recreate the output below by running `crossplane composition render`
392+
with these files.
392393

393394
The `xr.yaml` file contains the composite resource to render:
394395

@@ -451,7 +452,8 @@ Crossplane CLI runs a function by adding an annotation in `functions.yaml`. Add
451452
the `render.crossplane.io/runtime` annotation to a Function to change how it's
452453
run.
453454

454-
`crossplane render` supports two `render.crossplane.io/runtime` values:
455+
`crossplane composition render` supports two `render.crossplane.io/runtime`
456+
values:
455457

456458
* `Docker` (the default) connects to Docker Engine. It uses Docker to pull and
457459
run a function runtime.
@@ -482,8 +484,8 @@ Use the `Development` runtime when you
482484
function end-to-end.
483485
{{</hint>}}
484486

485-
`crossplane render` also supports the following Function annotations. These
486-
annotations affect how it runs Functions:
487+
`crossplane composition render` also supports the following Function
488+
annotations. These annotations affect how it runs Functions:
487489

488490
* `render.crossplane.io/runtime-docker-cleanup` - When using the `Docker`
489491
runtime this annotation specifies whether the CLI should stop the function
@@ -497,6 +499,21 @@ the container, and `Orphan`, to leave it running.
497499
running at the specified target. It uses
498500
[gRPC target syntax](https://github.com/grpc/grpc/blob/v1.59.1/doc/naming.md).
499501

502+
{{<hint "tip">}}
503+
The `crossplane composition render` CLI command runs the `crossplane internal
504+
render` command from the Crossplane controller binary. By default, it runs the
505+
latest stable version of Crossplane in a Docker container so that you don't need
506+
to download the controller binary.
507+
508+
You can use the following flags to render using a different Crossplane version:
509+
510+
* `--crossplane-version` to run a different Crossplane version in Docker.
511+
* `--crossplane-image` to select an arbitrary Crossplane Docker image (e.g.,
512+
from your local mirror).
513+
* `--crossplane-binary` to provide an arbitrary Crossplane controller binary
514+
(e.g., to test local changes to Crossplane iteslf).
515+
{{</hint>}}
516+
500517
## Verify a composition
501518

502519
View all available Compositions with `kubectl get composition`.

content/master/guides/write-a-composition-function-in-go.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ for the SDK.
449449

450450
## Test the function end-to-end
451451

452-
Test your function by adding unit tests, and by using the `crossplane render`
453-
command.
452+
Test your function by adding unit tests, and by using the `crossplane
453+
composition render` command.
454454

455455
Go has rich support for unit testing. When you initialize a function from the
456456
template it adds some unit tests to `fn_test.go`. These tests follow Go's
@@ -617,8 +617,8 @@ Expand the following block to see example files.
617617

618618
{{<expand "The xr.yaml, composition.yaml and function.yaml files">}}
619619

620-
You can recreate the output below using by running `crossplane render` with
621-
these files.
620+
You can recreate the output below using by running `crossplane composition
621+
render` with these files.
622622

623623
The `xr.yaml` file contains the composite resource to render:
624624

@@ -677,9 +677,9 @@ spec:
677677

678678
The Function in `functions.yaml` uses the
679679
{{<hover label="development" line="6">}}Development{{</hover>}}
680-
runtime. This tells `crossplane render` that your function is running
681-
locally. It connects to your locally running function instead of using Docker to
682-
pull and run the function.
680+
runtime. This tells `crossplane composition render` that your function is
681+
running locally. It connects to your locally running function instead of using
682+
Docker to pull and run the function.
683683

684684
```yaml {label="development"}
685685
apiVersion: pkg.crossplane.io/v1
@@ -702,10 +702,10 @@ to run without encryption or authentication. Only use it during testing and
702702
development.
703703
{{</hint>}}
704704

705-
In a separate terminal, run `crossplane render`.
705+
In a separate terminal, run `crossplane composition render`.
706706

707707
```shell
708-
crossplane render xr.yaml composition.yaml functions.yaml
708+
crossplane composition render xr.yaml composition.yaml functions.yaml
709709
```
710710

711711
This command calls your function. In the terminal where your function is running
@@ -717,8 +717,8 @@ go run . --insecure --debug
717717
2023-10-31T16:17:32.159-0700 INFO function-xbuckets/fn.go:125 Added desired buckets {"xr-version": "example.crossplane.io/v1", "xr-kind": "XBuckets", "xr-name": "example-buckets", "region": "us-east-2", "count": 3}
718718
```
719719

720-
The `crossplane render` command prints the desired resources the function
721-
returns.
720+
The `crossplane composition render` command prints the desired resources the
721+
function returns.
722722

723723
```yaml
724724
---

content/master/guides/write-a-composition-function-in-python.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ for further details.
335335

336336
## Test the function end-to-end
337337

338-
Test your function by adding unit tests, and by using the `crossplane render`
339-
command.
338+
Test your function by adding unit tests, and by using the `crossplane
339+
composition render` command.
340340

341341
When you initialize a function from the
342342
template it adds some unit tests to `tests/test_fn.py`. These tests use the
@@ -479,8 +479,8 @@ Expand the following block to see example files.
479479

480480
{{<expand "The xr.yaml, composition.yaml and function.yaml files">}}
481481

482-
You can recreate the output below using by running `crossplane render` with
483-
these files.
482+
You can recreate the output below using by running `crossplane composition
483+
render` with these files.
484484

485485
The `xr.yaml` file contains the composite resource to render:
486486

@@ -537,11 +537,10 @@ spec:
537537
```
538538
{{</expand>}}
539539

540-
The Function in `functions.yaml` uses the
541-
{{<hover label="development" line="6">}}Development{{</hover>}}
542-
runtime. This tells `crossplane render` that your function is running
543-
locally. It connects to your locally running function instead of using Docker to
544-
pull and run the function.
540+
The Function in `functions.yaml` uses the {{<hover label="development"
541+
line="6">}}Development{{</hover>}} runtime. This tells `crossplane composition
542+
render` that your function is running locally. It connects to your locally
543+
running function instead of using Docker to pull and run the function.
545544

546545
```yaml {label="development"}
547546
apiVersion: pkg.crossplane.io/v1
@@ -563,10 +562,10 @@ hatch run development
563562
Only use it during testing and development.
564563
{{</hint>}}
565564

566-
In a separate terminal, run `crossplane render`.
565+
In a separate terminal, run `crossplane composition render`.
567566

568567
```shell
569-
crossplane render xr.yaml composition.yaml functions.yaml
568+
crossplane composition render xr.yaml composition.yaml functions.yaml
570569
```
571570

572571
This command calls your function. In the terminal where your function is running
@@ -578,8 +577,8 @@ hatch run development
578577
2024-01-11T22:12:58.153792Z [info ] Added desired buckets count=3 filename=fn.py lineno=68 region=us-east-2 tag=
579578
```
580579

581-
The `crossplane render` command prints the desired resources the function
582-
returns.
580+
The `crossplane composition render` command prints the desired resources the
581+
function returns.
583582

584583
```yaml
585584
---

content/master/operations/operation.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -524,17 +524,22 @@ learn how to install and use the Crossplane CLI.
524524
{{< /hint >}}
525525

526526
{{<hint "important">}}
527-
Running `crossplane alpha render op` requires [Docker](https://www.docker.com).
527+
`crossplane operation render` is an alpha command and is hidden by default. Run
528+
`crossplane config set features.enableAlpha true` to make it visible.
529+
{{< /hint >}}
530+
531+
{{<hint "important">}}
532+
Running `crossplane operation render` requires [Docker](https://www.docker.com).
528533
{{< /hint >}}
529534

530535
Provide an operation, composition functions, and any required resources to render
531536
the output locally.
532537

533538
```shell
534-
crossplane alpha render op operation.yaml functions.yaml --required-resources=ingress.yaml
539+
crossplane operation render operation.yaml functions.yaml --required-resources=ingress.yaml
535540
```
536541

537-
`crossplane alpha render op` prints the Operation status and any resources the
542+
`crossplane operation render` prints the Operation status and any resources the
538543
operation functions created or modified. It shows what would happen if you
539544
applied the Operation to a cluster.
540545

@@ -578,17 +583,17 @@ need access to. You can specify multiple files or use glob patterns:
578583

579584
```shell
580585
# Multiple specific files
581-
crossplane alpha render op operation.yaml functions.yaml \
586+
crossplane operation render operation.yaml functions.yaml \
582587
--required-resources=deployment.yaml,service.yaml,configmap.yaml
583588
584589
# Glob pattern for all YAML files in a directory
585-
crossplane alpha render op operation.yaml functions.yaml \
590+
crossplane operation render operation.yaml functions.yaml \
586591
--required-resources="resources/*.yaml"
587592
```
588593

589594
{{<hint "tip">}}
590-
Use the `crossplane alpha render op` command to test your Operations locally
591-
before deploying them to a cluster. The command helps validate function logic
595+
Use the `crossplane operation render` command to test your Operations locally
596+
before deploying them to a cluster. The command helps validate function logic
592597
and required resource access patterns.
593598
{{</hint>}}
594599

0 commit comments

Comments
 (0)