Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zarf prepare docs #314

Merged
merged 2 commits into from
Feb 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions docs/prepare.md
Original file line number Diff line number Diff line change
@@ -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 <registry_name> -u <username> -p <secret>`
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
```