model

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package model is the provider-independent deployment graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	Resource  string            `json:"resource"`
	Extension string            `json:"extension"`
	Instance  string            `json:"instance"` // grove database name, trove store, kv store
	Keys      map[string]string `json:"keys"`     // config key -> value or ${VAR} reference
}

type Capabilities

type Capabilities struct {
	Level         Level                        `json:"level"`
	Resources     map[ResourceType][]Lifecycle `json:"resources"`
	Ingress       bool                         `json:"ingress"`
	FileMounts    bool                         `json:"file_mounts"`
	NetworkPolicy bool                         `json:"network_policy"`
	Observe       bool                         `json:"observe"`
	Logs          bool                         `json:"logs"`
	Rollback      bool                         `json:"rollback"`
}

func (Capabilities) Supports

func (c Capabilities) Supports(t ResourceType, l Lifecycle) bool

Supports reports whether the target can host resources of type t with lifecycle l.

type ConfigFile

type ConfigFile struct {
	Name    string `json:"name"`
	Path    string `json:"path"`   // mount path inside the container
	Format  string `json:"format"` // "yaml"
	Content string `json:"content"`
}

ConfigFile matches ctrlplane's provider.ConfigFile field for field.

type Connection

type Connection struct {
	From      string        `json:"from"`
	To        string        `json:"to"`
	Port      string        `json:"port"`
	Address   string        `json:"address"` // target-specific, filled by the provider
	ConfigKey string        `json:"config_key"`
	EnvVar    string        `json:"env_var"` // "<TO>_URL"
	Timeout   time.Duration `json:"timeout"`
	Retries   int           `json:"retries"`
}

type Deployment

type Deployment struct {
	Revision      uint64       `json:"revision,omitempty"`
	BuildExcludes []string     `json:"build_excludes,omitempty"`
	Project       string       `json:"project"`
	Environment   string       `json:"environment"`
	TargetName    string       `json:"target_name"`
	Target        spec.Target  `json:"target"`
	Registry      string       `json:"registry"`
	Services      []Service    `json:"services"`
	Resources     []Resource   `json:"resources"`
	Connections   []Connection `json:"connections"`
	Secrets       []SecretRef  `json:"secrets"`
	Migrations    []Migration  `json:"migrations"`
	Routes        []Route      `json:"routes"`
	Overlay       OverlayMode  `json:"overlay"` // file, inline, local-file-fallback
}

type Exposure

type Exposure = spec.Exposure

type Health

type Health struct {
	Readiness string `json:"readiness"`
	Liveness  string `json:"liveness"`
	Startup   string `json:"startup"`
	Heartbeat bool   `json:"heartbeat"`
	None      bool   `json:"none"`
}

type Image

type Image struct {
	Repository string `json:"repository"`
	Tag        string `json:"tag"`
	Digest     string `json:"digest"`
	Dockerfile string `json:"dockerfile"` // relative path when the user supplied one
}

type Kind

type Kind = spec.Kind

type Level

type Level string
const (
	LevelRenderable    Level = "renderable"
	LevelValidated     Level = "validated"
	LevelApply         Level = "apply"
	LevelLiveQualified Level = "live-qualified"
)

type Lifecycle

type Lifecycle = spec.Lifecycle // same three values

type Migration

type Migration struct {
	Service   string   `json:"service"`
	Resources []string `json:"resources"`
	Command   []string `json:"command"`
}

type OverlayMode

type OverlayMode string
const (
	OverlayFile     OverlayMode = "file"
	OverlayInline   OverlayMode = "inline"
	OverlayFallback OverlayMode = "config-local"
)

type Port

type Port struct {
	Name     string   `json:"name"`
	Port     int      `json:"port"`
	Protocol string   `json:"protocol"`
	Exposure Exposure `json:"exposure"`
}

type Resource

type Resource struct {
	RuntimeRecipe *RuntimeRecipe `json:"runtime_recipe,omitempty"`
	Name          string         `json:"name"`
	Type          ResourceType   `json:"type"`
	Lifecycle     Lifecycle      `json:"lifecycle"`
	Version       string         `json:"version"`
	Recipe        string         `json:"recipe"`
	Features      []string       `json:"features"`
	Bucket        string         `json:"bucket"`
	Secret        SecretRef      `json:"secret"`
	UsedBy        []string       `json:"used_by"`
}

