fix: added database size to lamp score to be able to specify database pvc size from lampScore

This commit is contained in:
Willem 2025-05-02 10:50:47 -04:00
parent df3c8ee2a6
commit b13766f960
2 changed files with 9 additions and 1 deletions

View File

@ -26,6 +26,7 @@ async fn main() {
project_root: "./php".into(), project_root: "./php".into(),
..Default::default() ..Default::default()
}, },
db_size: "2Gi".to_string(),
}; };
// You can choose the type of Topology you want, we suggest starting with the // You can choose the type of Topology you want, we suggest starting with the

View File

@ -3,6 +3,7 @@ use dockerfile_builder::instruction::{CMD, COPY, ENV, EXPOSE, FROM, RUN, WORKDIR
use dockerfile_builder::{Dockerfile, instruction_builder::EnvBuilder}; use dockerfile_builder::{Dockerfile, instruction_builder::EnvBuilder};
use non_blank_string_rs::NonBlankString; use non_blank_string_rs::NonBlankString;
use serde_json::json; use serde_json::json;
use std::collections::HashMap;
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
@ -30,6 +31,7 @@ pub struct LAMPScore {
pub domain: Url, pub domain: Url,
pub config: LAMPConfig, pub config: LAMPConfig,
pub php_version: Version, pub php_version: Version,
pub database_size: String,
} }
#[derive(Debug, Clone, Serialize)] #[derive(Debug, Clone, Serialize)]
@ -156,6 +158,11 @@ impl LAMPInterpret {
inventory: &Inventory, inventory: &Inventory,
topology: &T, topology: &T,
) -> Result<Outcome, InterpretError> { ) -> Result<Outcome, InterpretError> {
let mut mariadb_overrides = HashMap::new();
mariadb_overrides.insert(
NonBlankString::from_str("primary.persistence.size").unwrap(),
self.score.database_size.clone(),
);
let score = HelmChartScore { let score = HelmChartScore {
namespace: self.get_namespace(), namespace: self.get_namespace(),
release_name: NonBlankString::from_str(&format!("{}-database", self.score.name)) release_name: NonBlankString::from_str(&format!("{}-database", self.score.name))
@ -165,7 +172,7 @@ impl LAMPInterpret {
) )
.unwrap(), .unwrap(),
chart_version: None, chart_version: None,
values_overrides: None, values_overrides: Some(mariadb_overrides),
create_namespace: true, create_namespace: true,
install_only: true, install_only: true,
values_yaml: None, values_yaml: None,