diff --git a/Cargo.lock b/Cargo.lock index 85c35a31a..6f5852e1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,7 +333,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "agent" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-debug-echo", "akri-discovery-utils", @@ -402,7 +402,7 @@ dependencies = [ [[package]] name = "akri-debug-echo" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-discovery-utils", "akri-shared", @@ -422,7 +422,7 @@ dependencies = [ [[package]] name = "akri-discovery-utils" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-shared", "anyhow", @@ -444,7 +444,7 @@ dependencies = [ [[package]] name = "akri-onvif" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-discovery-utils", "akri-shared", @@ -472,7 +472,7 @@ dependencies = [ [[package]] name = "akri-opcua" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-discovery-utils", "akri-shared", @@ -496,7 +496,7 @@ dependencies = [ [[package]] name = "akri-shared" -version = "0.11.0" +version = "0.11.1" dependencies = [ "anyhow", "async-trait", @@ -525,7 +525,7 @@ dependencies = [ [[package]] name = "akri-udev" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-discovery-utils", "anyhow", @@ -1043,7 +1043,7 @@ checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "controller" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-shared", "anyhow", @@ -1243,7 +1243,7 @@ dependencies = [ [[package]] name = "debug-echo-discovery-handler" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-debug-echo", "akri-discovery-utils", @@ -2540,7 +2540,7 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "onvif-discovery-handler" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-discovery-utils", "akri-onvif", @@ -2590,7 +2590,7 @@ dependencies = [ [[package]] name = "opcua-discovery-handler" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-discovery-utils", "akri-opcua", @@ -4189,7 +4189,7 @@ dependencies = [ [[package]] name = "udev-discovery-handler" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-discovery-utils", "akri-udev", @@ -4200,7 +4200,7 @@ dependencies = [ [[package]] name = "udev-video-broker" -version = "0.11.0" +version = "0.11.1" dependencies = [ "akri-shared", "env_logger", @@ -4477,7 +4477,7 @@ dependencies = [ [[package]] name = "webhook-configuration" -version = "0.11.0" +version = "0.11.1" dependencies = [ "actix", "actix-rt 2.7.0", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index c08d4b866..2e1cc5c0c 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "agent" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring ", ""] edition = "2018" rust-version = "1.68.1" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index b28c42634..ace9f6503 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "controller" -version = "0.11.0" +version = "0.11.1" authors = ["", ""] edition = "2018" rust-version = "1.68.1" diff --git a/controller/src/util/instance_action.rs b/controller/src/util/instance_action.rs index 862cfc340..9a13a8be2 100644 --- a/controller/src/util/instance_action.rs +++ b/controller/src/util/instance_action.rs @@ -419,13 +419,13 @@ pub async fn handle_instance_change( } }; if let Some(broker_spec) = &configuration.spec.broker_spec { - match broker_spec { + let instance_change_result = match broker_spec { BrokerSpec::BrokerPodSpec(p) => { handle_instance_change_pod(instance, p, action, kube_interface).await } BrokerSpec::BrokerJobSpec(j) => { handle_instance_change_job( - instance.clone(), + instance, *configuration.metadata.generation.as_ref().unwrap(), j, action, @@ -433,10 +433,12 @@ pub async fn handle_instance_change( ) .await } + }; + if let Err(e) = instance_change_result { + error!("Unable to handle Broker action: {:?}", e); } - } else { - Ok(()) } + Ok(()) } /// Called when an Instance has changed that requires a Job broker. Action determined by InstanceAction. @@ -444,7 +446,7 @@ pub async fn handle_instance_change( /// InstanceAction::Remove => Delete all Jobs labeled with the Instance name /// InstanceAction::Update => No nothing pub async fn handle_instance_change_job( - instance: Instance, + instance: &Instance, config_generation: i64, job_spec: &JobSpec, action: &InstanceAction, @@ -472,7 +474,7 @@ pub async fn handle_instance_change_job( trace!("handle_instance_change_job - instance added"); let capability_id = format!("{}/{}", AKRI_PREFIX, instance_name); let new_job = job::create_new_job_from_spec( - &instance, + instance, OwnershipInfo::new( OwnershipType::Instance, instance_name.to_string(), @@ -841,6 +843,7 @@ mod handle_instance_tests { new_pod_names: Vec<&'static str>, new_pod_instance_names: Vec<&'static str>, new_pod_namespaces: Vec<&'static str>, + new_pod_error: Vec, } fn configure_add_shared_config_a_359973(pod_name: &'static str) -> HandleAdditionWork { @@ -848,6 +851,7 @@ mod handle_instance_tests { new_pod_names: vec![pod_name], new_pod_instance_names: vec!["config-a-359973"], new_pod_namespaces: vec!["config-a-namespace"], + new_pod_error: vec![false], } } fn get_config_work() -> HandleConfigWork { @@ -857,11 +861,12 @@ mod handle_instance_tests { find_config_result: "../test/json/config-a.json", } } - fn configure_add_local_config_a_b494b6() -> HandleAdditionWork { + fn configure_add_local_config_a_b494b6(error: bool) -> HandleAdditionWork { HandleAdditionWork { new_pod_names: vec!["config-a-b494b6-pod"], new_pod_instance_names: vec!["config-a-b494b6"], new_pod_namespaces: vec!["config-a-namespace"], + new_pod_error: vec![error], } } @@ -873,6 +878,7 @@ mod handle_instance_tests { work.new_pod_namespaces[i], AKRI_INSTANCE_LABEL_NAME, work.new_pod_instance_names[i], + work.new_pod_error[i], ); } } @@ -944,7 +950,33 @@ mod handle_instance_tests { find_pods_delete_start_time: false, config_work: get_config_work(), deletion_work: None, - addition_work: Some(configure_add_local_config_a_b494b6()), + addition_work: Some(configure_add_local_config_a_b494b6(false)), + }, + ); + run_handle_instance_change_test( + &mut mock, + "../test/json/local-instance.json", + &InstanceAction::Add, + ) + .await; + } + + #[tokio::test] + async fn test_handle_instance_change_for_add_new_local_instance_error() { + let _ = env_logger::builder().is_test(true).try_init(); + + let mut mock = MockKubeInterface::new(); + configure_for_handle_instance_change( + &mut mock, + &HandleInstanceWork { + find_pods_selector: "akri.sh/instance=config-a-b494b6", + find_pods_result: "../test/json/empty-list.json", + find_pods_phase: None, + find_pods_start_time: None, + find_pods_delete_start_time: false, + config_work: get_config_work(), + deletion_work: None, + addition_work: Some(configure_add_local_config_a_b494b6(true)), }, ); run_handle_instance_change_test( @@ -1139,7 +1171,7 @@ mod handle_instance_tests { find_pods_delete_start_time: false, config_work: get_config_work(), deletion_work: None, - addition_work: Some(configure_add_local_config_a_b494b6()), + addition_work: Some(configure_add_local_config_a_b494b6(false)), }, ); run_handle_instance_change_test( diff --git a/controller/src/util/shared_test_utils.rs b/controller/src/util/shared_test_utils.rs index d6155b444..09ac39735 100644 --- a/controller/src/util/shared_test_utils.rs +++ b/controller/src/util/shared_test_utils.rs @@ -253,6 +253,7 @@ pub mod config_for_tests { pod_namespace: &'static str, label_id: &'static str, label_value: &'static str, + error: bool, ) { trace!("mock.expect_create_pod pod_name:{}", pod_name); mock.expect_create_pod() @@ -269,7 +270,10 @@ pub mod config_for_tests { == label_value && namespace == pod_namespace }) - .returning(move |_, _| Ok(())); + .returning(move |_, _| match error { + false => Ok(()), + true => Err(anyhow::format_err!("create pod error")), + }); } pub fn configure_remove_pod( diff --git a/deployment/helm/Chart.yaml b/deployment/helm/Chart.yaml index 9e9142cac..647cb4418 100644 --- a/deployment/helm/Chart.yaml +++ b/deployment/helm/Chart.yaml @@ -16,9 +16,9 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.11.0 +version: 0.11.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 0.11.0 +appVersion: 0.11.1 diff --git a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml index fdf128a4b..4f7f289df 100644 --- a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "debug-echo-discovery-handler" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.68.1" diff --git a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml index be4359c1c..0dbf31b02 100644 --- a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "onvif-discovery-handler" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.68.1" diff --git a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml index b000cf76b..1c5c5e133 100644 --- a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "opcua-discovery-handler" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.68.1" diff --git a/discovery-handler-modules/udev-discovery-handler/Cargo.toml b/discovery-handler-modules/udev-discovery-handler/Cargo.toml index 1b1f4dd1c..8019b9e02 100644 --- a/discovery-handler-modules/udev-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/udev-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "udev-discovery-handler" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.68.1" diff --git a/discovery-handlers/debug-echo/Cargo.toml b/discovery-handlers/debug-echo/Cargo.toml index 7ce4bcf3b..36fe3ff04 100644 --- a/discovery-handlers/debug-echo/Cargo.toml +++ b/discovery-handlers/debug-echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-debug-echo" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.68.1" diff --git a/discovery-handlers/onvif/Cargo.toml b/discovery-handlers/onvif/Cargo.toml index 815363ee6..bb991d751 100644 --- a/discovery-handlers/onvif/Cargo.toml +++ b/discovery-handlers/onvif/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-onvif" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.68.1" diff --git a/discovery-handlers/opcua/Cargo.toml b/discovery-handlers/opcua/Cargo.toml index ddc8f0f99..0447e64c2 100644 --- a/discovery-handlers/opcua/Cargo.toml +++ b/discovery-handlers/opcua/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-opcua" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.68.1" diff --git a/discovery-handlers/udev/Cargo.toml b/discovery-handlers/udev/Cargo.toml index acc97f9f3..7cda3dc95 100644 --- a/discovery-handlers/udev/Cargo.toml +++ b/discovery-handlers/udev/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-udev" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.68.1" diff --git a/discovery-utils/Cargo.toml b/discovery-utils/Cargo.toml index 9bfb15dbb..c587e5ea2 100644 --- a/discovery-utils/Cargo.toml +++ b/discovery-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-discovery-utils" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.68.1" diff --git a/samples/brokers/udev-video-broker/Cargo.toml b/samples/brokers/udev-video-broker/Cargo.toml index 301385c89..063545313 100644 --- a/samples/brokers/udev-video-broker/Cargo.toml +++ b/samples/brokers/udev-video-broker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "udev-video-broker" -version = "0.11.0" +version = "0.11.1" authors = ["Kate Goldenring ", ""] edition = "2018" rust-version = "1.68.1" diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 57f9c47c7..b0e70301d 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-shared" -version = "0.11.0" +version = "0.11.1" authors = [""] edition = "2018" rust-version = "1.68.1" diff --git a/version.txt b/version.txt index d9df1bbc0..af88ba824 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.11.0 +0.11.1 diff --git a/webhooks/validating/configuration/Cargo.toml b/webhooks/validating/configuration/Cargo.toml index 976a6a928..52154cd9e 100644 --- a/webhooks/validating/configuration/Cargo.toml +++ b/webhooks/validating/configuration/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "webhook-configuration" -version = "0.11.0" +version = "0.11.1" authors = ["DazWilkin "] edition = "2018" rust-version = "1.68.1"