unit

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateQuadletUnit

func GenerateQuadletUnit(unit QuadletUnit, verbose bool) string

func GetUnitStatus

func GetUnitStatus(unitName string, unitType string) (string, error)

func ProcessManifests

func ProcessManifests(repo *git.Repository, force bool) error

func ReloadSystemd

func ReloadSystemd() error

func RestartUnit

func RestartUnit(unitName string, unitType string) error

func ShowUnit

func ShowUnit(unitName string, unitType string) error

func StartUnit

func StartUnit(unitName string, unitType string) error

func StopUnit

func StopUnit(unitName string, unitType string) error

Types

type ContainerConfig

type ContainerConfig struct {
	Image           string            `yaml:"image"`
	Label           []string          `yaml:"label"`
	PublishPort     []string          `yaml:"publish"`
	Environment     map[string]string `yaml:"environment"`
	EnvironmentFile string            `yaml:"environment_file"`
	Volume          []string          `yaml:"volume"`
	Network         []string          `yaml:"network"`
	Command         []string          `yaml:"command"`
	Entrypoint      []string          `yaml:"entrypoint"`
	User            string            `yaml:"user"`
	Group           string            `yaml:"group"`
	WorkingDir      string            `yaml:"working_dir"`
	PodmanArgs      []string          `yaml:"podman_args"`
	RunInit         bool              `yaml:"run_init"`
	Notify          bool              `yaml:"notify"`
	Privileged      bool              `yaml:"privileged"`
	ReadOnly        bool              `yaml:"read_only"`
	SecurityLabel   []string          `yaml:"security_label"`
	HostName        string            `yaml:"hostname"`
	Secrets         []SecretConfig    `yaml:"secrets"`
}

ContainerConfig represents the configuration for a container in a Quadlet unit. It includes settings such as the container image, published ports, environment variables, volumes, networks, command, entrypoint, user, and other container-specific options.

type ImageConfig

type ImageConfig struct {
	Image      string   `yaml:"image"`
	PodmanArgs []string `yaml:"podman_args"`
}

ImageConfig represents the configuration for an image in a Quadlet unit.

type NetworkConfig

type NetworkConfig struct {
	Label      []string `yaml:"label"`
	Driver     string   `yaml:"driver"`
	Gateway    string   `yaml:"gateway"`
	IPRange    string   `yaml:"ip_range"`
	Subnet     string   `yaml:"subnet"`
	IPv6       bool     `yaml:"ipv6"`
	Internal   bool     `yaml:"internal"`
	DNSEnabled bool     `yaml:"dns_enabled"`
	Options    []string `yaml:"options"`
}

NetworkConfig represents the configuration for a network in a Quadlet unit.

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

func NewProcessor

func NewProcessor(repo *git.Repository, unitRepo *Repository) *Processor

func (*Processor) Process

func (p *Processor) Process(force bool) error

type QuadletUnit

type QuadletUnit struct {
	Name      string          `yaml:"name"`
	Type      string          `yaml:"type"`
	Systemd   SystemdConfig   `yaml:"systemd"`
	Container ContainerConfig `yaml:"container,omitempty"`
	Volume    VolumeConfig    `yaml:"volume,omitempty"`
	Network   NetworkConfig   `yaml:"network,omitempty"`
	Image     ImageConfig     `yaml:"image,omitempty"`
}

QuadletUnit represents the configuration for a Quadlet unit, which can include systemd, container, volume, network, pod, Kubernetes, image, and build settings.

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func NewUnitRepository

func NewUnitRepository(db *sql.DB) *Repository

func (*Repository) Create

func (r *Repository) Create(unit *Unit) (int64, error)

func (*Repository) Delete

func (r *Repository) Delete(id int64) error

func (*Repository) FindAll

func (r *Repository) FindAll() ([]Unit, error)

func (*Repository) FindByID

func (r *Repository) FindByID(id int64) (Unit, error)

func (*Repository) FindByUnitType

func (r *Repository) FindByUnitType(unitType string) ([]Unit, error)

type SecretConfig

type SecretConfig struct {
	Name   string `yaml:"name"`
	Type   string `yaml:"type"`   // mount or env
	Target string `yaml:"target"` // defaults to secret name
	UID    int    `yaml:"uid"`    // defaults to 0, mount type only
	GID    int    `yaml:"gid"`    // defaults to 0, mount type only
	Mode   string `yaml:"mode"`   // defaults to 0444, mount type only
}

type SystemdConfig

type SystemdConfig struct {
	Description     string   `yaml:"description"`
	Documentation   []string `yaml:"documentation"`
	After           []string `yaml:"after"`
	Before          []string `yaml:"before"`
	Requires        []string `yaml:"requires"`
	Wants           []string `yaml:"wants"`
	Conflicts       []string `yaml:"conflicts"`
	RestartPolicy   string   `yaml:"restart_policy"`
	TimeoutStartSec int      `yaml:"timeout_start_sec"`
	Type            string   `yaml:"type"`
	RemainAfterExit bool     `yaml:"remain_after_exit"`
	WantedBy        []string `yaml:"wanted_by"`
}

SystemdConfig represents the configuration for a systemd unit. It includes settings such as the unit description, dependencies, restart policy, and other systemd-specific options.

type Unit

type Unit struct {
	ID            int64     `db:"id"`
	Name          string    `db:"name"`
	Type          string    `db:"type"`
	CleanupPolicy string    `db:"cleanup_policy"`
	SHA1Hash      []byte    `db:"sha1_hash"`
	CreatedAt     time.Time `db:"created_at"`
}

Unit represents a record in the units table

type VolumeConfig

type VolumeConfig struct {
	Label    []string `yaml:"label"`
	Device   string   `yaml:"device"`
	Options  []string `yaml:"options"`
	UID      int      `yaml:"uid"`
	GID      int      `yaml:"gid"`
	Mode     string   `yaml:"mode"`
	Chown    bool     `yaml:"chown"`
	Selinux  bool     `yaml:"selinux"`
	Copy     bool     `yaml:"copy"`
	Group    string   `yaml:"group"`
	Size     string   `yaml:"size"`
	Capacity string   `yaml:"capacity"`
	Type     string   `yaml:"type"`
}

Jump to

Keyboard shortcuts

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