bootstrap

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bootstrap builds a Hardware's OSIE files into an uncompressed `newc` CPIO archive, which the kernel extracts as an additional initramfs, and serves it over HTTP.

Index

Constants

View Source
const ArchiveName = "bootstrap.cpio"

ArchiveName is the file name the Handler serves.

View Source
const DefaultMode = 0o400

DefaultMode is applied to files that do not specify one. Delivered files are read-only to their owner because they routinely carry credentials.

View Source
const Dir = "osie_files"

Dir is where the delivered files land in the initramfs, relative to its root. A dedicated top-level path, so it survives the OSIE (CaptainOS's) rootfs-to-tmpfs transition (its init does cp -ax) and is not hidden by a later mount.

Variables

This section is empty.

Functions

func Archive

func Archive(files []File, modTime time.Time) ([]byte, error)

Archive serializes files into an uncompressed `newc` CPIO archive.

Parent directory entries are synthesized and deduplicated, entries are emitted in a deterministic order, and the archive is terminated with the mandatory TRAILER!!! entry.

modTime is stamped on every entry. It must be stable for a given set of files: the archive is regenerated per HTTP request, and a BMC assembles one ISO mount from thousands of range requests, so a moving clock would splice mismatched headers together. A zero time yields the epoch.

func ModTime

func ModTime(hw *tinkerbell.Hardware) time.Time

ModTime is the timestamp stamped on the delivered files.

The Hardware's creation time is used because it is stable for the life of the object; see Archive for why a live clock cannot be. It does not move when the files themselves are edited.

Types

type BackendReader

type BackendReader interface {
	FilterHardware(ctx context.Context, opts data.HardwareFilter) (*tinkerbell.Hardware, error)
}

BackendReader is the interface for getting hardware data from a backend.

type File

type File struct {
	// Name is the archive-relative path, e.g. "osie_files/network/config.json".
	// A leading "/" is stripped; the kernel extracts relative to the initramfs root.
	Name string
	// Mode holds the permission bits, at most 0o777. Zero means DefaultMode,
	// so a mode of no permissions at all cannot be requested.
	Mode uint32
	Data []byte
}

File is a single regular file to place in the generated archive.

func Files

func Files(hw *tinkerbell.Hardware) ([]File, error)

Files returns the per-host files to deliver.

Content is entirely user defined: every file comes from the Hardware's spec.metadata.osieFiles, placed under Dir. Nothing is synthesized, so a Hardware with no files produces an empty archive.

type Handler

type Handler struct {
	Logger  logr.Logger
	Backend BackendReader
}

Handler serves a Hardware's archive over HTTP, looked up by MAC address.

func (*Handler) HandlerFunc

func (h *Handler) HandlerFunc() http.HandlerFunc

HandlerFunc returns a handler for paths ending in <mac>/bootstrap.cpio.

Jump to

Keyboard shortcuts

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