orca_core/config/
service.rs1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5use crate::types::{
6 DeployStrategy, PlacementConstraint, Replicas, ResourceLimits, RuntimeKind, VolumeSpec,
7};
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct ProbeConfig {
12 pub path: String,
14 pub port: Option<u16>,
16 #[serde(default = "default_probe_interval")]
18 pub interval_secs: u64,
19 #[serde(default = "default_probe_timeout")]
21 pub timeout_secs: u64,
22 #[serde(default = "default_probe_failures")]
24 pub failure_threshold: u32,
25 #[serde(default = "default_initial_delay")]
27 pub initial_delay_secs: u64,
28}
29
30fn default_probe_interval() -> u64 {
31 10
32}
33fn default_probe_timeout() -> u64 {
34 3
35}
36fn default_probe_failures() -> u32 {
37 3
38}
39fn default_initial_delay() -> u64 {
40 5
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
45pub struct ServicesConfig {
46 pub service: Vec<ServiceConfig>,
47}
48
49#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct ServiceConfig {
51 pub name: String,
52 #[serde(default)]
53 pub runtime: RuntimeKind,
54 pub image: Option<String>,
56 pub module: Option<String>,
58 #[serde(default)]
59 pub replicas: Replicas,
60 pub port: Option<u16>,
62 pub host_port: Option<u16>,
64 pub domain: Option<String>,
66 #[serde(default)]
69 pub routes: Vec<String>,
70 pub health: Option<String>,
72 pub readiness: Option<ProbeConfig>,
74 pub liveness: Option<ProbeConfig>,
76 #[serde(default)]
77 pub env: HashMap<String, String>,
78 pub resources: Option<ResourceLimits>,
79 pub volume: Option<VolumeSpec>,
80 pub deploy: Option<DeployStrategy>,
81 pub placement: Option<PlacementConstraint>,
82 pub network: Option<String>,
85 #[serde(default)]
87 pub aliases: Vec<String>,
88 #[serde(default)]
90 pub mounts: Vec<String>,
91 #[serde(default)]
93 pub triggers: Vec<String>,
94 pub assets: Option<String>,
96}