Skip to content

Commit

Permalink
Add extra config to Kaniko docs (#2019)
Browse files Browse the repository at this point in the history
* add extra args to kaniko docs

* Update docs/book/stacks-and-components/component-guide/image-builders/kaniko.md

Co-authored-by: Alex Strick van Linschoten <strickvl@users.noreply.github.com>

---------

Co-authored-by: Alex Strick van Linschoten <strickvl@users.noreply.github.com>
  • Loading branch information
safoinme and strickvl authored Nov 10, 2023
1 parent b09fa8b commit 99fd6a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ zenml image-builder register <NAME> \
--kubernetes_context=<KUBERNETES_CONTEXT> \
--kubernetes_namespace=<KUBERNETES_NAMESPACE> \
--service_account_name=<KUBERNETES_SERVICE_ACCOUNT_NAME>
# --executor_args='["--compressed-caching=false", "--use-new-run=true"]'

# or update an existing one
zenml image-builder update <NAME> \
Expand Down Expand Up @@ -139,6 +140,7 @@ zenml image-builder register <NAME> \
--kubernetes_context=<KUBERNETES_CONTEXT> \
--volume_mounts='[{"name": "docker-config", "mountPath": "/kaniko/.docker/"}]' \
--volumes='[{"name": "docker-config", "configMap": {"name": "docker-config"}}]'
# --executor_args='["--compressed-caching=false", "--use-new-run=true"]'

# or update an existing one
zenml image-builder update <NAME> \
Expand All @@ -153,8 +155,7 @@ information.

#### Passing additional parameters to the Kaniko build

If you want to pass [additional flags](https://github.com/GoogleContainerTools/kaniko#additional-flags) to the Kaniko
build, pass them as a JSON string when registering your image builder in the stack:
You can pass additional parameters to the Kaniko build by setting the `executor_args` attribute of the image builder.

```shell
zenml image-builder register <NAME> \
Expand All @@ -163,5 +164,16 @@ zenml image-builder register <NAME> \
--executor_args='["--label", "key=value"]' # Adds a label to the final image
```

List of some possible additional flags:

* `--cache`: Set to `false` to disable caching. Defaults to `true`.
* `--cache-dir`: Set the directory where to store cached layers. Defaults to `/cache`.
* `--cache-repo`: Set the repository where to store cached layers. Defaults to `gcr.io/kaniko-project/executor`.
* `--cache-ttl`: Set the cache expiration time. Defaults to `24h`.
* `--cleanup`: Set to `false` to disable cleanup of the working directory. Defaults to `true`.
* `--compressed-caching`: Set to `false` to disable compressed caching. Defaults to `true`.

For a full list of possible flags, check out the [Kaniko additional flags](https://github.com/GoogleContainerTools/kaniko#additional-flags)

<!-- For scarf -->
<figure><img alt="ZenML Scarf" referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=f0b4f458-0a54-4fcd-aa95-d5ee424815bc" /></figure>
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class KanikoImageBuilderConfig(BaseImageBuilderConfig):
executor_args: Additional arguments to forward to the Kaniko executor.
See https://github.com/GoogleContainerTools/kaniko#additional-flags
for a full list of available arguments.
Example: `["--compressed-caching=false"]`
"""

kubernetes_context: str
Expand Down

0 comments on commit 99fd6a0

Please sign in to comment.