Documentation
¶
Overview ¶
Package declarative is the shared declarative resource model for Miabi: a family of miabi.io/v1 kinds with one parse/validate/render path and one plan/diff engine. Four consumers speak the same kinds — the apply API, GitOps, the Terraform provider, and marketplace templates.
Index ¶
- Constants
- Variables
- func CheckReferences(refs []Reference, known KnownNames) error
- func GenerateSecret(spec SecretSpec) string
- func JSONSchema() ([]byte, error)
- func Marshal(set *ResourceSet) ([]byte, error)
- func RandAlphaNum(n int) string
- type Action
- type AppView
- type ApplicationPlacementSpec
- type ApplicationSpec
- func (a *ApplicationSpec) AddCapabilities() []string
- func (a *ApplicationSpec) Constraints() []string
- func (a *ApplicationSpec) Devices() []string
- func (a *ApplicationSpec) DropCapabilities() []string
- func (a *ApplicationSpec) Location() string
- func (a *ApplicationSpec) NoNewPrivileges() bool
- func (a *ApplicationSpec) ReadOnlyRootFilesystem() bool
- func (a *ApplicationSpec) Replicas() int
- func (a *ApplicationSpec) RunAsUser() string
- func (a *ApplicationSpec) Runtime() string
- func (a *ApplicationSpec) Strategy() string
- func (a *ApplicationSpec) Update() *UpdateSpec
- type CapabilitiesSpec
- type Change
- type ConfigSpec
- type ConnView
- type CronJobSpec
- type DatabasePlacementSpec
- type DatabaseResourcesSpec
- type DatabaseSpec
- type DeploymentSpec
- type DomainSpec
- type Edge
- type EdgeType
- type FieldDiff
- type HealthcheckSpec
- type JobSpec
- type Kind
- type KnownNames
- type Meta
- type MiddlewareSpec
- type MountSpec
- type PlacementSpec
- type Plan
- type PlanOptions
- type PortSpec
- type ProjectSpec
- type Reference
- type RegistrySpec
- type RenderContext
- type Renderer
- func (r *Renderer) RenderEnv(scope string, env map[string]string) (map[string]string, error)
- func (r *Renderer) RenderEnvLenient(scope string, env map[string]string) map[string]string
- func (r *Renderer) RenderFiles(scope string, files map[string]string, delimiters []string) (map[string]string, error)
- func (r *Renderer) RenderString(name, s string) (string, error)
- type Resource
- type ResourceSet
- func (s *ResourceSet) Add(r Resource)
- func (s *ResourceSet) All() []Resource
- func (s *ResourceSet) ByKind(k Kind) []Resource
- func (s *ResourceSet) Get(key string) (Resource, bool)
- func (s *ResourceSet) Has(k Kind, name string) bool
- func (s *ResourceSet) Len() int
- func (s *ResourceSet) References() []Reference
- type ResourceSpec
- type RouteMaintenanceSpec
- type RouteSecuritySpec
- type RouteSpec
- type SecretSpec
- type SecuritySpec
- type SourceSpec
- type StackSpec
- type UpdateSpec
- type VolumeSpec
Constants ¶
const ( SecretLower = "abcdefghijklmnopqrstuvwxyz" SecretUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" SecretDigits = "0123456789" SecretSymbols = "!#$%&()*+,-./:;<=>?@[]^_{|}~" )
The alphabet a generated secret draws from. SecretSymbols is character-for- character the console generator's set (web/src/composables/useGenerator.ts): a policy written in a manifest and the same policy set in the UI must produce values from the same alphabet, or `generate:` and the generator are two different features wearing one name.
Quotes, backslash and backtick are excluded on both sides: they are what break a value pasted into a shell, a YAML file or a connection string, and dropping them costs about 0.2 bits per character.
const ( // RunOnChange runs the Job when its fingerprint (command, entrypoint, image, registry, runAsUser, // timeout) changes. Edit the command to run it again. RunOnChange = "onChange" // RunOnce runs the Job exactly once per name; later spec edits are refused. Rename it to run again. RunOnce = "once" // RunOnRelease runs the Job each time a new release of its app becomes active, however that // deploy started (GitOps, console, pipeline, rollback). RunOnRelease = "onRelease" )
Job run policies.
const ( MaxConfigFileBytes = 256 * 1024 MaxConfigTotalBytes = 512 * 1024 DefaultFileMode = "0644" ReloadRestart = "restart" ReloadNone = "none" )
Config limits and defaults. The per-file cap is what matters against Docker's 500 KB config-object limit, since projection is always per file.
const APIVersion = "miabi.io/v1"
APIVersion is the only accepted apiVersion. It is shared with the marketplace manifest engine so the two families stay in lock-step.
const AnnotationSkipInitialRun = "miabi.io/skip-initial-run"
Annotation that creates a Job definition without its first run, to adopt a job that has already run elsewhere.
const DefaultRegistryServer = "registry-1.docker.io"
DefaultRegistryServer is the implicit registry host when a manifest names none. It mirrors registry.DefaultServer — duplicated rather than imported so this package stays free of service dependencies, and both sides must agree or a converged registry would diff.
const DefaultSecretLength = 32
DefaultSecretLength is the length used when a manifest asks to generate a secret without saying how long.
const JobSpecField = "spec"
JobSpecField is the diff field a changed Job run template shows up as.
const LabelGitOpsSource = "miabi.io/gitops-source"
LabelGitOpsSource is the Meta.Labels key recording which GitOps project (source id) created an actual resource, so a single project's resources can be listed or torn down without touching another project's.
const LabelManagedBy = "miabi.io/managed-by"
LabelManagedBy is the Meta.Labels key that records which subsystem owns an actual resource. The plan engine uses it to keep prune from ever deleting a resource the apply engine did not create.
const SchemaFileName = "miabi.io-v1.schema.json"
SchemaFileName is the published file name, kept here so the generator, the docs site and the editor extension cannot disagree about it.
const SchemaID = "https://docs.miabi.io/schema/miabi.io-v1.schema.json"
SchemaID is where the generated schema is published. Editors resolve $ref against it, so it must be the URL the file is actually served from.
Variables ¶
var ErrNoResources = errors.New("no declarative resources found")
ErrNoResources reports that a manifest source parsed with zero resources: the path exists but holds no miabi.io/v1 documents. Callers distinguish it from a missing path (fs.ErrNotExist) to decide whether an empty result is an intentional teardown or an error.
Functions ¶
func CheckReferences ¶ added in v1.10.12
func CheckReferences(refs []Reference, known KnownNames) error
CheckReferences reports every reference to a name that exists nowhere, or to a field its kind lacks. Those can only fail at apply, so a dry run should say so. A name that does exist is never flagged, even where apply might still resolve it late: this check never blocks what apply would accept.
func GenerateSecret ¶ added in v1.9.0
func GenerateSecret(spec SecretSpec) string
GenerateSecret produces a value satisfying the spec's generation policy.
Conflicts are resolved before generating rather than silently disobeyed: a length shorter than the minimums it demands trims them (symbols first, since a policy is more often "at least N digits"), and the alphabet always includes letters and digits.
func JSONSchema ¶ added in v1.8.2
func Marshal ¶
func Marshal(set *ResourceSet) ([]byte, error)
Marshal serializes a resource set into a single multi-document YAML bundle that Parse round-trips. Project resources are organizational and omitted — their children are already first-class members of the set.
func RandAlphaNum ¶
RandAlphaNum returns a cryptographically-random alphanumeric string of length n (used to satisfy secrets with generate: true).
Types ¶
type AppView ¶ added in v1.9.3
AppView is how one application appears to another's manifest. Host is the app's own NAME, which is registered as a DNS alias on every workspace network it joins — so a sibling can be addressed with a value the manifest author writes rather than one the platform mints. Alias is the container's exact identity (mb-app-<token>-<id>), kept because it predates Host and Config files use it.
type ApplicationPlacementSpec ¶ added in v1.10.0
type ApplicationPlacementSpec struct {
// Location names where the app is created. Omitted, the app follows its stack, a volume it mounts or
// the databases it references, else the workspace default. Fixed once created.
Location string `yaml:"location,omitempty" json:"location,omitempty"`
// Constraints narrow the nodes of the location a service is scheduled on, in Swarm syntax:
// node.labels.disk==ssd. An empty list clears them; omitting the field keeps them.
Constraints []string `yaml:"constraints,omitempty" json:"constraints,omitempty"`
}
ApplicationPlacementSpec is where an application runs.
type ApplicationSpec ¶
type ApplicationSpec struct {
// Source builds the image from a Git repository instead of pulling one. Exactly one of source and
// image is set: an app either builds or pulls, and a manifest declaring both would not say which
// wins. Image stays the plain, common case; source is what makes a build-from-git app expressible
// at all, so an app created in the console can be exported and re-applied as itself.
Source *SourceSpec `yaml:"source,omitempty" json:"source,omitempty"`
Image string `yaml:"image,omitempty" json:"image,omitempty"`
Tag string `yaml:"tag,omitempty" json:"tag,omitempty"`
Digest string `yaml:"digest,omitempty" json:"digest,omitempty"` // sha256:… (immutable pin)
Command []string `yaml:"command,omitempty" json:"command,omitempty"`
Ports []PortSpec `yaml:"ports,omitempty" json:"ports,omitempty"`
Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
SecretEnv []string `yaml:"secretEnv,omitempty" json:"secretEnv,omitempty"`
Mounts []MountSpec `yaml:"mounts,omitempty" json:"mounts,omitempty"`
Resources *ResourceSpec `yaml:"resources,omitempty" json:"resources,omitempty"`
// Placement is where the app runs: the location it is created in and, for a service, the nodes Swarm
// may schedule it on.
Placement *ApplicationPlacementSpec `yaml:"placement,omitempty" json:"placement,omitempty"`
// Deployment is how the app runs and how a new release replaces the running one.
Deployment *DeploymentSpec `yaml:"deployment,omitempty" json:"deployment,omitempty"`
// Security is the account the container runs as, the hardening it runs with and the kernel privileges
// it is granted, checked on apply the way the console checks them.
Security *SecuritySpec `yaml:"security,omitempty" json:"security,omitempty"`
// Healthcheck is how the container's health is probed. A deploy waits for it to report healthy before
// the new release goes live, so a broken release never replaces a working one. Omitted, the app keeps
// the check it has, so one configured in the console is not undone.
Healthcheck *HealthcheckSpec `yaml:"healthcheck,omitempty" json:"healthcheck,omitempty"`
// ContainerLabels are user-defined Docker labels stamped on the app's container(s), for
// label-driven tools like Traefik. Reserved keys (io.miabi.*, com.docker.*) are stripped on apply
// — a manifest is machine-authored, so import is fail-soft rather than erroring.
ContainerLabels map[string]string `yaml:"containerLabels,omitempty" json:"containerLabels,omitempty"`
// Stack optionally names the owning Stack resource.
Stack string `yaml:"stack,omitempty" json:"stack,omitempty"`
// Registry names the Registry credential used to pull this image; empty means an anonymous public
// pull. It need not be declared in the same bundle: a name not in the manifest resolves against
// the workspace's existing credentials, so a token created once in the UI can be reused.
Registry string `yaml:"registry,omitempty" json:"registry,omitempty"`
// ExternalLabel pins the subdomain used for external access (`<label>.<base-domain>`). When unset
// Miabi generates a stable label. The label is platform-wide unique: if already claimed it is
// ignored and a generated one is used, so a copy-pasted manifest never fails on a clash.
ExternalLabel string `yaml:"externalLabel,omitempty" json:"externalLabel,omitempty"`
// ReloadPolicy decides what a mounted config's content change does: "restart"
// (default) redeploys the app, "none" leaves it running for apps that watch
// their own config file.
ReloadPolicy string `yaml:"reloadPolicy,omitempty" json:"reloadPolicy,omitempty"`
// Deprecated: use security.runAsUser. Still accepted; setting both is an error.
DeprecatedRunAsUser string `yaml:"runAsUser,omitempty" json:"runAsUser,omitempty"`
// Deprecated: use deployment.strategy. Still accepted; setting both is an error.
DeprecatedStrategy string `yaml:"strategy,omitempty" json:"strategy,omitempty"`
// ConfigFP fingerprints every mounted config's digest, filled by the apply engine
// on both sides of the diff so a content change converges as an app update.
// Not serialized: derived state, like RegistrySpec.PasswordFP.
ConfigFP string `yaml:"-" json:"-"`
}
ApplicationSpec is a long-running container workload. CI writes the immutable Digest; GitOps converges runtime to it.
func (*ApplicationSpec) AddCapabilities ¶ added in v1.10.0
func (a *ApplicationSpec) AddCapabilities() []string
AddCapabilities are the capabilities the app is granted.
func (*ApplicationSpec) Constraints ¶ added in v1.10.0
func (a *ApplicationSpec) Constraints() []string
Constraints are the app's Swarm placement constraints; nil when unstated, empty when cleared.
func (*ApplicationSpec) Devices ¶ added in v1.10.0
func (a *ApplicationSpec) Devices() []string
Devices are the host devices exposed to the app.
func (*ApplicationSpec) DropCapabilities ¶ added in v1.10.0
func (a *ApplicationSpec) DropCapabilities() []string
DropCapabilities are the capabilities the app drops.
func (*ApplicationSpec) Location ¶ added in v1.10.0
func (a *ApplicationSpec) Location() string
Location is the location the app names, or "" when it names none.
func (*ApplicationSpec) NoNewPrivileges ¶ added in v1.10.0
func (a *ApplicationSpec) NoNewPrivileges() bool
NoNewPrivileges reports whether the app asks for no-new-privileges.
func (*ApplicationSpec) ReadOnlyRootFilesystem ¶ added in v1.10.0
func (a *ApplicationSpec) ReadOnlyRootFilesystem() bool
ReadOnlyRootFilesystem reports whether the container's root filesystem is read-only.
func (*ApplicationSpec) Replicas ¶ added in v1.10.0
func (a *ApplicationSpec) Replicas() int
Replicas is the replica count the app names, or 0 when it names none.
func (*ApplicationSpec) RunAsUser ¶ added in v1.8.3
func (a *ApplicationSpec) RunAsUser() string
RunAsUser is the account the container runs as, or "" for the image's own.
func (*ApplicationSpec) Runtime ¶ added in v1.10.0
func (a *ApplicationSpec) Runtime() string
Runtime is the runtime the app names, or "" when it names none.
func (*ApplicationSpec) Strategy ¶ added in v1.9.3
func (a *ApplicationSpec) Strategy() string
Strategy is the rollout strategy the app names, or "" when it names none.
func (*ApplicationSpec) Update ¶ added in v1.10.0
func (a *ApplicationSpec) Update() *UpdateSpec
Update is the service rollout tuning, or nil when unstated.
type CapabilitiesSpec ¶ added in v1.10.0
type CapabilitiesSpec struct {
// Add grants capabilities, e.g. ["NET_ADMIN"]. Anything off the allow-list is refused on apply, not
// dropped.
Add []string `yaml:"add,omitempty" json:"add,omitempty"`
// Drop removes capabilities from the default set. ALL removes every one, leaving only what add grants.
Drop []string `yaml:"drop,omitempty" json:"drop,omitempty"`
}
CapabilitiesSpec changes the Linux capabilities a container starts with. The CAP_ prefix is optional.
type Change ¶
type Change struct {
Action Action `json:"action"`
Kind Kind `json:"kind"`
Name string `json:"name"`
Reason string `json:"reason,omitempty"`
Fields []FieldDiff `json:"fields,omitempty"`
}
Change is one entry in a plan: what happens to one resource.
type ConfigSpec ¶ added in v1.8.1
type ConfigSpec struct {
// Data maps a file key (a relative filename, "/" permitted for subdirectories)
// to its content.
Data map[string]string `yaml:"data" json:"data"`
// Mode is the default octal file mode applied to every key ("0644" when empty).
Mode string `yaml:"mode,omitempty" json:"mode,omitempty"`
// Sensitive redacts content in API responses and diffs it by digest only.
Sensitive bool `yaml:"sensitive,omitempty" json:"sensitive,omitempty"`
// Delimiters overrides the interpolation delimiters for every value, so a file
// whose own syntax uses {{ }} is not mangled. Exactly two distinct entries.
Delimiters []string `yaml:"delimiters,omitempty" json:"delimiters,omitempty"`
// DigestFP fingerprints the rendered data, filled by the apply engine on both
// sides of the diff. Not serialized: derived state, like RegistrySpec.PasswordFP.
DigestFP string `yaml:"-" json:"-"`
}
ConfigSpec is a set of named files projected into containers at mount time. Values are interpolated exactly like application env, so a config can carry a rendered database password without a bootstrap script.
type ConnView ¶
ConnView is a resolved database's connection detail, exposed to env interpolation as {{ .databases.<name>.* }}.
type CronJobSpec ¶ added in v1.10.13
type CronJobSpec struct {
// App is the Application the command runs in. Immutable: moving a schedule to another app is a
// delete and a create.
App string `yaml:"app" json:"app"`
// Schedule is a standard 5-field cron expression, evaluated in UTC.
Schedule string `yaml:"schedule" json:"schedule"`
// Command is the command to run, as a list of arguments (no shell).
Command []string `yaml:"command" json:"command"`
// Entrypoint overrides the image's entrypoint.
Entrypoint []string `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
// Image runs a different image in the app's runtime context; omitted runs the app's active release.
Image string `yaml:"image,omitempty" json:"image,omitempty"`
// Registry names the Registry credential that pulls Image. Only valid with image.
Registry string `yaml:"registry,omitempty" json:"registry,omitempty"`
// TimeoutSeconds stops a run that takes longer; 0 uses the platform default.
TimeoutSeconds int `yaml:"timeoutSeconds,omitempty" json:"timeoutSeconds,omitempty"`
// ConcurrencyPolicy decides what a fire does while the previous run is still active: allow
// (start another), forbid (skip this fire) or replace (cancel the running one). Default allow.
ConcurrencyPolicy string `yaml:"concurrencyPolicy,omitempty" json:"concurrencyPolicy,omitempty"`
// HistoryLimit is how many finished runs to keep; 0 keeps the default 20.
HistoryLimit int `yaml:"historyLimit,omitempty" json:"historyLimit,omitempty"`
// Suspend pauses the schedule. Omitted leaves the live value alone, so a pause made in the
// console survives a sync.
Suspend *bool `yaml:"suspend,omitempty" json:"suspend,omitempty"`
// Security pins the account runs use; omitted inherits the app's when each run fires.
Security *SecuritySpec `yaml:"security,omitempty" json:"security,omitempty"`
}
CronJobSpec is a schedule bound to an Application. Each fire runs Command in the app's runtime context, on the app's active release unless Image overrides it.
func (*CronJobSpec) RunAsUser ¶ added in v1.10.13
func (c *CronJobSpec) RunAsUser() string
RunAsUser returns the pinned account, or "".
type DatabasePlacementSpec ¶ added in v1.10.0
type DatabasePlacementSpec struct {
// Location names where the database is created; omitted, the workspace default. Fixed once created.
Location string `yaml:"location,omitempty" json:"location,omitempty"`
// contains filtered or unexported fields
}
DatabasePlacementSpec is where a database is created. It also reads the string this field held before it became a block (placement: dedicated) as the old spelling of instance.
func (*DatabasePlacementSpec) UnmarshalYAML ¶ added in v1.10.0
func (p *DatabasePlacementSpec) UnmarshalYAML(n *yaml.Node) error
UnmarshalYAML reads the block, or the bare string the field held before it became one.
type DatabaseResourcesSpec ¶ added in v1.10.0
type DatabaseResourcesSpec struct {
Memory string `yaml:"memory,omitempty" json:"memory,omitempty"`
CPU string `yaml:"cpu,omitempty" json:"cpu,omitempty"`
// Size names a database size the platform offers (Enterprise), instead of memory and cpu.
Size string `yaml:"size,omitempty" json:"size,omitempty"`
}
DatabaseResourcesSpec limits a database instance, by memory and CPU or by a named size. Memory accepts Ki/Mi/Gi; CPU is a number of cores, "0.5" for half of one. "0" removes a limit.
func (*DatabaseResourcesSpec) MemoryBytes ¶ added in v1.10.0
func (r *DatabaseResourcesSpec) MemoryBytes() (int64, error)
MemoryBytes parses the memory limit into bytes; empty or "0" is unlimited.
func (*DatabaseResourcesSpec) NanoCPUs ¶ added in v1.10.0
func (r *DatabaseResourcesSpec) NanoCPUs() (int64, error)
NanoCPUs parses the CPU limit into nano-CPUs; empty or "0" is unlimited.
type DatabaseSpec ¶
type DatabaseSpec struct {
Engine string `yaml:"engine" json:"engine"` // postgres|mysql|mariadb|redis|mongodb|libsql
Version string `yaml:"version,omitempty" json:"version,omitempty"` // e.g. "16-alpine"
// Instance decides which instance hosts the database: auto (default) reuses a compatible running one
// and provisions one when none exists, dedicated always provisions one, shared requires an existing one.
Instance string `yaml:"instance,omitempty" json:"instance,omitempty"`
// Placement is where the database is created. The string form (placement: dedicated) is the
// deprecated spelling of instance.
Placement *DatabasePlacementSpec `yaml:"placement,omitempty" json:"placement,omitempty"`
// Resources limit the database's instance, the engine tuned to the memory. Stating them gives the database
// an instance of its own, since a reused one already runs with another's size. Omitted, the instance keeps
// its limits.
Resources *DatabaseResourcesSpec `yaml:"resources,omitempty" json:"resources,omitempty"`
}
DatabaseSpec requests a logical database on a DatabaseInstance.
func (*DatabaseSpec) Location ¶ added in v1.10.0
func (d *DatabaseSpec) Location() string
Location is the location the database names, or "".
type DeploymentSpec ¶ added in v1.10.0
type DeploymentSpec struct {
// Runtime is container (one Docker container) or service (a replicated Swarm service, which needs a
// location that runs a swarm). Omitted, a new app is a container and an existing one keeps its runtime.
Runtime string `yaml:"runtime,omitempty" json:"runtime,omitempty"`
// Replicas is how many tasks a service runs, 1 to 100. Omitted, a new service runs one and an
// existing one keeps its count, so a scale made in the console is not undone.
Replicas int `yaml:"replicas,omitempty" json:"replicas,omitempty"`
// Strategy is how a new release replaces the running one: recreate (stop then start), rolling
// (start the new container before retiring the old) or canary (run both and shift traffic).
// Omitted, the app keeps the strategy it is configured with.
Strategy string `yaml:"strategy,omitempty" json:"strategy,omitempty"`
// Update tunes how Swarm rolls a new release of a service out.
Update *UpdateSpec `yaml:"update,omitempty" json:"update,omitempty"`
}
DeploymentSpec is how an application runs and rolls out.
type DomainSpec ¶
type DomainSpec struct {
TLS string `yaml:"tls,omitempty" json:"tls,omitempty"` // acme|custom (default acme)
Wildcard bool `yaml:"wildcard,omitempty" json:"wildcard,omitempty"`
}
DomainSpec declares an owned hostname/zone; the hostname is the resource's metadata.name (a real FQDN). tls is the default certificate policy routes under it inherit, and wildcard covers *.name too. Ownership verification is a runtime action.
type Edge ¶
Edge is a directed dependency from one resource to another, keyed by Resource Key() ("<Kind>/<name>"). From depends on / targets To.
func Edges ¶
func Edges(set *ResourceSet) []Edge
Edges derives the cross-resource dependency edges within a set. It must run on the parsed (un-rendered) set, where env still carries the "{{ .databases.X }}" templates that reveal soft references. Only edges whose target is in the set are emitted; the result is deduplicated.
type EdgeType ¶
type EdgeType string
EdgeType classifies a dependency between two resources, so a topology view can label and style the link.
const ( EdgeMount EdgeType = "mount" // Application -> Volume (mounts[].volume) EdgeStack EdgeType = "stack" // Application -> Stack (stack) EdgeRoute EdgeType = "route" // Route -> Application (app) EdgeDomain EdgeType = "domain" // Route -> Domain (host under the domain) EdgeDatabase EdgeType = "database" // Application -> Database (env {{ .databases.X }}) EdgeSecret EdgeType = "secret" // Application -> Secret (env {{ .secrets.X }}) EdgeAppRef EdgeType = "app-ref" // Application -> Application (env {{ .applications.X }}) EdgeRegistry EdgeType = "registry" // Application -> Registry (spec.registry) EdgeConfig EdgeType = "config" // Application -> Config (mounts[].config) // EdgeMiddleware is Route -> Middleware (spec.middlewares). Only drawn for a // middleware declared in the same bundle: a route may just as well name one the // workspace already has, and that is not a dangling reference. EdgeMiddleware EdgeType = "middleware" // EdgeSchedule is CronJob -> Application (spec.app). EdgeSchedule EdgeType = "schedule" // EdgeRun is Job -> Application (spec.app). EdgeRun EdgeType = "run" )
type FieldDiff ¶
type FieldDiff struct {
Field string `json:"field"`
From string `json:"from"`
To string `json:"to"`
}
FieldDiff is a single changed field in an update.
type HealthcheckSpec ¶ added in v1.10.12
type HealthcheckSpec struct {
// Type is http (GET path on port, healthy on 2xx/3xx), command (run command in the container, healthy
// on exit 0), image (the image's own HEALTHCHECK, the default) or none (no check, not even the image's).
Type string `yaml:"type" json:"type"`
// Path is the URL path an http check requests, e.g. /healthz.
Path string `yaml:"path,omitempty" json:"path,omitempty"`
// Port is the container port an http check probes. Omitted, the app's first port.
Port int `yaml:"port,omitempty" json:"port,omitempty"`
// Command is the shell command a command check runs, e.g. pg_isready. It needs a shell in the image;
// an http check does not.
Command string `yaml:"command,omitempty" json:"command,omitempty"`
IntervalSeconds int `yaml:"intervalSeconds,omitempty" json:"intervalSeconds,omitempty"`
TimeoutSeconds int `yaml:"timeoutSeconds,omitempty" json:"timeoutSeconds,omitempty"`
Retries int `yaml:"retries,omitempty" json:"retries,omitempty"`
StartPeriodSeconds int `yaml:"startPeriodSeconds,omitempty" json:"startPeriodSeconds,omitempty"`
}
HealthcheckSpec is how a container's health is probed. Only the fields stated are applied; the rest keep their current value (interval 30s, timeout 5s, 3 retries and no start period on a new app).
type JobSpec ¶ added in v1.10.13
type JobSpec struct {
// App is the Application the command runs in. Immutable.
App string `yaml:"app" json:"app"`
// Command is the command to run, as a list of arguments (no shell).
Command []string `yaml:"command" json:"command"`
// Entrypoint overrides the image's entrypoint.
Entrypoint []string `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
// Image runs a different image in the app's runtime context; omitted runs the app's active release.
Image string `yaml:"image,omitempty" json:"image,omitempty"`
// Registry names the Registry credential that pulls Image. Only valid with image.
Registry string `yaml:"registry,omitempty" json:"registry,omitempty"`
// TimeoutSeconds stops a run that takes longer; 0 uses the platform default.
TimeoutSeconds int `yaml:"timeoutSeconds,omitempty" json:"timeoutSeconds,omitempty"`
// RunPolicy decides when the Job runs: onChange (default) when its fingerprint changes, once per
// name, or onRelease each time a new release of the app becomes active.
RunPolicy string `yaml:"runPolicy,omitempty" json:"runPolicy,omitempty"`
// WaitForDeploy (onChange only, default true) holds a run while the app has a deploy in flight,
// so it runs on the new release; a failed deploy marks the run skipped.
WaitForDeploy *bool `yaml:"waitForDeploy,omitempty" json:"waitForDeploy,omitempty"`
// HistoryLimit is how many finished runs to keep; 0 keeps the default 20.
HistoryLimit int `yaml:"historyLimit,omitempty" json:"historyLimit,omitempty"`
// BackoffLimit is how many times a failed run is retried before the Job counts as failed; 0
// (default) never retries. Retries start a new run; a sync never does.
BackoffLimit int `yaml:"backoffLimit,omitempty" json:"backoffLimit,omitempty"`
// Security pins the account runs use; omitted inherits the app's.
Security *SecuritySpec `yaml:"security,omitempty" json:"security,omitempty"`
// SpecFP is the fingerprint of the spec the platform last applied, filled by the apply engine on
// the live side. Derived state, never serialized.
SpecFP string `yaml:"-" json:"-"`
}
JobSpec is a declared one-off run in an Application's runtime context. Syncing the same commit twice never runs it twice; a failed run is not retried by the next sync.
func (*JobSpec) Fingerprint ¶ added in v1.10.13
Fingerprint hashes what a run executes: a change to any of these is a new run under onChange. Policy, history and app are not part of it.
type Kind ¶
type Kind string
Kind enumerates the declarative resource kinds. They map 1:1 to the resources the platform manages and the Terraform provider exposes.
const ( KindApplication Kind = "Application" KindStack Kind = "Stack" KindDatabase Kind = "Database" KindVolume Kind = "Volume" // KindRoute is an HTTP routing rule (host/path -> app:port + TLS), distinct from KindDomain: a // Route exposes an app on a hostname, while a Domain is the owned hostname/zone tracking DNS // ownership and the default TLS policy routes under it inherit. KindRoute Kind = "Route" KindSecret Kind = "Secret" // KindDomain is an owned hostname (or zone) a workspace controls: its default // TLS policy and (optional) wildcard coverage. DNS-ownership verification is a // runtime action, not a declarable field. KindDomain Kind = "Domain" // KindRegistry is a container-registry credential used to pull private images. // It is deliberately not called a "secret": Miabi's Secret kind is the vault, // and an Application references this one by name through spec.registry. KindRegistry Kind = "Registry" // KindProject bundles a set of resources living in one repo/namespace. KindProject Kind = "Project" // KindConfig is a set of named configuration files projected into containers as // read-only files. Secret carries one opaque value consumed as env; Config // carries named text payloads consumed as files. Both are encrypted at rest. KindConfig Kind = "Config" // KindMiddleware is a gateway middleware — rate limiting, basic auth, an access // policy — that Routes reference by name through spec.middlewares. It is a // resource of its own rather than a block inside RouteSpec because one policy is // normally shared: writing the rate limit once and naming it from five routes is // the point, and inlining it would make five copies to keep in step. KindMiddleware Kind = "Middleware" // KindCronJob is a schedule that runs a command in an Application's runtime // context (same image, env, networks and volumes) on a cron expression. KindCronJob Kind = "CronJob" // KindJob is a declared one-off run in an Application's runtime context. It is // a run definition plus a fingerprint: a sync runs it only when its runPolicy // says so, never again for an unchanged spec. KindJob Kind = "Job" )
type KnownNames ¶ added in v1.10.12
KnownNames holds, per collection, the names a reference may resolve to: those declared in the bundle and those already in the workspace.
type Meta ¶
type Meta struct {
Name string `yaml:"name" json:"name"`
// UID is the resource's portable identifier (its Miabi uid). Written on
// export so a restore into another install — or a rename in a manifest — keeps
// identity. Optional in hand-authored manifests; matched ahead of name when set.
UID string `yaml:"uid,omitempty" json:"uid,omitempty"`
Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
Annotations map[string]string `yaml:"annotations,omitempty" json:"annotations,omitempty"`
}
Meta is the identity block shared by every kind. Labels are short and identifying (for selection and grouping); Annotations hold descriptive data the engine stores but never queries. Custom metadata belongs in one of these maps, never as ad-hoc top-level keys.
type MiddlewareSpec ¶ added in v1.9.3
type MiddlewareSpec struct {
Type string `yaml:"type" json:"type"`
// Paths narrows the middleware to the request paths listed; empty applies it to
// everything the route serves.
Paths []string `yaml:"paths,omitempty" json:"paths,omitempty"`
// Rule is the type's configuration, passed through to the gateway.
Rule map[string]any `yaml:"rule,omitempty" json:"rule,omitempty"`
RuleFP string `yaml:"-" json:"-"`
}
MiddlewareSpec is one gateway middleware. Type selects the behaviour from the gateway's catalogue (basicAuth, rateLimit, accessPolicy, …) and Rule carries that type's own configuration, so the manifest reads like the gateway config it produces rather than a Miabi-shaped translation of it.
type MountSpec ¶
type MountSpec struct {
Volume string `yaml:"volume,omitempty" json:"volume,omitempty"`
Config string `yaml:"config,omitempty" json:"config,omitempty"`
// Key selects one file from the config, making Path that file's exact location.
// Empty projects every key under Path as a directory prefix.
Key string `yaml:"key,omitempty" json:"key,omitempty"`
Path string `yaml:"path" json:"path"`
Mode string `yaml:"mode,omitempty" json:"mode,omitempty"`
ReadOnly bool `yaml:"readOnly,omitempty" json:"readOnly,omitempty"`
}
MountSpec attaches a managed Volume into the container filesystem.
type PlacementSpec ¶ added in v1.10.0
type PlacementSpec struct {
// Location names where the resource is created; omitted, the workspace default. Fixed once created.
Location string `yaml:"location,omitempty" json:"location,omitempty"`
}
PlacementSpec is where a stack or volume is created.
type Plan ¶
type Plan struct {
Changes []Change `json:"changes"`
}
Plan is an ordered set of changes that converges actual state to desired. Creates/updates run in dependency order (volumes/dbs before apps before domains); deletes run in reverse.
func BuildPlan ¶
func BuildPlan(desired, actual *ResourceSet, opts PlanOptions) *Plan
BuildPlan diffs desired against actual and returns an ordered convergence plan. actual should contain only Miabi-managed resources when Prune is set, so unmanaged resources are never deleted.
func (*Plan) HasChanges ¶
HasChanges reports whether the plan mutates anything.
type PlanOptions ¶
type PlanOptions struct {
// Prune emits deletes for actual resources absent from desired.
Prune bool
// PruneManagedBy, when non-empty, restricts prune to actual resources whose
// LabelManagedBy label equals it — so a GitOps prune never deletes a
// hand-created or otherwise-owned resource. Empty prunes any orphan.
PruneManagedBy string
// PruneGitOpsSource, when non-empty, restricts prune to actual resources whose LabelGitOpsSource
// equals it, so one project's reconcile never prunes another's. Empty leaves prune unscoped.
// Resources with no source label are never matched, so a scoped prune never deletes them.
PruneGitOpsSource string
// IncludeNoop keeps in-sync resources in the plan (useful for status views).
IncludeNoop bool
}
PlanOptions tunes plan generation.
type PortSpec ¶
type PortSpec struct {
Container int `yaml:"container" json:"container"`
Protocol string `yaml:"protocol,omitempty" json:"protocol,omitempty"` // tcp|udp (default tcp)
Scheme string `yaml:"scheme,omitempty" json:"scheme,omitempty"` // http|https (default http)
// ExternalAccess publishes this port on `<externalLabel>.<base-domain>` over
// HTTPS via the reverse proxy (the base domain must be configured platform-wide).
ExternalAccess bool `yaml:"externalAccess,omitempty" json:"externalAccess,omitempty"`
// Publish binds this container port to a host port on the node (raw TCP/UDP).
// HostPort requests a specific host port; 0 auto-allocates from the pool.
Publish bool `yaml:"publish,omitempty" json:"publish,omitempty"`
HostPort int `yaml:"hostPort,omitempty" json:"hostPort,omitempty"`
}
PortSpec is a container port and how it is reached. The two exposure knobs are orthogonal: externalAccess gives it a public HTTPS URL through the reverse proxy, while publish/hostPort binds it to a raw port on the node, like `docker -p`.
type ProjectSpec ¶
type ProjectSpec struct {
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Resources []Resource `yaml:"-" json:"resources,omitempty"`
}
ProjectSpec bundles a set of resources authored in one place. Child resources may be inlined; the parser flattens them into the document set.
type Reference ¶ added in v1.10.12
type Reference struct {
// Where locates it for an error message, e.g. `application "web" env DATABASE_URL`.
Where string
Collection string // databases | secrets | applications | inputs
Name string
Field string // empty when the reference names no field
}
Reference is one {{ .collection.name.field }} reference a bundle's templates make.
type RegistrySpec ¶ added in v1.7.3
type RegistrySpec struct {
Server string `yaml:"server,omitempty" json:"server,omitempty"`
Username string `yaml:"username,omitempty" json:"username,omitempty"`
Password string `yaml:"password,omitempty" json:"password,omitempty"`
// PasswordFP is the fingerprint of the *rendered* password, filled in by the apply engine on both
// sides of the diff. Deliberately not serialized: it is derived state, so a Marshal->Parse round
// trip (how GitOps canonicalizes a bundle) simply recomputes it.
PasswordFP string `yaml:"-" json:"-"`
}
RegistrySpec is a container-registry credential; an Application selects one via spec.registry. Password is write-only and never appears in a plan — prefer a vault reference over an inline literal. A rotation still converges via an unreadable fingerprint (see PasswordFP).
type RenderContext ¶
type RenderContext struct {
Inputs map[string]string
Databases map[string]ConnView
Apps map[string]AppView // app name -> how a sibling addresses it
Secrets map[string]string // secret name -> value
}
RenderContext is the read-only data env interpolation resolves against. It mirrors the marketplace renderer's context but adds secrets, so GitOps and apply share one interpolation surface.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer interpolates manifest strings against a RenderContext.
func NewRenderer ¶
func NewRenderer(ctx RenderContext) *Renderer
NewRenderer builds a renderer (nil maps are tolerated).
func (*Renderer) RenderEnvLenient ¶
RenderEnvLenient interpolates every value best-effort: a value whose references cannot resolve yet is left as its original template instead of failing. Used for plan/diff, where a not-yet-created dependency must not abort the plan; apply re-renders strictly.
func (*Renderer) RenderFiles ¶ added in v1.8.1
func (r *Renderer) RenderFiles(scope string, files map[string]string, delimiters []string) (map[string]string, error)
RenderFiles interpolates a config's files. Delimiters, when set, replaces the interpolation markers for this config only, so a file whose own syntax uses {{ }} is not mangled. Strict: an unresolvable reference fails the render rather than storing a broken file.
type Resource ¶
type Resource struct {
APIVersion string `yaml:"apiVersion" json:"apiVersion"`
Kind Kind `yaml:"kind" json:"kind"`
Metadata Meta `yaml:"metadata" json:"metadata"`
Application *ApplicationSpec `yaml:"-" json:"application,omitempty"`
Stack *StackSpec `yaml:"-" json:"stack,omitempty"`
Database *DatabaseSpec `yaml:"-" json:"database,omitempty"`
Volume *VolumeSpec `yaml:"-" json:"volume,omitempty"`
Route *RouteSpec `yaml:"-" json:"route,omitempty"`
Secret *SecretSpec `yaml:"-" json:"secret,omitempty"`
Domain *DomainSpec `yaml:"-" json:"domain,omitempty"`
Registry *RegistrySpec `yaml:"-" json:"registry,omitempty"`
Project *ProjectSpec `yaml:"-" json:"project,omitempty"`
Config *ConfigSpec `yaml:"-" json:"config,omitempty"`
Middleware *MiddlewareSpec `yaml:"-" json:"middleware,omitempty"`
CronJob *CronJobSpec `yaml:"-" json:"cronJob,omitempty"`
Job *JobSpec `yaml:"-" json:"job,omitempty"`
}
Resource is one parsed declarative object. Exactly one of the typed spec pointers is set, determined by Kind.
type ResourceSet ¶
type ResourceSet struct {
// contains filtered or unexported fields
}
ResourceSet is an ordered, key-indexed collection of resources. It is the shape both desired state (parsed manifests) and actual state (a workspace snapshot) take so the plan engine can diff them generically.
func Parse ¶
func Parse(data []byte) (*ResourceSet, error)
Parse decodes a single- or multi-document YAML stream into a normalized, validated set of resources. Unknown spec fields are rejected so typos surface rather than being silently dropped. A Project's inline resources are flattened into the set.
func ParseFS ¶
func ParseFS(fsys fs.FS, dir string) (*ResourceSet, error)
ParseFS walks an fs.FS rooted at dir, parsing every .yaml/.yml file in lexical order into one combined set. It is the entry point GitOps uses over a cloned repo's manifest path.
func (*ResourceSet) Add ¶
func (s *ResourceSet) Add(r Resource)
Add appends r. A later Add with the same Key replaces the earlier entry.
func (*ResourceSet) All ¶
func (s *ResourceSet) All() []Resource
All returns the resources in insertion order.
func (*ResourceSet) ByKind ¶
func (s *ResourceSet) ByKind(k Kind) []Resource
ByKind returns the resources of a given kind, in insertion order.
func (*ResourceSet) Get ¶
func (s *ResourceSet) Get(key string) (Resource, bool)
Get returns the resource for key and whether it exists.
func (*ResourceSet) Has ¶
func (s *ResourceSet) Has(k Kind, name string) bool
Has reports whether a resource of the given kind+name is present.
func (*ResourceSet) References ¶ added in v1.10.12
func (s *ResourceSet) References() []Reference
References lists the references in every value apply renders: application env, registry passwords, middleware rules and config files (under their own delimiters).
type ResourceSpec ¶
type ResourceSpec struct {
Memory string `yaml:"memory,omitempty" json:"memory,omitempty"` // e.g. "512Mi"
CPU string `yaml:"cpu,omitempty" json:"cpu,omitempty"` // e.g. "0.5"
// GPU is the number of whole GPU units the app requests (0 = none). GPUKind
// narrows the request to a vendor/model ("nvidia", "NVIDIA A100-…").
GPU int `yaml:"gpu,omitempty" json:"gpu,omitempty"`
GPUKind string `yaml:"gpuKind,omitempty" json:"gpuKind,omitempty"`
}
ResourceSpec caps memory/CPU and requests GPUs. Empty/zero means unlimited/none.
func (*ResourceSpec) MemoryBytes ¶
func (rs *ResourceSpec) MemoryBytes() (int64, error)
MemoryBytes parses the memory cap (e.g. "512Mi", "1Gi") into bytes. Empty or "0" means unlimited (0).
func (*ResourceSpec) NanoCPUs ¶
func (rs *ResourceSpec) NanoCPUs() (int64, error)
NanoCPUs parses the CPU cap (a core fraction, e.g. "0.5", "2") into nano-CPUs (1 core = 1e9). Empty or "0" means unlimited (0).
type RouteMaintenanceSpec ¶ added in v1.8.3
type RouteMaintenanceSpec struct {
Enabled bool `yaml:"enabled" json:"enabled"`
// StatusCode must be 4xx or 5xx: a parked route answering 2xx reads as
// healthy to uptime monitors and search engines.
StatusCode int `yaml:"statusCode,omitempty" json:"statusCode,omitempty"`
Message string `yaml:"message,omitempty" json:"message,omitempty"`
}
RouteMaintenanceSpec is the response a parked route answers with. An unset statusCode or message leaves the gateway's defaults (503 and a short notice).
type RouteSecuritySpec ¶ added in v1.8.3
type RouteSecuritySpec struct {
// ExploitProtection has the gateway reject requests carrying common injection
// and traversal signatures before the backend sees them.
ExploitProtection bool `yaml:"exploitProtection,omitempty" json:"exploitProtection,omitempty"`
}
RouteSecuritySpec holds a route's gateway security switches, mirroring Goma's own security block so the manifest reads like the gateway config it produces.
type RouteSpec ¶
type RouteSpec struct {
Hosts []string `yaml:"hosts" json:"hosts"`
App string `yaml:"app" json:"app"` // target application name
Port int `yaml:"port,omitempty" json:"port,omitempty"`
Path string `yaml:"path,omitempty" json:"path,omitempty"`
TLS string `yaml:"tls,omitempty" json:"tls,omitempty"` // acme|custom|off (default acme)
Certificate string `yaml:"certificate,omitempty" json:"certificate,omitempty"`
TLSProvider string `yaml:"tlsProvider,omitempty" json:"tlsProvider,omitempty"`
Rewrite string `yaml:"rewrite,omitempty" json:"rewrite,omitempty"`
Methods []string `yaml:"methods,omitempty" json:"methods,omitempty"`
// AdvancedConfig is raw Goma route YAML that SUPERSEDES the structured fields above.
AdvancedConfig string `yaml:"advancedConfig,omitempty" json:"advancedConfig,omitempty"`
// Security carries the gateway's per-route switches.
Security *RouteSecuritySpec `yaml:"security,omitempty" json:"security,omitempty"`
// Maintenance parks the route at the gateway. Omitting it means "serving",
// so removing the block from a manifest resumes traffic.
Maintenance *RouteMaintenanceSpec `yaml:"maintenance,omitempty" json:"maintenance,omitempty"`
Middlewares []string `yaml:"middlewares,omitempty" json:"middlewares,omitempty"`
}
RouteSpec binds one or more hostnames (and an optional path) to an application's port with a TLS mode — an HTTP routing rule. List every hostname the route should answer on, e.g. both example.com and www.example.com.
type SecretSpec ¶
type SecretSpec struct {
Value string `yaml:"value,omitempty" json:"value,omitempty"`
Generate bool `yaml:"generate,omitempty" json:"generate,omitempty"`
Length int `yaml:"length,omitempty" json:"length,omitempty"`
Symbols *bool `yaml:"symbols,omitempty" json:"symbols,omitempty"`
// MinNumbers / MinSpecial guarantee at least this many digits / symbols
// appear, for policies that demand them. Asking for symbols implies them.
MinNumbers int `yaml:"minNumbers,omitempty" json:"minNumbers,omitempty"`
MinSpecial int `yaml:"minSpecial,omitempty" json:"minSpecial,omitempty"`
}
SecretSpec is a write-only secret value. Value is never read back; the diff engine treats secrets as opaque (presence/absence only).
The generation options mirror the console's generator exactly, so the same policy can be expressed in a manifest and in the UI and mean the same thing. Without them `generate:` could not satisfy a service that requires a symbol, and the two halves of the product would disagree about what generating a secret means.
func (SecretSpec) WantSymbols ¶ added in v1.9.0
func (s SecretSpec) WantSymbols() bool
WantSymbols reports whether the generated alphabet includes punctuation: explicitly requested, or implied by asking for a minimum number of them.
type SecuritySpec ¶ added in v1.9.6
type SecuritySpec struct {
// RunAsUser pins the container to an account — "1000", "1000:1000", "node", "node:node" — like
// `docker run --user`. Empty keeps the image's own user. A workspace under the restricted security
// profile must give a non-root numeric uid; anything else is refused on apply, not silently
// dropped, since the manifest is the source of truth for what should be running.
RunAsUser string `yaml:"runAsUser,omitempty" json:"runAsUser,omitempty"`
// ReadOnlyRootFilesystem mounts the container's root filesystem read-only. Volumes stay writable, so
// an image that writes elsewhere (/tmp, /var/run) needs a volume there.
ReadOnlyRootFilesystem bool `yaml:"readOnlyRootFilesystem,omitempty" json:"readOnlyRootFilesystem,omitempty"`
// NoNewPrivileges stops a process gaining privileges through setuid binaries. The restricted security
// profile always sets it, so false is refused there rather than silently overridden.
NoNewPrivileges *bool `yaml:"noNewPrivileges,omitempty" json:"noNewPrivileges,omitempty"`
// Capabilities adds Linux capabilities beyond Docker's default set and drops any from it.
Capabilities *CapabilitiesSpec `yaml:"capabilities,omitempty" json:"capabilities,omitempty"`
// Devices are host device nodes exposed to the container, e.g. ["/dev/net/tun"].
Devices []string `yaml:"devices,omitempty" json:"devices,omitempty"`
// Deprecated: use capabilities.add. Still accepted; setting both is an error.
DeprecatedAddCapabilities []string `yaml:"addCapabilities,omitempty" json:"addCapabilities,omitempty"`
}
SecuritySpec is the account a container runs as, its hardening and the kernel privileges it is granted. An omitted field means the container default, so removing one from a manifest converges.
type SourceSpec ¶ added in v1.9.3
type SourceSpec struct {
// Git is the repository URL (https or ssh). Required.
Git string `yaml:"git" json:"git"`
// Ref is the branch, tag or commit to build. Empty builds the repository's default branch.
Ref string `yaml:"ref,omitempty" json:"ref,omitempty"`
// BuildMethod is auto (Dockerfile if present, else buildpacks), dockerfile or buildpack.
// Empty means auto.
BuildMethod string `yaml:"buildMethod,omitempty" json:"buildMethod,omitempty"`
// Builder is the Cloud Native Buildpacks builder image; Buildpacks pins the buildpacks to run.
// Both apply to the buildpack path only.
Builder string `yaml:"builder,omitempty" json:"builder,omitempty"`
Buildpacks []string `yaml:"buildpacks,omitempty" json:"buildpacks,omitempty"`
// BuildEnv are variables available to the BUILD, not to the running container — a private module
// token, a feature flag the compiler reads. Runtime env belongs in spec.env.
BuildEnv map[string]string `yaml:"buildEnv,omitempty" json:"buildEnv,omitempty"`
// Repository names a stored Git credential for a private repo, by its name in the workspace. It
// is not a declarable kind, so it resolves against credentials that already exist — the same rule
// spec.registry follows for an image pull.
Repository string `yaml:"repository,omitempty" json:"repository,omitempty"`
}
SourceSpec builds an application's image from a Git repository. It mirrors the console's Source card: where the code is, which ref to build, and how to turn it into an image.
type StackSpec ¶
type StackSpec struct {
Description string `yaml:"description,omitempty" json:"description,omitempty"`
// Placement is where the stack is created. Member applications that name no location follow it.
Placement *PlacementSpec `yaml:"placement,omitempty" json:"placement,omitempty"`
}
StackSpec groups applications into one logical unit / network.
type UpdateSpec ¶ added in v1.10.0
type UpdateSpec struct {
Parallelism int `yaml:"parallelism,omitempty" json:"parallelism,omitempty"`
DelaySeconds int `yaml:"delaySeconds,omitempty" json:"delaySeconds,omitempty"`
}
UpdateSpec is a service rollout: how many tasks are replaced at once, and the pause between batches.
type VolumeSpec ¶
type VolumeSpec struct {
Size string `yaml:"size,omitempty" json:"size,omitempty"` // e.g. "5Gi" (0/empty = unbounded)
// StorageClass names the admin-registered storage the volume is created on (e.g. "ssd-fast").
// Omit it to take whatever this install's plan and node defaults decide, which is what keeps one
// manifest portable across installs with different disks. A class cannot be changed afterwards:
// the data is already under it, so apply refuses the edit rather than recreating the volume.
StorageClass string `yaml:"storageClass,omitempty" json:"storageClass,omitempty"`
// Placement is where the volume is created.
Placement *PlacementSpec `yaml:"placement,omitempty" json:"placement,omitempty"`
}
VolumeSpec declares persistent storage.
func (*VolumeSpec) Location ¶ added in v1.10.0
func (v *VolumeSpec) Location() string
Location is the location the volume names, or "".
func (*VolumeSpec) SizeBytes ¶ added in v1.10.2
func (v *VolumeSpec) SizeBytes() (int64, error)
SizeBytes parses the declared capacity (e.g. "5Gi") into bytes. Empty or "0" means unbounded.