generator

package
v5.21.2 Latest Latest
Warning

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

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

Documentation

Overview

Package generator provides an interface for generating files from code.

This package defines the Generator interface implemented by specific distribution generators for generating configuration files from Go structs.

Key functionality:

  • Generator[T, Options]: Generic interface for content generation
  • Generate: Transform model into string representation

Subpackages:

  • argocd: ArgoCD configuration generator
  • flux: Flux configuration generator
  • k3d: K3d YAML configuration generator
  • kind: Kind YAML configuration generator
  • kustomization: Kustomization YAML generator
  • talos: Talos configuration generator
  • yaml: Generic YAML generator using reflection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildOCIURL added in v5.11.0

func BuildOCIURL(host string, port int32, projectName string) string

BuildOCIURL constructs the OCI registry URL for GitOps sources. For port values:

  • port > 0: use the specified port (e.g., 5000 for local registries)
  • port == 0: default to 5000 (backward compatible behavior)
  • port < 0 (e.g., -1): no port suffix (for external HTTPS registries like ghcr.io)

Types

type Generator

type Generator[T any, Options any] interface {
	Generate(model T, opts Options) (string, error)
}

Generator is implemented by specific distribution generators (kind, k3d, kustomization). The Options type parameter allows each implementation to define its own options structure.

type MockGenerator

type MockGenerator[T any, Options any] struct {
	mock.Mock
}

MockGenerator is an autogenerated mock type for the Generator type

func NewMockGenerator

func NewMockGenerator[T any, Options any](t interface {
	mock.TestingT
	Cleanup(func())
}) *MockGenerator[T, Options]

NewMockGenerator creates a new instance of MockGenerator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockGenerator[T, Options]) EXPECT

func (_m *MockGenerator[T, Options]) EXPECT() *MockGenerator_Expecter[T, Options]

func (*MockGenerator[T, Options]) Generate

func (_mock *MockGenerator[T, Options]) Generate(model T, opts Options) (string, error)

Generate provides a mock function for the type MockGenerator

type MockGenerator_Expecter

type MockGenerator_Expecter[T any, Options any] struct {
	// contains filtered or unexported fields
}

func (*MockGenerator_Expecter[T, Options]) Generate

func (_e *MockGenerator_Expecter[T, Options]) Generate(model interface{}, opts interface{}) *MockGenerator_Generate_Call[T, Options]

Generate is a helper method to define mock.On call

  • model T
  • opts Options

type MockGenerator_Generate_Call

type MockGenerator_Generate_Call[T any, Options any] struct {
	*mock.Call
}

MockGenerator_Generate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Generate'

func (*MockGenerator_Generate_Call[T, Options]) Return

func (_c *MockGenerator_Generate_Call[T, Options]) Return(s string, err error) *MockGenerator_Generate_Call[T, Options]

func (*MockGenerator_Generate_Call[T, Options]) Run

func (_c *MockGenerator_Generate_Call[T, Options]) Run(run func(model T, opts Options)) *MockGenerator_Generate_Call[T, Options]

func (*MockGenerator_Generate_Call[T, Options]) RunAndReturn

func (_c *MockGenerator_Generate_Call[T, Options]) RunAndReturn(run func(model T, opts Options) (string, error)) *MockGenerator_Generate_Call[T, Options]

Directories

Path Synopsis
Package argocd provides generators for ArgoCD GitOps resources.
Package argocd provides generators for ArgoCD GitOps resources.
Package flux provides generators for Flux GitOps resources.
Package flux provides generators for Flux GitOps resources.
Package k3dgenerator provides utilities for generating K3d cluster configurations.
Package k3dgenerator provides utilities for generating K3d cluster configurations.
Package kindgenerator provides utilities for generating Kind cluster configurations.
Package kindgenerator provides utilities for generating Kind cluster configurations.
Package kustomizationgenerator provides utilities for generating kustomization.yaml files.
Package kustomizationgenerator provides utilities for generating kustomization.yaml files.
Package talosgenerator provides a generator for Talos project scaffolding.
Package talosgenerator provides a generator for Talos project scaffolding.
Package yamlgenerator provides YAML generation functionality for arbitrary models.
Package yamlgenerator provides YAML generation functionality for arbitrary models.

Jump to

Keyboard shortcuts

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