Skip to content
hupe1980Public

About

⚓ chart2kro converts a Helm chart into a kro ResourceGraphDefinition: a Kubernetes API whose instances deploy what the chart deploys. Every input is verified against Helm with kro's own code, and every value it does not expose comes with a reason.

Topics

Resources

Contributing

Stars

7 stars

Watchers

1 watching

Forks

Repository files navigation

⚓ chart2kro

Turn Helm charts into kro APIs you can trust

CI Release Go Reference License: Apache 2.0

chart2kro converts a Helm chart into a kro ResourceGraphDefinition: a Kubernetes API whose instances deploy what the chart deploys. Every input is verified against Helm with kro's own code, and every value it does not expose comes with a reason.

Website · Quick Start · Commands · Go Library · Examples · Docs


✨ Features

Feature Description
✅ Accepted by kro Every RGD is checked offline with kro's own admission schema and graph builder before it is written
🎯 Faithful to Helm An instance with the defaults deploys what helm template deploys
🔬 Verified inputs A value becomes an input only after kro's runtime, run offline, reproduced Helm's output for it; loops over lists become kro collections
📋 Every decision explained Inputs carry the chart's values.yaml docs; values that are not exposed get a reason code
🧱 Isolated instances Names and namespaces come from the instance; selectors never reach another instance's pods
🔐 No secret leaks Secrets you pass never become defaults; generated passwords become required inputs
🚦 CI-ready convert --check catches stale output, diff catches breaking API changes, and a GitHub Action runs both
📦 Go library The CLI is a thin client of pkg/chart2kro

One static binary. No Helm, kubectl or cluster needed to convert. Output runs on kro ≥ v0.9.2.


📦 Installation

Homebrew
brew install hupe1980/tap/chart2kro
Go install
go install github.com/hupe1980/chart2kro/cmd/chart2kro@latest
Release binaries

Download an archive for Linux, macOS or Windows from the releases. Releases are signed; see verifying a release.

Docker
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/work" -w /work \
  ghcr.io/hupe1980/chart2kro convert ./mychart -o api/
From source
git clone https://github.com/hupe1980/chart2kro.git && cd chart2kro
just build   # or: CGO_ENABLED=0 go build -o chart2kro ./cmd/chart2kro

🚀 Quick Start

1. Convert a chart (a directory, .tgz, oci:// reference or repo/chart):

chart2kro convert oci://ghcr.io/stefanprodan/charts/podinfo --version 6.15.0 -o podinfo/
podinfo 6.15.0 → Podinfo.kro.run/v1alpha1: 3 resources, 29 exposed, 33 frozen, 0 failed, 60 unused (256 witnesses, kro v0.9.4, Kubernetes 1.37)
  frozen: changes-structure             15
  frozen: toggles-fields                8
  frozen: transformed                   6
  frozen: unknown-kind                  4
  unused: affects-only-dropped-objects  11
  run 'chart2kro inspect' for details

2. Install the API on a cluster with kro:

kubectl apply -f podinfo/rgd.yaml

3. Create instances. Fields mirror the chart's values.yaml:

apiVersion: kro.run/v1alpha1
kind: Podinfo
metadata:
  name: blue
spec:
  replicaCount: 2
  ui:
    color: "#34577c"

The Getting started guide walks through this on a local cluster.


🔧 Commands

Command Purpose Example
convert Chart → RGD, example instance and report chart2kro convert ./mychart -f platform.yaml --expose 'image.tag,replicaCount' -o api/
inspect Why a value is exposed, frozen or unused chart2kro inspect ./mychart --value ui.message
validate Validate any RGD offline with kro's checks chart2kro validate api/rgd.yaml
diff Classify API changes against an existing RGD chart2kro diff ./mychart --version 2.0.0 --against api/rgd.yaml
instance Helm release values → an instance chart2kro instance ./mychart --from release.yaml --name web
version Version, kro and Kubernetes catalogs chart2kro version --format json

In CI, convert -o api/ --check exits 9 when api/ is stale, and diff exits 8 on breaking changes. On GitHub, one step does both:

- uses: hupe1980/chart2kro@v0.2.0
  with:
    chart: charts/webapp
    output-dir: api

See the GitHub Action guide. All flags and exit codes are in the CLI reference.


🐹 Go Library

import "github.com/hupe1980/chart2kro/pkg/chart2kro"

res, err := chart2kro.Convert(ctx, chart2kro.Options{
    Chart:  "oci://ghcr.io/stefanprodan/charts/podinfo",
    Expose: []string{"replicaCount", "image.tag"},
    Group:  "apps.example.com",
})
if err != nil {
    os.Exit(chart2kro.ExitCode(err)) // same exit codes as the CLI
}
// res.RGD, res.Instance, res.Prerequisites, res.Report

See the Go library guide and pkg.go.dev.


🐚 Shell Completion

source <(chart2kro completion bash)    # also: zsh, fish, powershell

📚 Documentation

🏁 Getting started Convert a chart and run two instances
🧭 Background kro, RGDs and how they differ from Helm
🎛️ Designing a platform API -f, --expose, API groups and CI checks
🚚 Migrating from Helm Turn running releases into instances
🚦 GitHub Action Check every pull request
⚙️ How it works Render, probe, assemble, validate, verify
🚧 Limitations · 🩺 Troubleshooting What cannot be translated, and every exit and reason code

Upgrading from v0.0.x? See the CHANGELOG.


🤝 Contributing

Contributions are welcome; see CONTRIBUTING.md.

📄 License

Apache 2.0, see LICENSE.

About

⚓ chart2kro converts a Helm chart into a kro ResourceGraphDefinition: a Kubernetes API whose instances deploy what the chart deploys. Every input is verified against Helm with kro's own code, and every value it does not expose comes with a reason.

Topics

Resources

Contributing

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages