Skip to content

Commit

Permalink
docs: fix oci-image example, add test + docs
Browse files Browse the repository at this point in the history
Closes #72
  • Loading branch information
mgoltzsche committed Mar 19, 2024
1 parent ebd2ec8 commit 6448af7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ When running khelm as kpt function or within a container the `repositories.yaml`

Unlike Helm khelm allows usage of any repository when `repositories.yaml` is not present or `--trust-any-repo` (env var `KHELM_TRUST_ANY_REPO`) is enabled.

### Loading a chart from an OCI registry

Using Helm, you can store a Helm chart as OCI image within a container registry.
To load a chart from an OCI registry using khelm you can leave the `repository` field empty and specify the container registry/image name within the `chart` field, prefixed with `oci://`.
When using a chart from an OCI registry, Helm's `repository.yaml` configuration is not used.
Instead, Docker's `config.json` is used to read private registry credentials from, if any.
This behaviour is aligned with Helm.

## Helm support

* Helm 2 is supported by the `v1` module version.
Expand Down
5 changes: 3 additions & 2 deletions e2e/cli-tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ teardown() {
grep -q myreleasex "$OUT_DIR/manifest.yaml"
}

@test "CLI should support oci registry" {
docker run --rm -u $(id -u):$(id -g) -v "$OUT_DIR:/out" "$IMAGE" template myreleasex oci://public.ecr.aws/karpenter/karpenter \
@test "CLI should support OCI registry" {
docker run --rm -u $(id -u):$(id -g) -v "$OUT_DIR:/out" "$IMAGE" \
template myreleasex oci://public.ecr.aws/karpenter/karpenter \
--version v0.27.0 \
--output /out/manifest.yaml \
--debug
Expand Down
4 changes: 4 additions & 0 deletions e2e/kustomize-plugin-tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ kustomizeBuild() {
@test "kustomize vars can overwrite helm values" {
kustomizeBuild example/kustomize-var/overlay ' value: changed by kustomization overlay'
}

@test "kustomize generator should support OCI registry" {
kustomizeBuild example/oci-image 'app.kubernetes.io/name: karpenter'
}
5 changes: 2 additions & 3 deletions example/oci-image/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ kind: ChartRenderer
metadata:
name: karpenter
namespace: kube-system
repository: "oci://public.ecr.aws/karpenter"
chart: karpenter
version: 0.27.0
chart: "oci://public.ecr.aws/karpenter/karpenter"
version: 0.35.0

0 comments on commit 6448af7

Please sign in to comment.