Skip to content

Commit

Permalink
reconciler(install): find latest version of extension if not supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
vrmiguel committed Jun 27, 2024
1 parent b6a42cc commit f6c81d5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion conductor/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tembo-operator/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tembo-operator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "controller"
description = "Tembo Operator for Postgres"
version = "0.49.1"
version = "0.49.2"
edition = "2021"
default-run = "controller"
license = "Apache-2.0"
Expand Down
32 changes: 22 additions & 10 deletions tembo-operator/src/extensions/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
kubernetes_queries::{add_trunk_install_to_status, remove_trunk_installs_from_status},
types::{TrunkInstall, TrunkInstallStatus},
},
trunk::get_latest_trunk_project_version,
Context,
};
use k8s_openapi::{api::core::v1::Pod, apimachinery::pkg::apis::meta::v1::ObjectMeta};
Expand Down Expand Up @@ -300,18 +301,29 @@ async fn execute_extension_install_command(
// Handle the case where version is None
let version = match &ext.version {
None => {
error!(
"Installing extension {} into {}: missing version",
warn!(
"Version for extension {} not specified in {}, will fetch latest version",
ext.name, coredb_name
);
return Ok(TrunkInstallStatus {
name: ext.name.clone(),
version: None,
error: true,
loading: false,
error_message: Some("Missing version".to_string()),
installed_to_pods: Some(vec![pod_name.to_string()]),
});

match get_latest_trunk_project_version(&ext.name).await {
Ok(latest_version) => latest_version,
Err(_) => {
error!(
"Failed to get latest version for extension {} in {}",
ext.name, coredb_name
);

return Ok(TrunkInstallStatus {
name: ext.name.clone(),
version: None,
error: true,
loading: false,
error_message: Some("Missing version".to_string()),
installed_to_pods: Some(vec![pod_name.to_string()]),
});
}
}
}
Some(version) => version.clone(),
};
Expand Down

0 comments on commit f6c81d5

Please sign in to comment.