Documentation
¶
Overview ¶
Package tinfoilconfig defines and validates the measured Tinfoil workload configuration format.
Index ¶
- Constants
- func HasReservedDebugContainer(config *Config) bool
- func ModelIsIsolated(config *Config, name string) bool
- func ReservedDebugRuntimeEnabled(containerName string, options Options) bool
- func ShimUpstreamSet(config *Config) bool
- func Validate(config *Config, options Options) error
- func ValidateBytes(data []byte, options Options) error
- type CVMNetworkConfig
- type Config
- type Container
- type Healthcheck
- type ModelSpec
- type NetworkSpec
- type Options
- type PortMapping
- type ShimConfig
- type ValidationMode
Constants ¶
View Source
const ( ReservedDebugContainerName = "tinfoil-debug-toolbox" ReservedDebugPort = "2222/tcp" ReservedDebugHostPort = 2222 )
View Source
const MaxConfigBytes = 1 << 20
View Source
const (
MaxModelDisks = 24
)
Variables ¶
This section is empty.
Functions ¶
func ModelIsIsolated ¶ added in v0.1.3
func ShimUpstreamSet ¶
func ValidateBytes ¶
Types ¶
type CVMNetworkConfig ¶
type CVMNetworkConfig struct {
InboundPorts []int `yaml:"inbound-ports"`
}
type Config ¶
type Config struct {
CVMVersion string `yaml:"cvm-version"`
ShimRaw yaml.Node `yaml:"shim"`
ShimCfg *ShimConfig `yaml:"-"`
CVMNetwork CVMNetworkConfig `yaml:"cvm-network"`
Networks map[string]*NetworkSpec `yaml:"networks"`
CPUs int `yaml:"cpus"`
Memory int `yaml:"memory"`
GPUs int `yaml:"gpus"`
Models []ModelSpec `yaml:"models"`
Containers []Container `yaml:"containers"`
KeyserverURL string `yaml:"keyserver-url,omitempty"`
}
type Container ¶
type Container struct {
Name string `yaml:"name"`
Image string `yaml:"image"`
Command []string `yaml:"command,omitempty"`
Entrypoint []string `yaml:"entrypoint,omitempty"`
WorkingDir string `yaml:"working_dir,omitempty"`
User string `yaml:"user,omitempty"`
Env []interface{} `yaml:"env,omitempty"`
Secrets []string `yaml:"secrets,omitempty"`
Models []string `yaml:"models,omitempty"`
Volumes []string `yaml:"volumes,omitempty"`
Devices []string `yaml:"devices,omitempty"`
CapAdd []string `yaml:"cap_add,omitempty"`
Runtime string `yaml:"runtime,omitempty"`
Networks []string `yaml:"networks,omitempty"`
Ports []string `yaml:"ports,omitempty"`
IPC string `yaml:"ipc,omitempty"`
PidMode string `yaml:"pid,omitempty"`
GPUs interface{} `yaml:"gpus,omitempty"`
ShmSize string `yaml:"shm_size,omitempty"`
Memory string `yaml:"memory,omitempty"`
CPUs float64 `yaml:"cpus,omitempty"`
Tmpfs map[string]string `yaml:"tmpfs,omitempty"`
ReadOnly *bool `yaml:"read_only,omitempty"`
PidsLimit *int64 `yaml:"pids_limit,omitempty"`
Restart string `yaml:"restart,omitempty"`
StopSignal string `yaml:"stop_signal,omitempty"`
StopTimeout *int `yaml:"stop_timeout,omitempty"`
Healthcheck *Healthcheck `yaml:"healthcheck,omitempty"`
// contains filtered or unexported fields
}
type Healthcheck ¶
type Healthcheck struct {
Test []string `yaml:"test"`
Interval string `yaml:"interval,omitempty"`
Timeout string `yaml:"timeout,omitempty"`
Retries int `yaml:"retries,omitempty"`
StartPeriod string `yaml:"start_period,omitempty"`
}
func (*Healthcheck) UnmarshalYAML ¶
func (h *Healthcheck) UnmarshalYAML(node *yaml.Node) error
type ModelSpec ¶
type ModelSpec struct {
Name string `yaml:"name,omitempty"`
Repo string `yaml:"repo,omitempty"`
MPK string `yaml:"mpk,omitempty"`
MWP string `yaml:"mwp,omitempty"`
EMWP string `yaml:"emwp,omitempty"`
KeySecret string `yaml:"key-secret,omitempty"`
// Schema is the pack schema the pinned artifact was built with (0 = schema 1,
// the original layout). Declarative for now; no consumer reads it yet.
Schema int `yaml:"schema,omitempty"`
}
type NetworkSpec ¶
func (*NetworkSpec) UnmarshalYAML ¶
func (n *NetworkSpec) UnmarshalYAML(node *yaml.Node) error
type Options ¶
type Options struct {
Mode ValidationMode
}
type PortMapping ¶ added in v0.1.4
func ParsePorts ¶ added in v0.1.4
func ParsePorts(ports []string) ([]PortMapping, error)
ParsePorts parses compose-style "<host>:<container>" entries, so no host-IP prefix, no ranges, no /udp suffix.
type ShimConfig ¶
type ShimConfig struct {
UpstreamPort int `yaml:"upstream-port"`
UpstreamContainer string `yaml:"upstream-container,omitempty"`
Paths []string `yaml:"paths"`
OriginDomains []string `yaml:"origins"`
TLSMode string `yaml:"tls-mode" default:"cert-proxy"`
TLSEnv string `yaml:"tls-env" default:"production"`
TLSChallengeMode string `yaml:"tls-challenge" default:"dns"`
TLSWildcard bool `yaml:"tls-wildcard" default:"false"`
TLSOwnSANDomain bool `yaml:"tls-own-san-domain" default:"false"`
ControlPlane string `yaml:"control-plane" default:"https://api.tinfoil.sh"`
ATC string `yaml:"atc" default:"https://atc.tinfoil.sh"`
Authenticated bool `yaml:"authenticated" default:"false"`
AuthenticatedEndpoints *[]string `yaml:"authenticated-endpoints"`
RateLimit float64 `yaml:"rate-limit"`
RateBurst int `yaml:"rate-burst"`
Email string `yaml:"email" default:"tls@tinfoil.sh"`
PublishAttestation bool `yaml:"publish-attestation" default:"true"`
DummyAttestation bool `yaml:"dummy-attestation" default:"false"`
ExpectedGPUs int `yaml:"expected-gpus" default:"0"`
}
func DecodeShim ¶
func DecodeShim(node *yaml.Node) (*ShimConfig, error)
func (*ShimConfig) Validate ¶
func (c *ShimConfig) Validate() error
type ValidationMode ¶
type ValidationMode uint8
ValidationMode selects which producer is allowed to construct the config. WorkloadMode is for user-supplied measured YAML. HostDebugMode is only for YAML after tinfoild has injected its reserved debug toolbox.
const ( WorkloadMode ValidationMode = iota HostDebugMode )
Click to show internal directories.
Click to hide internal directories.