generators

package
v0.1.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package generators provides a pluggable system for generating Kubernetes resources from different configuration formats. It implements a registry pattern with Group, Version, Kind (GVK) identification following Kubernetes conventions.

Documentation

For detailed documentation, see:

  • DESIGN.md: High-level design and GVK system overview
  • ARCHITECTURE.md: Implementation patterns and conventions
  • STATUS.md: Current development status and roadmap

Architecture

The package uses a registry pattern where each generator type:

  • Is identified by a GVK (Group, Version, Kind)
  • Implements the ApplicationConfig interface
  • Is organized in its own subpackage
  • Supports multiple versions (v1alpha1, v1beta1, v1, etc.)

Generator Organization

Each generator type is organized as:

generators/
├── <type>/                 # Generator type package
│   ├── v1alpha1.go        # Version implementation
│   ├── v1beta1.go         # Future version
│   ├── internal/          # Internal implementation
│   │   └── <type>.go      # Core logic
│   └── doc.go             # Package documentation

Available Generators

  • appworkload: Standard Kubernetes workloads (Deployments, StatefulSets, DaemonSets)
  • fluxhelm: Flux HelmRelease with various source types

Registration

Generators self-register during package initialization:

func init() {
    generators.Register(generators.GVK{
        Group:   "generators.gokure.dev",
        Version: "v1alpha1",
        Kind:    "MyGenerator",
    }, func() interface{} {
        return &MyGeneratorV1Alpha1{}
    })
}

Usage

Generators are typically used through the ApplicationWrapper:

var wrapper stack.ApplicationWrapper
err := yaml.Unmarshal(yamlData, &wrapper)
if err != nil {
    // handle error
}

app := wrapper.ToApplication()
resources, err := app.Config.Generate(app)

Creating New Generators

To create a new generator:

1. Create a new package under generators/<type> 2. Implement the ApplicationConfig interface 3. Add version files (v1alpha1.go, etc.) 4. Register in init() function 5. Add documentation

Version Evolution

Generators support version evolution:

  • v1alpha1: Initial implementation, API may change
  • v1beta1: API stabilizing, backward compatibility within beta
  • v1: Stable API, backward compatibility guaranteed

When adding new versions, implement conversion interfaces to support migration between versions.

Index

Constants

This section is empty.

Variables

View Source
var (
	ParseAPIVersion = gvk.ParseAPIVersion
)

Re-export common functions for backward compatibility

Functions

func Create

func Create(apiVersion, kind string) (stack.ApplicationConfig, error)

Create creates a new ApplicationConfig instance for the given apiVersion and kind

func CreateFromGVK

func CreateFromGVK(gvkObj GVK) (stack.ApplicationConfig, error)

CreateFromGVK creates a new ApplicationConfig instance for the given GVK

func HasKind

func HasKind(apiVersion, kind string) bool

HasKind checks if a GVK is registered in the global registry

func Register

func Register(gvk GVK, factory ApplicationConfigFactory)

Register adds a new ApplicationConfig type to the global registry

Types

type ApplicationConfigFactory

type ApplicationConfigFactory = gvk.Factory[stack.ApplicationConfig]

ApplicationConfigFactory is a function that creates a new ApplicationConfig instance

type BaseMetadata

type BaseMetadata = gvk.BaseMetadata

BaseMetadata provides common metadata fields for generators

type Convertible

type Convertible = gvk.Convertible

type GVK

type GVK = gvk.GVK

Re-export GVK type for backward compatibility

func ListKinds

func ListKinds() []GVK

ListKinds returns all registered GVKs from the global registry

type MetadataConfig

type MetadataConfig = gvk.MetadataType

type NamedConfig

type NamedConfig = gvk.NamedType

type NamespacedConfig

type NamespacedConfig = gvk.NamespacedType

type VersionedType

type VersionedType = gvk.VersionedType

Re-export interfaces from internal/gvk for backward compatibility

Directories

Path Synopsis
Package appworkload provides generators for creating standard Kubernetes workloads (Deployments, StatefulSets, DaemonSets) along with their associated resources (Services, Ingresses, PersistentVolumeClaims).
Package appworkload provides generators for creating standard Kubernetes workloads (Deployments, StatefulSets, DaemonSets) along with their associated resources (Services, Ingresses, PersistentVolumeClaims).
Package fluxhelm provides generators for creating Flux HelmRelease resources along with their associated source resources (HelmRepository, GitRepository, OCIRepository, or Bucket).
Package fluxhelm provides generators for creating Flux HelmRelease resources along with their associated source resources (HelmRepository, GitRepository, OCIRepository, or Bucket).
Package kurelpackage provides a generator for creating kurel packages from Kubernetes manifests with support for values substitution, patches, and conditional extensions.
Package kurelpackage provides a generator for creating kurel packages from Kubernetes manifests with support for values substitution, patches, and conditional extensions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL