Skip to content

Commit 604eb6d

Browse files
author
secus
committed
Update ResourceRequirements fields and default values
1 parent 9d94b9a commit 604eb6d

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

src/deployment/models.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,26 @@ pub struct CreateDeploymentRequest {
5050
pub registry_auth: Option<RegistryAuth>,
5151
}
5252

53-
#[derive(Debug, Serialize, Deserialize, Validate, Default, ToSchema)]
53+
#[derive(Debug, Serialize, Deserialize, Validate, ToSchema)]
5454
pub struct ResourceRequirements {
55-
/// CPU request/limit (e.g., "100m", "0.5")
56-
pub cpu: Option<String>,
57-
/// Memory request/limit (e.g., "128Mi", "1Gi")
58-
pub memory: Option<String>,
55+
/// CPU limit (e.g., "500m", "1")
56+
pub cpu_limit: Option<String>,
57+
/// Memory limit (e.g., "512Mi", "1Gi")
58+
pub memory_limit: Option<String>,
59+
/// CPU request (e.g., "100m", "0.1")
60+
pub cpu_request: Option<String>,
61+
/// Memory request (e.g., "128Mi", "256Mi")
62+
pub memory_request: Option<String>,
63+
}
64+
impl Default for ResourceRequirements {
65+
fn default() -> Self {
66+
Self {
67+
cpu_limit: Some("500m".to_string()),
68+
memory_limit: Some("512Mi".to_string()),
69+
cpu_request: Some("100m".to_string()),
70+
memory_request: Some("128Mi".to_string()),
71+
}
72+
}
5973
}
6074

6175
#[derive(Debug, Serialize, Deserialize, Validate, ToSchema)]

src/handlers/deployment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub async fn create_deployment(
123123

124124
// For now, we'll just return the response
125125

126-
Ok(Json(DeploymentResponse {
126+
Ok(Json(DeploymentResponse {
127127
id: deployment_id,
128128
app_name: payload.app_name,
129129
image: payload.image,

0 commit comments

Comments
 (0)