generate

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package generate turns a compose project into Quadlet units.

Two commitments shape the output. First, every non-obvious translation decision is annotated in the unit itself, because the person reading the unit in six months is the one who needs to know why it says what it says. Second, nothing is dropped silently: a compose feature that cannot be translated becomes a finding, never an omission.

The default shape is one .container per service plus a shared .network, per ADR-0001. That is not a stylistic choice: Podman's default network has DNS disabled, so without a user-defined network, sibling service names do not resolve and the compose semantics are lost.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Note

type Note struct {
	// Unit is the generated unit it concerns, empty for project-wide notes.
	Unit string
	// Message states what happened.
	Message string
	// Severity is `error`, `warning`, or `note`.
	Severity string
}

Note is a translation decision or an untranslatable feature.

type Options

type Options struct {
	// Pod emits a single .pod unit that every container joins, instead of a
	// shared .network. Containers in a pod share a network namespace and
	// reach each other on localhost.
	Pod bool
	// Annotate writes explanatory comments into the generated units.
	// On by default; tests that compare exact bytes may turn it off.
	Annotate bool
}

Options control conversion.

type Result

type Result struct {
	Units []Unit
	// Notes are translation decisions worth reporting to the user, beyond
	// what is annotated in the files.
	Notes []Note
}

Result is everything a conversion produced.

func Convert

func Convert(p *compose.Project, opts Options) *Result

Convert turns a compose project into Quadlet units.

type Unit

type Unit struct {
	// Name is the file name, e.g. `web.container`.
	Name string
	// Content is the file's text.
	Content string
}

Unit is a generated unit file.

Jump to

Keyboard shortcuts

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