{"id":13638497,"url":"https://github.com/noris-network/cuegen","last_synced_at":"2025-08-21T03:32:24.919Z","repository":{"id":65196324,"uuid":"579039589","full_name":"noris-network/cuegen","owner":"noris-network","description":"Cuegen is a tool to build (not only) kubernetes resources with CUE","archived":false,"fork":false,"pushed_at":"2024-12-08T05:05:16.000Z","size":18472,"stargazers_count":27,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-10T07:10:59.010Z","etag":null,"topics":["argocd-plugin","cue","cuelang","kubernetes","sops"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"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/noris-network.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-16T14:04:30.000Z","updated_at":"2024-11-05T14:09:28.000Z","dependencies_parsed_at":"2023-12-05T14:28:25.448Z","dependency_job_id":"7171e8c3-ed33-488b-aa78-e04c13b3ddd9","html_url":"https://github.com/noris-network/cuegen","commit_stats":{"total_commits":138,"total_committers":3,"mean_commits":46.0,"dds":"0.24637681159420288","last_synced_commit":"d3216197c6beb325ebb7071f4653dea350a900f4"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noris-network%2Fcuegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noris-network%2Fcuegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noris-network%2Fcuegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noris-network%2Fcuegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noris-network","download_url":"https://codeload.github.com/noris-network/cuegen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230487843,"owners_count":18233865,"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":["argocd-plugin","cue","cuelang","kubernetes","sops"],"created_at":"2024-08-02T01:00:46.963Z","updated_at":"2025-08-21T03:32:24.912Z","avatar_url":"https://github.com/noris-network.png","language":"Go","funding_links":[],"categories":["kubernetes","Projects","Configuration Management"],"sub_categories":[],"readme":"[![release](https://img.shields.io/github/release/noris-network/cuegen.svg)](https://github.com/noris-network/cuegen/releases)\n[![release](https://github.com/noris-network/cuegen/actions/workflows/release.yaml/badge.svg)](https://github.com/noris-network/cuegen/actions/workflows/release.yaml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/noris-network/cuegen)](https://goreportcard.com/report/github.com/noris-network/cuegen)\n[![downloads](https://img.shields.io/github/downloads/noris-network/cuegen/total.svg)](https://github.com/noris-network/cuegen/releases)\n\n# Cuegen\n\nCuegen is a tool to build kubernetes resources with [CUE][CUE]. It solves the\nproblems of composing and versioning of \"charts\", as well as easily importing\nexternal data (scripts, certificates, keys, etc.) into CUE charts. For this\npurpose, it extends the rich possibilities that [CUE][CUE] already provides\nwith the ability to \"compose\" charts from various sources and load resources,\ncontrolled by attributes.\n\n\u003e *If CUE and creating k8s resources with CUE is new to you, the\n[CUE homepage][CUE], the [k8s tutorial][k8stut], as well as [examples][eg]\nin this repository (in that order) are good starting points.*\n\n## Table of Contents\n- [Cuegen](#cuegen)\n  - [Table of Contents](#table-of-contents)\n  - [Features](#features)\n  - [Install](#install)\n  - [Usage](#usage)\n  - [Configuration](#configuration)\n  - [Environment Variables](#environment-variables)\n  - [Components](#components)\n  - [Attributes](#attributes)\n    - [Attribute \"@readfile\"](#attribute-readfile)\n    - [Attribute \"@readmap\"](#attribute-readmap)\n    - [Attribute \"@read\"](#attribute-read)\n      - [with file Attribute value](#with-file-attribute-value)\n      - [with directory Attribute value](#with-directory-attribute-value)\n  - [Order Workaround](#order-workaround)\n  - [0.15.0 Embed Experiment](#0150-embed-experiment)\n  - [Changelog](#changelog)\n\n## Features\n  * Compose manifests from various, versioned sources (local directories, git-repositories)\n  * Load file contents into CUE values, e.g. a script into a ConfigMap key\n  * Load whole directories as key/values data at once, e.g. into a ConfigMap\n  * Load structured data (JSON/YAML/env) into a CUE struct\n  * Automatically decrypt [SOPS][SOPS]-encrypted data\n  * Load remote charts\n\n## Install\nDownload the [latest release][rel] or build with *go1.20rc3 or later*:\n\n    go install github.com/noris-network/cuegen@latest\n\n\n## Usage\n\n    cuegen path/to/cuegen.yaml\n    # or\n    cuegen path/to/directory-containing-cuegen-dot-yaml\n    # or\n    cuegen https://git.example.com/deployments/myapp.git\n\nHave a look at the [examples][eg] for some ready-to-run examples.\n\nCuegen can be used as [config management plugin][cmp] in ArgoCD. A container\nwith the [`plugin.yaml`](docker/plugin.yaml) configuration\n[is available at docker hub][cuegen-cmp]. The cuegen-cmp plugin container\nexpects the cuegen config file to be named `cuegen.yaml`.\n\n## Configuration\nA configuration file (preferred name: `cuegen.cue`, [schema][cfgschema]) is\nrequired to run `cuegen`. For backwards compatibility the yaml format will still\nbe supported in the future.\n\n    cuegen: {\n      objectsPath:    \"objects\"          // this will be dumped to YAML\n      secretDataPath: \"secret.*.data\"    // values matching this path will be loaded as []byte and\n                                         //     automatically be base64 encoded when dumped to YAML\n      checkPath:                         // this path is checked to contain only concrete values\n      checkPaths: [                      // when more than one path needs to be checked, the\n        \"values\",                        //     'objectsPath' with always be checked.\n        \"global\",\n      ]\n      components: [                      // merge cue files from these soures into the main entrypoint\n        \"https://$GITLAB_TOKEN@gitlab.noris.net/mcs/components/cuegen/mongodb.git?ref=v6.0.4-mcs.1\",\n        \"https://$GITLAB_TOKEN@gitlab.noris.net/mcs/components/cuegen/wekan.git?ref=v6.71-mcs.0\",\n      ]\n      debug: false                       // print some info useful for debugging\n    }\n\n## Environment Variables\nSome environment variables can help working with cuegen:\n\n    CUEGEN_DEBUG              turn on debug output with \"true\"\n    CUEGEN_HTTP_PASSWORD      password for git authentication\n    CUEGEN_HTTP_USERNAME      username for git authentication\n    DUMP_OVERLAYS_TO          directory to dump overlays to (debug only)\n    SOPS_AGE_KEY              age key for decryption\n    SOPS_AGE_KEY_FILE         age key file for decryption\n    YQ_PRETTYPRINT            !=\"\": run yaml output thru `yq -P`\n                              starting with `/`: use as path to yq\n\n## Components\nComponents can be\n\n  * directories outside the main chart\n  * zip files\n  * git repositories\n\n\u003e *Local paths are not restricted. As this could be a security problem,\n\u003e this will change in a future release.*\n\nEnvironment variables in components are [expanded][expenv], that can be used to\ne.g. add authentication to git urls or prefix local paths. For cloning private\nrepositories via Http url, `CUEGEN_HTTP_USERNAME` and `CUEGEN_HTTP_PASSWORD` can\nalso be set in the environment.\n\nComponents Example:\n\n    cuegen: components: [\n      \"../database-chart\",\n      \"../common-static-resources.zip\",\n      \"https://github.com/nxcc/cuegen-test-chart-one?ref=v0.1.0\",\n      \"https://github.com/noris-network/cuegen?ref=v0.2.1#examples/configmap\",\n    ]\n\nBecause of the way CUE and cuegen work, all `*.cue` files need to be in the root\nof the components directory.\nNo special files need to be present for a chart, and although cuegen does not\nrequire or evaluate them, it is recommended to add metadata (see [examples][eg]).\nFor git repositories, a branch or tag name can be specified with the `ref`\nparameter.\nIf a zip file has only one directory in it's root, this level is skipped and\ncuegen uses all files in that directory.\n\n\n## Attributes\nThe directory containing `cuegen.yaml` is the base directory, all paths are relative\nto this.\n\n\n### Attribute \"@readfile\"\nAttribute `@readfile` loads contents of given file(s) into a CUE value. An optional\nsuffix controlls whitespace (`=nl`: ensure `\\n` at end, `=trim`: trim whitespace\nfrom begin and end).\n\nLoad `version.txt` into `Version`, trim any whitespace from begin and end:\n\n    Version: string @readfile(version.txt=trim)\n\nLoad `my.crt` and `chain.crt` concatenated into `Certificate`. A `\\n` is ensured\nto be placed after `my.crt`:\n\n    Certificate: string @readfile(my.crt=nl, chain.crt)\n\n\n### Attribute \"@readmap\"\nAttribute `@readmap` loads contents of given file(s) into a CUE value as key/value\ndata. When the cue path matches `secretDataPath`, values are inserted as []byte.\nThis will automatically base64 encode them when dumped to YAML. This is useful\nfor Secrets. This can also be forced by an `=bytes` suffix.\n\nLoad values from `data.json` as []bytes:\n\n    secret: foo: {\n      data: {} @readmap(data.json=bytes)\n    }\n\n\n### Attribute \"@read\"\n\n#### with file Attribute value\nAttribute `@read(filename)` tries to load structured data (JSON/YAML/env) into a\nCUE struct.\n\nLoad key/value data from `env.env` and `data.yaml` into `configMap.myconfig.data`:\n\n    configMap: \"myconfig\": {\n\t    data: {} @read(env.env, data.yaml)\n    }\n\n\n#### with directory Attribute value\nAttribute `@read(directory)` tries to load regular files from the given directory\nas key/values into a CUE struct.\n\nLoad all files from directory `scripts` as key/values into `configMap.scripts.data`:\n\n    configMap: \"scripts\": {\n\t    data: {} @read(scripts)\n    }\n\n## Order Workaround\nUntil [issue 2555][issue2555] is resolved in CUE, there is a [temporary workaround](examples/workaround/).\n\n## 0.15.0 Embed Experiment\nCuegen `0.15.0` is based on cue v0.10.0. When `apiVersion` is set to \"v1alpha4\", cue attribute handling\nis removed in favour for cue [native embedding][cue-embed]. Right now sops encrypted files need to be\nnamed like `\u003cfilename\u003e.sops.\u003cext\u003e` for formats supported by sops, otherwise like `\u003cfilename\u003e.\u003cext\u003e.sops`.\nThey will be temporarily decrypted to files named like `\u003cfilename\u003e.\u003cext\u003e`, and removed again after Yaml\noutput was generated [(usage example)][eg-embed].\n\nAll future releases at least until release 1.0.0 will be backwards compatible to current\nnon-experimental `cuegen` behaviour.\n\n## 0.16.0\nCuegen `0.16.0` introduces the new apiVersion \"v1beta1\", all alpha versions are now deprecated, but\nwill still work at least until 2026.\n\n## Changelog\n\n  * `v0.1.0`  - Initial release\n  * `v0.1.1`  - Improved attribute lookup\n  * `v0.2.0`  - Added checks when reading `cuegen.yaml`\n  * `v0.2.1`  - Improved error messages\n  * `v0.3.0`  - Added ability to read subpaths from git repos\n  * `v0.3.1`  - No code changes, trigger cmp build\n  * `v0.3.2`  - No code changes, bump go version to 1.20\n  * `v0.4.0`  - switch default config to `cuegen.cue`, use cue v0.5.0-beta5\n  * `v0.4.1`  - Make components \u0026 checkPaths optional\n  * `v0.4.2`  - downgrade cue to v0.5.0-beta.2 ([performance regression][gh2243])\n  * `v0.4.3`  - fix running as kustomize plugin\n  * `v0.4.4`  - improve handling of git urls\n  * `v0.5.0`  - add cuegen default config\n  * `v0.6.0`  - add dumpOverlays option\n  * `v0.7.0`  - upgrade cue to v0.5.0 (many fixes, rare performance regression still present)\n  * `v0.7.1`  - fix secret handling of @readfile\n  * `v0.7.2`  - internal cleanup\n  * `v0.8.0`  - allow remote cuegen directories, rm kustomize plugin support\n  * `v0.9.0`  - upgrade cue to v0.6.0\n  * `v0.10.0` - add `YQ_PRETTYPRINT` to filter output thru `yq -P`\n  * `v0.11.0` - add `DUMP_OVERLAYS_TO` to dump overlays to directory (debug)\n  * `v0.11.1` - upgrade sops\n  * `v0.12.0` - add workaround for file order bug\n  * `v0.13.0` - No code changes, bump cue version to 0.7.0\n  * `v0.13.1` - bump deps\n  * `v0.14.x` - \"silent release\" of v1alpha2 schema...\n  * `v0.14.4` - No code changes, bump cue version to 0.8.0\n  * `v0.14.5` - No code changes, bump cue version to 0.8.1\n  * `v0.14.6` - No code changes, bump cue version to 0.8.2\n  * `v0.15.0` - Introduce \"embed experiment'\n  * `v0.15.1` - No code changes, bump cue version to 0.11.0\n  * `v0.15.2` - No code changes, bump cue version to 0.11.1\n  * `v0.16.0` - new apiVersion \"v1beta1\", bump cue version to 0.12.0\n  * `v0.16.1` - No code changes, bump deps\n  * `v0.16.2` - Upgrade patched cue\n  * `v0.16.3` - cue version 0.12.1\n\n[CUE]:         https://cuelang.org\n[SOPS]:        https://github.com/mozilla/sops\n[k8stut]:      https://cuelang.org/docs/tutorials/\n[eg]:          examples/\n[eg-embed]:    examples/embed-experiment\n[rel]:         https://github.com/noris-network/cuegen/releases/latest\n[cmp]:         https://argo-cd.readthedocs.io/en/stable/operator-manual/config-management-plugins/#sidecar-plugin\n[cuegen-cmp]:  https://hub.docker.com/r/nxcc/cuegen-cmp\n[expenv]:      https://pkg.go.dev/os#ExpandEnv\n[cfgschema]:   internal/app/schema.cue\n[gh2243]:      https://github.com/cue-lang/cue/issues/2243\n[issue2555]:   https://github.com/cue-lang/cue/issues/2555\n[modules]:     https://cuelang.org/docs/reference/modules/\n[cue-embed]:   https://cuelang.org/docs/howto/embed-files-in-cue-evaluation/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoris-network%2Fcuegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoris-network%2Fcuegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoris-network%2Fcuegen/lists"}