-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add repository field for stacks, clean up clippy wanrings #517
Conversation
@@ -405,7 +405,7 @@ async fn check_for_extensions_enabled_with_load( | |||
for extension in trunk_installed_extensions_not_in_all_actually_installed_extensions.clone() | |||
{ | |||
let found = | |||
check_for_so_files(cdb, ctx.clone(), &*pod_name, extension.name.clone()).await?; | |||
check_for_so_files(cdb, ctx.clone(), &pod_name, extension.name.clone()).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
@@ -430,7 +430,7 @@ async fn check_for_extensions_enabled_with_load( | |||
found = true; | |||
for desired_location in desired_extension.locations { | |||
let location_status = ExtensionInstallLocationStatus { | |||
enabled: Some(desired_location.enabled.clone()), | |||
enabled: Some(desired_location.enabled), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
@@ -277,7 +277,7 @@ pub async fn get_trunk_project_metadata_for_version( | |||
let response_body = response.text().await?; | |||
let project_metadata: Vec<TrunkProjectMetadata> = serde_json::from_str(&response_body)?; | |||
// There will only be one index here, so we can safely assume index 0 | |||
let project_metadata = match project_metadata.get(0) { | |||
let project_metadata = match project_metadata.first() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
@@ -367,7 +367,7 @@ pub async fn is_control_file_absent( | |||
// where there are multiple extensions | |||
let control_file_absent = project_metadata | |||
.extensions | |||
.get(0) | |||
.first() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
let loadable_library_name = extension_metadata | ||
.loadable_libraries | ||
.as_ref() | ||
.and_then(|loadable_libraries| loadable_libraries.iter().find(|l| l.requires_restart)) | ||
.map(|loadable_library| loadable_library.library_name.clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
let a = semver::Version::parse(a).unwrap(); | ||
let b = semver::Version::parse(b).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
@@ -550,17 +543,17 @@ mod tests { | |||
let extension_name = "auto_explain".to_string(); | |||
let result = extension_name_matches_trunk_project(extension_name).await; | |||
assert!(result.is_ok()); | |||
assert_eq!(result.unwrap(), true); | |||
assert!(result.unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
|
||
let extension_name = "pgml".to_string(); | ||
let result = extension_name_matches_trunk_project(extension_name).await; | ||
assert!(result.is_ok()); | ||
assert_eq!(result.unwrap(), false); | ||
assert!(!result.unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
|
||
let extension_name = "vector".to_string(); | ||
let result = extension_name_matches_trunk_project(extension_name).await; | ||
assert!(result.is_ok()); | ||
assert_eq!(result.unwrap(), false); | ||
assert!(!result.unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
@@ -592,7 +585,7 @@ mod tests { | |||
let version = "15.3.0".to_string(); | |||
let result = is_control_file_absent(trunk_project, version).await; | |||
assert!(result.is_ok()); | |||
assert_eq!(result.unwrap(), true); | |||
assert!(result.unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
@@ -618,11 +611,11 @@ mod tests { | |||
fn test_is_semver() { | |||
let version = "1.2.3".to_string(); | |||
let result = is_semver(version); | |||
assert_eq!(result, true); | |||
assert!(result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
|
||
let version = "1.2".to_string(); | ||
let result = is_semver(version); | ||
assert_eq!(result, false); | ||
assert!(!result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
} else if has_extension { | ||
println!( | ||
"CoreDB {} has extension {} enabled in status", | ||
name, extension | ||
); | ||
return Ok(()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
@@ -2332,7 +2329,7 @@ mod test { | |||
}); | |||
let params = PatchParams::apply("tembo-integration-test"); | |||
let patch = Patch::Apply(&coredb_json); | |||
let coredb_resource = coredbs.patch(name, ¶ms, &patch).await.unwrap(); | |||
let _coredb_resource = coredbs.patch(name, ¶ms, &patch).await.unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
@@ -2346,7 +2343,7 @@ mod test { | |||
// Check status.extensions.locations is not empty | |||
let coredb_resource = coredbs.get(name).await.unwrap(); | |||
for extension in coredb_resource.status.unwrap().extensions.unwrap() { | |||
assert!(extension.locations.len() > 0); | |||
assert!(!extension.locations.is_empty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix clippy warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing my concerns. There is one other thing that I think would be nice to do, maybe reducing one duplication of configuration and helping test image updates in stack yamls.
tembo-operator/src/defaults.rs
Outdated
} | ||
|
||
pub fn default_llm_image() -> String { | ||
"quay.io/tembo/ml-cnpg:15.3.0-1-63e32a1".to_owned() | ||
"ml-cnpg:15.3.0-1-63e32a1".to_owned() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible for the values in this file to come from the stack yamls? So it's like if someone updates the image in a stack yaml, then the operator tests run in CI and it's using the new image from the stack yaml for which there are operator tests?
If we don't do that, then our operator tests use the image configured here in the defaults, but a future change to stack yaml, then following that to update in control plane, can result in us use image defaults that have not been tested by the functional testing in the operator code
conductor/src/lib.rs
Outdated
|
||
// Watch for deletion | ||
let wp = WatchParams { | ||
field_selector: Some(format!("metadata.name={}", name)), | ||
..WatchParams::default() | ||
}; | ||
let stream = coredb_api | ||
.watch(&wp, "0") | ||
.await | ||
.map_err(ConductorError::KubeError)?; | ||
|
||
let mut pinned_stream = Box::pin(stream); | ||
|
||
while let Some(status) = pinned_stream.try_next().await? { | ||
if let WatchEvent::Deleted(_) = status { | ||
info!("CoreDB {} deleted", name); | ||
return Ok(()); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a WatchEvent
to conductor. This will ensure that the function will not return unless there is an error or if the CoreDB
CR is actually deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there could be an issue with this, because any waiting logic in conductor blocks the processing of other events. This means in the future event that a namespace takes awhile to delete, then this replica of conductor will stop processing all other events including new instances, update instances, and so on. That's why I think it is problematic to do "wait" style logic in conductor or operator, rather "requeue" style, so that waits instead handled like interrupts.
conductor/src/lib.rs
Outdated
|
||
// Watch for deletion | ||
let wp = WatchParams { | ||
field_selector: Some(format!("metadata.name={}", name)), | ||
..WatchParams::default() | ||
}; | ||
let stream = ns_api | ||
.watch(&wp, "0") | ||
.await | ||
.map_err(ConductorError::KubeError)?; | ||
|
||
let mut pinned_stream = Box::pin(stream); | ||
|
||
while let Some(status) = pinned_stream.try_next().await? { | ||
if let WatchEvent::Deleted(_) = status { | ||
info!("Namespace {} deleted", name); | ||
return Ok(()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a WatchEvent
to conductor. This will ensure that the function will not return unless there is an error or if the Namespace
is actually deleted.
Add new field
repository
to theStack
struct to allow setting a different repository if wanted.Clean up clippy warnings
fixes: TEM-2538