engineconfig

package
v0.29.0 Latest Latest
Warning

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

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

Documentation

Overview

Package engineconfig manages upstream k3s/RKE2 source pins, source pulls, and config struct codegen.

Index

Constants

View Source
const (
	// EngineConfigOut is where the generated config structs are written.
	EngineConfigOut = "pkg/engineconfig/gen"
)
View Source
const EnginePinsPath = "thirdparty-src/pins.json"

EnginePinsPath is the canonical manifest of pinned upstream distros and tags.

View Source
const ThirdpartySrcDir = "thirdparty-src"

ThirdpartySrcDir is the root the pinned upstream source is pulled into and generated from.

Variables

This section is empty.

Functions

func GenerateEngineConfig

func GenerateEngineConfig() error

GenerateEngineConfig generates config.yaml structs from thirdparty-src/.

func LatestTag

func LatestTag(repoURL, prefix string) (string, error)

LatestTag is the highest-versioned of those tags.

func PinTag

func PinTag(pins *EnginePins, distro, prefix string) (string, error)

PinTag resolves the newest non-RC tag matching prefix, pins it in thirdparty-src/pins.json, and re-pulls that version's source when the pin moved. Returns the resolved tag.

func PullAllEngineSources

func PullAllEngineSources() error

PullAllEngineSources pulls all files pinned in thirdparty-src/pins.json.

func PullEngineSource

func PullEngineSource(p SourcePull) error

PullEngineSource pulls the specified source files into DestDir.

func RemoteTags

func RemoteTags(repoURL, prefix string) ([]string, error)

RemoteTags lists every non-RC upstream tag on a minor line ("v1.36").

func TagMinor

func TagMinor(tag string) (string, error)

TagMinor returns the thirdparty-src directory name for a tag's minor line ("v1.35.8+k3s1" -> "v1_35").

func TagVersion

func TagVersion(tag string) ([3]int, error)

TagVersion parses the leading major.minor.patch of an upstream tag ("v1.35.8+k3s1").

func UpdateAllPins

func UpdateAllPins() error

UpdateAllPins refreshes every pinned minor line in thirdparty-src/pins.json.

Types

type EnginePins

type EnginePins struct {
	Distros []PinDistro `json:"distros"`
}

EnginePins is the on-disk form of thirdparty-src/pins.json.

func ReadEnginePins

func ReadEnginePins() (EnginePins, error)

ReadEnginePins loads and parses thirdparty-src/pins.json.

func (*EnginePins) Distro

func (p *EnginePins) Distro(name string) (*PinDistro, error)

Distro returns the pinned entry for a distro name.

func (EnginePins) Pulls

func (p EnginePins) Pulls() ([]SourcePull, error)

Pulls flattens the pins into one pull per pinned tag.

func (EnginePins) Write

func (p EnginePins) Write() error

Write rewrites thirdparty-src/pins.json from the in-memory pins.

type PinDistro

type PinDistro struct {
	Name  string   `json:"name"`
	Repo  string   `json:"repo"`
	Files []string `json:"files"`
	Tags  []string `json:"tags"`
}

PinDistro pins one upstream repository.

func (*PinDistro) SetTag

func (d *PinDistro) SetTag(tag string) (prev string, changed bool, err error)

SetTag pins tag for its minor line, replacing whatever that line held.

type SourcePull

type SourcePull struct {
	RepoURL string
	Tag     string
	DestDir string
	Files   []string
}

SourcePull describes one upstream file set to pull verbatim into thirdparty-src/.

Jump to

Keyboard shortcuts

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