Available on crate feature
deployment only.Expand description
Deployment contract validation and generation for Kubernetes/Helm/Docker.
Apps provide ~20% customisation via DeploymentContract; this module
generates ~80% boilerplate (Dockerfile, Helm chart, Compose fragment) and
validates existing artifacts against the contract.
§Architecture
App Config::default() → DeploymentContract → generate_chart("chart/")
→ generate_dockerfile()
→ generate_compose_fragment()
→ validate_helm_values("chart/")
→ validate_dockerfile("Dockerfile")The config cascade (figment) is the SSoT for app defaults. The contract captures the deployment-facing subset. Generation creates artifacts from scratch; validation asserts that existing artifacts match.
§Example
use hyperi_rustlib::deployment::{
DeploymentContract, HealthContract, ImageProfile, KedaContract, NativeDepsContract,
generate_dockerfile, generate_chart, generate_compose_fragment,
};
let contract = DeploymentContract {
app_name: "dfe-loader".into(),
binary_name: "dfe-loader".into(),
description: "High-performance data loader".into(),
metrics_port: 9090,
health: HealthContract::default(),
env_prefix: "DFE_LOADER".into(),
metric_prefix: "loader".into(),
config_mount_path: "/etc/dfe/loader.yaml".into(),
image_registry: "ghcr.io/hyperi-io".into(),
extra_ports: vec![],
entrypoint_args: vec!["--config".into(), "/etc/dfe/loader.yaml".into()],
secrets: vec![],
default_config: None,
depends_on: vec!["kafka".into(), "clickhouse".into()],
keda: Some(KedaContract::default()),
base_image: "ubuntu:24.04".into(),
native_deps: NativeDepsContract::for_rustlib_features(
&["transport-kafka", "spool", "tiered-sink"],
"ubuntu:24.04",
),
image_profile: ImageProfile::Production,
oci_labels: Default::default(),
schema_version: 1,
};
// Generate production Dockerfile (without identity annotations -- Phase 1
// backwards-compat. New callers should pass `Some(&identity)`; see
// `ContractIdentity::new` and `ContractIdentity::detect`.)
let dockerfile = generate_dockerfile(&contract, None);
// Generate development Dockerfile (same binary, adds debug tools)
let dev_dockerfile = generate_dockerfile(&contract.with_dev_profile(), None);
// Generate Helm chart directory
// generate_chart(&contract, "chart/").unwrap();
// Generate Docker Compose service fragment
let compose = generate_compose_fragment(&contract);Re-exports§
pub use app_project::AppProjectContract;pub use app_project::AppProjectDestination;pub use app_project::generate_argocd_app_project;pub use contract_identity::ContractIdentity;pub use contract_identity::IdentityError;pub use contract_identity::KEY_PREFIX;pub use contract_identity::VERSION;pub use generate::ArgocdConfig;pub use generate::generate_argocd_application;pub use generate::generate_chart;pub use generate::generate_compose_fragment;pub use generate::generate_container_manifest;pub use generate::generate_dockerfile;pub use generate::generate_runtime_stage;pub use waves::WAVE_APPS;pub use waves::WAVE_CRDS;pub use waves::WAVE_OPERATORS;pub use waves::WAVE_POST;pub use waves::WAVE_TOPICS;
Modules§
- app_
project - ArgoCD
AppProjectgenerator. - contract_
identity - Contract Identity Annotation Scheme v1.
- generate
- Generate deployment artifacts (Dockerfile, Helm chart, Compose fragment,
container manifest, ArgoCD Application) from a
DeploymentContract. - waves
- ArgoCD sync-wave constants.
Structs§
- AptRepo
Contract - A custom APT repository (e.g., Confluent for librdkafka).
- Contract
Mismatch - A single contract mismatch between app defaults and deployment artifact.
- Deployment
Contract - Deployment-facing contract points derived from the app config cascade.
- Health
Contract - Health probe endpoint paths.
- Keda
Config - KEDA autoscaling configuration for the app config cascade.
- Keda
Contract - KEDA contract points validated against Helm
values.yaml. - Native
Deps Contract - Runtime native dependencies for a container image.
- OciLabels
- OCI image labels for the container.
- Port
Contract - Additional container port beyond the metrics port.
- Secret
EnvContract - A single environment variable sourced from a K8s Secret.
- Secret
Group Contract - A group of secrets from the same K8s Secret (e.g., “kafka”, “clickhouse”).
Enums§
- Deployment
Error - Errors from deployment validation and generation.
- Image
Profile - Container image profile – controls what goes into the generated Dockerfile.
Constants§
- DEFAULT_
BASE_ IMAGE - Default base image for the runtime stage.
- DEFAULT_
IMAGE_ REGISTRY - Default publish-target registry for HyperI org.
Functions§
- argocd_
repo_ url_ from_ cascade - Read the git repo URL for ArgoCD generation from the config cascade.
- base_
image_ from_ cascade - Read the runtime base image from the config cascade.
- image_
registry_ from_ cascade - Read the publish-target image registry from the config cascade.
- validate_
dockerfile - Validate a Dockerfile against the deployment contract.
- validate_
helm_ values - Validate a Helm chart directory against the deployment contract.