Documentation
¶
Overview ¶
Package preflight runs deterministic pre-deploy checks (DNS, ports, disk, memory, image and git reachability, env, mounts, GPU) and reports pass, warn or fail with a reason and fix hint for each. It only reads: nothing here writes a resource or influences the reconciler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrGitAuth = errors.New("repository requires credentials") ErrGitBranchMissing = errors.New("branch not found") ErrGitUnverifiable = errors.New("url scheme cannot be checked") )
Git check errors a check maps to a status.
var ( ErrImageNotFound = errors.New("image not found") ErrImageRateLimited = errors.New("registry rate limited") )
Image lookup errors a check maps to a status.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check struct {
ID string `json:"id"`
Name string `json:"name"`
Status Status `json:"status"`
Reason string `json:"reason"`
Fix string `json:"fix,omitempty"`
}
Check is one preflight result.
type Env ¶
type Env struct {
PublicIP func(ctx context.Context) (string, error)
LookupHost func(ctx context.Context, host string) ([]string, error)
HostPortHolder func(ctx context.Context, nodeID string, port int) (holder string, inUse bool, err error)
FreeDisk func(ctx context.Context, nodeID string) (int64, error)
Memory func(ctx context.Context, nodeID string) (total, available int64, err error)
Image ImageInspector
Git GitChecker
GPUFit func(ctx context.Context, nodeID string) error
Limits Limits
}
Env holds the probes a Run uses. A nil probe skips its check, so a deployment without (say) GPU support simply omits it.
type GitChecker ¶
GitChecker verifies a repository is reachable and has a branch.
type ImageInfo ¶
type ImageInfo struct {
SizeBytes int64
}
ImageInfo is what a manifest lookup learned about an image.
type ImageInspector ¶
ImageInspector resolves an image reference against its registry.
type Limits ¶
type Limits struct {
Timeout time.Duration
MinMemoryBytes int64
DiskFactor float64
MinFreeDisk int64
ImageCacheTTL time.Duration
}
Limits are the tunable thresholds, all overridable by environment.
func LimitsFromEnv ¶
func LimitsFromEnv() Limits
LimitsFromEnv reads the thresholds, falling back to defaults.
type RegistryInspector ¶
type RegistryInspector struct {
Client *http.Client
TTL time.Duration
// contains filtered or unexported fields
}
RegistryInspector reads manifests over the registry v2 API with anonymous bearer tokens, caching results for TTL.
type Request ¶
type Request struct {
Name string
NodeID string
Image string
Port int
HostPort int
Domains []string
// IsLocalNode is the caller-resolved placement fact (NodeID == "" or
// the control plane's own node id): this package has no node store of
// its own, so it can't resolve NodeID itself, only react to it.
IsLocalNode bool
MemoryBytes int64
RequiredEnv []string
EnvKeys []string
BindMounts []string
VolumePaths []string
GPU bool
GitURL string
GitBranch string
}
Request describes the app being checked. Zero fields skip the checks that depend on them.
type SmartHTTPChecker ¶
SmartHTTPChecker lists refs over git's smart HTTP protocol, so no git binary is spawned. Only http(s) URLs can be checked.