Skip to main content

replicas_for

Function replicas_for 

Source
pub fn replicas_for(
    target: Target,
    resource: &str,
    export: Option<&ExportConfig>,
) -> u32
Expand description

Returns the replica count for resource on target.

Resolution order: per-resource override -> per-target default -> 1. Compose has no replica concept and always returns 1 regardless of any override.

use lightshuttle_export::{Target, resolve::replicas_for};

// Defaults to 1 when no export config is provided.
assert_eq!(replicas_for(Target::Kubernetes, "api", None), 1);
assert_eq!(replicas_for(Target::Compose, "api", None), 1);