https://github.com/sondr3/cuebernetes
Convert CUE Kubernetes manifests to YAML
https://github.com/sondr3/cuebernetes
cue kubernetes
Last synced: 2 months ago
JSON representation
Convert CUE Kubernetes manifests to YAML
- Host: GitHub
- URL: https://github.com/sondr3/cuebernetes
- Owner: sondr3
- License: apache-2.0
- Created: 2026-03-09T20:20:33.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-03-13T20:23:30.000Z (3 months ago)
- Last Synced: 2026-03-14T08:37:22.600Z (3 months ago)
- Topics: cue, kubernetes
- Language: Go
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
cuebernetes
A converter for Kubernetes files in Cue to YAML
> [!NOTE]
> This is in many ways a fork, or at the very least based on [cke-cue-kubernetes-resource-exporter](https://github.com/Kystverket/cke-cue-kubernetes-resource-exporter)
# Quickstart
```sh
git clone github.com/sondr3/cuebernetes
cd cuebernetes
go install .
```
## Usage
You can either render directly to YAML (the default) or write the files back
out to a output directory (defaults to `_yaml`).
### Example data
You can either use exported fields or just a naked export. See the following
examples. One has exported named fields and one is just a single exported
namespace.
```cue
package kube
import (
source "cue.dev/x/crd/fluxcd.io/source/v1"
core "cue.dev/x/k8s.io/api/core/v1"
)
ns: core.#Namespace & {
...
}
repo: source.#HelmRepository & {
...
}
```
```cue
package kube
import (
core "cue.dev/x/k8s.io/api/core/v1"
)
core.#Namespace & {
...
}
```
### Straight out
Just point it at a file (or directory), and it'll print all the Cue files that are
Kubernetes manifests to `stdout`.
```shell
$ cuebernetes testdata/apps/podinfo.cue
# DO NOT EDIT -- generated from testdata/apps/podinfo.cue
apiVersion: v1
kind: Namespace
...
```
### Written out
> [!TIP]
> If you do `--output .` it'll write the YAML file alongside the Cue files.
Point it at a file or directory, and it'll write those Cue manifests to the
output directory as a 1-to-1 mapping, essentially just changing the `.cue` to
`.yaml`.
```shell
$ cuebernetes -m write testdata/apps/podinfo.cue
Wrote 1 file(s)
```
If you want to split the exported fields in the Cue files, you can use `--split`
to write each file to its own file instead of a multi-document one.
# License
Apache.