diff --git a/docs/prepare.md b/docs/prepare.md new file mode 100644 index 0000000000..e0ab359cd1 --- /dev/null +++ b/docs/prepare.md @@ -0,0 +1,57 @@ +# Zarf Prepare Command + +`zarf prepare ...` + +## Using Zarf prepare to list chart images + +1. Download the zarf binary from [releases](https://repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/-/releases) [reference](workstation.md#install) +2. `zarf tools registry login -u -p ` +3. `zarf prepare find-images -p /chart` # Ran next in the same directory as a zarf.yaml file + + +### Breaking it down + + +**The Zarf Binary** +See [README](../README.md) for more details about zarf. Add `zarf` binary to your path and make it executable for ease of use i.e. `export PATH=$PATH:/path/to/zarf/binary && chmod +x /path/to/zarf/binary/zarf` + +**zarf tools registry login...** +This command is a utility of Zarf to help create a Zarf package. In other zarf commands (like `zarf prepare find-images`) the package images will be validated against a live registry! The registry login is stored in your docker config, typically stored in `~/.docker/config.json` and zarf commands don't require a container runtime (i.e. docker daemon, podman instance, etc...). + +**zarf prepare find-images -p /chart** +This command discovers images used in a helm chart. Try out this quick example: + +`git clone https://github.com/defenseunicorns/zarf.git` +`cd zarf/examples/tiny-kafka` +`zarf prepare find-images -p /chart` +You should see output similar to: +```shell + ✔ Processing helm chart strimzi-kafka-operator:0.24.0 from repo https://strimzi.io/charts/ + ✔ Copying charts/strimzi-values.yaml + ✔ Templating helm chart strimzi-kafka-operator + # kafka-strimzi-demo - baseline + - registry1.dso.mil/ironbank/opensource/strimzi/operator:0.24.0 + # Possible images - kafka-strimzi-demo - baseline + - registry1.dso.mil/ironbank/opensource/strimzi/kafka:0.24.0-kafka-2.8.0 +``` + +If you inspect the zarf.yaml, you'll notice those two images are specified... +No, we aren't cheating. Delete the `images:` block in the zarf.yaml and rerun `zarf prepare find-images -p /chart`... +The output is the same :) +Zarf is inspecting the helm chart specified by the directory `-p /chart` flag. The kafka image isn't even specified in the chart, but it's deployed by the operator. + + +**The zarf.yaml** +The zarf.yaml file is used specify a zarf package configuration. For the find-images command, all we really need is a ZarfPackageConfig with a component specified. +```yaml +kind: ZarfPackageConfig + +components: + - name: baseline + charts: + - name: strimzi-kafka-operator + url: https://strimzi.io/charts/ + version: 0.24.0 + valuesFiles: + - charts/strimzi-values.yaml +```