pub struct StackDef {
pub name: String,
pub org: OrgId,
pub file: ComposeFile,
pub base_dir: PathBuf,
pub secrets: BTreeMap<String, SecretBinding>,
pub force: BTreeMap<String, u64>,
pub images: BTreeMap<String, String>,
pub deployed_at: u64,
pub deployed_by: String,
pub source: Option<String>,
pub domains: BTreeMap<String, Vec<DomainSpec>>,
pub previous: Option<Box<StackDef>>,
}Expand description
A deployed stack, as the daemon stores it.
Fields§
§name: String§org: OrgIdThe org the stack runs in (its incus project).
file: ComposeFileThe resolved compose file.
base_dir: PathBufWhere relative bind paths resolve.
secrets: BTreeMap<String, SecretBinding>The secrets the services use, by top-level key: references into the
org’s store by name and version, never values (secrets).
force: BTreeMap<String, u64>Bumped per service by a forced update, to replace instances whose spec did not change (a moved image tag, say).
images: BTreeMap<String, String>The digest each registry: image resolved to at deploy time, by
service: a moved tag is a new revision, and a rollback runs exactly
what ran before.
deployed_at: u64Unix seconds.
deployed_by: StringWho deployed it (an Access identity, or local).
source: Option<String>The compose file as written (${VAR} unresolved), when it was
deployed as text and needed no variables from the caller: what
stack_export hands out. file is what it resolved to.
domains: BTreeMap<String, Vec<DomainSpec>>The stack’s managed domains merged into file (source), per
service, so a rollback puts them back too.
previous: Option<Box<StackDef>>The deployment this one replaced, for rollback.
Implementations§
Source§impl StackDef
impl StackDef
pub fn qualified(&self) -> String
Sourcepub fn revision(&self, service: &str) -> Result<String>
pub fn revision(&self, service: &str) -> Result<String>
The service’s revision: a hash of what shapes its instances. Replica
count, rollout settings and dependencies are left out, so changing
them never replaces an instance. A secret counts by its binding
(store name, driver, version), so a new version is a new revision,
unless its on_change for the service is restart or none: then
the version is left out, and a new one is delivered to the running
replicas instead (StackDef::live_secrets).
Sourcepub fn on_change(&self, service: &str, key: &str) -> OnChange
pub fn on_change(&self, service: &str, key: &str) -> OnChange
What a new version of the top-level secret key does to service:
the service’s own references first, then the secret’s on_change,
then roll.
Sourcepub fn live_secrets(&self, service: &str) -> BTreeMap<String, (OnChange, u64)>
pub fn live_secrets(&self, service: &str) -> BTreeMap<String, (OnChange, u64)>
The secrets service uses whose new versions reach its running
replicas in place (on_change: restart or none), with the setting
and the version bound now.
Sourcepub fn services_using(&self, key: &str) -> Vec<String>
pub fn services_using(&self, key: &str) -> Vec<String>
The services using the top-level secret key.
Sourcepub fn store_secrets(&self) -> BTreeSet<String>
pub fn store_secrets(&self) -> BTreeSet<String>
Names in the org’s store that the stack’s services use (external
ones, and the <stack>_<key> ones it owns): what isb secret rm
must not pull out from under it.
Sourcepub fn instance_image(&self, service: &str, image: &str) -> String
pub fn instance_image(&self, service: &str, image: &str) -> String
A service’s image as its instances get it: a registry: tag pinned
to the digest it named at deploy time (StackDef::images).