fusefile

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

package fusefile is the canonical authoring format for a fuse environment. a Fusefile is parsed and compiled client-side into the orchestrator wire (CreateEnvironmentRequest); the orchestrator never sees a Fusefile.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KindSupportsMIG added in v0.7.0

func KindSupportsMIG(kind string) bool

KindSupportsMIG reports whether a GPU kind can plausibly run a MIG profile. An empty kind (unknown at request time) and any unrecognized kind return true so the scheduler's per-device MIGCapable flag remains the source of truth; only a kind on the known non-MIG denylist returns false. Matching is case-insensitive and substring-based so "NVIDIA V100" and "v100-sxm2" both resolve.

func ValidGPUProfile added in v0.7.0

func ValidGPUProfile(s string) bool

ValidGPUProfile reports whether s is a well-formed MIG profile name ("1g.10gb", "2g.20gb", ...). Shared with the API layer's request validation so raw SDK callers are held to the same vocabulary as Fusefile authors.

Types

type Compiled

type Compiled struct {
	Spec            ResourceSpec
	ManifestJSON    []byte
	StartupScript   string
	RequiredSecrets []string
	Expose          []ExposeSpec
}

Compiled is the result of compiling a Fusefile: the resource spec, the manifest json to upload to the guest, the startup script to run, the secrets the environment needs at create time, and any ports to expose.

func Compile

func Compile(f *Fusefile) (*Compiled, error)

Compile turns the human-friendly Fusefile.Resources into a ResourceSpec.

type EnvValue

type EnvValue struct {
	Value  string `yaml:"value,omitempty"`
	Secret string `yaml:"secret,omitempty"`
}

EnvValue is either a literal value or a secret reference. exactly one is set.

type Expose

type Expose struct {
	Port int    `yaml:"port"`
	As   string `yaml:"as,omitempty"`
}

Expose publishes a guest port to the outside world.

type ExposeSpec

type ExposeSpec struct {
	Port int
	As   string
}

ExposeSpec requests that a guest port be published as a reachable endpoint. Mirrors Fusefile's Expose entries one-for-one.

type Fusefile

type Fusefile struct {
	Version   int                `yaml:"version"`
	Image     string             `yaml:"image,omitempty"`
	Resources Resources          `yaml:"resources,omitempty"`
	Setup     []string           `yaml:"setup,omitempty"`
	Services  map[string]Service `yaml:"services,omitempty"`
	Run       string             `yaml:"run,omitempty"`
	Workspace string             `yaml:"workspace,omitempty"`
	Expose    []Expose           `yaml:"expose,omitempty"`
	Secrets   []string           `yaml:"secrets,omitempty"`
}

Fusefile is the v1 authoring contract.

func Parse

func Parse(data []byte) (*Fusefile, error)

Parse decodes a Fusefile from yaml bytes using a strict decoder (unknown fields are rejected) and then validates the result. It returns the parsed Fusefile only if it is structurally valid.

type ResourceSpec

type ResourceSpec struct {
	CPUs              int32
	RamMB             int32
	StorageGB         int32
	Region            string
	MaxRuntimeSeconds int64
	Image             string
	GPUs              int32
	GPUKind           string
	GPUProfile        string
}

ResourceSpec mirrors internal/api.ResourceSpec field-for-field so the CLI can copy Compiled.Spec into the sdk/api spec without importing the api package.

Image selects the VM's base rootfs at create time (a name resolved by the firecracker host agent to a pre-baked rootfs file; see FUSEFILE_PLAN.md Phase 7). It lives here, not in the manifest json, because rootfs selection happens at Provider.Create — before the guest boots and long before the manifest is ever uploaded to it.

type Resources

type Resources struct {
	CPUs    int32  `yaml:"cpus,omitempty"`
	GPU     int    `yaml:"gpu,omitempty"`      // device count: whole GPUs, or MIG instances when gpu_profile is set
	GPUKind string `yaml:"gpu_kind,omitempty"` // optional match, e.g. "a100"
	// GPUProfile requests fractional GPU allocation: a MIG profile in
	// nvidia mig-parted vocabulary (e.g. "1g.10gb", "2g.20gb"). When set,
	// `gpu` counts MIG instances of this profile rather than whole
	// devices (decision D5). Empty means whole-device allocation.
	GPUProfile string `yaml:"gpu_profile,omitempty"`
	Memory     string `yaml:"memory,omitempty"`      // e.g. "2GB"
	Storage    string `yaml:"storage,omitempty"`     // e.g. "10GB"
	MaxRuntime string `yaml:"max_runtime,omitempty"` // go duration
}

Resources is the human-friendly hardware spec; compiled to ResourceSpec.

type Service

type Service struct {
	Image string              `yaml:"image"`
	Ports []int               `yaml:"ports,omitempty"`
	Env   map[string]EnvValue `yaml:"env,omitempty"`
}

Service is one in-vm service; compiled to manifest.services and a compose unit.

Jump to

Keyboard shortcuts

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