Compare commits

...

2 Commits

2 changed files with 13 additions and 11 deletions

View File

@ -24,6 +24,7 @@ async fn main() {
// This config can be extended as needed for more complicated configurations // This config can be extended as needed for more complicated configurations
config: LAMPConfig { config: LAMPConfig {
project_root: "./php".into(), project_root: "./php".into(),
database_size: format!("2Gi").into(),
..Default::default() ..Default::default()
}, },
}; };

View File

@ -37,7 +37,7 @@ pub struct LAMPScore {
pub struct LAMPConfig { pub struct LAMPConfig {
pub project_root: PathBuf, pub project_root: PathBuf,
pub ssl_enabled: bool, pub ssl_enabled: bool,
pub database_size: String, pub database_size: Option<String>,
} }
impl Default for LAMPConfig { impl Default for LAMPConfig {
@ -45,7 +45,7 @@ impl Default for LAMPConfig {
LAMPConfig { LAMPConfig {
project_root: Path::new("./src").to_path_buf(), project_root: Path::new("./src").to_path_buf(),
ssl_enabled: true, ssl_enabled: true,
database_size: "2Gi".to_string(), database_size: None,
} }
} }
} }
@ -159,11 +159,13 @@ impl LAMPInterpret {
inventory: &Inventory, inventory: &Inventory,
topology: &T, topology: &T,
) -> Result<Outcome, InterpretError> { ) -> Result<Outcome, InterpretError> {
let mut mariadb_overrides = HashMap::new(); let mut values_overrides = HashMap::new();
mariadb_overrides.insert( if let Some(database_size) = self.score.config.database_size.clone() {
values_overrides.insert(
NonBlankString::from_str("primary.persistence.size").unwrap(), NonBlankString::from_str("primary.persistence.size").unwrap(),
self.score.config.database_size.clone(), database_size,
); );
}
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))
@ -173,7 +175,7 @@ impl LAMPInterpret {
) )
.unwrap(), .unwrap(),
chart_version: None, chart_version: None,
values_overrides: Some(mariadb_overrides), values_overrides: Some(values_overrides),
create_namespace: true, create_namespace: true,
install_only: true, install_only: true,
values_yaml: None, values_yaml: None,
@ -181,7 +183,6 @@ impl LAMPInterpret {
score.create_interpret().execute(inventory, topology).await score.create_interpret().execute(inventory, topology).await
} }
fn build_dockerfile(&self, score: &LAMPScore) -> Result<PathBuf, Box<dyn std::error::Error>> { fn build_dockerfile(&self, score: &LAMPScore) -> Result<PathBuf, Box<dyn std::error::Error>> {
let mut dockerfile = Dockerfile::new(); let mut dockerfile = Dockerfile::new();