{"id":17960990,"url":"https://github.com/slok/go-helm-template","last_synced_at":"2025-03-25T03:31:27.987Z","repository":{"id":38314996,"uuid":"451058212","full_name":"slok/go-helm-template","owner":"slok","description":"Simple go library to run Helm template without executing Helm","archived":false,"fork":false,"pushed_at":"2025-03-14T07:47:11.000Z","size":400,"stargazers_count":18,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-19T08:39:20.734Z","etag":null,"topics":["go","golang","helm","helm-chart","k8s","kubernetes","lib","library","template"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slok.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-23T09:31:41.000Z","updated_at":"2025-02-06T21:24:45.000Z","dependencies_parsed_at":"2024-01-19T08:50:48.962Z","dependency_job_id":"ffaf310e-0ca2-4248-8516-5782142296d4","html_url":"https://github.com/slok/go-helm-template","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slok%2Fgo-helm-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slok%2Fgo-helm-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slok%2Fgo-helm-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slok%2Fgo-helm-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slok","download_url":"https://codeload.github.com/slok/go-helm-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245394739,"owners_count":20608122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","helm","helm-chart","k8s","kubernetes","lib","library","template"],"created_at":"2024-10-29T11:07:56.944Z","updated_at":"2025-03-25T03:31:27.980Z","avatar_url":"https://github.com/slok.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-helm-template\n\n[![CI](https://github.com/slok/go-helm-template/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/slok/go-helm-template/actions/workflows/ci.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/slok/go-helm-template)](https://goreportcard.com/report/github.com/slok/go-helm-template)\n[![Apache 2 licensed](https://img.shields.io/badge/license-Apache2-blue.svg)](https://raw.githubusercontent.com/slok/go-helm-template/master/LICENSE)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/slok/go-helm-template)](https://github.com/slok/go-helm-template/releases/latest)\n\nSimple, fast and easy to use Go library to run [helm template][helm-template] without the need of a [Helm] binary nor its execution as an external command.\n\n## Features\n\n- Simple\n- Fast\n- Compatible with go [`fs.FS`](https://pkg.go.dev/io/fs#FS) (Template charts from FS, embedded, memory...)\n- Testable.\n- No Helm binary required.\n- No external command execution from Go.\n- Template specific files option.\n\n## Getting started\n\n```golang\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"testing/fstest\"\n\n    \"github.com/slok/go-helm-template/helm\"\n)\n\n// Chart data in memory.\nconst (\n    chart = `\napiVersion: v2\nname: example-memory\nversion: 0.1.0\n`\n    configmap = `\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: {{ printf \"%s-%s\" .Chart.Name .Release.Name | trunc 63 | trimSuffix \"-\" }}\n  namespace: {{ .Release.Namespace }}\n  labels:\n    {{- with .Values.labels -}}\n    {{ toYaml . | nindent 4 }}\n    {{- end }}\ndata:\n  something: something\n`\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    // Create chart in memory.\n    chartFS := make(fstest.MapFS)\n    chartFS[\"Chart.yaml\"] = \u0026fstest.MapFile{Data: []byte(chart)}\n    chartFS[\"templates/configmap.yaml\"] = \u0026fstest.MapFile{Data: []byte(configmap)}\n\n    // Load chart.\n    chart, err := helm.LoadChart(ctx, chartFS)\n    if err != nil {\n        panic(err)\n    }\n\n    // Execute helm template.\n    result, err := helm.Template(ctx, helm.TemplateConfig{\n        Chart:       chart,\n        ReleaseName: \"test\",\n        Namespace:   \"no-kube-system\",\n        Values: map[string]interface{}{\n            \"labels\": map[string]string{\n                \"example-from\": \"go-helm-template\",\n            },\n        },\n    })\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Println(result)\n}\n```\n\n## Examples\n\n- [Chart unit test](./examples/chart-unit-test): An example that shows how to use the library for chart unit testing.\n- [Custom](examples/custom): An example that templates a chart with custom options (e.g CRDs).\n- [Embed](examples/embed): An example that renders charts embedded in the binary using [`embed.FS`][embed-fs].\n- [Memory](examples/memory): An example that templates a chart from memory.\n- [Simple](examples/simple): A simple way of templating a chart in the FS.\n\n\n## Tradeoffs\n\nThis library doesn't support anything apart from simple `helm template`. dependencies, hooks... and similar _fancy_ features, are not supported.\n\n## Why\n\nOne of the [Helm]'s most powerful feature (if not the most) is its template system, lots of users only use [Helm] for this usage.\n\nNot depending on helm as a system dependency, nor requiring to execute an external command, improves the portability and performance of applications that use Helm internally.\n\n\n## Some use cases\n\n- Remove process execution for simple helm template calls.\n- Control better the execution flow of rendering multiple charts.\n- Embed charts in compiled binaries with [`embed.FS`][embed-fs].\n- Increase Helm template speed.\n- Chart unit testing.\n\n[helm]: https://helm.sh\n[helm-template]: https://helm.sh/docs/helm/helm_template/\n[embed-fs]: https://pkg.go.dev/embed#FS\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslok%2Fgo-helm-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslok%2Fgo-helm-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslok%2Fgo-helm-template/lists"}