#kubernetes-crd #nickel #crd #kubernetes

bin+lib amalgam

Type-safe configuration generator for Nickel from various schema sources

8 releases (4 breaking)

0.6.4 Sep 1, 2025
0.6.2 Sep 1, 2025
0.4.1 Aug 29, 2025
0.3.0 Aug 28, 2025
0.1.0 Aug 28, 2025

#522 in Configuration

Download history

250 downloads per month

Apache-2.0

355KB
7.5K SLoC

amalgam

Type-safe configuration generator for Nickel from various schema sources.

Overview

amalgam is a command-line tool that generates type-safe Nickel configurations from Kubernetes CRDs, OpenAPI specifications, Go types, and other schema sources.

Installation

cargo install amalgam

Or with Nix:

nix run github:seryl/amalgam

Usage

Import Kubernetes CRDs

# Import from live cluster
amalgam k8s-import --context production --output ./k8s-types

# Import specific CRD
amalgam k8s-import --crd cert-manager.io --output ./cert-manager

# Import from file
amalgam import --input my-crd.yaml --output ./types

Convert OpenAPI to Nickel

amalgam import --input openapi.yaml --output ./api-types --format nickel

Generate Go structs from Nickel

amalgam export --input config.ncl --output types.go --format go

Watch mode

# Watch for changes and regenerate
amalgam watch --input ./schemas --output ./generated

Features

  • Multi-format Support: OpenAPI, Kubernetes CRDs, JSON Schema, Go AST
  • Bidirectional: Import to Nickel, export from Nickel
  • Type Safety: Generates contracts and validation
  • Dependency Resolution: Automatic import management
  • Incremental: Only regenerates changed schemas

Configuration

Create an amalgam.toml file:

[input]
paths = ["./schemas", "./crds"]
watch = true

[output]
path = "./generated"
format = "nickel"

[kubernetes]
enabled = true
context = "default"
namespaces = ["default", "kube-system"]

Examples

See the examples directory for sample configurations and generated types.

Dependencies

~51–73MB
~1M SLoC