type ResourceType

type ResourceType string
const (
	Postgres      ResourceType = "postgres"
	MySQL         ResourceType = "mysql"
	SQLite        ResourceType = "sqlite"
	MongoDB       ResourceType = "mongodb"
	ClickHouse    ResourceType = "clickhouse"
	Turso         ResourceType = "turso"
	Redis         ResourceType = "redis"
	Memcached     ResourceType = "memcached"
	NATS          ResourceType = "nats"
	Kafka         ResourceType = "kafka"
	RabbitMQ      ResourceType = "rabbitmq"
	ObjectStorage ResourceType = "object-storage"
	SMTP          ResourceType = "smtp"
	MQTT          ResourceType = "mqtt"
	Meilisearch   ResourceType = "meilisearch"
	Elasticsearch ResourceType = "elasticsearch"
	Typesense     ResourceType = "typesense"
)

type Route

type Route struct {
	Service string `json:"service"`
	Port    string `json:"port"`
	Host    string `json:"host"`
	TLS     string `json:"tls"`
	Path    string `json:"path"` // "/" default
}

type RuntimeRecipe

type RuntimeRecipe struct {
	ID          string            `json:"id"                   yaml:"id"`
	Type        ResourceType      `json:"type"                 yaml:"type"`
	Version     string            `json:"version"              yaml:"version"`
	Image       string            `json:"image"                yaml:"image"`
	Features    []string          `json:"features,omitempty"   yaml:"features,omitempty"`
	Env         map[string]string `json:"env,omitempty"        yaml:"env,omitempty"` // values may reference ${SECRET}
	Port        int               `json:"port"                 yaml:"port"`
	Volume      string            `json:"volume,omitempty"     yaml:"volume,omitempty"` // container path to persist
	Healthcheck []string          `json:"healthcheck"          yaml:"healthcheck"`
	Default     bool              `json:"default,omitempty"    yaml:"default,omitempty"`
	Command     []string          `json:"command,omitempty"    yaml:"command,omitempty"`
	InitImage   string            `json:"init_image,omitempty" yaml:"init_image,omitempty"`
	InitEnv     map[string]string `json:"init_env,omitempty"   yaml:"init_env,omitempty"`
	Init        []string          `json:"init,omitempty"       yaml:"init,omitempty"` // one-shot after healthy, e.g. bucket creation
	DSN         string            `json:"dsn"                  yaml:"dsn"`            // template: "postgres://${USER}:${PASSWORD}@{host}:{port}/{database}"
	Source      string            `json:"-"                    yaml:"-"`
}

type SecretRef

type SecretRef struct {
	Name     string `json:"name"`
	Resolver string `json:"resolver"` // "env", "file", "kubernetes"
	EnvVar   string `json:"env_var"`  // the variable the overlay references
	Resolved bool   `json:"resolved"`
	Where    string `json:"where"` // human description of where it was found
}

SecretRef matches ctrlplane's provider.SecretRef in spirit: a name and where it resolves, never a value.

type Service

type Service struct {
	RuntimeConfig map[string]any    `json:"runtime_config,omitempty"`
	Name          string            `json:"name"`
	App           string            `json:"app"`
	Dir           string            `json:"dir"`       // absolute path to the app's main package
	MainPath      string            `json:"main_path"` // relative to project root, e.g. "cmd/api"
	Kind          Kind              `json:"kind"`
	Image         Image             `json:"image"`
	Ports         []Port            `json:"ports"`
	Health        Health            `json:"health"`
	Replicas      int               `json:"replicas"`
	Resources     spec.ResourceSpec `json:"resources"`
	ConfigFiles   []ConfigFile      `json:"config_files"` // the overlay and any mounted config
	Bindings      []Binding         `json:"bindings"`
	Env           map[string]string `json:"env"`
	Calls         []string          `json:"calls"`
	Discovery     bool              `json:"discovery"`
	Migrate       []string          `json:"migrate"` // nil: none; the command when set
	Schedule      string            `json:"schedule"`
}

Jump to

Keyboard shortcuts

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