From 05c8a63a7cce8319f4883b361d4d8fb5923cf59f Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Tue, 10 Aug 2021 12:46:54 -0700 Subject: [PATCH 01/22] k8s-openapi 0.12.0 and kube 0.57.0 --- Cargo.lock | 867 ++++++++++++------ Cargo.toml | 5 +- agent/Cargo.toml | 31 +- agent/src/main.rs | 1 - agent/src/util/config_action.rs | 79 +- agent/src/util/device_plugin_builder.rs | 95 +- agent/src/util/device_plugin_service.rs | 61 +- agent/src/util/discovery_operator.rs | 57 +- agent/src/util/registration.rs | 16 +- agent/src/util/slot_reconciliation.rs | 14 +- agent/src/util/v1beta1.rs | 92 +- controller/Cargo.toml | 9 +- controller/src/util/instance_action.rs | 62 +- controller/src/util/node_watcher.rs | 77 +- controller/src/util/pod_watcher.rs | 70 +- controller/src/util/shared_test_utils.rs | 50 +- .../debug-echo-discovery-handler/Cargo.toml | 2 +- .../onvif-discovery-handler/Cargo.toml | 2 +- .../opcua-discovery-handler/Cargo.toml | 2 +- .../udev-discovery-handler/Cargo.toml | 2 +- discovery-handlers/debug-echo/Cargo.toml | 5 +- .../debug-echo/src/discovery_handler.rs | 14 +- discovery-handlers/onvif/Cargo.toml | 5 +- .../onvif/src/discovery_handler.rs | 6 +- .../onvif/src/discovery_impl.rs | 2 +- discovery-handlers/opcua/Cargo.toml | 5 +- .../opcua/src/discovery_handler.rs | 6 +- discovery-handlers/udev/Cargo.toml | 5 +- .../udev/src/discovery_handler.rs | 10 +- discovery-utils/Cargo.toml | 12 +- discovery-utils/src/discovery/mod.rs | 23 +- discovery-utils/src/discovery/v0.rs | 68 +- discovery-utils/src/registration_client.rs | 2 +- shared/Cargo.toml | 20 +- shared/src/akri/configuration.rs | 143 ++- shared/src/akri/instance.rs | 231 ++--- shared/src/akri/mod.rs | 4 +- shared/src/k8s/mod.rs | 199 ++-- shared/src/k8s/node.rs | 14 +- shared/src/k8s/pod.rs | 218 ++--- shared/src/k8s/service.rs | 263 ++---- shared/src/lib.rs | 1 - shared/src/os/mod.rs | 2 +- shared/src/uds/unix_stream.rs | 21 +- webhooks/validating/configuration/Cargo.toml | 5 +- webhooks/validating/configuration/src/main.rs | 4 +- 46 files changed, 1515 insertions(+), 1367 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9a7900c1f..28cdb757f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,7 +55,7 @@ dependencies = [ "derive_more", "either", "futures-util", - "http 0.2.4", + "http", "log", "openssl", "tokio-openssl", @@ -90,8 +90,8 @@ dependencies = [ "futures-core", "futures-util", "fxhash", - "h2 0.2.6", - "http 0.2.4", + "h2 0.2.7", + "http", "httparse", "indexmap", "itoa", @@ -138,7 +138,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ad299af73649e1fc893e333ccf86f377751eb95ff875d095131574c6f43452c" dependencies = [ "bytestring", - "http 0.2.4", + "http", "log", "regex", "serde", @@ -342,37 +342,39 @@ dependencies = [ "akri-shared", "akri-udev", "anyhow", - "async-stream", + "async-stream 0.3.2", "async-trait", "blake2", "cfg-if 1.0.0", "chrono", - "env_logger", + "env_logger 0.8.4", "futures 0.3.16", "futures-core", "futures-util", - "h2 0.2.6", - "hyper 0.13.10", + "h2 0.3.3", + "hyper 0.14.11", "k8s-openapi", "kube", + "kube-runtime", "lazy_static", "log", "mock_instant", "mockall", "mockall_double", - "prometheus 0.12.0", - "prost", + "prometheus 0.11.0", + "prost 0.7.0", + "prost-types 0.7.0", "rand 0.8.4", "serde", "serde_derive", "serde_json", "serde_yaml", "tempfile", - "tokio 0.2.25", - "tokio-core", - "tonic", - "tonic-build", - "tower", + "tokio 1.9.0", + "tokio-stream", + "tonic 0.4.3", + "tonic-build 0.4.2", + "tower 0.4.8", "url 2.2.2", "uuid", ] @@ -394,15 +396,16 @@ dependencies = [ "akri-shared", "anyhow", "async-trait", - "env_logger", + "env_logger 0.8.4", "futures-util", "log", "serde", "serde_derive", "serde_json", "serde_yaml", - "tokio 0.2.25", - "tonic", + "tokio 1.9.0", + "tokio-stream", + "tonic 0.4.3", ] [[package]] @@ -411,18 +414,20 @@ version = "0.6.12" dependencies = [ "akri-shared", "anyhow", + "async-stream 0.3.2", "async-trait", "futures 0.3.16", "log", - "prost", + "prost 0.7.0", "serde", "serde_derive", "serde_yaml", "tempfile", - "tokio 0.2.25", - "tonic", - "tonic-build", - "tower", + "tokio 1.9.0", + "tokio-stream", + "tonic 0.4.3", + "tonic-build 0.4.2", + "tower 0.4.8", ] [[package]] @@ -434,7 +439,7 @@ dependencies = [ "anyhow", "async-trait", "bytes 0.5.6", - "env_logger", + "env_logger 0.8.4", "futures-util", "hyper 0.13.10", "log", @@ -445,8 +450,9 @@ dependencies = [ "serde_yaml", "sxd-document", "sxd-xpath", - "tokio 0.2.25", - "tonic", + "tokio 1.9.0", + "tokio-stream", + "tonic 0.4.3", "uuid", "xml-rs", "yaserde", @@ -461,18 +467,19 @@ dependencies = [ "akri-shared", "anyhow", "async-trait", - "env_logger", + "env_logger 0.8.4", "futures-util", "log", "mockall", "opcua-client", - "prost", + "prost 0.6.1", "serde", "serde_derive", "serde_json", "serde_yaml", - "tokio 0.2.25", - "tonic", + "tokio 1.9.0", + "tokio-stream", + "tonic 0.4.3", "url 2.2.2", ] @@ -483,25 +490,26 @@ dependencies = [ "anyhow", "async-trait", "either", - "env_logger", - "futures 0.1.31", + "env_logger 0.6.2", "futures 0.3.16", "futures-util", + "hyper 0.14.11", "k8s-openapi", "kube", + "kube-runtime", "log", "mockall", "prometheus 0.11.0", "rand 0.8.4", + "schemars", "serde", "serde_derive", "serde_json", "serde_yaml", - "tokio 0.2.25", - "tokio-core", - "tokio-signal", - "tonic", - "tower", + "tokio 1.9.0", + "tokio-stream", + "tonic 0.4.3", + "tower 0.4.8", "warp", ] @@ -512,20 +520,21 @@ dependencies = [ "akri-discovery-utils", "anyhow", "async-trait", - "env_logger", + "env_logger 0.8.4", "futures-util", "log", "mockall", "pest", "pest_derive", - "prost", + "prost 0.6.1", "regex", "serde", "serde_derive", "serde_json", "serde_yaml", - "tokio 0.2.25", - "tonic", + "tokio 1.9.0", + "tokio-stream", + "tonic 0.4.3", "udev", ] @@ -546,19 +555,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "async-compression" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443ccbb270374a2b1055fc72da40e1f237809cd6bb0e97e66d264cd138473a6" -dependencies = [ - "bytes 0.5.6", - "flate2", - "futures-core", - "memchr", - "pin-project-lite 0.2.7", -] - [[package]] name = "async-executor" version = "1.4.1" @@ -659,7 +655,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22068c0c19514942eefcfd4daf8976ef1aad84e61539f95cd200c35202f80af5" dependencies = [ - "async-stream-impl", + "async-stream-impl 0.2.1", + "futures-core", +] + +[[package]] +name = "async-stream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" +dependencies = [ + "async-stream-impl 0.3.2", "futures-core", ] @@ -674,6 +680,17 @@ dependencies = [ "syn", ] +[[package]] +name = "async-stream-impl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "async-task" version = "4.0.3" @@ -754,12 +771,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "base64" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" - [[package]] name = "base64" version = "0.12.3" @@ -1015,10 +1026,11 @@ dependencies = [ "async-std", "async-trait", "chrono", - "env_logger", + "env_logger 0.8.4", "futures 0.3.16", "k8s-openapi", "kube", + "kube-runtime", "lazy_static", "log", "mockall", @@ -1027,7 +1039,7 @@ dependencies = [ "serde_derive", "serde_json", "serde_yaml", - "tokio 0.2.25", + "tokio 1.9.0", ] [[package]] @@ -1175,15 +1187,71 @@ dependencies = [ "syn", ] +[[package]] +name = "darling" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "dashmap" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +dependencies = [ + "cfg-if 1.0.0", + "num_cpus", +] + [[package]] name = "debug-echo-discovery-handler" version = "0.6.12" dependencies = [ "akri-debug-echo", "akri-discovery-utils", - "env_logger", + "env_logger 0.8.4", "log", - "tokio 0.2.25", + "tokio 1.9.0", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1224,20 +1292,20 @@ dependencies = [ ] [[package]] -name = "dirs" -version = "2.0.2" +name = "dirs-next" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if 0.1.10", - "dirs-sys", + "cfg-if 1.0.0", + "dirs-sys-next", ] [[package]] -name = "dirs-sys" -version = "0.3.6" +name = "dirs-sys-next" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users", @@ -1250,6 +1318,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "downcast" version = "0.10.0" @@ -1262,6 +1336,12 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" +[[package]] +name = "dyn-clone" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf" + [[package]] name = "either" version = "1.6.1" @@ -1289,6 +1369,19 @@ dependencies = [ "syn", ] +[[package]] +name = "env_logger" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" +dependencies = [ + "atty", + "humantime 1.3.0", + "log", + "regex", + "termcolor", +] + [[package]] name = "env_logger" version = "0.8.4" @@ -1296,7 +1389,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" dependencies = [ "atty", - "humantime", + "humantime 2.1.0", "log", "regex", "termcolor", @@ -1497,12 +1590,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2" -[[package]] -name = "futures-timer" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6" - [[package]] name = "futures-util" version = "0.3.16" @@ -1599,20 +1686,22 @@ dependencies = [ [[package]] name = "h2" -version = "0.2.6" -source = "git+https://github.com/kate-goldenring/h2?branch=master#7c7ef6a579c9ce2392787c5728f805ce10f74ddf" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" dependencies = [ "bytes 0.5.6", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.4", + "http", "indexmap", "slab", "tokio 0.2.25", "tokio-util 0.3.1", "tracing", + "tracing-futures", ] [[package]] @@ -1626,7 +1715,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 0.2.4", + "http", "indexmap", "slab", "tokio 1.9.0", @@ -1650,7 +1739,7 @@ dependencies = [ "bitflags", "bytes 1.0.1", "headers-core", - "http 0.2.4", + "http", "mime", "sha-1 0.9.7", "time 0.1.44", @@ -1662,7 +1751,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ - "http 0.2.4", + "http", ] [[package]] @@ -1700,17 +1789,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "http" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" -dependencies = [ - "bytes 0.4.12", - "fnv", - "itoa", -] - [[package]] name = "http" version = "0.2.4" @@ -1729,7 +1807,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" dependencies = [ "bytes 0.5.6", - "http 0.2.4", + "http", ] [[package]] @@ -1739,7 +1817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" dependencies = [ "bytes 1.0.1", - "http 0.2.4", + "http", "pin-project-lite 0.2.7", ] @@ -1761,6 +1839,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] + [[package]] name = "humantime" version = "2.1.0" @@ -1777,8 +1864,8 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.2.6", - "http 0.2.4", + "h2 0.2.7", + "http", "http-body 0.3.1", "httparse", "httpdate 0.3.2", @@ -1802,7 +1889,7 @@ dependencies = [ "futures-core", "futures-util", "h2 0.3.3", - "http 0.2.4", + "http", "http-body 0.4.2", "httparse", "httpdate 1.0.1", @@ -1815,19 +1902,37 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper 0.14.11", + "pin-project-lite 0.2.7", + "tokio 1.9.0", + "tokio-io-timeout", +] + [[package]] name = "hyper-tls" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 0.5.6", - "hyper 0.13.10", + "bytes 1.0.1", + "hyper 0.14.11", "native-tls", - "tokio 0.2.25", - "tokio-tls", + "tokio 1.9.0", + "tokio-native-tls", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.1.5" @@ -1914,6 +2019,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.7" @@ -1930,20 +2044,27 @@ dependencies = [ ] [[package]] -name = "k8s-openapi" -version = "0.6.0" +name = "jsonpath_lib" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8eb97e4ea14cef484aa56f44e93653cb6faa351b5f130d38584b3184b6ef5d1" +checksum = "eaa63191d68230cccb81c5aa23abd53ed64d83337cacbb25a7b8c7979523774f" dependencies = [ - "base64 0.10.1", - "bytes 0.4.12", + "log", + "serde", + "serde_json", +] + +[[package]] +name = "k8s-openapi" +version = "0.12.0" +source = "git+https://github.com/kazk/k8s-openapi?branch=add-schema#9ee8bec4bc28ab7a53a785d5db9f2d05909b4fcb" +dependencies = [ + "base64 0.13.0", + "bytes 1.0.1", "chrono", - "http 0.1.21", - "percent-encoding 2.1.0", "serde", "serde-value", "serde_json", - "url 2.2.2", ] [[package]] @@ -1958,28 +2079,84 @@ dependencies = [ [[package]] name = "kube" -version = "0.23.0" +version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a8a53ca3e8cb9f6ebdf09cdd8943d08926da7ca8d5c1d89dee1ed0e8df0a2a" +checksum = "8152fba26129a09bf30179092753b399760a305a218b8bc558f9a2087b5c1d70" dependencies = [ - "base64 0.11.0", + "base64 0.13.0", + "bytes 1.0.1", "chrono", - "dirs", + "dirs-next", "either", "futures 0.3.16", - "futures-timer", - "http 0.2.4", + "http", + "http-body 0.4.2", + "hyper 0.14.11", + "hyper-timeout", + "hyper-tls", + "jsonpath_lib", "k8s-openapi", - "log", + "kube-core", + "kube-derive", "openssl", - "reqwest 0.10.10", + "pem", + "pin-project 1.0.8", "serde", - "serde_derive", "serde_json", "serde_yaml", "thiserror", - "time 0.1.44", - "url 2.2.2", + "tokio 1.9.0", + "tokio-native-tls", + "tokio-util 0.6.7", + "tower 0.4.8", + "tower-http", + "tracing", +] + +[[package]] +name = "kube-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36b767df01404bb99fb75ac2ceded28ce34c30fdcffbb4346e2c44d30756bfba" +dependencies = [ + "form_urlencoded", + "http", + "k8s-openapi", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "kube-derive" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d0e5489859d9430689f64e69cacc9bf8cb68556f436c73a6a308d4e256b7a0" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "serde_json", + "syn", +] + +[[package]] +name = "kube-runtime" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8358421de932e06d0521700fc8ecfc7058c95509e0770d2da88be78cd737c07" +dependencies = [ + "dashmap", + "derivative", + "futures 0.3.16", + "k8s-openapi", + "kube", + "pin-project 1.0.8", + "serde", + "smallvec 1.6.1", + "snafu", + "tokio 1.9.0", + "tokio-util 0.6.7", ] [[package]] @@ -2159,18 +2336,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "mio-named-pipes" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" -dependencies = [ - "log", - "mio 0.6.23", - "miow 0.3.7", - "winapi 0.3.9", -] - [[package]] name = "mio-uds" version = "0.6.8" @@ -2360,9 +2525,9 @@ version = "0.6.12" dependencies = [ "akri-discovery-utils", "akri-onvif", - "env_logger", + "env_logger 0.8.4", "log", - "tokio 0.2.25", + "tokio 1.9.0", ] [[package]] @@ -2444,9 +2609,9 @@ version = "0.6.12" dependencies = [ "akri-discovery-utils", "akri-opcua", - "env_logger", + "env_logger 0.8.4", "log", - "tokio 0.2.25", + "tokio 1.9.0", ] [[package]] @@ -2472,7 +2637,7 @@ name = "openapi" version = "1.1.0" source = "git+https://github.com/DazWilkin/openapi-admission-v1?tag=v1.1.0#60a9ba6bd64efda65cb136a21e0d6a53e962c415" dependencies = [ - "reqwest 0.11.4", + "reqwest", "serde", "serde_derive", "serde_json", @@ -2514,9 +2679,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "1.1.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" +checksum = "039f02eb0f69271f26abe3202189275d7aa2258b903cb0281b5de710a2570ff3" dependencies = [ "num-traits", ] @@ -2585,7 +2750,18 @@ dependencies = [ ] [[package]] -name = "percent-encoding" +name = "pem" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" +dependencies = [ + "base64 0.13.0", + "once_cell", + "regex", +] + +[[package]] +name = "percent-encoding" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" @@ -2867,7 +3043,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" dependencies = [ "bytes 0.5.6", - "prost-derive", + "prost-derive 0.6.1", +] + +[[package]] +name = "prost" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +dependencies = [ + "bytes 1.0.1", + "prost-derive 0.7.0", ] [[package]] @@ -2878,14 +3064,32 @@ checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" dependencies = [ "bytes 0.5.6", "heck", - "itertools", + "itertools 0.8.2", "log", "multimap", "petgraph", - "prost", - "prost-types", + "prost 0.6.1", + "prost-types 0.6.1", "tempfile", - "which", + "which 3.1.1", +] + +[[package]] +name = "prost-build" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" +dependencies = [ + "bytes 1.0.1", + "heck", + "itertools 0.9.0", + "log", + "multimap", + "petgraph", + "prost 0.7.0", + "prost-types 0.7.0", + "tempfile", + "which 4.2.2", ] [[package]] @@ -2895,7 +3099,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" dependencies = [ "anyhow", - "itertools", + "itertools 0.8.2", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +dependencies = [ + "anyhow", + "itertools 0.9.0", "proc-macro2", "quote", "syn", @@ -2908,7 +3125,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa" dependencies = [ "bytes 0.5.6", - "prost", + "prost 0.6.1", +] + +[[package]] +name = "prost-types" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" +dependencies = [ + "bytes 1.0.1", + "prost 0.7.0", ] [[package]] @@ -3074,43 +3301,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "reqwest" -version = "0.10.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" -dependencies = [ - "async-compression", - "base64 0.13.0", - "bytes 0.5.6", - "encoding_rs", - "futures-core", - "futures-util", - "http 0.2.4", - "http-body 0.3.1", - "hyper 0.13.10", - "hyper-tls", - "ipnet", - "js-sys", - "lazy_static", - "log", - "mime", - "mime_guess", - "native-tls", - "percent-encoding 2.1.0", - "pin-project-lite 0.2.7", - "serde", - "serde_json", - "serde_urlencoded 0.7.0", - "tokio 0.2.25", - "tokio-tls", - "url 2.2.2", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg 0.7.0", -] - [[package]] name = "reqwest" version = "0.11.4" @@ -3122,7 +3312,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "http 0.2.4", + "http", "http-body 0.4.2", "hyper 0.14.11", "ipnet", @@ -3196,19 +3386,6 @@ dependencies = [ "semver 0.11.0", ] -[[package]] -name = "rustls" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" -dependencies = [ - "base64 0.10.1", - "log", - "ring", - "sct", - "webpki", -] - [[package]] name = "rustls" version = "0.19.1" @@ -3245,10 +3422,28 @@ dependencies = [ ] [[package]] -name = "scoped-tls" -version = "0.1.2" +name = "schemars" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" +checksum = "bc6ab463ae35acccb5cba66c0084c985257b797d288b6050cc2f6ac1b266cb78" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "902fdfbcf871ae8f653bddf4b2c05905ddaabc08f69d32a915787e3be0d31356" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn", +] [[package]] name = "scoped-tls" @@ -3339,9 +3534,9 @@ dependencies = [ [[package]] name = "serde-value" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a65a7291a8a568adcae4c10a677ebcedbc6c9cec91c054dee2ce40b0e3290eb" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" dependencies = [ "ordered-float", "serde", @@ -3358,12 +3553,24 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_derive_internals" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dbab34ca63057a1f15280bdf3c39f2b1eb1b54c17e98360e511637aef7418c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_json" version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127" dependencies = [ + "indexmap", "itoa", "ryu", "serde", @@ -3466,6 +3673,29 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +[[package]] +name = "snafu" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" +dependencies = [ + "doc-comment", + "futures-core", + "pin-project 0.4.28", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "socket2" version = "0.3.19" @@ -3758,13 +3988,12 @@ dependencies = [ "libc", "memchr", "mio 0.6.23", - "mio-named-pipes", "mio-uds", "num_cpus", "pin-project-lite 0.1.12", "signal-hook-registry", "slab", - "tokio-macros", + "tokio-macros 0.2.6", "winapi 0.3.9", ] @@ -3779,10 +4008,12 @@ dependencies = [ "libc", "memchr", "mio 0.7.13", + "num_cpus", "once_cell", "parking_lot 0.11.1", "pin-project-lite 0.2.7", "signal-hook-registry", + "tokio-macros 1.3.0", "winapi 0.3.9", ] @@ -3797,25 +4028,6 @@ dependencies = [ "tokio-io", ] -[[package]] -name = "tokio-core" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87b1395334443abca552f63d4f61d0486f12377c2ba8b368e523f89e828cffd4" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "iovec", - "log", - "mio 0.6.23", - "scoped-tls 0.1.2", - "tokio 0.1.22", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "tokio-timer", -] - [[package]] name = "tokio-current-thread" version = "0.1.7" @@ -3858,6 +4070,16 @@ dependencies = [ "log", ] +[[package]] +name = "tokio-io-timeout" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9" +dependencies = [ + "pin-project-lite 0.2.7", + "tokio 1.9.0", +] + [[package]] name = "tokio-macros" version = "0.2.6" @@ -3869,6 +4091,27 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-macros" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio 1.9.0", +] + [[package]] name = "tokio-openssl" version = "0.4.0" @@ -3900,31 +4143,24 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.12.3" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3068d891551949b37681724d6b73666787cc63fa8e255c812a41d2513aff9775" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ - "futures-core", - "rustls 0.16.0", - "tokio 0.2.25", + "rustls", + "tokio 1.9.0", "webpki", ] [[package]] -name = "tokio-signal" -version = "0.2.9" +name = "tokio-stream" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c34c6e548f101053321cba3da7cbb87a610b85555884c41b07da2eb91aff12" +checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" dependencies = [ - "futures 0.1.31", - "libc", - "mio 0.6.23", - "mio-uds", - "signal-hook-registry", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "winapi 0.3.9", + "futures-core", + "pin-project-lite 0.2.7", + "tokio 1.9.0", ] [[package]] @@ -3980,16 +4216,6 @@ dependencies = [ "tokio-executor", ] -[[package]] -name = "tokio-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" -dependencies = [ - "native-tls", - "tokio 0.2.25", -] - [[package]] name = "tokio-tungstenite" version = "0.11.0" @@ -4075,6 +4301,7 @@ dependencies = [ "futures-sink", "log", "pin-project-lite 0.2.7", + "slab", "tokio 1.9.0", ] @@ -4084,23 +4311,22 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08283643b1d483eb7f3fc77069e63b5cba3e4db93514b3d45470e67f123e4e48" dependencies = [ - "async-stream", + "async-stream 0.2.1", "async-trait", "base64 0.10.1", "bytes 0.5.6", "futures-core", "futures-util", - "http 0.2.4", + "http", "http-body 0.3.1", "hyper 0.13.10", "percent-encoding 1.0.1", "pin-project 0.4.28", - "prost", - "prost-derive", + "prost 0.6.1", + "prost-derive 0.6.1", "tokio 0.2.25", - "tokio-rustls", "tokio-util 0.2.0", - "tower", + "tower 0.3.1", "tower-balance", "tower-load", "tower-make", @@ -4109,6 +4335,36 @@ dependencies = [ "tracing-futures", ] +[[package]] +name = "tonic" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac42cd97ac6bd2339af5bcabf105540e21e45636ec6fa6aae5e85d44db31be0" +dependencies = [ + "async-stream 0.3.2", + "async-trait", + "base64 0.13.0", + "bytes 1.0.1", + "futures-core", + "futures-util", + "h2 0.3.3", + "http", + "http-body 0.4.2", + "hyper 0.14.11", + "percent-encoding 2.1.0", + "pin-project 1.0.8", + "prost 0.7.0", + "prost-derive 0.7.0", + "tokio 1.9.0", + "tokio-rustls", + "tokio-stream", + "tokio-util 0.6.7", + "tower 0.4.8", + "tower-service", + "tracing", + "tracing-futures", +] + [[package]] name = "tonic-build" version = "0.1.1" @@ -4116,7 +4372,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0436413ba71545bcc6c2b9a0f9d78d72deb0123c6a75ccdfe7c056f9930f5e52" dependencies = [ "proc-macro2", - "prost-build", + "prost-build 0.6.1", + "quote", + "syn", +] + +[[package]] +name = "tonic-build" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c695de27302f4697191dda1c7178131a8cb805463dda02864acb80fe1322fdcf" +dependencies = [ + "proc-macro2", + "prost-build 0.7.0", "quote", "syn", ] @@ -4139,6 +4407,26 @@ dependencies = [ "tower-util", ] +[[package]] +name = "tower" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60422bc7fefa2f3ec70359b8ff1caff59d785877eb70595904605bcc412470f" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project 1.0.8", + "rand 0.8.4", + "slab", + "tokio 1.9.0", + "tokio-stream", + "tokio-util 0.6.7", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower-balance" version = "0.3.0" @@ -4186,6 +4474,23 @@ dependencies = [ "tower-service", ] +[[package]] +name = "tower-http" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b56efe69aa0ad2b5da6b942e57ea9f6fe683b7a314d4ff48662e2c8838de1" +dependencies = [ + "bytes 1.0.1", + "futures-core", + "futures-util", + "http", + "http-body 0.4.2", + "pin-project 1.0.8", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower-layer" version = "0.3.1" @@ -4402,7 +4707,7 @@ dependencies = [ "base64 0.12.3", "byteorder", "bytes 0.5.6", - "http 0.2.4", + "http", "httparse", "input_buffer", "log", @@ -4455,9 +4760,9 @@ version = "0.6.12" dependencies = [ "akri-discovery-utils", "akri-udev", - "env_logger", + "env_logger 0.8.4", "log", - "tokio 0.2.25", + "tokio 1.9.0", ] [[package]] @@ -4465,16 +4770,16 @@ name = "udev-video-broker" version = "0.6.12" dependencies = [ "akri-shared", - "env_logger", + "env_logger 0.8.4", "futures 0.1.31", "lazy_static", "log", "prometheus 0.12.0", - "prost", + "prost 0.6.1", "rscam", "tokio 0.2.25", - "tonic", - "tonic-build", + "tonic 0.1.1", + "tonic-build 0.1.1", ] [[package]] @@ -4625,14 +4930,14 @@ dependencies = [ "bytes 0.5.6", "futures 0.3.16", "headers", - "http 0.2.4", + "http", "hyper 0.13.10", "log", "mime", "mime_guess", "multipart", "pin-project 0.4.28", - "scoped-tls 1.0.0", + "scoped-tls", "serde", "serde_json", "serde_urlencoded 0.6.1", @@ -4745,9 +5050,10 @@ dependencies = [ "clap", "k8s-openapi", "kube", + "kube-runtime", "openapi", "openssl", - "rustls 0.19.1", + "rustls", "serde", "serde_json", ] @@ -4780,6 +5086,17 @@ dependencies = [ "libc", ] +[[package]] +name = "which" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" +dependencies = [ + "either", + "lazy_static", + "libc", +] + [[package]] name = "widestring" version = "0.4.3" diff --git a/Cargo.toml b/Cargo.toml index 5fb515883..4af5b45fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,10 @@ # Patch to allow invalid authority headers provided by grpc-go / kubelet # Issue to track: https://github.com/grpc/grpc-go/issues/2628 +# [patch.crates-io] +# h2 = { git = "https://github.com/kate-goldenring/h2", branch = "master" } + [patch.crates-io] -h2 = { git = "https://github.com/kate-goldenring/h2", branch = "master" } +k8s-openapi = { git = "https://github.com/kazk/k8s-openapi", branch = "add-schema" } [workspace] members = [ diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 2416e808d..c53a4c4af 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -14,7 +14,7 @@ akri-opcua = { path = "../discovery-handlers/opcua", optional = true } akri-udev = { path = "../discovery-handlers/udev", optional = true } akri-shared = { path = "../shared" } anyhow = "1.0.38" -async-stream = "0.2" +async-stream = "0.3" async-trait = "0.1.0" blake2 = "0.9.0" chrono = "0.4.10" @@ -23,29 +23,32 @@ env_logger = "0.8.3" futures = { version = "0.3.1", package = "futures" } futures-core = "0.3" futures-util = "0.3" -hyper = "0.13.10" -h2 = "=0.2.6" -kube = { version = "0.23.0", features = ["openapi"] } -k8s-openapi = { version = "0.6.0", features = ["v1_16"] } +hyper = "0.14.2" +h2 = "0.3.0" +kube = { version = "0.57.0", features = ["derive"] } +kube-runtime = "0.57.0" +k8s-openapi = { version = "0.12.0", default-features = false, features = ["v1_16"] } lazy_static = "1.4" log = "0.4" mockall_double = "0.2.0" -prometheus = { version = "0.12.0", features = ["process"] } -prost = "0.6" -rand = "0.8.3" +prometheus = { version = "0.11.0", features = ["process"] } +prost = "0.7" +prost-types = "0.7" +rand = "0.8.2" serde = "1.0.104" serde_json = "1.0.45" serde_yaml = "0.8.11" serde_derive = "1.0.104" -tokio = { version = "0.2", features = ["full"] } -tokio-core = "0.1" -tonic = "0.1" -tower = "0.3" -url = "2.2.0" +tokio = { version = "1.0", features = ["rt-multi-thread", "time", "fs", "macros", "net"] } +tokio-stream = { version = "0.1", features = ["net"] } +tonic = "0.4.0" +# TODO kagold maybe dont need tower +tower = "0.4.4" +url = "2.1.0" uuid = { version = "0.8.1", features = ["v4"] } [build-dependencies] -tonic-build = "0.1.1" +tonic-build = "0.4.0" [dev-dependencies] # for testing using a simple discovery handler diff --git a/agent/src/main.rs b/agent/src/main.rs index 358f38553..ea7568b87 100644 --- a/agent/src/main.rs +++ b/agent/src/main.rs @@ -5,7 +5,6 @@ extern crate lazy_static; extern crate log; #[macro_use] extern crate serde_derive; -extern crate tokio_core; mod util; use akri_shared::akri::{metrics::run_metrics_server, API_NAMESPACE}; diff --git a/agent/src/util/config_action.rs b/agent/src/util/config_action.rs index 89a8ac798..bcd473942 100644 --- a/agent/src/util/config_action.rs +++ b/agent/src/util/config_action.rs @@ -9,12 +9,12 @@ use super::{ registration::RegisteredDiscoveryHandlerMap, }; use akri_shared::{ - akri::{configuration::KubeAkriConfig, API_CONFIGURATIONS, API_NAMESPACE, API_VERSION}, + akri::{configuration::Configuration, API_CONFIGURATIONS, API_NAMESPACE, API_VERSION}, k8s, k8s::{try_delete_instance, KubeInterface}, }; -use futures::StreamExt; -use kube::api::{Informer, RawApi, WatchEvent}; +use futures::{StreamExt, TryStreamExt}; +use kube::api::{Api, ListParams, WatchEvent}; use log::{info, trace}; use std::{collections::HashMap, sync::Arc}; use tokio::sync::{broadcast, mpsc, Mutex}; @@ -43,7 +43,7 @@ pub async fn do_config_watch( ) -> Result<(), Box> { info!("do_config_watch - enter"); let config_map: ConfigMap = Arc::new(Mutex::new(HashMap::new())); - let kube_interface = k8s::create_kube_interface(); + let kube_interface = k8s::KubeImpl::new().await?; let mut tasks = Vec::new(); // Handle pre-existing configs @@ -54,7 +54,7 @@ pub async fn do_config_watch( let new_discovery_handler_sender = new_discovery_handler_sender.clone(); tasks.push(tokio::spawn(async move { handle_config_add( - Arc::new(Box::new(k8s::create_kube_interface())), + Arc::new(Box::new(k8s::KubeImpl::new().await.unwrap())), &config, config_map, discovery_handler_map, @@ -90,22 +90,20 @@ async fn watch_for_config_changes( new_discovery_handler_sender: broadcast::Sender, ) -> Result<(), Box> { trace!("watch_for_config_changes - start"); - let akri_config_type = RawApi::customResource(API_CONFIGURATIONS) - .group(API_NAMESPACE) - .version(API_VERSION); - let informer = Informer::raw(kube_interface.get_kube_client(), akri_config_type) - .init() - .await?; + let configurations_api = Api::::all(kube_interface.get_kube_client()); loop { - let mut configs = informer.poll().await?.boxed(); + let mut stream = configurations_api + .watch(&ListParams::default(), API_VERSION) + .await? + .boxed(); // Currently, this does not handle None except to break the // while. - while let Some(event) = configs.next().await { + while let Some(event) = stream.try_next().await? { let new_discovery_handler_sender = new_discovery_handler_sender.clone(); handle_config( kube_interface, - event?, + event, config_map.clone(), discovery_handler_map.clone(), new_discovery_handler_sender, @@ -119,7 +117,7 @@ async fn watch_for_config_changes( /// correct function based on the event type. async fn handle_config( kube_interface: &impl KubeInterface, - event: WatchEvent, + event: WatchEvent, config_map: ConfigMap, discovery_handler_map: RegisteredDiscoveryHandlerMap, new_discovery_handler_sender: broadcast::Sender, @@ -128,12 +126,12 @@ async fn handle_config( match event { WatchEvent::Added(config) => { info!( - "handle_config - added Configuration {}", + "handle_config - added Configuration {:?}", config.metadata.name ); tokio::spawn(async move { handle_config_add( - Arc::new(Box::new(k8s::create_kube_interface())), + Arc::new(Box::new(k8s::KubeImpl::new().await.unwrap())), &config, config_map, discovery_handler_map, @@ -146,7 +144,7 @@ async fn handle_config( } WatchEvent::Deleted(config) => { info!( - "handle_config - deleted Configuration {}", + "handle_config - deleted Configuration {:?}", config.metadata.name, ); handle_config_delete(kube_interface, &config, config_map).await?; @@ -155,13 +153,13 @@ async fn handle_config( // If a config is updated, delete all associated instances and device plugins and then recreate them to reflect updated config WatchEvent::Modified(config) => { info!( - "handle_config - modified Configuration {}", + "handle_config - modified Configuration {:?}", config.metadata.name, ); handle_config_delete(kube_interface, &config, config_map.clone()).await?; tokio::spawn(async move { handle_config_add( - Arc::new(Box::new(k8s::create_kube_interface())), + Arc::new(Box::new(k8s::KubeImpl::new().await.unwrap())), &config, config_map, discovery_handler_map, @@ -183,7 +181,7 @@ async fn handle_config( /// Then calls a function to continually observe the availability of instances associated with the Configuration. async fn handle_config_add( kube_interface: Arc>, - config: &KubeAkriConfig, + config: &Configuration, config_map: ConfigMap, discovery_handler_map: RegisteredDiscoveryHandlerMap, new_discovery_handler_sender: broadcast::Sender, @@ -203,7 +201,7 @@ async fn handle_config_add( config_map .lock() .await - .insert(config_name.clone(), config_info); + .insert(config_name.clone().unwrap(), config_info); let config = config.clone(); // Keep discovering instances until the config is deleted, signaled by a message from handle_config_delete @@ -229,18 +227,19 @@ async fn handle_config_add( /// and deletes the Instance CRD. async fn handle_config_delete( kube_interface: &impl KubeInterface, - config: &KubeAkriConfig, + config: &Configuration, config_map: ConfigMap, ) -> Result<(), Box> { + let name = config.metadata.name.clone().unwrap(); trace!( "handle_config_delete - for config {} telling do_periodic_discovery to end", - config.metadata.name + name ); // Send message to stop observing instances' availability and waits until response is received if config_map .lock() .await - .get(&config.metadata.name) + .get(&name) .unwrap() .stop_discovery_sender .clone() @@ -250,7 +249,7 @@ async fn handle_config_delete( config_map .lock() .await - .get_mut(&config.metadata.name) + .get_mut(&name) .unwrap() .finished_discovery_receiver .recv() @@ -258,12 +257,12 @@ async fn handle_config_delete( .unwrap(); trace!( "handle_config_delete - for config {} received message that do_periodic_discovery ended", - config.metadata.name + name ); } else { trace!( "handle_config_delete - for config {} do_periodic_discovery receiver has been dropped", - config.metadata.name + name ); } @@ -271,12 +270,8 @@ async fn handle_config_delete( let instance_map: InstanceMap; { let mut config_map_locked = config_map.lock().await; - instance_map = config_map_locked - .get(&config.metadata.name) - .unwrap() - .instance_map - .clone(); - config_map_locked.remove(&config.metadata.name); + instance_map = config_map_locked.get(&name).unwrap().instance_map.clone(); + config_map_locked.remove(&name); } delete_all_instances_in_map(kube_interface, instance_map, config).await?; Ok(()) @@ -286,14 +281,14 @@ async fn handle_config_delete( pub async fn delete_all_instances_in_map( kube_interface: &impl k8s::KubeInterface, instance_map: InstanceMap, - config: &KubeAkriConfig, + config: &Configuration, ) -> Result<(), Box> { let mut instance_map_locked = instance_map.lock().await; let instances_to_delete_map = instance_map_locked.clone(); let namespace = config.metadata.namespace.as_ref().unwrap(); for (instance_name, instance_info) in instances_to_delete_map { trace!( - "handle_config_delete - found Instance {} associated with deleted config {} ... sending message to end list_and_watch", + "handle_config_delete - found Instance {} associated with deleted config {:?} ... sending message to end list_and_watch", instance_name, config.metadata.name ); @@ -317,7 +312,7 @@ mod config_action_tests { }; use super::*; use akri_discovery_utils::discovery::{mock_discovery_handler, v0::Device}; - use akri_shared::{akri::configuration::KubeAkriConfig, k8s::MockKubeInterface}; + use akri_shared::{akri::configuration::Configuration, k8s::MockKubeInterface}; use std::{collections::HashMap, fs, sync::Arc}; use tokio::sync::{broadcast, Mutex}; @@ -326,7 +321,7 @@ mod config_action_tests { let _ = env_logger::builder().is_test(true).try_init(); let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = fs::read_to_string(path_to_config).expect("Unable to read file"); - let config: KubeAkriConfig = serde_yaml::from_str(&config_yaml).unwrap(); + let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); let config_name = config.metadata.name.clone(); let mut list_and_watch_message_receivers = Vec::new(); let mut visible_discovery_results = Vec::new(); @@ -386,7 +381,7 @@ mod config_action_tests { async fn run_and_test_handle_config_add( discovery_handler_map: RegisteredDiscoveryHandlerMap, config_map: ConfigMap, - config: KubeAkriConfig, + config: Configuration, dh_endpoint: &DiscoveryHandlerEndpoint, dh_name: &str, ) -> tokio::task::JoinHandle<()> { @@ -416,7 +411,7 @@ mod config_action_tests { // Loop until the Configuration and single discovered Instance are added to the ConfigMap let mut x: i8 = 0; while x < 5 { - tokio::time::delay_for(std::time::Duration::from_millis(200)).await; + tokio::time::sleep(std::time::Duration::from_millis(200)).await; if let Some(config_info) = config_map.lock().await.get(&config.metadata.name) { if config_info.instance_map.lock().await.len() == 1 { break; @@ -444,7 +439,7 @@ mod config_action_tests { ) { let mut x: i8 = 0; while x < 5 { - tokio::time::delay_for(std::time::Duration::from_millis(200)).await; + tokio::time::sleep(std::time::Duration::from_millis(200)).await; let dh_map = discovery_handler_map.lock().unwrap(); if let Some(dh_details_map) = dh_map.get(dh_name) { if dh_details_map.get(dh_endpoint).unwrap().connectivity_status == dh_status { @@ -497,7 +492,7 @@ mod config_action_tests { // Discovery Handler should create an instance and be marked as Active let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = fs::read_to_string(path_to_config).expect("Unable to read file"); - let config: KubeAkriConfig = serde_yaml::from_str(&config_yaml).unwrap(); + let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); let config_name = config.metadata.name.clone(); let config_map: ConfigMap = Arc::new(Mutex::new(HashMap::new())); let first_add_handle = run_and_test_handle_config_add( diff --git a/agent/src/util/device_plugin_builder.rs b/agent/src/util/device_plugin_builder.rs index ed31124b2..9c43cefb0 100644 --- a/agent/src/util/device_plugin_builder.rs +++ b/agent/src/util/device_plugin_builder.rs @@ -9,11 +9,12 @@ use super::{ }; use akri_discovery_utils::discovery::v0::Device; use akri_shared::{ - akri::{configuration::KubeAkriConfig, AKRI_PREFIX}, + akri::{configuration::Configuration, AKRI_PREFIX}, uds::unix_stream, }; use async_trait::async_trait; use futures::stream::TryStreamExt; +use futures::TryFutureExt; use log::{info, trace}; #[cfg(test)] use mockall::{automock, predicate::*}; @@ -33,7 +34,7 @@ pub trait DevicePluginBuilderInterface: Send + Sync { async fn build_device_plugin( &self, instance_name: String, - config: &KubeAkriConfig, + config: &Configuration, shared: bool, instance_map: InstanceMap, device: Device, @@ -65,7 +66,7 @@ impl DevicePluginBuilderInterface for DevicePluginBuilder { async fn build_device_plugin( &self, instance_name: String, - config: &KubeAkriConfig, + config: &Configuration, shared: bool, instance_map: InstanceMap, device: Device, @@ -87,7 +88,7 @@ impl DevicePluginBuilderInterface for DevicePluginBuilder { instance_name: instance_name.clone(), endpoint: device_endpoint.clone(), config: config.spec.clone(), - config_name: config.metadata.name.clone(), + config_name: config.metadata.name.clone().unwrap(), config_uid: config.metadata.uid.as_ref().unwrap().clone(), config_namespace: config.metadata.namespace.as_ref().unwrap().clone(), shared, @@ -131,25 +132,31 @@ impl DevicePluginBuilderInterface for DevicePluginBuilder { tokio::fs::create_dir_all(Path::new(&socket_path[..]).parent().unwrap()) .await .expect("Failed to create dir at socket path"); - let mut uds = - UnixListener::bind(socket_path.clone()).expect("Failed to bind to socket path"); let service = DevicePluginServer::new(device_plugin_service); - let socket_path_to_delete = socket_path.clone(); + let task_socket_path = socket_path.clone(); task::spawn(async move { + let socket_to_delete = task_socket_path.clone(); + let incoming = { + let uds = + UnixListener::bind(task_socket_path).expect("Failed to bind to socket path"); + + async_stream::stream! { + while let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await { + yield item; + } + } + }; Server::builder() .add_service(service) - .serve_with_incoming_shutdown( - uds.incoming().map_ok(unix_stream::UnixStream), - shutdown_signal(server_ender_receiver), - ) + .serve_with_incoming_shutdown(incoming, shutdown_signal(server_ender_receiver)) .await .unwrap(); trace!( "serve - gracefully shutdown ... deleting socket {}", - socket_path_to_delete + socket_to_delete ); // Socket may already be deleted in the case of the kubelet restart - std::fs::remove_file(socket_path_to_delete).unwrap_or(()); + std::fs::remove_file(socket_to_delete).unwrap_or(()); }); akri_shared::uds::unix_stream::try_connect(&socket_path).await?; @@ -256,34 +263,44 @@ pub mod tests { } } + async fn serve_for_test>( + service: RegistrationServer, + socket: P, + ) { + let incoming = { + let uds = UnixListener::bind(socket).expect("Failed to bind to socket path"); + + async_stream::stream! { + while let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await { + yield item; + } + } + }; + + Server::builder() + .add_service(service) + .serve_with_incoming(incoming) + .await + .unwrap(); + } + #[tokio::test] async fn test_register() { let device_plugins_dirs = Builder::new().prefix("device-plugins").tempdir().unwrap(); - let kubelet_socket = device_plugins_dirs - .path() - .join("kubelet.sock") - .to_str() - .unwrap() - .to_string(); + let kubelet_socket = device_plugins_dirs.path().join("kubelet.sock"); + let kubelet_socket_str = kubelet_socket.clone().to_str().unwrap(); // Start kubelet registration server - let mut uds = - UnixListener::bind(kubelet_socket.clone()).expect("Failed to bind to socket path"); - let registration = MockRegistration { return_error: false, }; let service = RegistrationServer::new(registration); task::spawn(async move { - Server::builder() - .add_service(service) - .serve_with_incoming(uds.incoming().map_ok(unix_stream::UnixStream)) - .await - .unwrap(); + serve_for_test(service, kubelet_socket).await; }); // Make sure registration server has started - akri_shared::uds::unix_stream::try_connect(&kubelet_socket) + akri_shared::uds::unix_stream::try_connect(kubelet_socket_str) .await .unwrap(); @@ -296,7 +313,7 @@ pub mod tests { "socket.sock", "random_instance", server_ender_sender, - &kubelet_socket + &kubelet_socket_str ) .await .is_ok()); @@ -307,12 +324,8 @@ pub mod tests { let device_plugin_builder = DevicePluginBuilder {}; let (server_ender_sender, mut server_ender_receiver) = mpsc::channel(1); let device_plugins_dirs = Builder::new().prefix("device-plugins").tempdir().unwrap(); - let kubelet_socket = device_plugins_dirs - .path() - .join("kubelet.sock") - .to_str() - .unwrap() - .to_string(); + let kubelet_socket = device_plugins_dirs.path().join("kubelet.sock"); + let kubelet_socket_str = kubelet_socket.clone().to_str().unwrap(); // Try to register when no registration service exists assert!(device_plugin_builder @@ -321,7 +334,7 @@ pub mod tests { "socket.sock", "random_instance", server_ender_sender.clone(), - &kubelet_socket + &kubelet_socket_str ) .await .is_err()); @@ -332,15 +345,11 @@ pub mod tests { let registration = MockRegistration { return_error: true }; let service = RegistrationServer::new(registration); task::spawn(async move { - Server::builder() - .add_service(service) - .serve_with_incoming(uds.incoming().map_ok(unix_stream::UnixStream)) - .await - .unwrap(); + serve_for_test(service, kubelet_socket).await; }); // Make sure registration server has started - akri_shared::uds::unix_stream::try_connect(&kubelet_socket) + akri_shared::uds::unix_stream::try_connect(&kubelet_socket_str) .await .unwrap(); @@ -351,7 +360,7 @@ pub mod tests { "socket.sock", "random_instance", server_ender_sender, - &kubelet_socket + &kubelet_socket_str ) .await .is_ok()); diff --git a/agent/src/util/device_plugin_service.rs b/agent/src/util/device_plugin_service.rs index c0566f702..97bb91e3f 100644 --- a/agent/src/util/device_plugin_service.rs +++ b/agent/src/util/device_plugin_service.rs @@ -10,25 +10,38 @@ use super::v1beta1::{ use akri_discovery_utils::discovery::v0::Device; use akri_shared::{ akri::{ - configuration::Configuration, - instance::Instance, + configuration::ConfigurationSpec, + instance::InstanceSpec, retry::{random_delay, MAX_INSTANCE_UPDATE_TRIES}, AKRI_SLOT_ANNOTATION_NAME, }, k8s, k8s::KubeInterface, }; +use futures::{Stream, TryFutureExt}; use log::{error, info, trace}; #[cfg(test)] use mock_instant::Instant; #[cfg(not(test))] use std::time::Instant; -use std::{collections::HashMap, sync::Arc, time::Duration}; +use std::{ + collections::HashMap, + convert::TryFrom, + env, + path::Path, + pin::Pin, + sync::Arc, + time::{Duration, SystemTime, UNIX_EPOCH}, +}; use tokio::{ sync::{broadcast, mpsc, Mutex}, - time::timeout, + task, + time::{sleep, timeout}, +}; +use tonic::{ + transport::{Endpoint, Server, Uri}, + Code, Request, Response, Status, }; -use tonic::{Code, Request, Response, Status}; /// Message sent in channel to `list_and_watch`. /// Dictates what action `list_and_watch` should take upon being awoken. @@ -75,7 +88,7 @@ pub struct DevicePluginService { /// Socket endpoint pub endpoint: String, /// Instance's Configuration - pub config: Configuration, + pub config: ConfigurationSpec, /// Name of Instance's Configuration CRD pub config_name: String, /// UID of Instance's Configuration CRD @@ -115,7 +128,9 @@ impl DevicePlugin for DevicePluginService { Ok(Response::new(resp)) } - type ListAndWatchStream = mpsc::Receiver>; + type ListAndWatchStream = + Pin> + Send + Sync + 'static>>; + // type ListAndWatchStream = mpsc::Receiver>; /// Called by Kubelet right after the DevicePluginService registers with Kubelet. /// Returns a stream of List of "virtual" Devices over a channel. @@ -142,7 +157,7 @@ impl DevicePlugin for DevicePluginService { tokio::spawn(async move { let mut keep_looping = true; #[cfg(not(test))] - let kube_interface = Arc::new(k8s::create_kube_interface()); + let kube_interface = Arc::new(k8s::KubeImpl::new().await.unwrap()); // Try to create an Instance CRD for this plugin and add it to the global InstanceMap else shutdown #[cfg(not(test))] @@ -229,7 +244,10 @@ impl DevicePlugin for DevicePluginService { } trace!("list_and_watch - for Instance {} ending", dps.instance_name); }); - Ok(Response::new(kubelet_update_receiver)) + + Ok(Response::new(Box::pin( + tokio_stream::wrappers::ReceiverStream::new(kubelet_update_receiver), + ))) } /// Kubelet calls allocate during pod creation. @@ -243,7 +261,7 @@ impl DevicePlugin for DevicePluginService { "allocate - kubelet called allocate for Instance {}", self.instance_name ); - let kube_interface = Arc::new(k8s::create_kube_interface()); + let kube_interface = Arc::new(k8s::KubeImpl::new().await.unwrap()); match self.internal_allocate(requests, kube_interface).await { Ok(resp) => Ok(resp), Err(e) => Err(e), @@ -349,7 +367,7 @@ impl DevicePluginService { fn get_slot_value( device_usage_id: &str, node_name: &str, - instance: &Instance, + instance: &InstanceSpec, ) -> Result { if let Some(allocated_node) = instance.device_usage.get(device_usage_id) { if allocated_node.is_empty() { @@ -386,7 +404,7 @@ async fn try_update_instance_device_usage( instance_namespace: &str, kube_interface: Arc, ) -> Result<(), Status> { - let mut instance: Instance; + let mut instance: InstanceSpec; for x in 0..MAX_INSTANCE_UPDATE_TRIES { // Grab latest instance match kube_interface @@ -484,7 +502,7 @@ fn build_container_allocate_response( async fn try_create_instance( dps: Arc, kube_interface: Arc, -) -> Result<(), Box> { +) -> Result<(), anyhow::Error> { // Make sure Configuration exists for instance if let Err(e) = kube_interface .find_configuration(&dps.config_name, &dps.config_namespace) @@ -500,7 +518,7 @@ async fn try_create_instance( let device_usage: std::collections::HashMap = (0..dps.config.capacity) .map(|x| (format!("{}-{}", dps.instance_name, x), "".to_string())) .collect(); - let instance = Instance { + let instance = InstanceSpec { configuration_name: dps.config_name.clone(), shared: dps.shared, nodes: vec![dps.node_name.clone()], @@ -530,7 +548,7 @@ async fn try_create_instance( match kube_interface .update_instance( &instance_object.spec, - &instance_object.metadata.name, + &instance_object.metadata.name.unwrap(), &dps.config_namespace, ) .await @@ -767,9 +785,9 @@ mod device_plugin_service_tests { v1beta1::device_plugin_client::DevicePluginClient, }; use super::*; - use akri_shared::akri::configuration::KubeAkriConfig; + use akri_shared::akri::configuration::Configuration; use akri_shared::{ - akri::instance::{Instance, KubeAkriInstance}, + akri::instance::{Instance, InstanceSpec}, k8s::MockKubeInterface, }; use std::{ @@ -819,7 +837,7 @@ mod device_plugin_service_tests { instance_json = instance_json.replace("config-a-b494b6", &instance_name_clone); instance_json = instance_json.replace("\":\"\"", &format!("\":\"{}\"", device_usage_node)); - let instance: KubeAkriInstance = serde_json::from_str(&instance_json).unwrap(); + let instance: Instance = serde_json::from_str(&instance_json).unwrap(); Ok(instance) }); } @@ -831,8 +849,7 @@ mod device_plugin_service_tests { let path_to_config = "../test/yaml/config-a.yaml"; let kube_akri_config_yaml = fs::read_to_string(path_to_config).expect("Unable to read file"); - let kube_akri_config: KubeAkriConfig = - serde_yaml::from_str(&kube_akri_config_yaml).unwrap(); + let kube_akri_config: Configuration = serde_yaml::from_str(&kube_akri_config_yaml).unwrap(); let device_instance_name = get_device_instance_name("b494b6", &kube_akri_config.metadata.name); let unique_time = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH); @@ -956,7 +973,7 @@ mod device_plugin_service_tests { let path_to_config = "../test/yaml/config-a.yaml"; let kube_akri_config_yaml = fs::read_to_string(path_to_config).expect("Unable to read file"); - let kube_akri_config: KubeAkriConfig = + let kube_akri_config: Configuration = serde_yaml::from_str(&kube_akri_config_yaml).unwrap(); Ok(kube_akri_config) }); @@ -1340,7 +1357,7 @@ mod device_plugin_service_tests { ); mock.expect_update_instance() .times(1) - .withf(move |instance_to_update: &Instance, _, _| { + .withf(move |instance_to_update: &InstanceSpec, _, _| { instance_to_update .device_usage .get(&device_usage_id_slot) diff --git a/agent/src/util/discovery_operator.rs b/agent/src/util/discovery_operator.rs index d3241d9ae..c081b7082 100644 --- a/agent/src/util/discovery_operator.rs +++ b/agent/src/util/discovery_operator.rs @@ -19,7 +19,7 @@ use akri_discovery_utils::discovery::v0::{ discovery_handler_client::DiscoveryHandlerClient, Device, DiscoverRequest, DiscoverResponse, }; use akri_shared::{ - akri::configuration::KubeAkriConfig, + akri::configuration::Configuration, k8s, os::env_var::{ActualEnvVarQuery, EnvVarQuery}, }; @@ -62,7 +62,7 @@ pub struct DiscoveryOperator { discovery_handler_map: RegisteredDiscoveryHandlerMap, /// The Akri Configuration associated with this `DiscoveryOperator`. /// The Configuration tells the `DiscoveryOperator` what to look for. - config: KubeAkriConfig, + config: Configuration, /// Map of Akri Instances discovered by this `DiscoveryOperator` instance_map: InstanceMap, } @@ -71,7 +71,7 @@ pub struct DiscoveryOperator { impl DiscoveryOperator { pub fn new( discovery_handler_map: RegisteredDiscoveryHandlerMap, - config: KubeAkriConfig, + config: Configuration, instance_map: InstanceMap, ) -> Self { DiscoveryOperator { @@ -87,7 +87,7 @@ impl DiscoveryOperator { } /// Returns config field. Allows the struct to be mocked. #[allow(dead_code)] - pub fn get_config(&self) -> KubeAkriConfig { + pub fn get_config(&self) -> Configuration { self.config.clone() } /// Returns instance_map field. Allows the struct to be mocked. @@ -125,9 +125,9 @@ impl DiscoveryOperator { self.config.spec.discovery_handler.name ); match discovery_handler.discover(discover_request).await { - Ok(device_update_receiver) => { - Some(StreamType::Embedded(device_update_receiver.into_inner())) - } + Ok(device_update_receiver) => Some(StreamType::Embedded( + device_update_receiver.into_inner().into_inner(), + )), Err(e) => { error!("get_stream - could not connect to DiscoveryHandler at endpoint {:?} with error {}", endpoint, e); None @@ -298,7 +298,7 @@ impl DiscoveryOperator { kube_interface: Arc>, ) -> Result<(), Box> { trace!( - "delete_offline_instances - entered for configuration {}", + "delete_offline_instances - entered for configuration {:?}", self.config.metadata.name ); let kube_interface_clone = kube_interface.clone(); @@ -340,21 +340,22 @@ impl DiscoveryOperator { shared: bool, device_plugin_builder: Box, ) -> Result<(), Box> { + let config_name = self.config.metadata.name.clone().unwrap(); trace!( "handle_discovery_results - for config {} with discovery results {:?}", - self.config.metadata.name, + config_name, discovery_results ); let currently_visible_instances: HashMap = discovery_results .iter() .map(|discovery_result| { let id = generate_instance_digest(&discovery_result.id, shared); - let instance_name = get_device_instance_name(&id, &self.config.metadata.name); + let instance_name = get_device_instance_name(&id, &config_name); (instance_name, discovery_result.clone()) }) .collect(); INSTANCE_COUNT_METRIC - .with_label_values(&[&self.config.metadata.name, &shared.to_string()]) + .with_label_values(&[&config_name, &shared.to_string()]) .set(currently_visible_instances.len() as i64); // Update the connectivity status of instances and return list of visible instances that don't have Instance CRs let instance_map = self.instance_map.lock().await.clone(); @@ -375,7 +376,7 @@ impl DiscoveryOperator { if !new_discovery_results.is_empty() { for discovery_result in new_discovery_results { let id = generate_instance_digest(&discovery_result.id, shared); - let instance_name = get_device_instance_name(&id, &self.config.metadata.name); + let instance_name = get_device_instance_name(&id, &config_name); trace!( "handle_discovery_results - new instance {} came online", instance_name @@ -541,7 +542,7 @@ pub mod start_discovery { "start_discovery - entered for {} discovery handler", config.spec.discovery_handler.name ); - let config_name = config.metadata.name.clone(); + let config_name = config.metadata.name.clone().unwrap(); let mut tasks = Vec::new(); let discovery_operator = Arc::new(discovery_operator); @@ -606,7 +607,7 @@ pub mod start_discovery { loop { tokio::select! { _ = stop_all_discovery_receiver.recv() => { - trace!("listen_for_new_discovery_handlers - received message to stop discovery for configuration {}", discovery_operator.get_config().metadata.name); + trace!("listen_for_new_discovery_handlers - received message to stop discovery for configuration {:?}", discovery_operator.get_config().metadata.name); discovery_operator.stop_all_discovery().await; break; }, @@ -614,10 +615,10 @@ pub mod start_discovery { // Check if it is one of this Configuration's discovery handlers if let Ok(discovery_handler_name) = result { if discovery_handler_name == discovery_operator.get_config().spec.discovery_handler.name { - trace!("listen_for_new_discovery_handlers - received new registered discovery handler for configuration {}", discovery_operator.get_config().metadata.name); + trace!("listen_for_new_discovery_handlers - received new registered discovery handler for configuration {:?}", discovery_operator.get_config().metadata.name); let new_discovery_operator = discovery_operator.clone(); discovery_tasks.push(tokio::spawn(async move { - do_discover(new_discovery_operator, Arc::new(Box::new(k8s::create_kube_interface()))).await.unwrap(); + do_discover(new_discovery_operator, Arc::new(Box::new(k8s::KubeImpl::new().await.unwrap()))).await.unwrap(); })); } } @@ -861,7 +862,7 @@ pub mod tests { use super::*; use akri_discovery_utils::discovery::mock_discovery_handler; use akri_shared::{ - akri::configuration::KubeAkriConfig, k8s::MockKubeInterface, os::env_var::MockEnvVarQuery, + akri::configuration::Configuration, k8s::MockKubeInterface, os::env_var::MockEnvVarQuery, }; use mock_instant::{Instant, MockClock}; use mockall::Sequence; @@ -869,7 +870,7 @@ pub mod tests { use tokio::sync::broadcast; pub async fn build_instance_map( - config: &KubeAkriConfig, + config: &Configuration, visible_discovery_results: &mut Vec, list_and_watch_message_receivers: &mut Vec< broadcast::Receiver, @@ -928,7 +929,7 @@ pub mod tests { fn create_mock_discovery_operator( discovery_handler_map: RegisteredDiscoveryHandlerMap, - config: KubeAkriConfig, + config: Configuration, instance_map: InstanceMap, ) -> MockDiscoveryOperator { let ctx = MockDiscoveryOperator::new_context(); @@ -1004,7 +1005,7 @@ pub mod tests { // Build discovery operator let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = std::fs::read_to_string(path_to_config).expect("Unable to read file"); - let config: KubeAkriConfig = serde_yaml::from_str(&config_yaml).unwrap(); + let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); let discovery_operator = create_mock_discovery_operator( discovery_handler_map.clone(), config, @@ -1064,7 +1065,7 @@ pub mod tests { .subscribe(); let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = std::fs::read_to_string(path_to_config).expect("Unable to read file"); - let config: KubeAkriConfig = serde_yaml::from_str(&config_yaml).unwrap(); + let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); let discovery_operator = Arc::new(DiscoveryOperator::new( discovery_handler_map, config, @@ -1229,7 +1230,7 @@ pub mod tests { Arc::new(std::sync::Mutex::new(HashMap::new())); let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = std::fs::read_to_string(path_to_config).expect("Unable to read file"); - let config: KubeAkriConfig = serde_yaml::from_str(&config_yaml).unwrap(); + let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); let config_name = config.metadata.name.clone(); INSTANCE_COUNT_METRIC .with_label_values(&[&config_name, "true"]) @@ -1324,7 +1325,7 @@ pub mod tests { let _ = env_logger::builder().is_test(true).try_init(); let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = std::fs::read_to_string(path_to_config).expect("Unable to read file"); - let config: KubeAkriConfig = serde_yaml::from_str(&config_yaml).unwrap(); + let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); let mut list_and_watch_message_receivers = Vec::new(); let discovery_handler_map: RegisteredDiscoveryHandlerMap = Arc::new(std::sync::Mutex::new(HashMap::new())); @@ -1401,12 +1402,12 @@ pub mod tests { // 1: InstanceConnectivityStatus of all instances that go offline is changed from Online to Offline // 2: InstanceConnectivityStatus of shared instances that come back online in under 5 minutes is changed from Offline to Online // 3: InstanceConnectivityStatus of unshared instances that come back online before next periodic discovery is changed from Offline to Online - #[tokio::test(core_threads = 2)] + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_update_instance_connectivity_status_factory() { let _ = env_logger::builder().is_test(true).try_init(); let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = std::fs::read_to_string(path_to_config).expect("Unable to read file"); - let config: KubeAkriConfig = serde_yaml::from_str(&config_yaml).unwrap(); + let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); let config_name = config.metadata.name.clone(); let mut list_and_watch_message_receivers = Vec::new(); let mut visible_discovery_results = Vec::new(); @@ -1554,7 +1555,7 @@ pub mod tests { } async fn run_update_instance_connectivity_status( - config: KubeAkriConfig, + config: Configuration, currently_visible_instances: HashMap, shared: bool, instance_map: InstanceMap, @@ -1582,7 +1583,7 @@ pub mod tests { ) -> DiscoveryOperator { let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = std::fs::read_to_string(path_to_config).expect("Unable to read file"); - let config: KubeAkriConfig = serde_yaml::from_str(&config_yaml).unwrap(); + let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); let discovery_handler_map = Arc::new(std::sync::Mutex::new(HashMap::new())); add_discovery_handler_to_map(dh_name, endpoint, false, discovery_handler_map.clone()); DiscoveryOperator::new( @@ -1683,7 +1684,7 @@ pub mod tests { std::env::set_var(super::super::constants::ENABLE_DEBUG_ECHO_LABEL, "yes"); let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = std::fs::read_to_string(path_to_config).expect("Unable to read file"); - let config: KubeAkriConfig = serde_yaml::from_str(&config_yaml).unwrap(); + let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); let discovery_handler_map = Arc::new(std::sync::Mutex::new(HashMap::new())); let endpoint = DiscoveryHandlerEndpoint::Embedded; let dh_name = akri_debug_echo::DISCOVERY_HANDLER_NAME.to_string(); diff --git a/agent/src/util/registration.rs b/agent/src/util/registration.rs index a70cdd109..0b3bf99ff 100644 --- a/agent/src/util/registration.rs +++ b/agent/src/util/registration.rs @@ -10,7 +10,7 @@ use akri_shared::{ os::env_var::{ActualEnvVarQuery, EnvVarQuery}, uds::unix_stream, }; -use futures::TryStreamExt; +use futures::TryFutureExt; #[cfg(test)] use mock_instant::Instant; use std::collections::HashMap; @@ -199,11 +199,19 @@ pub async fn internal_run_registration_server( ); // Delete socket in case previously created/used std::fs::remove_file(&socket_path).unwrap_or(()); - let mut uds = - tokio::net::UnixListener::bind(socket_path).expect("Failed to bind to socket path"); + let incoming = { + let uds = + tokio::net::UnixListener::bind(socket_path).expect("Failed to bind to socket path"); + + async_stream::stream! { + while let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await { + yield item; + } + } + }; Server::builder() .add_service(RegistrationServer::new(registration)) - .serve_with_incoming(uds.incoming().map_ok(unix_stream::UnixStream)) + .serve_with_incoming(incoming) .await?; trace!( "internal_run_registration_server - gracefully shutdown ... deleting socket {}", diff --git a/agent/src/util/slot_reconciliation.rs b/agent/src/util/slot_reconciliation.rs index c59600a16..02f9bb968 100644 --- a/agent/src/util/slot_reconciliation.rs +++ b/agent/src/util/slot_reconciliation.rs @@ -1,5 +1,5 @@ use super::{constants::SLOT_RECONCILIATION_CHECK_DELAY_SECS, crictl_containers}; -use akri_shared::{akri::instance::Instance, k8s::KubeInterface}; +use akri_shared::{akri::instance::InstanceSpec, k8s::KubeInterface}; use async_trait::async_trait; use k8s_openapi::api::core::v1::PodStatus; #[cfg(test)] @@ -140,8 +140,6 @@ impl DevicePluginSlotReconciler { .as_ref() .unwrap_or(&PodStatus::default()) .conditions - .as_ref() - .unwrap_or(&Vec::new()) .iter() .any(|condition| condition.type_ == "ContainersReady" && condition.status != "True") }); @@ -249,7 +247,7 @@ impl DevicePluginSlotReconciler { ) }) .collect::>(); - let modified_instance = Instance { + let modified_instance = InstanceSpec { configuration_name: instance.spec.configuration_name.clone(), broker_properties: instance.spec.broker_properties.clone(), shared: instance.spec.shared, @@ -261,7 +259,7 @@ impl DevicePluginSlotReconciler { match kube_interface .update_instance( &modified_instance, - &instance.metadata.name, + &instance.metadata.name.unwrap(), &instance.metadata.namespace.unwrap(), ) .await @@ -311,7 +309,7 @@ pub async fn periodic_slot_reconciliation( slot_grace_period: std::time::Duration, ) -> Result<(), Box> { trace!("periodic_slot_reconciliation - start"); - let kube_interface = akri_shared::k8s::create_kube_interface(); + let kube_interface = akri_shared::k8s::KubeImpl::new().await?; let node_name = std::env::var("AGENT_NODE_NAME").unwrap(); let crictl_path = std::env::var("HOST_CRICTL_PATH").unwrap(); let runtime_endpoint = std::env::var("HOST_RUNTIME_ENDPOINT").unwrap(); @@ -327,8 +325,8 @@ pub async fn periodic_slot_reconciliation( }; loop { - trace!("periodic_slot_reconciliation - iteration pre delay_for"); - tokio::time::delay_for(std::time::Duration::from_secs( + trace!("periodic_slot_reconciliation - iteration pre sleep"); + tokio::time::sleep(std::time::Duration::from_secs( SLOT_RECONCILIATION_CHECK_DELAY_SECS, )) .await; diff --git a/agent/src/util/v1beta1.rs b/agent/src/util/v1beta1.rs index 2b179f098..b01a89c37 100644 --- a/agent/src/util/v1beta1.rs +++ b/agent/src/util/v1beta1.rs @@ -8,17 +8,17 @@ pub struct DevicePluginOptions { pub struct RegisterRequest { /// Version of the API the Device Plugin was built against #[prost(string, tag = "1")] - pub version: std::string::String, + pub version: ::prost::alloc::string::String, /// Name of the unix socket the device plugin is listening on /// PATH = path.Join(DevicePluginPath, endpoint) #[prost(string, tag = "2")] - pub endpoint: std::string::String, + pub endpoint: ::prost::alloc::string::String, /// Schedulable resource name. As of now it's expected to be a DNS Label #[prost(string, tag = "3")] - pub resource_name: std::string::String, + pub resource_name: ::prost::alloc::string::String, /// Options to be communicated with Device Manager #[prost(message, optional, tag = "4")] - pub options: ::std::option::Option, + pub options: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Empty {} @@ -28,7 +28,7 @@ pub struct Empty {} #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListAndWatchResponse { #[prost(message, repeated, tag = "1")] - pub devices: ::std::vec::Vec, + pub devices: ::prost::alloc::vec::Vec, } /// E.g: /// struct Device { @@ -41,10 +41,10 @@ pub struct Device { /// to identify devices during the communication /// Max length of this field is 63 characters #[prost(string, tag = "1")] - pub id: std::string::String, + pub id: ::prost::alloc::string::String, /// Health of the device, can be healthy or unhealthy, see constants.go #[prost(string, tag = "2")] - pub health: std::string::String, + pub health: ::prost::alloc::string::String, } /// - PreStartContainer is expected to be called before each container start if indicated by plugin during registration phase. /// - PreStartContainer allows kubelet to pass reinitialized devices to containers. @@ -53,7 +53,7 @@ pub struct Device { #[derive(Clone, PartialEq, ::prost::Message)] pub struct PreStartContainerRequest { #[prost(string, repeated, tag = "1")] - pub devices_i_ds: ::std::vec::Vec, + pub devices_i_ds: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// PreStartContainerResponse will be send by plugin in response to PreStartContainerRequest #[derive(Clone, PartialEq, ::prost::Message)] @@ -67,12 +67,12 @@ pub struct PreStartContainerResponse {} #[derive(Clone, PartialEq, ::prost::Message)] pub struct AllocateRequest { #[prost(message, repeated, tag = "1")] - pub container_requests: ::std::vec::Vec, + pub container_requests: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ContainerAllocateRequest { #[prost(string, repeated, tag = "1")] - pub devices_i_ds: ::std::vec::Vec, + pub devices_i_ds: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// AllocateResponse includes the artifacts that needs to be injected into /// a container for accessing 'deviceIDs' that were mentioned as part of @@ -85,22 +85,24 @@ pub struct ContainerAllocateRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct AllocateResponse { #[prost(message, repeated, tag = "1")] - pub container_responses: ::std::vec::Vec, + pub container_responses: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ContainerAllocateResponse { /// List of environment variable to be set in the container to access one of more devices. #[prost(map = "string, string", tag = "1")] - pub envs: ::std::collections::HashMap, + pub envs: + ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, /// Mounts for the container. #[prost(message, repeated, tag = "2")] - pub mounts: ::std::vec::Vec, + pub mounts: ::prost::alloc::vec::Vec, /// Devices for the container. #[prost(message, repeated, tag = "3")] - pub devices: ::std::vec::Vec, + pub devices: ::prost::alloc::vec::Vec, /// Container annotations to pass to the container runtime #[prost(map = "string, string", tag = "4")] - pub annotations: ::std::collections::HashMap, + pub annotations: + ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, } /// Mount specifies a host volume to mount into a container. /// where device library or tools are installed on host and container @@ -108,10 +110,10 @@ pub struct ContainerAllocateResponse { pub struct Mount { /// Path of the mount within the container. #[prost(string, tag = "1")] - pub container_path: std::string::String, + pub container_path: ::prost::alloc::string::String, /// Path of the mount on the host. #[prost(string, tag = "2")] - pub host_path: std::string::String, + pub host_path: ::prost::alloc::string::String, /// If set, the mount is read-only. #[prost(bool, tag = "3")] pub read_only: bool, @@ -121,16 +123,16 @@ pub struct Mount { pub struct DeviceSpec { /// Path of the device within the container. #[prost(string, tag = "1")] - pub container_path: std::string::String, + pub container_path: ::prost::alloc::string::String, /// Path of the device on the host. #[prost(string, tag = "2")] - pub host_path: std::string::String, + pub host_path: ::prost::alloc::string::String, /// Cgroups permissions of the device, candidates are one or more of /// * r - allows container to read from the specified device. /// * w - allows container to write to the specified device. /// * m - allows container to create device files that do not yet exist. #[prost(string, tag = "3")] - pub permissions: std::string::String, + pub permissions: ::prost::alloc::string::String, } #[doc = r" Generated client implementations."] pub mod registration_client { @@ -193,6 +195,11 @@ pub mod registration_client { } } } + impl std::fmt::Debug for RegistrationClient { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "RegistrationClient {{ ... }}") + } + } } #[doc = r" Generated client implementations."] pub mod device_plugin_client { @@ -311,6 +318,11 @@ pub mod device_plugin_client { } } } + impl std::fmt::Debug for DevicePluginClient { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "DevicePluginClient {{ ... }}") + } + } } #[doc = r" Generated server implementations."] pub mod registration_server { @@ -331,7 +343,6 @@ pub mod registration_server { #[doc = " Kubelet or the registered resourceName is already taken by another"] #[doc = " active device plugin. Device plugin is expected to terminate upon registration failure"] #[derive(Debug)] - #[doc(hidden)] pub struct RegistrationServer { inner: _Inner, } @@ -348,17 +359,23 @@ pub mod registration_server { Self { inner } } } - impl Service> for RegistrationServer { + impl Service> for RegistrationServer + where + T: Registration, + B: HttpBody + Send + Sync + 'static, + B::Error: Into + Send + 'static, + { type Response = http::Response; type Error = Never; type Future = BoxFuture; fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) } - fn call(&mut self, req: http::Request) -> Self::Future { + fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/v1beta1.Registration/Register" => { + #[allow(non_camel_case_types)] struct RegisterSvc(pub Arc); impl tonic::server::UnaryService for RegisterSvc { type Response = super::Empty; @@ -368,7 +385,7 @@ pub mod registration_server { request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); - let fut = async move { inner.register(request).await }; + let fut = async move { (*inner).register(request).await }; Box::pin(fut) } } @@ -392,6 +409,7 @@ pub mod registration_server { Ok(http::Response::builder() .status(200) .header("grpc-status", "12") + .header("content-type", "application/grpc") .body(tonic::body::BoxBody::empty()) .unwrap()) }), @@ -432,7 +450,7 @@ pub mod device_plugin_server { request: tonic::Request, ) -> Result, tonic::Status>; #[doc = "Server streaming response type for the ListAndWatch method."] - type ListAndWatchStream: Stream> + type ListAndWatchStream: futures_core::Stream> + Send + Sync + 'static; @@ -460,7 +478,6 @@ pub mod device_plugin_server { } #[doc = " DevicePlugin is the service advertised by Device Plugins"] #[derive(Debug)] - #[doc(hidden)] pub struct DevicePluginServer { inner: _Inner, } @@ -477,24 +494,31 @@ pub mod device_plugin_server { Self { inner } } } - impl Service> for DevicePluginServer { + impl Service> for DevicePluginServer + where + T: DevicePlugin, + B: HttpBody + Send + Sync + 'static, + B::Error: Into + Send + 'static, + { type Response = http::Response; type Error = Never; type Future = BoxFuture; fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) } - fn call(&mut self, req: http::Request) -> Self::Future { + fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/v1beta1.DevicePlugin/GetDevicePluginOptions" => { + #[allow(non_camel_case_types)] struct GetDevicePluginOptionsSvc(pub Arc); impl tonic::server::UnaryService for GetDevicePluginOptionsSvc { type Response = super::DevicePluginOptions; type Future = BoxFuture, tonic::Status>; fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = self.0.clone(); - let fut = async move { inner.get_device_plugin_options(request).await }; + let fut = + async move { (*inner).get_device_plugin_options(request).await }; Box::pin(fut) } } @@ -515,6 +539,7 @@ pub mod device_plugin_server { Box::pin(fut) } "/v1beta1.DevicePlugin/ListAndWatch" => { + #[allow(non_camel_case_types)] struct ListAndWatchSvc(pub Arc); impl tonic::server::ServerStreamingService for ListAndWatchSvc { type Response = super::ListAndWatchResponse; @@ -523,7 +548,7 @@ pub mod device_plugin_server { BoxFuture, tonic::Status>; fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = self.0.clone(); - let fut = async move { inner.list_and_watch(request).await }; + let fut = async move { (*inner).list_and_watch(request).await }; Box::pin(fut) } } @@ -544,6 +569,7 @@ pub mod device_plugin_server { Box::pin(fut) } "/v1beta1.DevicePlugin/Allocate" => { + #[allow(non_camel_case_types)] struct AllocateSvc(pub Arc); impl tonic::server::UnaryService for AllocateSvc { type Response = super::AllocateResponse; @@ -553,7 +579,7 @@ pub mod device_plugin_server { request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); - let fut = async move { inner.allocate(request).await }; + let fut = async move { (*inner).allocate(request).await }; Box::pin(fut) } } @@ -574,6 +600,7 @@ pub mod device_plugin_server { Box::pin(fut) } "/v1beta1.DevicePlugin/PreStartContainer" => { + #[allow(non_camel_case_types)] struct PreStartContainerSvc(pub Arc); impl tonic::server::UnaryService @@ -586,7 +613,7 @@ pub mod device_plugin_server { request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); - let fut = async move { inner.pre_start_container(request).await }; + let fut = async move { (*inner).pre_start_container(request).await }; Box::pin(fut) } } @@ -610,6 +637,7 @@ pub mod device_plugin_server { Ok(http::Response::builder() .status(200) .header("grpc-status", "12") + .header("content-type", "application/grpc") .body(tonic::body::BoxBody::empty()) .unwrap()) }), diff --git a/controller/Cargo.toml b/controller/Cargo.toml index 988d0d33b..f61ccdb19 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -14,8 +14,9 @@ chrono = "0.4.10" env_logger = "0.8.3" futures = "0.3.1" anyhow = "1.0.38" -kube = { version = "0.23.0", features = ["openapi"] } -k8s-openapi = { version = "0.6.0", features = ["v1_16"] } +kube = { version = "0.57.0", features = ["derive"] } +kube-runtime = "0.57.0" +k8s-openapi = { version = "0.12.0", default-features = false, features = ["v1_16"] } lazy_static = "1.4" log = "0.4" prometheus = { version = "0.12.0", features = ["process"] } @@ -23,7 +24,7 @@ serde = "1.0.104" serde_derive = "1.0.104" serde_json = "1.0.45" serde_yaml = "0.8.11" -tokio = { version = "0.2", features = ["full"] } +tokio = { version = "1.0.2", features = ["full"] } [dev-dependencies] -mockall = "0.9.0" \ No newline at end of file +mockall = "0.9.0" diff --git a/controller/src/util/instance_action.rs b/controller/src/util/instance_action.rs index 4f46b276b..1764177ce 100644 --- a/controller/src/util/instance_action.rs +++ b/controller/src/util/instance_action.rs @@ -2,7 +2,7 @@ use super::super::BROKER_POD_COUNT_METRIC; use super::{pod_action::PodAction, pod_action::PodActionInfo}; use akri_shared::{ akri::{ - configuration::KubeAkriConfig, instance::KubeAkriInstance, AKRI_PREFIX, API_INSTANCES, + configuration::Configuration, instance::Instance, AKRI_PREFIX, API_INSTANCES, API_NAMESPACE, API_VERSION, }, k8s, @@ -13,9 +13,9 @@ use akri_shared::{ }, }; use async_std::sync::Mutex; -use futures::StreamExt; -use k8s_openapi::api::core::v1::{PodSpec, PodStatus}; -use kube::api::{Informer, Object, RawApi, WatchEvent}; +use futures::{StreamExt, TryStreamExt}; +use k8s_openapi::api::core::v1::Pod; +use kube::api::{Api, ListParams, Object, WatchEvent}; use log::{error, info, trace}; use std::collections::HashMap; use std::sync::Arc; @@ -43,7 +43,7 @@ pub enum InstanceAction { /// This invokes an internal method that watches for Instance events pub async fn handle_existing_instances( ) -> Result<(), Box> { - internal_handle_existing_instances(&k8s::create_kube_interface()).await + internal_handle_existing_instances(&k8s::KubeImpl::new().await?).await } /// This invokes an internal method that watches for Instance events @@ -51,7 +51,7 @@ pub async fn do_instance_watch( synchronization: Arc>, ) -> Result<(), Box> { // Watch for instance changes - internal_do_instance_watch(&synchronization, &k8s::create_kube_interface()).await + internal_do_instance_watch(&synchronization, &k8s::KubeImpl::new().await?).await } /// This invokes an internal method that watches for Instance events @@ -64,7 +64,7 @@ async fn internal_handle_existing_instances( let pre_existing_instances = kube_interface.get_instances().await?; for instance in pre_existing_instances { tasks.push(tokio::spawn(async move { - let inner_kube_interface = k8s::create_kube_interface(); + let inner_kube_interface = k8s::KubeImpl::new().await.unwrap(); handle_instance_change(&instance, &InstanceAction::Update, &inner_kube_interface) .await .unwrap(); @@ -80,25 +80,19 @@ async fn internal_do_instance_watch( kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("internal_do_instance_watch - enter"); - let akri_instance_type = RawApi::customResource(API_INSTANCES) - .group(API_NAMESPACE) - .version(API_VERSION); - - let informer = Informer::raw(kube_interface.get_kube_client(), akri_instance_type) - .init() - .await?; + let instances_api = Api::::all(kube_interface.get_kube_client()); loop { - let mut instances = informer.poll().await?.boxed(); + let mut stream = instances_api.watch(&ListParams::default(), API_VERSION).await?.boxed(); // Currently, this does not handle None except to break the // while. - while let Some(event) = instances.next().await { + while let Some(status) = stream.try_next().await? { // Aquire lock to ensure cleanup_instance_and_configuration_svcs and the // inner loop handle_instance call in internal_do_instance_watch // cannot execute at the same time. let _lock = synchronization.lock().await; trace!("internal_do_instance_watch - aquired sync lock"); - handle_instance(event?, kube_interface).await?; + handle_instance(status, kube_interface).await?; } } } @@ -106,14 +100,14 @@ async fn internal_do_instance_watch( /// This takes an event off the Instance stream and delegates it to the /// correct function based on the event type. async fn handle_instance( - event: WatchEvent, + event: WatchEvent, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_instance - enter"); match event { WatchEvent::Added(instance) => { info!( - "handle_instance - added Akri Instance {}: {:?}", + "handle_instance - added Akri Instance {:?}: {:?}", instance.metadata.name, instance.spec ); handle_instance_change(&instance, &InstanceAction::Add, kube_interface).await?; @@ -121,7 +115,7 @@ async fn handle_instance( } WatchEvent::Deleted(instance) => { info!( - "handle_instance - deleted Akri Instance {}: {:?}", + "handle_instance - deleted Akri Instance {:?}: {:?}", instance.metadata.name, instance.spec ); handle_instance_change(&instance, &InstanceAction::Remove, kube_interface).await?; @@ -129,7 +123,7 @@ async fn handle_instance( } WatchEvent::Modified(instance) => { info!( - "handle_instance - modified Akri Instance {}: {:?}", + "handle_instance - modified Akri Instance {:?}: {:?}", instance.metadata.name, instance.spec ); handle_instance_change(&instance, &InstanceAction::Update, kube_interface).await?; @@ -162,13 +156,13 @@ struct PodContext { /// the Instance event action. If this method has enough information, /// it will update the nodes_to_act_on map with the required action. fn determine_action_for_pod( - k8s_pod: &Object, + k8s_pod: &Pod, action: &InstanceAction, nodes_to_act_on: &mut HashMap, ) { if k8s_pod.status.is_none() { error!( - "determine_action_for_pod - no pod status found for {}", + "determine_action_for_pod - no pod status found for {:?}", &k8s_pod.metadata.name ); return; @@ -176,7 +170,7 @@ fn determine_action_for_pod( if k8s_pod.status.as_ref().unwrap().phase.is_none() { error!( - "determine_action_for_pod - no pod phase found for {}", + "determine_action_for_pod - no pod phase found for {:?}", &k8s_pod.metadata.name ); return; @@ -192,7 +186,7 @@ fn determine_action_for_pod( .is_none() { error!( - "determine_action_for_pod - no {} label found for {}", + "determine_action_for_pod - no {} label found for {:?}", AKRI_TARGET_NODE_LABEL_NAME, &k8s_pod.metadata.name ); return; @@ -212,7 +206,7 @@ fn determine_action_for_pod( .is_none() { error!( - "determine_action_for_pod - no {} label found for {}", + "determine_action_for_pod - no {} label found for {:?}", AKRI_INSTANCE_LABEL_NAME, &k8s_pod.metadata.name ); return; @@ -234,7 +228,7 @@ fn determine_action_for_pod( instance_action: action.clone(), status_start_time: pod_start_time, unknown_node: !nodes_to_act_on.contains_key(node_to_run_pod_on), - trace_node_name: k8s_pod.metadata.name.clone(), + trace_node_name: k8s_pod.metadata.name.clone().unwrap(), }; update_pod_context.action = match pod_action_info.select_pod_action() { Ok(action) => action, @@ -356,7 +350,7 @@ async fn handle_addition_work( instance_class_name: &str, instance_shared: bool, new_node: &str, - instance_configuration: &KubeAkriConfig, + instance_configuration: &Configuration, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!( @@ -399,13 +393,13 @@ async fn handle_addition_work( /// disappearances, starting broker Pods/Services that are missing, /// and stopping Pods/Services that are no longer needed. pub async fn handle_instance_change( - instance: &KubeAkriInstance, + instance: &Instance, action: &InstanceAction, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_instance_change - enter {:?}", action); - let instance_name = instance.metadata.name.clone(); + let instance_name = instance.metadata.name.clone().unwrap(); let instance_namespace = instance.metadata.namespace.as_ref().ok_or(format!( "Namespace not found for instance: {}", &instance_name @@ -511,7 +505,7 @@ pub async fn handle_instance_change( // Furthermore, Akri Agent is still modifying the Instances. This should not happen beacuse Agent // is designed to shutdown when it's Configuration watcher fails. error!( - "handle_instance_change - no configuration found for {} yet instance {} exists - check that device plugin is running propertly", + "handle_instance_change - no configuration found for {:?} yet instance {:?} exists - check that device plugin is running propertly", &instance.spec.configuration_name, &instance.metadata.name ); return Ok(()); @@ -552,7 +546,7 @@ mod handle_instance_tests { use super::super::shared_test_utils::config_for_tests::PodList; use super::*; use akri_shared::{ - akri::instance::KubeAkriInstance, + akri::instance::Instance, k8s::{pod::AKRI_INSTANCE_LABEL_NAME, MockKubeInterface}, os::file, }; @@ -789,7 +783,7 @@ mod handle_instance_tests { ) { trace!("run_handle_instance_change_test enter"); let instance_json = file::read_file_to_string(instance_file); - let instance: KubeAkriInstance = serde_json::from_str(&instance_json).unwrap(); + let instance: Instance = serde_json::from_str(&instance_json).unwrap(); handle_instance( match action { InstanceAction::Add => WatchEvent::Added(instance), @@ -948,7 +942,7 @@ mod handle_instance_tests { let deleted_node = "node-b"; let instance_file = "../test/json/shared-instance-update.json"; let instance_json = file::read_file_to_string(instance_file); - let kube_object_instance: KubeAkriInstance = serde_json::from_str(&instance_json).unwrap(); + let kube_object_instance: Instance = serde_json::from_str(&instance_json).unwrap(); let mut instance = kube_object_instance.spec; instance.nodes = instance .nodes diff --git a/controller/src/util/node_watcher.rs b/controller/src/util/node_watcher.rs index 889afd99e..e442c6450 100644 --- a/controller/src/util/node_watcher.rs +++ b/controller/src/util/node_watcher.rs @@ -1,19 +1,18 @@ use akri_shared::{ akri::{ - instance::{Instance, KubeAkriInstance}, + instance::{Instance, InstanceSpec}, + NODE_VERSION, retry::{random_delay, MAX_INSTANCE_UPDATE_TRIES}, }, k8s, k8s::KubeInterface, }; use futures::StreamExt; -use k8s_openapi::api::core::v1::{NodeSpec, NodeStatus}; -use kube::api::{Api, Informer, Object, WatchEvent}; +use k8s_openapi::api::core::v1::{Node, NodeStatus}; +use kube::api::{Api, ListParams, WatchEvent}; use log::trace; use std::collections::HashMap; -type NodeObject = Object; - /// Node states that NodeWatcher is interested in /// /// NodeState describes the various states that the controller can @@ -54,12 +53,11 @@ impl NodeWatcher { &mut self, ) -> Result<(), Box> { trace!("watch - enter"); - let kube_interface = k8s::create_kube_interface(); - let resource = Api::v1Node(kube_interface.get_kube_client()); - let inf = Informer::new(resource.clone()).init().await?; + let kube_interface = k8s::KubeImpl::new().await?; + let nodes_api = Api::::all(kube_interface.get_kube_client()); loop { - let mut nodes = inf.poll().await?.boxed(); + let mut nodes = nodes_api.watch(&ListParams::default(), NODE_VERSION).await?.boxed(); // Currently, this does not handle None except to break the // while. @@ -89,7 +87,7 @@ impl NodeWatcher { /// non-Running Node. async fn handle_node( &mut self, - event: WatchEvent, + event: WatchEvent, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_node - enter"); @@ -98,10 +96,10 @@ impl NodeWatcher { trace!("handle_node - Added: {:?}", &node.metadata.name); if self.is_node_ready(&node) { self.known_nodes - .insert(node.metadata.name, NodeState::Running); + .insert(node.metadata.name.unwrap(), NodeState::Running); } else { self.known_nodes - .insert(node.metadata.name, NodeState::Known); + .insert(node.metadata.name.unwrap(), NodeState::Known); } } WatchEvent::Modified(node) => { @@ -113,7 +111,7 @@ impl NodeWatcher { ); if self.is_node_ready(&node) { self.known_nodes - .insert(node.metadata.name.clone(), NodeState::Running); + .insert(node.metadata.name.unwrap(), NodeState::Running); } else { self.call_handle_node_disappearance_if_needed(&node, kube_interface) .await?; @@ -136,16 +134,17 @@ impl NodeWatcher { /// only once for any Node as it disappears. async fn call_handle_node_disappearance_if_needed( &mut self, - node: &NodeObject, + node: &Node, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { + let node_name = node.metadata.name.clone().unwrap(); trace!( "call_handle_node_disappearance_if_needed - enter: {:?}", &node.metadata.name ); let last_known_state = self .known_nodes - .get(&node.metadata.name) + .get(&node_name) .unwrap_or(&NodeState::Running); trace!( "call_handle_node_disappearance_if_needed - last_known_state: {:?}", @@ -161,24 +160,22 @@ impl NodeWatcher { "call_handle_node_disappearance_if_needed - call handle_node_disappearance: {:?}", &node.metadata.name ); - self.handle_node_disappearance(&node.metadata.name, kube_interface) + self.handle_node_disappearance(&node_name, kube_interface) .await?; self.known_nodes - .insert(node.metadata.name.clone(), NodeState::InstancesCleaned); + .insert(node_name, NodeState::InstancesCleaned); } Ok(()) } /// This determines if a node is in the Ready state. - fn is_node_ready(&self, k8s_node: &NodeObject) -> bool { + fn is_node_ready(&self, k8s_node: &Node) -> bool { trace!("is_node_ready - for node {:?}", k8s_node.metadata.name); k8s_node .status .as_ref() .unwrap_or(&NodeStatus::default()) .conditions - .as_ref() - .unwrap_or(&Vec::new()) .iter() .filter_map(|condition| { if condition.type_ == "Ready" { @@ -200,7 +197,7 @@ impl NodeWatcher { &self, vanished_node_name: &str, kube_interface: &impl KubeInterface, - ) -> Result<(), Box> { + ) -> Result<(), anyhow::Error> { trace!( "handle_node_disappearance - enter vanished_node_name={:?}", vanished_node_name, @@ -212,11 +209,11 @@ impl NodeWatcher { instances.items.len() ); for instance in instances.items { - let instance_name = instance.metadata.name.clone(); - let instance_namespace = instance.metadata.namespace.as_ref().ok_or(format!( - "Namespace not found for instance: {}", + let instance_name = instance.metadata.name.clone().unwrap(); + let instance_namespace = instance.metadata.namespace.as_ref().ok_or(anyhow::Error::msg(format!( + "Namespace not found for instance: {:?}", instance_name - ))?; + )))?; trace!( "handle_node_disappearance - make sure node is not referenced here: {:?}", @@ -270,9 +267,9 @@ impl NodeWatcher { vanished_node_name: &str, instance_name: &str, instance_namespace: &str, - instance: &KubeAkriInstance, + instance: &Instance, kube_interface: &impl KubeInterface, - ) -> Result<(), Box> { + ) -> Result<(), anyhow::Error> { trace!( "try_remove_nodes_from_instance - vanished_node_name: {:?}", &vanished_node_name @@ -302,7 +299,7 @@ impl NodeWatcher { .collect::>(); // Save the instance - let modified_instance = Instance { + let modified_instance = InstanceSpec { configuration_name: instance.spec.configuration_name.clone(), broker_properties: instance.spec.broker_properties.clone(), shared: instance.spec.shared, @@ -331,7 +328,7 @@ mod tests { #[derive(Clone)] struct UpdateInstance { - instance_to_update: Instance, + instance_to_update: InstanceSpec, instance_name: &'static str, instance_namespace: &'static str, } @@ -368,7 +365,7 @@ mod tests { async fn test_handle_node_added_unready() { let _ = env_logger::builder().is_test(true).try_init(); let node_json = file::read_file_to_string("../test/json/node-a-not-ready.json"); - let node: NodeObject = serde_json::from_str(&node_json).unwrap(); + let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); node_watcher .handle_node(WatchEvent::Added(node), &MockKubeInterface::new()) @@ -388,7 +385,7 @@ mod tests { let _ = env_logger::builder().is_test(true).try_init(); let node_json = file::read_file_to_string("../test/json/node-a.json"); - let node: NodeObject = serde_json::from_str(&node_json).unwrap(); + let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); node_watcher .handle_node(WatchEvent::Added(node), &MockKubeInterface::new()) @@ -408,12 +405,12 @@ mod tests { let _ = env_logger::builder().is_test(true).try_init(); let node_json = file::read_file_to_string("../test/json/node-b-not-ready.json"); - let node: NodeObject = serde_json::from_str(&node_json).unwrap(); + let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); let instance_file = "../test/json/shared-instance-update.json"; let instance_json = file::read_file_to_string(instance_file); - let kube_object_instance: KubeAkriInstance = serde_json::from_str(&instance_json).unwrap(); + let kube_object_instance: Instance = serde_json::from_str(&instance_json).unwrap(); let mut instance = kube_object_instance.spec; instance.nodes.clear(); instance @@ -452,7 +449,7 @@ mod tests { let _ = env_logger::builder().is_test(true).try_init(); let node_json = file::read_file_to_string("../test/json/node-b.json"); - let node: NodeObject = serde_json::from_str(&node_json).unwrap(); + let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); let mock = MockKubeInterface::new(); @@ -474,12 +471,12 @@ mod tests { let _ = env_logger::builder().is_test(true).try_init(); let node_json = file::read_file_to_string("../test/json/node-b-not-ready.json"); - let node: NodeObject = serde_json::from_str(&node_json).unwrap(); + let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); let instance_file = "../test/json/shared-instance-update.json"; let instance_json = file::read_file_to_string(instance_file); - let kube_object_instance: KubeAkriInstance = serde_json::from_str(&instance_json).unwrap(); + let kube_object_instance: Instance = serde_json::from_str(&instance_json).unwrap(); let mut instance = kube_object_instance.spec; instance.nodes.clear(); instance @@ -544,14 +541,14 @@ mod tests { mock.expect_update_instance() .times(MAX_INSTANCE_UPDATE_TRIES as usize) .withf(move |_instance, n, ns| n == "config-a-359973" && ns == "config-a-namespace") - .returning(move |_, _, _| Err(None.ok_or("failure")?)); + .returning(move |_, _, _| Err(None.ok_or(anyhow::anyhow!("failure"))?)); mock.expect_find_instance() .times((MAX_INSTANCE_UPDATE_TRIES - 1) as usize) .withf(move |n, ns| n == "config-a-359973" && ns == "config-a-namespace") .returning(move |_, _| { let instance_file = "../test/json/shared-instance-update.json"; let instance_json = file::read_file_to_string(instance_file); - let instance: KubeAkriInstance = serde_json::from_str(&instance_json).unwrap(); + let instance: Instance = serde_json::from_str(&instance_json).unwrap(); Ok(instance) }); @@ -568,7 +565,7 @@ mod tests { let instance_file = "../test/json/shared-instance-update.json"; let instance_json = file::read_file_to_string(instance_file); - let kube_object_instance: KubeAkriInstance = serde_json::from_str(&instance_json).unwrap(); + let kube_object_instance: Instance = serde_json::from_str(&instance_json).unwrap(); let mut mock = MockKubeInterface::new(); mock.expect_update_instance() @@ -625,7 +622,7 @@ mod tests { ); let node_json = file::read_file_to_string(node_file); - let kube_object_node: Object = + let kube_object_node: Node = serde_json::from_str(&node_json).unwrap(); let node_watcher = NodeWatcher::new(); diff --git a/controller/src/util/pod_watcher.rs b/controller/src/util/pod_watcher.rs index 630fc3ef0..d6dbf6559 100644 --- a/controller/src/util/pod_watcher.rs +++ b/controller/src/util/pod_watcher.rs @@ -1,6 +1,6 @@ use akri_shared::{ akri::{ - configuration::KubeAkriConfig, + configuration::Configuration, retry::{random_delay, MAX_INSTANCE_UPDATE_TRIES}, }, k8s, @@ -12,14 +12,14 @@ use akri_shared::{ }, }; use async_std::sync::Mutex; -use futures::StreamExt; -use k8s_openapi::api::core::v1::{PodSpec, PodStatus, ServiceSpec}; -use kube::api::{Api, Informer, Object, WatchEvent}; +use futures::{StreamExt, TryStreamExt}; +use k8s_openapi::api::core::v1::{Pod, ServiceSpec}; +use kube::api::{Api, ListParams, WatchEvent}; +use kube_runtime::watcher::{watcher, Event}; use log::trace; use std::{collections::HashMap, sync::Arc}; -type PodObject = Object; -type PodSlice = [PodObject]; +type PodSlice = [Pod]; /// Pod states that BrokerPodWatcher is interested in /// @@ -80,28 +80,24 @@ impl BrokerPodWatcher { &mut self, ) -> Result<(), Box> { trace!("watch - enter"); - let kube_interface = k8s::create_kube_interface(); - let resource = Api::v1Pod(kube_interface.get_kube_client()); - let informer = Informer::new(resource.clone()) - .labels(AKRI_TARGET_NODE_LABEL_NAME) - .init() - .await?; + let kube_interface = k8s::KubeImpl::new().await?; + let resource = Api::::all(kube_interface.get_kube_client()); + let watcher = watcher(resource, ListParams::default().labels(AKRI_TARGET_NODE_LABEL_NAME)); + let mut informer = watcher.boxed(); let synchronization = Arc::new(Mutex::new(())); loop { - let mut pods = informer.poll().await?.boxed(); - // Currently, this does not handle None except to break the // while. - while let Some(event) = pods.next().await { + while let Some(event) = informer.try_next().await? { let _lock = synchronization.lock().await; - self.handle_pod(event?, &kube_interface).await?; + self.handle_pod(event, &kube_interface).await?; } } } /// Gets Pods phase and returns "Unknown" if no phase exists - fn get_pod_phase(&mut self, pod: &PodObject) -> String { + fn get_pod_phase(&mut self, pod: &Pod) -> String { if pod.status.is_some() { pod.status .as_ref() @@ -120,7 +116,7 @@ impl BrokerPodWatcher { /// ensure that the instance and configuration services are removed as needed. async fn handle_pod( &mut self, - event: WatchEvent, + event: Event, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_pod - enter [event: {:?}]", event); @@ -163,7 +159,7 @@ impl BrokerPodWatcher { /// any Pod as it exits the Running phase. async fn handle_running_pod_if_needed( &mut self, - pod: &PodObject, + pod: &Pod, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_running_pod_if_needed - enter"); @@ -189,7 +185,7 @@ impl BrokerPodWatcher { /// expected and accepted. async fn handle_ended_pod_if_needed( &mut self, - pod: &PodObject, + pod: &Pod, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_ended_pod_if_needed - enter"); @@ -215,7 +211,7 @@ impl BrokerPodWatcher { /// expected and accepted. async fn handle_deleted_pod_if_needed( &mut self, - pod: &PodObject, + pod: &Pod, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_deleted_pod_if_needed - enter"); @@ -239,7 +235,7 @@ impl BrokerPodWatcher { /// error if the annotations are not found. fn get_instance_and_configuration_from_pod( &self, - pod: &PodObject, + pod: &Pod, ) -> Result<(String, String), Box> { trace!("get_instance_and_configuration_from_pod - enter"); let instance_id = pod @@ -260,7 +256,7 @@ impl BrokerPodWatcher { /// supported by Running broker Pods. async fn handle_non_running_pod( &self, - pod: &PodObject, + pod: &Pod, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_non_running_pod - enter"); @@ -386,7 +382,7 @@ impl BrokerPodWatcher { /// by the configuration. async fn handle_running_pod( &self, - pod: &PodObject, + pod: &Pod, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_running_pod - enter"); @@ -515,7 +511,7 @@ impl BrokerPodWatcher { instance_uid: &str, namespace: &str, configuration_name: &str, - configuration: &KubeAkriConfig, + configuration: &Configuration, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!( @@ -1150,8 +1146,8 @@ mod tests { async fn test_create_or_update_service_successful_update() { let _ = env_logger::builder().is_test(true).try_init(); - let dcc_json = file::read_file_to_string("../test/json/config-a.json"); - let dcc: KubeAkriConfig = serde_json::from_str(&dcc_json).unwrap(); + let config_json = file::read_file_to_string("../test/json/config-a.json"); + let config: Configuration = serde_json::from_str(&config_json).unwrap(); let pod_watcher = BrokerPodWatcher::new(); let mut mock = MockKubeInterface::new(); @@ -1180,7 +1176,7 @@ mod tests { AKRI_INSTANCE_LABEL_NAME, "config-a-b494b6", ownership, - &dcc.spec.instance_service_spec.unwrap().clone(), + &config.spec.instance_service_spec.unwrap().clone(), true, &mock, ) @@ -1192,8 +1188,8 @@ mod tests { async fn test_create_or_update_service_failed_update() { let _ = env_logger::builder().is_test(true).try_init(); - let dcc_json = file::read_file_to_string("../test/json/config-a.json"); - let dcc: KubeAkriConfig = serde_json::from_str(&dcc_json).unwrap(); + let config_json = file::read_file_to_string("../test/json/config-a.json"); + let config: Configuration = serde_json::from_str(&config_json).unwrap(); let pod_watcher = BrokerPodWatcher::new(); let mut mock = MockKubeInterface::new(); @@ -1223,7 +1219,7 @@ mod tests { AKRI_INSTANCE_LABEL_NAME, "config-a-b494b6", ownership, - &dcc.spec.instance_service_spec.unwrap().clone(), + &config.spec.instance_service_spec.unwrap().clone(), true, &mock ) @@ -1235,8 +1231,8 @@ mod tests { async fn test_create_or_update_service_successful_create() { let _ = env_logger::builder().is_test(true).try_init(); - let dcc_json = file::read_file_to_string("../test/json/config-a.json"); - let dcc: KubeAkriConfig = serde_json::from_str(&dcc_json).unwrap(); + let config_json = file::read_file_to_string("../test/json/config-a.json"); + let config: Configuration = serde_json::from_str(&config_json).unwrap(); let pod_watcher = BrokerPodWatcher::new(); let mut mock = MockKubeInterface::new(); @@ -1267,7 +1263,7 @@ mod tests { AKRI_INSTANCE_LABEL_NAME, "config-a-b494b6", ownership, - &dcc.spec.instance_service_spec.unwrap().clone(), + &config.spec.instance_service_spec.unwrap().clone(), true, &mock, ) @@ -1279,8 +1275,8 @@ mod tests { async fn test_create_or_update_service_failed_create() { let _ = env_logger::builder().is_test(true).try_init(); - let dcc_json = file::read_file_to_string("../test/json/config-a.json"); - let dcc: KubeAkriConfig = serde_json::from_str(&dcc_json).unwrap(); + let config_json = file::read_file_to_string("../test/json/config-a.json"); + let config: Configuration = serde_json::from_str(&config_json).unwrap(); let pod_watcher = BrokerPodWatcher::new(); let mut mock = MockKubeInterface::new(); @@ -1307,7 +1303,7 @@ mod tests { AKRI_INSTANCE_LABEL_NAME, "config-a-b494b6", ownership, - &dcc.spec.instance_service_spec.unwrap().clone(), + &config.spec.instance_service_spec.unwrap().clone(), true, &mock ) diff --git a/controller/src/util/shared_test_utils.rs b/controller/src/util/shared_test_utils.rs index 44654c780..1fe4e7996 100644 --- a/controller/src/util/shared_test_utils.rs +++ b/controller/src/util/shared_test_utils.rs @@ -2,20 +2,18 @@ pub mod config_for_tests { use akri_shared::{ akri::{ - configuration::KubeAkriConfig, - instance::{Instance, KubeAkriInstance, KubeAkriInstanceList}, + configuration::Configuration, + instance::{Instance, InstanceSpec, KubeAkriInstanceList}, }, k8s::MockKubeInterface, os::file, }; - use k8s_openapi::api::core::v1::{PodSpec, PodStatus, ServiceSpec, ServiceStatus}; - use kube::api::{Object, ObjectList}; + use k8s_openapi::api::core::v1::{Pod, Service}; + use kube::api::ObjectList; use log::trace; - pub type PodObject = Object; - pub type PodList = ObjectList; - pub type ServiceObject = Object; - pub type ServiceList = ObjectList; + pub type PodList = ObjectList; + pub type ServiceList = ObjectList; pub fn configure_find_instance( mock: &mut MockKubeInterface, @@ -31,15 +29,15 @@ pub mod config_for_tests { .returning(move |_, _| { if result_error { // Return error that instance could not be found - Err(kube::Error::Api(kube::ErrorResponse { + Err(anyhow::anyhow!(kube::Error::Api(kube::error::ErrorResponse { status: "Failure".to_string(), message: "instances.akri.sh \"akri-blah-901a7b\" not found".to_string(), reason: "NotFound".to_string(), code: akri_shared::k8s::ERROR_NOT_FOUND, - })) + }))) } else { let dci_json = file::read_file_to_string(result_file); - let dci: KubeAkriInstance = serde_json::from_str(&dci_json).unwrap(); + let dci: Instance = serde_json::from_str(&dci_json).unwrap(); Ok(dci) } }); @@ -81,7 +79,7 @@ pub mod config_for_tests { pub fn configure_update_instance( mock: &mut MockKubeInterface, - instance_to_update: Instance, + instance_to_update: InstanceSpec, instance_name: &'static str, instance_namespace: &'static str, result_error: bool, @@ -102,7 +100,7 @@ pub mod config_for_tests { }) .returning(move |_, _, _| { if result_error { - Err(None.ok_or("failure")?) + Err(None.ok_or(anyhow::anyhow!("failure"))?) } else { Ok(()) } @@ -122,11 +120,11 @@ pub mod config_for_tests { .withf(move |name, namespace| name == config_name && namespace == config_namespace) .returning(move |_, _| { if result_error { - Err(None.ok_or("failure")?) + Err(None.ok_or(anyhow::anyhow!("failure"))?) } else { - let dcc_json = file::read_file_to_string(result_file); - let dcc: KubeAkriConfig = serde_json::from_str(&dcc_json).unwrap(); - Ok(dcc) + let config_json = file::read_file_to_string(result_file); + let config: Configuration = serde_json::from_str(&config_json).unwrap(); + Ok(config) } }); } @@ -143,7 +141,7 @@ pub mod config_for_tests { .withf(move |selector| selector == svc_selector) .returning(move |_| { if result_error { - Err(None.ok_or("failure")?) + Err(None.ok_or(anyhow::anyhow!("failure"))?) } else { let svcs_json = file::read_file_to_string(result_file); let svcs: ServiceList = serde_json::from_str(&svcs_json).unwrap(); @@ -169,19 +167,13 @@ pub mod config_for_tests { .withf(move |svc_to_create, ns| { svc_to_create .metadata - .as_ref() - .unwrap() .name .as_ref() .unwrap() == svc_name && svc_to_create .metadata - .as_ref() - .unwrap() .labels - .as_ref() - .unwrap() .get(label_id) .unwrap() == label_value @@ -225,7 +217,7 @@ pub mod config_for_tests { .withf(move |_svc, name, namespace| name == svc_name && namespace == svc_namespace) .returning(move |_, _, _| { if result_error { - Err(None.ok_or("failure")?) + Err(None.ok_or(anyhow::anyhow!("failure"))?) } else { Ok(()) } @@ -247,7 +239,7 @@ pub mod config_for_tests { .withf(move |selector| selector == pod_selector) .returning(move |_| { if result_error { - Err(None.ok_or("failure")?) + Err(None.ok_or(anyhow::anyhow!("failure"))?) } else { let pods_json = file::read_file_to_string(result_file); let pods: PodList = serde_json::from_str(&pods_json).unwrap(); @@ -269,19 +261,13 @@ pub mod config_for_tests { .withf(move |pod_to_create, namespace| { pod_to_create .metadata - .as_ref() - .unwrap() .name .as_ref() .unwrap() == pod_name && pod_to_create .metadata - .as_ref() - .unwrap() .labels - .as_ref() - .unwrap() .get(label_id) .unwrap() == label_value diff --git a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml index 13875d094..080f00c45 100644 --- a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml @@ -11,4 +11,4 @@ akri-discovery-utils = { path = "../../discovery-utils" } akri-debug-echo = { path = "../../discovery-handlers/debug-echo" } env_logger = "0.8.3" log = "0.4" -tokio = { version = "0.2", features = ["rt-threaded", "sync", "time", "stream", "fs", "macros", "uds"] } +tokio = { version = "1.0" } diff --git a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml index 7e4cc75b4..37c08c27c 100644 --- a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml @@ -11,4 +11,4 @@ akri-discovery-utils = { path = "../../discovery-utils" } akri-onvif = { path = "../../discovery-handlers/onvif" } env_logger = "0.8.3" log = "0.4" -tokio = { version = "0.2", features = ["rt-threaded", "sync", "time", "stream", "fs", "macros", "uds"] } \ No newline at end of file +tokio = { version = "1.0" } \ No newline at end of file diff --git a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml index fe8d5dac0..877584eb5 100644 --- a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml @@ -11,4 +11,4 @@ akri-discovery-utils = { path = "../../discovery-utils" } akri-opcua = { path = "../../discovery-handlers/opcua" } env_logger = "0.8.3" log = "0.4" -tokio = { version = "0.2", features = ["rt-threaded", "sync", "time", "stream", "fs", "macros", "uds"] } \ No newline at end of file +tokio = { version = "1.0" } \ No newline at end of file diff --git a/discovery-handler-modules/udev-discovery-handler/Cargo.toml b/discovery-handler-modules/udev-discovery-handler/Cargo.toml index dafbc5f76..242d9ec9a 100644 --- a/discovery-handler-modules/udev-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/udev-discovery-handler/Cargo.toml @@ -11,4 +11,4 @@ akri-discovery-utils = { path = "../../discovery-utils" } akri-udev = { path = "../../discovery-handlers/udev" } env_logger = "0.8.3" log = "0.4" -tokio = { version = "0.2", features = ["rt-threaded", "sync", "time", "stream", "fs", "macros", "uds"] } +tokio = { version = "1.0" } diff --git a/discovery-handlers/debug-echo/Cargo.toml b/discovery-handlers/debug-echo/Cargo.toml index 09b8e9d37..95e370263 100644 --- a/discovery-handlers/debug-echo/Cargo.toml +++ b/discovery-handlers/debug-echo/Cargo.toml @@ -17,8 +17,9 @@ serde = "1.0.104" serde_json = "1.0.45" serde_yaml = "0.8.11" serde_derive = "1.0.104" -tokio = { version = "0.2", features = ["rt-threaded", "sync", "time", "stream", "fs", "macros", "uds"] } -tonic = {version = "0.1.0", features = ["tls"] } +tokio = { version = "1.0", features = ["time", "net", "sync"] } +tokio-stream = { version = "0.1", features = ["net"] } +tonic = { version = "0.4.0", features = ["tls"] } [dev-dependencies] akri-shared = { path = "../../shared" } \ No newline at end of file diff --git a/discovery-handlers/debug-echo/src/discovery_handler.rs b/discovery-handlers/debug-echo/src/discovery_handler.rs index a5be894c6..2c7e8fd54 100644 --- a/discovery-handlers/debug-echo/src/discovery_handler.rs +++ b/discovery-handlers/debug-echo/src/discovery_handler.rs @@ -8,7 +8,7 @@ use log::{error, info, trace}; use std::time::Duration; use std::{collections::HashMap, fs}; use tokio::sync::mpsc; -use tokio::time::delay_for; +use tokio::time::sleep; use tonic::{Response, Status}; // TODO: make this configurable @@ -55,7 +55,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { info!("discover - called for debug echo protocol"); let register_sender = self.register_sender.clone(); let discover_request = request.get_ref(); - let (mut discovered_devices_sender, discovered_devices_receiver) = + let (discovered_devices_sender, discovered_devices_receiver) = mpsc::channel(DISCOVERED_DEVICES_CHANNEL_CAPACITY); let discovery_handler_config: DebugEchoDiscoveryDetails = deserialize_discovery_details(&discover_request.discovery_details) @@ -86,7 +86,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { .await { error!("discover - for debugEcho failed to send discovery response with error {}", e); - if let Some(mut sender) = register_sender { + if let Some(sender) = register_sender { sender.send(()).await.unwrap(); } break; @@ -118,16 +118,16 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { { // TODO: consider re-registering here error!("discover - for debugEcho failed to send discovery response with error {}", e); - if let Some(mut sender) = register_sender { + if let Some(sender) = register_sender { sender.send(()).await.unwrap(); } break; } } - delay_for(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; + sleep(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; } }); - Ok(Response::new(discovered_devices_receiver)) + Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new(discovered_devices_receiver))) } } @@ -194,7 +194,7 @@ mod tests { .discover(discover_request) .await .unwrap() - .into_inner(); + .into_inner().into_inner(); let devices = stream.recv().await.unwrap().unwrap().devices; assert_eq!(1, devices.len()); assert_eq!(devices[0], device); diff --git a/discovery-handlers/onvif/Cargo.toml b/discovery-handlers/onvif/Cargo.toml index c2dcee6b9..f26229c89 100644 --- a/discovery-handlers/onvif/Cargo.toml +++ b/discovery-handlers/onvif/Cargo.toml @@ -22,8 +22,9 @@ serde_yaml = "0.8.11" serde_derive = "1.0.104" sxd-document = "0.3.0" sxd-xpath = "0.4.0" -tokio = { version = "0.2", features = ["rt-threaded", "sync", "time", "stream", "fs", "macros", "uds"] } -tonic = {version = "0.1.0", features = ["tls"] } +tokio = { version = "1.0", features = ["time", "net", "sync"] } +tokio-stream = { version = "0.1", features = ["net"] } +tonic = { version = "0.4.0", features = ["tls"] } uuid = { version = "0.8.1", features = ["v4"] } xml-rs = { version = "0.8.0" } yaserde = "0.6.0" diff --git a/discovery-handlers/onvif/src/discovery_handler.rs b/discovery-handlers/onvif/src/discovery_handler.rs index b6302105f..00bc10f1c 100644 --- a/discovery-handlers/onvif/src/discovery_handler.rs +++ b/discovery-handlers/onvif/src/discovery_handler.rs @@ -16,7 +16,7 @@ use akri_discovery_utils::{ use async_trait::async_trait; use log::{error, info, trace}; use std::{collections::HashMap, time::Duration}; -use tokio::{sync::mpsc, time::delay_for}; +use tokio::{sync::mpsc, time::sleep}; use tonic::{Response, Status}; // TODO: make this configurable @@ -130,10 +130,10 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { break; } } - delay_for(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; + sleep(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; } }); - Ok(Response::new(discovered_devices_receiver)) + Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new(discovered_devices_receiver))) } } diff --git a/discovery-handlers/onvif/src/discovery_impl.rs b/discovery-handlers/onvif/src/discovery_impl.rs index be8ef0d85..f2826e4b1 100644 --- a/discovery-handlers/onvif/src/discovery_impl.rs +++ b/discovery-handlers/onvif/src/discovery_impl.rs @@ -372,7 +372,7 @@ pub mod util { time::{Duration, SystemTime}, }; - #[tokio::test(core_threads = 2)] + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_timeout_for_simple_onvif_discover() { let _ = env_logger::builder().is_test(true).try_init(); diff --git a/discovery-handlers/opcua/Cargo.toml b/discovery-handlers/opcua/Cargo.toml index cfc8fafd5..65c6b9267 100644 --- a/discovery-handlers/opcua/Cargo.toml +++ b/discovery-handlers/opcua/Cargo.toml @@ -20,8 +20,9 @@ serde = "1.0.104" serde_json = "1.0.45" serde_yaml = "0.8.11" serde_derive = "1.0.1" -tokio = { version = "0.2", features = ["rt-threaded", "sync", "time", "stream", "fs", "macros", "uds"] } -tonic = {version = "0.1.0", features = ["tls"] } +tokio = { version = "1.0", features = ["time", "net", "sync"] } +tokio-stream = { version = "0.1", features = ["net"] } +tonic = { version = "0.4.0", features = ["tls"] } url = "2.2.0" [dev-dependencies] diff --git a/discovery-handlers/opcua/src/discovery_handler.rs b/discovery-handlers/opcua/src/discovery_handler.rs index a59f22132..138dd741e 100644 --- a/discovery-handlers/opcua/src/discovery_handler.rs +++ b/discovery-handlers/opcua/src/discovery_handler.rs @@ -13,7 +13,7 @@ use async_trait::async_trait; use log::{error, info, trace}; use std::time::Duration; use tokio::sync::mpsc; -use tokio::time::delay_for; +use tokio::time::sleep; use tonic::{Response, Status}; // TODO: make this configurable @@ -147,10 +147,10 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { break; } } - delay_for(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; + sleep(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; } }); - Ok(Response::new(discovered_devices_receiver)) + Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new(discovered_devices_receiver))) } } diff --git a/discovery-handlers/udev/Cargo.toml b/discovery-handlers/udev/Cargo.toml index 017a1bcdb..cc0315048 100644 --- a/discovery-handlers/udev/Cargo.toml +++ b/discovery-handlers/udev/Cargo.toml @@ -21,8 +21,9 @@ serde = "1.0.104" serde_json = "1.0.45" serde_yaml = "0.8.11" serde_derive = "1.0.104" -tokio = { version = "0.2", features = ["rt-threaded", "sync", "time", "stream", "fs", "macros", "uds"] } -tonic = {version = "0.1.0", features = ["tls"] } +tokio = { version = "1.0", features = ["time", "net", "sync"] } +tokio-stream = { version = "0.1", features = ["net"] } +tonic = { version = "0.4.0", features = ["tls"] } udev = "0.5" [dev-dependencies] diff --git a/discovery-handlers/udev/src/discovery_handler.rs b/discovery-handlers/udev/src/discovery_handler.rs index ee217f334..c38293024 100644 --- a/discovery-handlers/udev/src/discovery_handler.rs +++ b/discovery-handlers/udev/src/discovery_handler.rs @@ -12,7 +12,7 @@ use log::{error, info, trace}; use std::collections::HashSet; use std::time::Duration; use tokio::sync::mpsc; -use tokio::time::delay_for; +use tokio::time::sleep; use tonic::{Response, Status}; // TODO: make this configurable @@ -47,7 +47,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { info!("discover - called for udev protocol"); let register_sender = self.register_sender.clone(); let discover_request = request.get_ref(); - let (mut discovered_devices_sender, discovered_devices_receiver) = + let (discovered_devices_sender, discovered_devices_receiver) = mpsc::channel(DISCOVERED_DEVICES_CHANNEL_CAPACITY); let discovery_handler_config: UdevDiscoveryDetails = deserialize_discovery_details(&discover_request.discovery_details) @@ -112,16 +112,16 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { "discover - for udev failed to send discovery response with error {}", e ); - if let Some(mut sender) = register_sender { + if let Some(sender) = register_sender { sender.send(()).await.unwrap(); } break; } } - delay_for(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; + sleep(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; } }); - Ok(Response::new(discovered_devices_receiver)) + Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new(discovered_devices_receiver))) } } diff --git a/discovery-utils/Cargo.toml b/discovery-utils/Cargo.toml index 5a163fbf8..f2d16f3ce 100644 --- a/discovery-utils/Cargo.toml +++ b/discovery-utils/Cargo.toml @@ -7,19 +7,21 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -prost = "0.6" -tonic = { version = "0.1.0", features = ["tls"] } akri-shared = { path = "../shared" } +async-stream = "0.3" anyhow = "1.0.38" async-trait = { version = "0.1.0", optional = true } futures = { version = "0.3.1", package = "futures" } log = "0.4" +prost = "0.7" serde = "1.0" serde_derive = "1.0" serde_yaml = "0.8.11" tempfile = { version = "3.1.0", optional = true } -tokio = { version = "0.2", features = ["time", "net", "sync"] } -tower = "0.3" +tokio = { version = "1.0", features = ["time", "net", "sync"] } +tokio-stream = { version = "0.1", features = ["net"] } +tonic = { version = "0.4.0", features = ["tls"] } +tower = "0.4.4" [features] mock-discovery-handler = ["async-trait", "tempfile"] @@ -29,4 +31,4 @@ async-trait = "0.1.0" tempfile = "3.1.0" [build-dependencies] -tonic-build = "0.1.1" \ No newline at end of file +tonic-build = "0.4.0" \ No newline at end of file diff --git a/discovery-utils/src/discovery/mod.rs b/discovery-utils/src/discovery/mod.rs index 46e038ef0..25dbbbe79 100644 --- a/discovery-utils/src/discovery/mod.rs +++ b/discovery-utils/src/discovery/mod.rs @@ -2,7 +2,8 @@ pub mod v0; /// Definition of the DiscoverStream type expected for supported embedded Akri DiscoveryHandlers -pub type DiscoverStream = tokio::sync::mpsc::Receiver>; +pub type DiscoverStream = + tokio_stream::wrappers::ReceiverStream>; pub mod discovery_handler { use super::super::registration_client::{ @@ -117,7 +118,7 @@ pub mod mock_discovery_handler { &self, _: tonic::Request, ) -> Result, tonic::Status> { - let (mut discovered_devices_sender, discovered_devices_receiver) = + let (discovered_devices_sender, discovered_devices_receiver) = mpsc::channel(super::discovery_handler::DISCOVERED_DEVICES_CHANNEL_CAPACITY); let devices = self.devices.clone(); tokio::spawn(async move { @@ -132,7 +133,9 @@ pub mod mock_discovery_handler { "mock discovery handler error", )) } else { - Ok(tonic::Response::new(discovered_devices_receiver)) + Ok(tonic::Response::new( + tokio_stream::wrappers::ReceiverStream::new(discovered_devices_receiver), + )) } } } @@ -189,7 +192,7 @@ pub mod mock_discovery_handler { pub mod server { use super::v0::discovery_handler_server::{DiscoveryHandler, DiscoveryHandlerServer}; use akri_shared::uds::unix_stream; - use futures::stream::TryStreamExt; + use futures::TryFutureExt; use log::info; use std::path::Path; use tokio::net::UnixListener; @@ -221,10 +224,18 @@ pub mod server { tokio::fs::create_dir_all(Path::new(discovery_endpoint).parent().unwrap()).await?; // Delete socket if it already exists std::fs::remove_file(discovery_endpoint).unwrap_or(()); - let mut uds = UnixListener::bind(discovery_endpoint)?; + let incoming = { + let uds = UnixListener::bind(discovery_endpoint)?; + + async_stream::stream! { + while let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await { + yield item; + } + } + }; Server::builder() .add_service(DiscoveryHandlerServer::new(discovery_handler)) - .serve_with_incoming(uds.incoming().map_ok(unix_stream::UnixStream)) + .serve_with_incoming(incoming) .await?; std::fs::remove_file(discovery_endpoint).unwrap_or(()); } else { diff --git a/discovery-utils/src/discovery/v0.rs b/discovery-utils/src/discovery/v0.rs index 699178fa5..03c377332 100644 --- a/discovery-utils/src/discovery/v0.rs +++ b/discovery-utils/src/discovery/v0.rs @@ -3,10 +3,10 @@ pub struct RegisterDiscoveryHandlerRequest { /// Name of the `DiscoveryHandler`. This name is specified in an /// Akri Configuration, to request devices discovered by this `DiscoveryHandler`. #[prost(string, tag = "1")] - pub name: std::string::String, + pub name: ::prost::alloc::string::String, /// Endpoint for the registering `DiscoveryHandler` #[prost(string, tag = "2")] - pub endpoint: std::string::String, + pub endpoint: ::prost::alloc::string::String, #[prost( enumeration = "register_discovery_handler_request::EndpointType", tag = "3" @@ -17,6 +17,7 @@ pub struct RegisterDiscoveryHandlerRequest { #[prost(bool, tag = "4")] pub shared: bool, } +/// Nested message and enum types in `RegisterDiscoveryHandlerRequest`. pub mod register_discovery_handler_request { /// Specifies the type of endpoint. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] @@ -33,30 +34,31 @@ pub struct DiscoverRequest { /// String containing all the details (such as filtering options) /// the `DiscoveryHandler` needs to find a set of devices. #[prost(string, tag = "1")] - pub discovery_details: std::string::String, + pub discovery_details: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct DiscoverResponse { /// List of discovered devices #[prost(message, repeated, tag = "1")] - pub devices: ::std::vec::Vec, + pub devices: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Device { /// Identifier for this device #[prost(string, tag = "1")] - pub id: std::string::String, + pub id: ::prost::alloc::string::String, /// Properties that identify the device. These are stored in the device's instance /// and set as environment variables in the device's broker Pods. May be information /// about where to find the device such as an RTSP URL or a device node (e.g. `/dev/video1`) #[prost(map = "string, string", tag = "2")] - pub properties: ::std::collections::HashMap, + pub properties: + ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, /// Optionally specify mounts for Pods that request this device as a resource #[prost(message, repeated, tag = "3")] - pub mounts: ::std::vec::Vec, + pub mounts: ::prost::alloc::vec::Vec, /// Optionally specify device information to be mounted for Pods that request this device as a resource #[prost(message, repeated, tag = "4")] - pub device_specs: ::std::vec::Vec, + pub device_specs: ::prost::alloc::vec::Vec, } /// From Device Plugin API /// Mount specifies a host volume to mount into a container. @@ -65,10 +67,10 @@ pub struct Device { pub struct Mount { /// Path of the mount within the container. #[prost(string, tag = "1")] - pub container_path: std::string::String, + pub container_path: ::prost::alloc::string::String, /// Path of the mount on the host. #[prost(string, tag = "2")] - pub host_path: std::string::String, + pub host_path: ::prost::alloc::string::String, /// If set, the mount is read-only. #[prost(bool, tag = "3")] pub read_only: bool, @@ -79,16 +81,16 @@ pub struct Mount { pub struct DeviceSpec { /// Path of the device within the container. #[prost(string, tag = "1")] - pub container_path: std::string::String, + pub container_path: ::prost::alloc::string::String, /// Path of the device on the host. #[prost(string, tag = "2")] - pub host_path: std::string::String, + pub host_path: ::prost::alloc::string::String, /// Cgroups permissions of the device, candidates are one or more of /// * r - allows container to read from the specified device. /// * w - allows container to write to the specified device. /// * m - allows container to create device files that do not yet exist. #[prost(string, tag = "3")] - pub permissions: std::string::String, + pub permissions: ::prost::alloc::string::String, } #[doc = r" Generated client implementations."] pub mod registration_client { @@ -148,6 +150,11 @@ pub mod registration_client { } } } + impl std::fmt::Debug for RegistrationClient { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "RegistrationClient {{ ... }}") + } + } } #[doc = r" Generated client implementations."] pub mod discovery_handler_client { @@ -207,6 +214,11 @@ pub mod discovery_handler_client { } } } + impl std::fmt::Debug for DiscoveryHandlerClient { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "DiscoveryHandlerClient {{ ... }}") + } + } } #[doc = r" Generated server implementations."] pub mod registration_server { @@ -223,7 +235,6 @@ pub mod registration_server { #[doc = " Registration is the service advertised by the Akri Agent."] #[doc = " Any `DiscoveryHandler` can register with the Akri Agent."] #[derive(Debug)] - #[doc(hidden)] pub struct RegistrationServer { inner: _Inner, } @@ -240,17 +251,23 @@ pub mod registration_server { Self { inner } } } - impl Service> for RegistrationServer { + impl Service> for RegistrationServer + where + T: Registration, + B: HttpBody + Send + Sync + 'static, + B::Error: Into + Send + 'static, + { type Response = http::Response; type Error = Never; type Future = BoxFuture; fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) } - fn call(&mut self, req: http::Request) -> Self::Future { + fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/v0.Registration/RegisterDiscoveryHandler" => { + #[allow(non_camel_case_types)] struct RegisterDiscoveryHandlerSvc(pub Arc); impl tonic::server::UnaryService @@ -264,7 +281,7 @@ pub mod registration_server { ) -> Self::Future { let inner = self.0.clone(); let fut = - async move { inner.register_discovery_handler(request).await }; + async move { (*inner).register_discovery_handler(request).await }; Box::pin(fut) } } @@ -288,6 +305,7 @@ pub mod registration_server { Ok(http::Response::builder() .status(200) .header("grpc-status", "12") + .header("content-type", "application/grpc") .body(tonic::body::BoxBody::empty()) .unwrap()) }), @@ -322,7 +340,7 @@ pub mod discovery_handler_server { #[async_trait] pub trait DiscoveryHandler: Send + Sync + 'static { #[doc = "Server streaming response type for the Discover method."] - type DiscoverStream: Stream> + type DiscoverStream: futures_core::Stream> + Send + Sync + 'static; @@ -332,7 +350,6 @@ pub mod discovery_handler_server { ) -> Result, tonic::Status>; } #[derive(Debug)] - #[doc(hidden)] pub struct DiscoveryHandlerServer { inner: _Inner, } @@ -349,17 +366,23 @@ pub mod discovery_handler_server { Self { inner } } } - impl Service> for DiscoveryHandlerServer { + impl Service> for DiscoveryHandlerServer + where + T: DiscoveryHandler, + B: HttpBody + Send + Sync + 'static, + B::Error: Into + Send + 'static, + { type Response = http::Response; type Error = Never; type Future = BoxFuture; fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) } - fn call(&mut self, req: http::Request) -> Self::Future { + fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/v0.DiscoveryHandler/Discover" => { + #[allow(non_camel_case_types)] struct DiscoverSvc(pub Arc); impl tonic::server::ServerStreamingService @@ -374,7 +397,7 @@ pub mod discovery_handler_server { request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); - let fut = async move { inner.discover(request).await }; + let fut = async move { (*inner).discover(request).await }; Box::pin(fut) } } @@ -398,6 +421,7 @@ pub mod discovery_handler_server { Ok(http::Response::builder() .status(200) .header("grpc-status", "12") + .header("content-type", "application/grpc") .body(tonic::body::BoxBody::empty()) .unwrap()) }), diff --git a/discovery-utils/src/registration_client.rs b/discovery-utils/src/registration_client.rs index 7c7fc1231..44c50b5e4 100644 --- a/discovery-utils/src/registration_client.rs +++ b/discovery-utils/src/registration_client.rs @@ -26,7 +26,7 @@ pub async fn register_discovery_handler( break; } trace!("register_discovery_handler - sleeping for 10 seconds and trying again"); - tokio::time::delay_for(std::time::Duration::from_secs(10)).await; + tokio::time::sleep(std::time::Duration::from_secs(10)).await; } Ok(()) } diff --git a/shared/Cargo.toml b/shared/Cargo.toml index d508a9360..59f3813f3 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -11,22 +11,24 @@ async-trait = "0.1.0" either = '*' anyhow = "1.0.38" futures = "0.3.1" -futures-old = { version = "0.1", package = "futures" } futures-util = "0.3" -env_logger = "0.8.3" -kube = { version = "0.23.0", features = ["openapi"] } -k8s-openapi = { version = "0.6.0", features = ["v1_16"] } +env_logger = "0.6.1" +hyper = { version = "0.14.2", package = "hyper" } +kube = { version = "0.57.0", features = ["derive"] } +kube-runtime = "0.57.0" +k8s-openapi = { version = "0.12.0", default-features = false, features = ["v1_16", "schema"] } log = "0.4" mockall = "0.9.0" prometheus = { version = "0.11.0", features = ["process"] } rand = "0.8.3" +schemars = "0.8.0" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" serde_yaml = "0.8" -tokio = { version = "0.2", features = ["full"] } -tokio-core = "0.1" -tokio-signal = "0.2" -tonic = "0.1" -tower = "0.3" +tokio = { version = "1.0.2", features = ["full"] } +tokio-stream = { version = "0.1", features = ["net"] } +tonic = "0.4.0" +tower = "0.4.4" +# tokio-signal = "0.2" warp = "0.2" diff --git a/shared/src/akri/configuration.rs b/shared/src/akri/configuration.rs index 7b917076e..9d898d8a3 100644 --- a/shared/src/akri/configuration.rs +++ b/shared/src/akri/configuration.rs @@ -10,18 +10,21 @@ use super::API_NAMESPACE; use super::API_VERSION; use k8s_openapi::api::core::v1::PodSpec; use k8s_openapi::api::core::v1::ServiceSpec; +use k8s_openapi::Schema; +use kube::CustomResource; use kube::{ - api::{ListParams, Object, ObjectList, RawApi, Void}, - client::APIClient, + api::{Api, ListParams, ObjectList}, + client::Client, }; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; use std::collections::HashMap; -pub type KubeAkriConfig = Object; -pub type KubeAkriConfigList = ObjectList>; +pub type KubeAkriConfigList = ObjectList; /// This specifies which `DiscoveryHandler` should be used for discovery /// and any details that need to be sent to the `DiscoveryHandler`. -#[derive(Serialize, Deserialize, Clone, Debug)] +#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct DiscoveryHandlerInfo { pub name: String, @@ -36,9 +39,15 @@ pub struct DiscoveryHandlerInfo { /// capabilities. For any specific capability found that is described by this /// configuration, an Instance /// is created. -#[derive(Serialize, Deserialize, Clone, Debug)] +// TODO: use kube-rs's CustomResource utility as done in instance.rs once +// k8s-openapi has added added support for JsonSchema on K8s objects. +// Issue to track: https://github.com/Arnavion/k8s-openapi/issues/86 +#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema)] +// group = API_NAMESPACE and version = API_VERSION +#[kube(group = "akri.sh", version = "v0", kind = "Configuration", namespaced)] +#[kube(apiextensions = "v1")] #[serde(rename_all = "camelCase")] -pub struct Configuration { +pub struct ConfigurationSpec { /// This defines the `DiscoveryHandler` that should be used to /// discover the capability and any information needed by the `DiscoveryHandler`. pub discovery_handler: DiscoveryHandlerInfo, @@ -52,6 +61,7 @@ pub struct Configuration { /// node that can access any capability described by this /// configuration #[serde(default, skip_serializing_if = "Option::is_none")] + #[schemars(schema_with = "pod_spec_schema")] pub broker_pod_spec: Option, /// This defines a service that should be created to access @@ -60,6 +70,7 @@ pub struct Configuration { /// can be found. For each Instance, there is at most 1 /// instance service. #[serde(default, skip_serializing_if = "Option::is_none")] + #[schemars(schema_with = "service_spec_schema")] pub instance_service_spec: Option, /// This defines a service that should be created to access @@ -67,6 +78,7 @@ pub struct Configuration { /// configuration. For each Configuration, there is at most /// 1 device capability service. #[serde(default, skip_serializing_if = "Option::is_none")] + #[schemars(schema_with = "service_spec_schema")] pub configuration_service_spec: Option, /// This defines some properties that will be set as @@ -78,41 +90,39 @@ pub struct Configuration { pub broker_properties: HashMap, } +fn pod_spec_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + serde_json::from_value(PodSpec::schema()).unwrap() +} + +fn service_spec_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + serde_json::from_value(ServiceSpec::schema()).unwrap() +} + /// Get Configurations for a given namespace /// /// Example: /// /// ```no_run /// use akri_shared::akri::configuration; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// let dccs = configuration::get_configurations(&api_client).await.unwrap(); /// # } /// ``` pub async fn get_configurations( - kube_client: &APIClient, -) -> Result> { - log::trace!("get_configurations enter"); - let akri_config_type = RawApi::customResource(API_CONFIGURATIONS) - .group(API_NAMESPACE) - .version(API_VERSION); - - log::trace!("get_configurations kube_client.request::(akri_config_type.list(...)?).await?"); - - let dcc_list_params = ListParams { - ..Default::default() - }; - match kube_client - .request::(akri_config_type.list(&dcc_list_params)?) - .await - { - Ok(configs_retrieved) => { + kube_client: &Client, +) -> Result { + // TODO kagold: pass in namespace and use Api::namespaced + let configurations_client: Api = Api::all(kube_client.clone()); + let lp = ListParams::default(); + match configurations_client.list(&lp).await { + Ok(configurations_retrieved) => { log::trace!("get_configurations return"); - Ok(configs_retrieved) + Ok(configurations_retrieved) } Err(kube::Error::Api(ae)) => { log::trace!( @@ -134,14 +144,14 @@ pub async fn get_configurations( /// /// ```no_run /// use akri_shared::akri::configuration; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); -/// let dcc = configuration::find_configuration( -/// "dcc-1", +/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let config = configuration::find_configuration( +/// "config-1", /// "default", /// &api_client).await.unwrap(); /// # } @@ -149,38 +159,34 @@ pub async fn get_configurations( pub async fn find_configuration( name: &str, namespace: &str, - kube_client: &APIClient, -) -> Result> { + kube_client: &Client, +) -> Result { log::trace!("find_configuration enter"); - let akri_config_type = RawApi::customResource(API_CONFIGURATIONS) - .group(API_NAMESPACE) - .version(API_VERSION) - .within(&namespace); + // TODO kagold: pass in namespace + let configurations_client: Api = Api::namespaced(kube_client.clone(), namespace); - log::trace!("find_configuration kube_client.request::(akri_config_type.get(...)?).await?"); + log::trace!("find_configuration getting instance with name {}", name); - match kube_client - .request::(akri_config_type.get(&name)?) - .await - { - Ok(config_retrieved) => { + match configurations_client.get(&name).await { + Ok(configuration_retrieved) => { log::trace!("find_configuration return"); - Ok(config_retrieved) - } - Err(kube::Error::Api(ae)) => { - log::trace!( - "find_configuration kube_client.request returned kube error: {:?}", - ae - ); - Err(ae.into()) - } - Err(e) => { - log::trace!("find_configuration kube_client.request error: {:?}", e); - Err(e.into()) + Ok(configuration_retrieved) } + Err(e) => match e { + kube::Error::Api(ae) => { + log::trace!( + "find_configuration kube_client.request returned kube error: {:?}", + ae + ); + Err(anyhow::anyhow!(ae)) + } + _ => { + log::trace!("find_configuration kube_client.request error: {:?}", e); + Err(anyhow::anyhow!(e)) + } + }, } } - fn default_capacity() -> i32 { 1 } @@ -191,38 +197,29 @@ mod crd_serialization_tests { use super::*; use env_logger; - #[derive(Serialize, Deserialize, Clone, Debug)] - #[serde(rename_all = "camelCase")] - struct ConfigurationCRD { - api_version: String, - kind: String, - metadata: HashMap, - spec: Configuration, - } - #[test] fn test_config_defaults_with_serialization() { let _ = env_logger::builder().is_test(true).try_init(); - if serde_json::from_str::(r#"{}"#).is_ok() { + if serde_json::from_str::(r#"{}"#).is_ok() { panic!("discovery handler is required"); } - serde_json::from_str::( + serde_json::from_str::( r#"{"discoveryHandler":{"name":"random", "discoveryDetails":"serialized details"}}"#, ) .unwrap(); - if serde_json::from_str::(r#"{"discoveryHandler":{"name":"random"}}"#) + if serde_json::from_str::(r#"{"discoveryHandler":{"name":"random"}}"#) .is_err() { panic!("discovery details are not required"); } - if serde_json::from_str::(r#"{"discoveryHandler":{}}"#).is_ok() { + if serde_json::from_str::(r#"{"discoveryHandler":{}}"#).is_ok() { panic!("discovery handler name is required"); } let json = r#"{"discoveryHandler":{"name":"onvif", "discoveryDetails":"{\"onvif\":{}}"}}"#; - let deserialized: Configuration = serde_json::from_str(json).unwrap(); + let deserialized: ConfigurationSpec = serde_json::from_str(json).unwrap(); assert_eq!(default_capacity(), deserialized.capacity); assert_eq!(None, deserialized.broker_pod_spec); assert_eq!(None, deserialized.instance_service_spec); @@ -235,7 +232,7 @@ mod crd_serialization_tests { let _ = env_logger::builder().is_test(true).try_init(); let json = r#"{"discoveryHandler":{"name":"random", "discoveryDetails":""}, "capacity":4}"#; - let deserialized: Configuration = serde_json::from_str(json).unwrap(); + let deserialized: ConfigurationSpec = serde_json::from_str(json).unwrap(); assert_eq!(4, deserialized.capacity); assert_eq!(None, deserialized.broker_pod_spec); assert_eq!(None, deserialized.instance_service_spec); @@ -261,7 +258,7 @@ mod crd_serialization_tests { log::trace!("test file: {}", &file); let yaml = file::read_file_to_string(&file); log::trace!("test file contents: {}", &yaml); - let deserialized: ConfigurationCRD = serde_yaml::from_str(&yaml).unwrap(); + let deserialized: Configuration = serde_yaml::from_str(&yaml).unwrap(); log::trace!("test file deserialized: {:?}", &deserialized); let reserialized = serde_json::to_string(&deserialized).unwrap(); log::trace!("test file reserialized: {:?}", &reserialized); @@ -324,7 +321,7 @@ mod crd_serialization_tests { } } "#; - let deserialized: Configuration = serde_json::from_str(json).unwrap(); + let deserialized: ConfigurationSpec = serde_json::from_str(json).unwrap(); assert_eq!(deserialized.discovery_handler.name, "random".to_string()); assert!(deserialized.discovery_handler.discovery_details.is_empty()); assert_eq!(5, deserialized.capacity); diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs index 5e133e0f2..63f370f3d 100644 --- a/shared/src/akri/instance.rs +++ b/shared/src/akri/instance.rs @@ -1,15 +1,15 @@ -use super::{API_INSTANCES, API_NAMESPACE, API_VERSION}; +use super::{API_NAMESPACE, API_VERSION}; use kube::{ - api::{ - DeleteParams, ListParams, Object, ObjectList, ObjectMeta, OwnerReference, PatchParams, - PostParams, RawApi, TypeMeta, Void, - }, - client::APIClient, + api::{Api, DeleteParams, ListParams, ObjectList, ObjectMeta, Patch, PatchParams, PostParams}, + Client, CustomResource, }; + +use k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1beta1 as apiexts; +use k8s_openapi::apimachinery::pkg::apis::meta::v1::OwnerReference; +use schemars::JsonSchema; use std::collections::HashMap; -pub type KubeAkriInstance = Object; -pub type KubeAkriInstanceList = ObjectList>; +pub type KubeAkriInstanceList = ObjectList; /// Defines the information in the Instance CRD /// @@ -17,9 +17,12 @@ pub type KubeAkriInstanceList = ObjectList>; /// a Configuration. For example, a Configuration /// may describe many cameras, each camera will be represented by a /// Instance. -#[derive(Serialize, Deserialize, Clone, Debug)] +#[derive(CustomResource, Deserialize, Serialize, Clone, Debug, JsonSchema)] #[serde(rename_all = "camelCase")] -pub struct Instance { +// group = API_NAMESPACE and version = API_VERSION +#[kube(group = "akri.sh", version = "v0", kind = "Instance", namespaced)] +#[kube(apiextensions = "v1")] +pub struct InstanceSpec { /// This contains the name of the corresponding Configuration pub configuration_name: String, @@ -56,35 +59,26 @@ pub struct Instance { /// /// ```no_run /// use akri_shared::akri::instance; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// let instances = instance::get_instances(&api_client).await.unwrap(); /// # } /// ``` pub async fn get_instances( - kube_client: &APIClient, -) -> Result> { + kube_client: &Client, +) -> Result { log::trace!("get_instances enter"); - let akri_instance_type = RawApi::customResource(API_INSTANCES) - .group(API_NAMESPACE) - .version(API_VERSION); - - log::trace!("get_instances kube_client.request::(akri_instance_type.list(...)?).await?"); - - let instance_list_params = ListParams { - ..Default::default() - }; - match kube_client - .request::(akri_instance_type.list(&instance_list_params)?) - .await - { - Ok(configs_retrieved) => { + // TODO kagold: pass in namespace and use Api::namespaced + let instances_client: Api = Api::all(kube_client.clone()); + let lp = ListParams::default(); + match instances_client.list(&lp).await { + Ok(instances_retrieved) => { log::trace!("get_instances return"); - Ok(configs_retrieved) + Ok(instances_retrieved) } Err(kube::Error::Api(ae)) => { log::trace!( @@ -106,14 +100,14 @@ pub async fn get_instances( /// /// ```no_run /// use akri_shared::akri::instance; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// let instance = instance::find_instance( -/// "dcc-1", +/// "config-1", /// "default", /// &api_client).await.unwrap(); /// # } @@ -121,25 +115,19 @@ pub async fn get_instances( pub async fn find_instance( name: &str, namespace: &str, - kube_client: &APIClient, -) -> Result { + kube_client: &Client, + // TODO kagold: dont use boxed +) -> Result { log::trace!("find_instance enter"); - let akri_instance_type = RawApi::customResource(API_INSTANCES) - .group(API_NAMESPACE) - .version(API_VERSION) - .within(&namespace); + // TODO kagold: pass in namespace + let instances_client: Api = Api::namespaced(kube_client.clone(), namespace); - log::trace!( - "find_instance kube_client.request::(akri_instance_type.get(...)?).await?" - ); + log::trace!("find_instance getting instance with name {}", name); - match kube_client - .request::(akri_instance_type.get(&name)?) - .await - { - Ok(config_retrieved) => { + match instances_client.get(&name).await { + Ok(instance_retrieved) => { log::trace!("find_instance return"); - Ok(config_retrieved) + Ok(instance_retrieved) } Err(e) => match e { kube::Error::Api(ae) => { @@ -147,11 +135,11 @@ pub async fn find_instance( "find_instance kube_client.request returned kube error: {:?}", ae ); - Err(kube::Error::Api(ae)) + Err(anyhow::anyhow!(ae)) } _ => { log::trace!("find_instance kube_client.request error: {:?}", e); - Err(e) + Err(anyhow::anyhow!(e)) } }, } @@ -164,12 +152,12 @@ pub async fn find_instance( /// ```no_run /// use akri_shared::akri::instance::Instance; /// use akri_shared::akri::instance; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// let instance = instance::create_instance( /// &Instance { /// configuration_name: "capability_configuration_name".to_string(), @@ -186,48 +174,34 @@ pub async fn find_instance( /// # } /// ``` pub async fn create_instance( - instance_to_create: &Instance, + instance_to_create: &InstanceSpec, name: &str, namespace: &str, owner_config_name: &str, owner_config_uid: &str, - kube_client: &APIClient, -) -> Result<(), Box> { + kube_client: &Client, +) -> Result<(), anyhow::Error> { log::trace!("create_instance enter"); - let akri_instance_type = RawApi::customResource(API_INSTANCES) - .group(API_NAMESPACE) - .version(API_VERSION) - .within(&namespace); - - let kube_instance = KubeAkriInstance { - metadata: ObjectMeta { - name: name.to_string(), - ownerReferences: vec![OwnerReference { - apiVersion: format!("{}/{}", API_NAMESPACE, API_VERSION), - kind: "Configuration".to_string(), - controller: true, - blockOwnerDeletion: true, - name: owner_config_name.to_string(), - uid: owner_config_uid.to_string(), - }], - ..Default::default() - }, - spec: instance_to_create.clone(), - status: None, - types: TypeMeta { - apiVersion: Some(format!("{}/{}", API_NAMESPACE, API_VERSION)), - kind: Some("Instance".to_string()), - }, + let instances_client: Api = Api::namespaced(kube_client.clone(), namespace); + + let mut instance = Instance::new(name, instance_to_create.clone()); + instance.metadata = ObjectMeta { + name: Some(name.to_string()), + owner_references: vec![OwnerReference { + api_version: format!("{}/{}", API_NAMESPACE, API_VERSION), + kind: "Configuration".to_string(), + controller: Some(true), + block_owner_deletion: Some(true), + name: owner_config_name.to_string(), + uid: owner_config_uid.to_string(), + }], + ..Default::default() }; - let binary_instance = serde_json::to_vec(&kube_instance)?; - log::trace!("create_instance akri_instance_type.create"); - let instance_create_params = PostParams::default(); - let create_request = akri_instance_type - .create(&instance_create_params, binary_instance) - .expect("failed to create request"); - log::trace!("create_instance kube_client.request::(akri_instance_type.create(...)?).await?"); - match kube_client - .request::(create_request) + log::trace!( + "create_instance instances_client.create(&PostParams::default(), &instance).await?" + ); + match instances_client + .create(&PostParams::default(), &instance) .await { Ok(_instance_created) => { @@ -254,12 +228,12 @@ pub async fn create_instance( /// /// ```no_run /// use akri_shared::akri::instance; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// let instance = instance::delete_instance( /// "instance-1", /// "default", @@ -269,21 +243,13 @@ pub async fn create_instance( pub async fn delete_instance( name: &str, namespace: &str, - kube_client: &APIClient, -) -> Result<(), Box> { + kube_client: &Client, +) -> Result<(), anyhow::Error> { log::trace!("delete_instance enter"); - let akri_instance_type = RawApi::customResource(API_INSTANCES) - .group(API_NAMESPACE) - .version(API_VERSION) - .within(&namespace); - - log::trace!("delete_instance akri_instance_type.delete"); + let instances_client: Api = Api::namespaced(kube_client.clone(), namespace); let instance_delete_params = DeleteParams::default(); - let delete_request = akri_instance_type - .delete(name, &instance_delete_params) - .expect("failed to delete request"); - log::trace!("delete_instance kube_client.request::(akri_instance_type.delete(...)?).await?"); - match kube_client.request::(delete_request).await { + log::trace!("delete_instance instances_client.delete(name, &instance_delete_params).await?"); + match instances_client.delete(name, &instance_delete_params).await { Ok(_void_response) => { log::trace!("delete_instance return"); Ok(()) @@ -309,12 +275,12 @@ pub async fn delete_instance( /// ```no_run /// use akri_shared::akri::instance::Instance; /// use akri_shared::akri::instance; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// let instance = instance::update_instance( /// &Instance { /// configuration_name: "capability_configuration_name".to_string(), @@ -329,37 +295,21 @@ pub async fn delete_instance( /// # } /// ``` pub async fn update_instance( - instance_to_update: &Instance, + instance_to_update: &InstanceSpec, name: &str, namespace: &str, - kube_client: &APIClient, -) -> Result<(), Box> { + kube_client: &Client, +) -> Result<(), anyhow::Error> { log::trace!("update_instance enter"); - let akri_instance_type = RawApi::customResource(API_INSTANCES) - .group(API_NAMESPACE) - .version(API_VERSION) - .within(&namespace); - - let existing_kube_akri_instance_type = find_instance(name, namespace, kube_client).await?; - let modified_kube_instance = KubeAkriInstance { - metadata: existing_kube_akri_instance_type.metadata, - spec: instance_to_update.clone(), - status: existing_kube_akri_instance_type.status, - types: existing_kube_akri_instance_type.types, - }; - log::trace!( - "update_instance wrapped_instance: {:?}", - serde_json::to_string(&modified_kube_instance).unwrap() - ); - let binary_instance = serde_json::to_vec(&modified_kube_instance)?; - - log::trace!("update_instance akri_instance_type.patch"); + let instances_client: Api = Api::namespaced(kube_client.clone(), namespace); + let instance_json = serde_json::json!(instance_to_update); + let patch = Patch::Apply(&instance_json); let instance_patch_params = PatchParams::default(); - let patch_request = akri_instance_type - .patch(name, &instance_patch_params, binary_instance) - .expect("failed to create request"); - log::trace!("update_instance kube_client.request::(akri_instance_type.patch(...)?).await?"); - match kube_client.request::(patch_request).await { + log::trace!("update_instance instances_client.patch(name, &instance_patch_params, instance_to_update).await?"); + match instances_client + .patch(name, &instance_patch_params, &patch) + .await + { Ok(_instance_modified) => { log::trace!("update_instance return"); Ok(()) @@ -388,22 +338,13 @@ mod crd_serializeation_tests { use super::*; use env_logger; - #[derive(Serialize, Deserialize, Clone, Debug)] - #[serde(rename_all = "camelCase")] - struct InstanceCRD { - api_version: String, - kind: String, - metadata: HashMap, - spec: Instance, - } - #[test] #[should_panic] fn test_instance_no_class_name_failure() { let _ = env_logger::builder().is_test(true).try_init(); let json = r#"{}"#; - let _: Instance = serde_json::from_str(json).unwrap(); + let _: InstanceSpec = serde_json::from_str(json).unwrap(); } #[test] @@ -411,7 +352,7 @@ mod crd_serializeation_tests { let _ = env_logger::builder().is_test(true).try_init(); let json = r#"{"configurationName": "foo"}"#; - let deserialized: Instance = serde_json::from_str(json).unwrap(); + let deserialized: InstanceSpec = serde_json::from_str(json).unwrap(); assert_eq!("foo".to_string(), deserialized.configuration_name); assert_eq!(0, deserialized.broker_properties.len()); assert_eq!(default_shared(), deserialized.shared); @@ -430,7 +371,7 @@ mod crd_serializeation_tests { let json = r#" configurationName: foo "#; - let deserialized: Instance = serde_yaml::from_str(json).unwrap(); + let deserialized: InstanceSpec = serde_yaml::from_str(json).unwrap(); assert_eq!("foo".to_string(), deserialized.configuration_name); assert_eq!(0, deserialized.broker_properties.len()); assert_eq!(default_shared(), deserialized.shared); @@ -447,7 +388,7 @@ mod crd_serializeation_tests { let _ = env_logger::builder().is_test(true).try_init(); let json = r#"{"configurationName":"blah","brokerProperties":{"a":"two"},"shared":true,"nodes":["n1","n2"],"deviceUsage":{"0":"","1":"n1"}}"#; - let deserialized: Instance = serde_json::from_str(json).unwrap(); + let deserialized: InstanceSpec = serde_json::from_str(json).unwrap(); assert_eq!("blah".to_string(), deserialized.configuration_name); assert_eq!(1, deserialized.broker_properties.len()); assert_eq!(true, deserialized.shared); @@ -467,7 +408,7 @@ mod crd_serializeation_tests { ]; for file in &files { let yaml = file::read_file_to_string(&file); - let deserialized: InstanceCRD = serde_yaml::from_str(&yaml).unwrap(); + let deserialized: Instance = serde_yaml::from_str(&yaml).unwrap(); let _ = serde_json::to_string(&deserialized).unwrap(); } } diff --git a/shared/src/akri/mod.rs b/shared/src/akri/mod.rs index f258b4b02..38c62aa4d 100644 --- a/shared/src/akri/mod.rs +++ b/shared/src/akri/mod.rs @@ -1,5 +1,7 @@ /// Akri API Version pub const API_VERSION: &str = "v0"; +/// Akri API Version +pub const NODE_VERSION: &str = "v1"; /// Akri CRD Namespace pub const API_NAMESPACE: &str = "akri.sh"; /// Akri Configuration CRD name @@ -30,6 +32,6 @@ pub mod retry { pub async fn random_delay() { let random_decimal: f32 = random::(); let random_delay_0_to_200: u64 = (200_f32 * random_decimal) as u64; - time::delay_for(Duration::from_millis(random_delay_0_to_200)).await; + time::sleep(Duration::from_millis(random_delay_0_to_200)).await; } } diff --git a/shared/src/k8s/mod.rs b/shared/src/k8s/mod.rs index b90c56d08..dd2b32d02 100644 --- a/shared/src/k8s/mod.rs +++ b/shared/src/k8s/mod.rs @@ -1,19 +1,19 @@ use super::akri::{ configuration, - configuration::{KubeAkriConfig, KubeAkriConfigList}, + configuration::{Configuration, KubeAkriConfigList}, instance, - instance::{Instance, KubeAkriInstance, KubeAkriInstanceList}, + instance::{Instance, InstanceSpec, KubeAkriInstanceList}, retry::{random_delay, MAX_INSTANCE_UPDATE_TRIES}, API_NAMESPACE, API_VERSION, }; use async_trait::async_trait; use futures::executor::block_on; use k8s_openapi::api::core::v1::{ - NodeSpec, NodeStatus, Pod, PodSpec, PodStatus, Service, ServiceSpec, ServiceStatus, + Node, Pod, PodSpec, PodStatus, Service, ServiceSpec, ServiceStatus, }; use kube::{ api::{Object, ObjectList}, - client::APIClient, + client::Client, config, }; use mockall::{automock, predicate::*}; @@ -75,12 +75,12 @@ impl OwnershipInfo { .to_string() } - pub fn get_controller(&self) -> bool { - true + pub fn get_controller(&self) -> Option { + Some(true) } - pub fn get_block_owner_deletion(&self) -> bool { - true + pub fn get_block_owner_deletion(&self) -> Option { + Some(true) } pub fn get_name(&self) -> String { @@ -95,133 +95,112 @@ impl OwnershipInfo { #[automock] #[async_trait] pub trait KubeInterface: Send + Sync { - fn get_kube_client(&self) -> APIClient; + fn get_kube_client(&self) -> Client; async fn find_node( &self, name: &str, - ) -> Result, Box>; + ) -> Result; async fn find_pods_with_label( &self, selector: &str, ) -> Result< - ObjectList>, - Box, + ObjectList, + anyhow::Error, >; async fn find_pods_with_field( &self, selector: &str, ) -> Result< - ObjectList>, - Box, + ObjectList, + anyhow::Error, >; async fn create_pod( &self, pod_to_create: &Pod, namespace: &str, - ) -> Result<(), Box>; + ) -> Result<(), anyhow::Error>; async fn remove_pod( &self, pod_to_remove: &str, namespace: &str, - ) -> Result<(), Box>; + ) -> Result<(), anyhow::Error>; async fn find_services( &self, selector: &str, - ) -> Result< - ObjectList>, - Box, - >; + ) -> Result, anyhow::Error>; async fn create_service( &self, svc_to_create: &Service, namespace: &str, - ) -> Result<(), Box>; + ) -> Result<(), anyhow::Error>; async fn remove_service( &self, svc_to_remove: &str, namespace: &str, - ) -> Result<(), Box>; + ) -> Result<(), anyhow::Error>; async fn update_service( &self, - svc_to_update: &Object, + svc_to_update: &Service, name: &str, namespace: &str, - ) -> Result<(), Box>; + ) -> Result<(), anyhow::Error>; async fn find_configuration( &self, name: &str, namespace: &str, - ) -> Result>; + ) -> Result; async fn get_configurations( &self, - ) -> Result>; + ) -> Result; - async fn find_instance( - &self, - name: &str, - namespace: &str, - ) -> Result; + async fn find_instance(&self, name: &str, namespace: &str) -> Result; async fn get_instances( &self, - ) -> Result>; + ) -> Result; async fn create_instance( &self, - instance_to_create: &Instance, + instance_to_create: &InstanceSpec, name: &str, namespace: &str, owner_config_name: &str, owner_config_uid: &str, - ) -> Result<(), Box>; + ) -> Result<(), anyhow::Error>; async fn delete_instance( &self, name: &str, namespace: &str, - ) -> Result<(), Box>; + ) -> Result<(), anyhow::Error>; async fn update_instance( &self, - instance_to_update: &Instance, + instance_to_update: &InstanceSpec, name: &str, namespace: &str, - ) -> Result<(), Box>; -} - -/// Create new KubeInetrace implementation -pub fn create_kube_interface() -> impl KubeInterface { - KubeImpl::new() + ) -> Result<(), anyhow::Error>; } #[derive(Clone)] -struct KubeImpl { - kube_configuration: kube::config::Configuration, +pub struct KubeImpl { + client: kube::Client, } impl KubeImpl { /// Create new instance of KubeImpl - fn new() -> Self { - KubeImpl { - kube_configuration: match std::env::var("KUBERNETES_PORT") { - Ok(_val) => { - log::trace!("Loading in-cluster config"); - config::incluster_config().unwrap() // pub fn incluster_config() -> Result { - } - Err(_e) => { - log::trace!("Loading config file"); - block_on(config::load_kube_config()).unwrap() // pub async fn load_kube_config() -> Result - } - }, - } + pub async fn new() -> Result { + Ok(KubeImpl { + client: Client::try_default().await?, + }) } } #[async_trait] impl KubeInterface for KubeImpl { - /// Create new APIClient using KubeImpl's kube::config::Configuration - fn get_kube_client(&self) -> APIClient { - APIClient::new(self.kube_configuration.clone()) + /// Return of clone of KubeImpl's client + fn get_kube_client(&self) -> Client { + self.client.clone() } /// Get Kuberenetes node for specified name @@ -234,15 +213,14 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// let node = kube.find_node("node-a").await.unwrap(); /// # } /// ``` async fn find_node( &self, name: &str, - ) -> Result, Box> - { + ) -> Result { node::find_node(name, self.get_kube_client()).await } @@ -256,17 +234,14 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// let interesting_pods = kube.find_pods_with_label("label=interesting").await.unwrap(); /// # } /// ``` async fn find_pods_with_label( &self, selector: &str, - ) -> Result< - ObjectList>, - Box, - > { + ) -> Result, anyhow::Error> { pod::find_pods_with_selector(Some(selector.to_string()), None, self.get_kube_client()).await } /// Get Kuberenetes pods with specified field selector @@ -279,17 +254,14 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// let pods_on_node_a = kube.find_pods_with_field("spec.nodeName=node-a").await.unwrap(); /// # } /// ``` async fn find_pods_with_field( &self, selector: &str, - ) -> Result< - ObjectList>, - Box, - > { + ) -> Result, anyhow::Error> { pod::find_pods_with_selector(None, Some(selector.to_string()), self.get_kube_client()).await } /// Create Kuberenetes pod @@ -303,7 +275,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// kube.create_pod(&Pod::default(), "pod_namespace").await.unwrap(); /// # } /// ``` @@ -311,7 +283,7 @@ impl KubeInterface for KubeImpl { &self, pod_to_create: &Pod, namespace: &str, - ) -> Result<(), Box> { + ) -> Result<(), anyhow::Error> { pod::create_pod(pod_to_create, namespace, self.get_kube_client()).await } /// Remove Kubernetes pod @@ -324,7 +296,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// kube.remove_pod("pod_to_remove", "pod_namespace").await.unwrap(); /// # } /// ``` @@ -332,7 +304,7 @@ impl KubeInterface for KubeImpl { &self, pod_to_remove: &str, namespace: &str, - ) -> Result<(), Box> { + ) -> Result<(), anyhow::Error> { pod::remove_pod(pod_to_remove, namespace, self.get_kube_client()).await } @@ -346,17 +318,14 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// let interesting_services = kube.find_services("label=interesting").await.unwrap(); /// # } /// ``` async fn find_services( &self, selector: &str, - ) -> Result< - ObjectList>, - Box, - > { + ) -> Result, anyhow::Error> { service::find_services_with_selector(selector, self.get_kube_client()).await } /// Create Kubernetes service @@ -370,7 +339,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// kube.create_service(&Service::default(), "service_namespace").await.unwrap(); /// # } /// ``` @@ -378,7 +347,7 @@ impl KubeInterface for KubeImpl { &self, svc_to_create: &Service, namespace: &str, - ) -> Result<(), Box> { + ) -> Result<(), anyhow::Error> { service::create_service(svc_to_create, namespace, self.get_kube_client()).await } /// Remove Kubernetes service @@ -391,7 +360,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// kube.remove_service("service_to_remove", "service_namespace").await.unwrap(); /// # } /// ``` @@ -399,7 +368,7 @@ impl KubeInterface for KubeImpl { &self, svc_to_remove: &str, namespace: &str, - ) -> Result<(), Box> { + ) -> Result<(), anyhow::Error> { service::remove_service(svc_to_remove, namespace, self.get_kube_client()).await } /// Update Kubernetes service @@ -413,7 +382,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// let selector = "environment=production,app=nginx"; /// for svc in kube.find_services(&selector).await.unwrap() { /// let svc_name = &svc.metadata.name.clone(); @@ -427,10 +396,10 @@ impl KubeInterface for KubeImpl { /// ``` async fn update_service( &self, - svc_to_update: &Object, + svc_to_update: &Service, name: &str, namespace: &str, - ) -> Result<(), Box> { + ) -> Result<(), anyhow::Error> { service::update_service(svc_to_update, name, namespace, self.get_kube_client()).await } @@ -444,15 +413,15 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); - /// let dcc = kube.find_configuration("dcc-1", "dcc-namespace").await.unwrap(); + /// let kube = k8s::KubeImpl::new().await?; + /// let config = kube.find_configuration("config-1", "config-namespace").await.unwrap(); /// # } /// ``` async fn find_configuration( &self, name: &str, namespace: &str, - ) -> Result> { + ) -> Result { configuration::find_configuration(name, namespace, &self.get_kube_client()).await } // Get Akri Configurations with given namespace @@ -465,13 +434,13 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// let dccs = kube.get_configurations().await.unwrap(); /// # } /// ``` async fn get_configurations( &self, - ) -> Result> { + ) -> Result { configuration::get_configurations(&self.get_kube_client()).await } @@ -485,15 +454,11 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// let instance = kube.find_instance("instance-1", "instance-namespace").await.unwrap(); /// # } /// ``` - async fn find_instance( - &self, - name: &str, - namespace: &str, - ) -> Result { + async fn find_instance(&self, name: &str, namespace: &str) -> Result { instance::find_instance(name, namespace, &self.get_kube_client()).await } // Get Akri Instances with given namespace @@ -506,13 +471,13 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// let instances = kube.get_instances().await.unwrap(); /// # } /// ``` async fn get_instances( &self, - ) -> Result> { + ) -> Result { instance::get_instances(&self.get_kube_client()).await } /// Create Akri Instance @@ -526,7 +491,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// kube.create_instance( /// &Instance{ /// configuration_name: "capability_configuration_name".to_string(), @@ -544,12 +509,12 @@ impl KubeInterface for KubeImpl { /// ``` async fn create_instance( &self, - instance_to_create: &Instance, + instance_to_create: &InstanceSpec, name: &str, namespace: &str, owner_config_name: &str, owner_config_uid: &str, - ) -> Result<(), Box> { + ) -> Result<(), anyhow::Error> { instance::create_instance( instance_to_create, name, @@ -570,7 +535,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// kube.delete_instance( /// "instance-1", /// "instance-namespace" @@ -581,7 +546,7 @@ impl KubeInterface for KubeImpl { &self, name: &str, namespace: &str, - ) -> Result<(), Box> { + ) -> Result<(), anyhow::Error> { instance::delete_instance(name, namespace, &self.get_kube_client()).await } /// Update Akri Instance @@ -595,7 +560,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::create_kube_interface(); + /// let kube = k8s::KubeImpl::new().await?; /// kube.update_instance( /// &Instance{ /// configuration_name: "capability_configuration_name".to_string(), @@ -611,10 +576,10 @@ impl KubeInterface for KubeImpl { /// ``` async fn update_instance( &self, - instance_to_update: &Instance, + instance_to_update: &InstanceSpec, name: &str, namespace: &str, - ) -> Result<(), Box> { + ) -> Result<(), anyhow::Error> { instance::update_instance(instance_to_update, name, namespace, &self.get_kube_client()) .await } @@ -626,7 +591,7 @@ pub async fn try_delete_instance( kube_interface: &dyn KubeInterface, instance_name: &str, instance_namespace: &str, -) -> Result<(), Box> { +) -> Result<(), anyhow::Error> { for x in 0..MAX_INSTANCE_UPDATE_TRIES { match kube_interface .delete_instance(instance_name, &instance_namespace) @@ -642,8 +607,9 @@ pub async fn try_delete_instance( .find_instance(&instance_name, &instance_namespace) .await { - Err(kube::Error::Api(ae)) => { - if ae.code == ERROR_NOT_FOUND { + Err(e) => { + if let Some(kube::Error::Api(ae)) = e.downcast_ref::() { + if ae.code == ERROR_NOT_FOUND { log::trace!( "try_delete_instance - discovered Instance {} already deleted", instance_name @@ -651,10 +617,11 @@ pub async fn try_delete_instance( break; } log::error!("try_delete_instance - when looking up Instance {}, got kube API error: {:?}", instance_name, ae); + } } - Err(e) => { - log::error!("try_delete_instance - when looking up Instance {}, got kube error: {:?}. {} retries left.", instance_name, e, MAX_INSTANCE_UPDATE_TRIES - x - 1); - } + // Err(e) => { + // log::error!("try_delete_instance - when looking up Instance {}, got kube error: {:?}. {} retries left.", instance_name, e, MAX_INSTANCE_UPDATE_TRIES - x - 1); + // } Ok(_) => { log::error!( "try_delete_instance - tried to delete Instance {} but still exists. {} retries left.", diff --git a/shared/src/k8s/node.rs b/shared/src/k8s/node.rs index 0443fb2e6..2e5a52884 100644 --- a/shared/src/k8s/node.rs +++ b/shared/src/k8s/node.rs @@ -1,7 +1,7 @@ -use k8s_openapi::api::core::v1::{NodeSpec, NodeStatus}; +use k8s_openapi::api::core::v1::Node; use kube::{ api::{Api, Object}, - client::APIClient, + client::Client, }; use log::trace; @@ -11,22 +11,22 @@ use log::trace; /// /// ```no_run /// use akri_shared::k8s::node; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { /// let label_selector = Some("environment=production,app=nginx".to_string()); -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// let node = node::find_node("node-a", api_client).await.unwrap(); /// # } /// ``` pub async fn find_node( name: &str, - kube_client: APIClient, -) -> Result, Box> { + kube_client: Client, +) -> Result { trace!("find_node with name={:?}", &name); - let nodes = Api::v1Node(kube_client); + let nodes: Api = Api::all(kube_client); trace!("find_node PRE nodes.get(...).await?"); let result = nodes.get(&name).await; trace!("find_node return"); diff --git a/shared/src/k8s/pod.rs b/shared/src/k8s/pod.rs index 51f1a3f93..4e1e879cf 100644 --- a/shared/src/k8s/pod.rs +++ b/shared/src/k8s/pod.rs @@ -11,7 +11,7 @@ use k8s_openapi::apimachinery::pkg::api::resource::Quantity; use k8s_openapi::apimachinery::pkg::apis::meta::v1::{ObjectMeta, OwnerReference}; use kube::{ api::{Api, DeleteParams, ListParams, Object, ObjectList, PostParams}, - client::APIClient, + client::Client, }; use log::{error, info, trace}; use std::collections::BTreeMap; @@ -28,13 +28,13 @@ pub const AKRI_TARGET_NODE_LABEL_NAME: &str = "akri.sh/target-node"; /// /// ```no_run /// use akri_shared::k8s::pod; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { /// let label_selector = Some("environment=production,app=nginx".to_string()); -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// for pod in pod::find_pods_with_selector(label_selector, None, api_client).await.unwrap() { /// println!("found pod: {}", pod.metadata.name) /// } @@ -43,13 +43,13 @@ pub const AKRI_TARGET_NODE_LABEL_NAME: &str = "akri.sh/target-node"; /// /// ```no_run /// use akri_shared::k8s::pod; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { /// let field_selector = Some("spec.nodeName=node-a".to_string()); -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// for pod in pod::find_pods_with_selector(None, field_selector, api_client).await.unwrap() { /// println!("found pod: {}", pod.metadata.name) /// } @@ -58,17 +58,14 @@ pub const AKRI_TARGET_NODE_LABEL_NAME: &str = "akri.sh/target-node"; pub async fn find_pods_with_selector( label_selector: Option, field_selector: Option, - kube_client: APIClient, -) -> Result< - ObjectList>, - Box, -> { + kube_client: Client, +) -> Result, anyhow::Error> { trace!( "find_pods_with_selector with label_selector={:?} field_selector={:?}", &label_selector, &field_selector ); - let pods = Api::v1Pod(kube_client); + let pods: Api = Api::all(kube_client); let pod_list_params = ListParams { label_selector, field_selector, @@ -127,11 +124,11 @@ type ResourceQuantityType = BTreeMap; /// OwnershipType, /// pod /// }; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// use k8s_openapi::api::core::v1::PodSpec; /// -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// let svc = pod::create_new_pod_from_spec( /// "pod_namespace", /// "capability_instance", @@ -183,8 +180,8 @@ pub fn create_new_pod_from_spec( let owner_references: Vec = vec![OwnerReference { api_version: ownership.get_api_version(), kind: ownership.get_kind(), - controller: Some(ownership.get_controller()), - block_owner_deletion: Some(ownership.get_block_owner_deletion()), + controller: ownership.get_controller(), + block_owner_deletion: ownership.get_block_owner_deletion(), name: ownership.get_name(), uid: ownership.get_uid(), }]; @@ -192,35 +189,27 @@ pub fn create_new_pod_from_spec( let mut modified_pod_spec = pod_spec.clone(); for container in &mut modified_pod_spec.containers { - let mut incoming_limits: Option = None; - let mut incoming_requests: Option = None; + let mut incoming_limits: ResourceQuantityType = BTreeMap::new(); + let mut incoming_requests: ResourceQuantityType = BTreeMap::new(); if let Some(resources) = container.resources.as_ref() { - if let Some(limits) = resources.limits.as_ref() { - let mut modified_limits = limits.clone(); - if modified_limits.contains_key(RESOURCE_REQUIREMENTS_KEY) { - let placeholder_value = modified_limits - .get(RESOURCE_REQUIREMENTS_KEY) - .unwrap() - .clone(); - modified_limits.insert(resource_limit_name.to_string(), placeholder_value); - modified_limits.remove(RESOURCE_REQUIREMENTS_KEY); - } - - incoming_limits = Some(modified_limits); + incoming_limits = resources.limits.clone(); + if incoming_limits.contains_key(RESOURCE_REQUIREMENTS_KEY) { + let placeholder_value = incoming_limits + .get(RESOURCE_REQUIREMENTS_KEY) + .unwrap() + .clone(); + incoming_limits.insert(resource_limit_name.to_string(), placeholder_value); + incoming_limits.remove(RESOURCE_REQUIREMENTS_KEY); } - if let Some(requests) = resources.requests.as_ref() { - let mut modified_requests = requests.clone(); - if modified_requests.contains_key(RESOURCE_REQUIREMENTS_KEY) { - let placeholder_value = modified_requests - .get(RESOURCE_REQUIREMENTS_KEY) - .unwrap() - .clone(); - modified_requests.insert(resource_limit_name.to_string(), placeholder_value); - modified_requests.remove(RESOURCE_REQUIREMENTS_KEY); - } - - incoming_requests = Some(modified_requests); + incoming_requests = resources.requests.clone(); + if incoming_requests.contains_key(RESOURCE_REQUIREMENTS_KEY) { + let placeholder_value = incoming_requests + .get(RESOURCE_REQUIREMENTS_KEY) + .unwrap() + .clone(); + incoming_requests.insert(resource_limit_name.to_string(), placeholder_value); + incoming_requests.remove(RESOURCE_REQUIREMENTS_KEY); } }; @@ -244,23 +233,23 @@ pub fn create_new_pod_from_spec( }) .node_selector_terms .push(NodeSelectorTerm { - match_fields: Some(vec![NodeSelectorRequirement { + match_fields: vec![NodeSelectorRequirement { key: OBJECT_NAME_FIELD.to_string(), operator: NODE_SELECTOR_OP_IN.to_string(), // need to find if there is an equivalent to: v1.NODE_SELECTOR_OP_IN, - values: Some(vec![node_to_run_pod_on.to_string()]), - }]), + values: vec![node_to_run_pod_on.to_string()], + }], ..Default::default() }); let result = Pod { spec: Some(modified_pod_spec), - metadata: Some(ObjectMeta { + metadata: ObjectMeta { name: Some(app_name), namespace: Some(pod_namespace.to_string()), - labels: Some(labels), - owner_references: Some(owner_references), + labels: labels, + owner_references: owner_references, ..Default::default() - }), + }, ..Default::default() }; @@ -350,8 +339,8 @@ mod broker_podspec_tests { vec![Container { image: Some(image.clone()), resources: Some(ResourceRequirements { - limits: Some(placeholder_limits), - requests: Some(placeholder_requests), + limits: placeholder_limits, + requests: placeholder_requests, }), ..Default::default() }], @@ -374,16 +363,16 @@ mod broker_podspec_tests { Container { image: Some("image1".to_string()), resources: Some(ResourceRequirements { - limits: Some(placeholder_limits1), - requests: Some(placeholder_requests1), + limits: placeholder_limits1, + requests: placeholder_requests1, }), ..Default::default() }, Container { image: Some("image2".to_string()), resources: Some(ResourceRequirements { - limits: Some(placeholder_limits2), - requests: Some(placeholder_requests2), + limits: placeholder_limits2, + requests: placeholder_requests2, }), ..Default::default() }, @@ -401,11 +390,11 @@ mod broker_podspec_tests { node_affinity: Some(NodeAffinity { required_during_scheduling_ignored_during_execution: Some(NodeSelector { node_selector_terms: vec![NodeSelectorTerm { - match_fields: Some(vec![NodeSelectorRequirement { + match_fields: vec![NodeSelectorRequirement { key: "do-not-change-this".to_string(), operator: NODE_SELECTOR_OP_IN.to_string(), // need to find if there is an equivalent to: v1.NODE_SELECTOR_OP_IN, - values: Some(vec!["existing-node-affinity".to_string()]), - }]), + values: vec!["existing-node-affinity".to_string()], + }], ..Default::default() }], //..Default::default() @@ -448,30 +437,19 @@ mod broker_podspec_tests { ); // Validate the metadata name/namesapce - assert_eq!(&app_name, &pod.metadata.clone().unwrap().name.unwrap()); - assert_eq!( - &pod_namespace, - &pod.metadata.clone().unwrap().namespace.unwrap() - ); + assert_eq!(&app_name, &pod.metadata.clone().name.unwrap()); + assert_eq!(&pod_namespace, &pod.metadata.clone().namespace.unwrap()); // Validate the labels added assert_eq!( &&app_name, - &pod.metadata - .clone() - .unwrap() - .labels - .unwrap() - .get(APP_LABEL_ID) - .unwrap() + &pod.metadata.clone().labels.get(APP_LABEL_ID).unwrap() ); assert_eq!( &&API_NAMESPACE.to_string(), &pod.metadata .clone() - .unwrap() .labels - .unwrap() .get(CONTROLLER_LABEL_ID) .unwrap() ); @@ -479,9 +457,7 @@ mod broker_podspec_tests { &&configuration_name, &pod.metadata .clone() - .unwrap() .labels - .unwrap() .get(AKRI_CONFIGURATION_LABEL_NAME) .unwrap() ); @@ -489,9 +465,7 @@ mod broker_podspec_tests { &&instance_name, &pod.metadata .clone() - .unwrap() .labels - .unwrap() .get(AKRI_INSTANCE_LABEL_NAME) .unwrap() ); @@ -499,9 +473,7 @@ mod broker_podspec_tests { &&node_to_run_pod_on, &pod.metadata .clone() - .unwrap() .labels - .unwrap() .get(AKRI_TARGET_NODE_LABEL_NAME) .unwrap() ); @@ -509,44 +481,21 @@ mod broker_podspec_tests { // Validate ownerReference assert_eq!( instance_name, - pod.metadata - .clone() - .unwrap() - .owner_references - .unwrap() - .get(0) - .unwrap() - .name + pod.metadata.clone().owner_references.get(0).unwrap().name ); assert_eq!( instance_uid, - pod.metadata - .clone() - .unwrap() - .owner_references - .unwrap() - .get(0) - .unwrap() - .uid + pod.metadata.clone().owner_references.get(0).unwrap().uid ); assert_eq!( "Instance", - &pod.metadata - .clone() - .unwrap() - .owner_references - .unwrap() - .get(0) - .unwrap() - .kind + &pod.metadata.clone().owner_references.get(0).unwrap().kind ); assert_eq!( &format!("{}/{}", API_NAMESPACE, API_VERSION), &pod.metadata .clone() - .unwrap() .owner_references - .unwrap() .get(0) .unwrap() .api_version @@ -554,9 +503,7 @@ mod broker_podspec_tests { assert!(pod .metadata .clone() - .unwrap() .owner_references - .unwrap() .get(0) .unwrap() .controller @@ -564,9 +511,7 @@ mod broker_podspec_tests { assert!(pod .metadata .clone() - .unwrap() .owner_references - .unwrap() .get(0) .unwrap() .block_owner_deletion @@ -604,8 +549,6 @@ mod broker_podspec_tests { .get(0) .unwrap() .match_fields - .as_ref() - .unwrap() .get(0) .unwrap() .key @@ -625,8 +568,6 @@ mod broker_podspec_tests { .get(0) .unwrap() .match_fields - .as_ref() - .unwrap() .get(0) .unwrap() .operator @@ -646,13 +587,9 @@ mod broker_podspec_tests { .get(0) .unwrap() .match_fields - .as_ref() - .unwrap() .get(0) .unwrap() .values - .as_ref() - .unwrap() ); // Validate the affinity added @@ -671,8 +608,6 @@ mod broker_podspec_tests { .get(1) .unwrap() .match_fields - .as_ref() - .unwrap() .get(0) .unwrap() .key @@ -692,8 +627,6 @@ mod broker_podspec_tests { .get(1) .unwrap() .match_fields - .as_ref() - .unwrap() .get(0) .unwrap() .operator @@ -713,13 +646,9 @@ mod broker_podspec_tests { .get(1) .unwrap() .match_fields - .as_ref() - .unwrap() .get(0) .unwrap() .values - .as_ref() - .unwrap() ); // Validate image name remanes unchanged @@ -750,8 +679,6 @@ mod broker_podspec_tests { .as_ref() .unwrap() .limits - .as_ref() - .unwrap() .contains_key("do-not-change-this") ); assert_eq!( @@ -766,8 +693,6 @@ mod broker_podspec_tests { .as_ref() .unwrap() .requests - .as_ref() - .unwrap() .contains_key("do-not-change-this") ); // Validate the limits/requires added @@ -783,8 +708,6 @@ mod broker_podspec_tests { .as_ref() .unwrap() .limits - .as_ref() - .unwrap() .contains_key(RESOURCE_REQUIREMENTS_KEY) ); assert_eq!( @@ -799,8 +722,6 @@ mod broker_podspec_tests { .as_ref() .unwrap() .requests - .as_ref() - .unwrap() .contains_key(RESOURCE_REQUIREMENTS_KEY) ); assert_eq!( @@ -815,8 +736,6 @@ mod broker_podspec_tests { .as_ref() .unwrap() .limits - .as_ref() - .unwrap() .contains_key(&resource_limit_name.clone()) ); assert_eq!( @@ -831,8 +750,6 @@ mod broker_podspec_tests { .as_ref() .unwrap() .requests - .as_ref() - .unwrap() .contains_key(&resource_limit_name.clone()) ); } @@ -846,26 +763,25 @@ mod broker_podspec_tests { /// /// ```no_run /// use akri_shared::k8s::pod; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// use k8s_openapi::api::core::v1::Pod; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// pod::create_pod(&Pod::default(), "pod_namespace", api_client).await.unwrap(); /// # } /// ``` pub async fn create_pod( pod_to_create: &Pod, namespace: &str, - kube_client: APIClient, -) -> Result<(), Box> { + kube_client: Client, +) -> Result<(), anyhow::Error> { trace!("create_pod enter"); - let pods = Api::v1Pod(kube_client.clone()).within(&namespace); - let pod_as_u8 = serde_json::to_vec(&pod_to_create)?; + let pods: Api = Api::namespaced(kube_client, namespace); info!("create_pod pods.create(...).await?:"); - match pods.create(&PostParams::default(), pod_as_u8).await { + match pods.create(&PostParams::default(), pod_to_create).await { Ok(created_pod) => { info!( "create_pod pods.create return: {:?}", @@ -883,7 +799,7 @@ pub async fn create_pod( serde_json::to_string(&pod_to_create), ae ); - Err(ae.into()) + Err(anyhow::anyhow!(ae)) } } Err(e) => { @@ -892,7 +808,7 @@ pub async fn create_pod( serde_json::to_string(&pod_to_create), e ); - Err(e.into()) + Err(anyhow::anyhow!(e)) } } } @@ -903,22 +819,22 @@ pub async fn create_pod( /// /// ```no_run /// use akri_shared::k8s::pod; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// pod::remove_pod("pod_to_remove", "pod_namespace", api_client).await.unwrap(); /// # } /// ``` pub async fn remove_pod( pod_to_remove: &str, namespace: &str, - kube_client: APIClient, -) -> Result<(), Box> { + kube_client: Client, +) -> Result<(), anyhow::Error> { trace!("remove_pod enter"); - let pods = Api::v1Pod(kube_client.clone()).within(&namespace); + let pods: Api = Api::namespaced(kube_client, namespace); info!("remove_pod pods.delete(...).await?:"); match pods.delete(pod_to_remove, &DeleteParams::default()).await { Ok(deleted_pod) => match deleted_pod { @@ -940,7 +856,7 @@ pub async fn remove_pod( "remove_pod pods.delete [{:?}] returned kube error: {:?}", &pod_to_remove, ae ); - Err(ae.into()) + Err(anyhow::anyhow!(ae)) } } Err(e) => { @@ -948,7 +864,7 @@ pub async fn remove_pod( "remove_pod pods.delete [{:?}] error: {:?}", &pod_to_remove, e ); - Err(e.into()) + Err(anyhow::anyhow!(e)) } } } diff --git a/shared/src/k8s/service.rs b/shared/src/k8s/service.rs index 7f9c3727d..ac1e0e10d 100644 --- a/shared/src/k8s/service.rs +++ b/shared/src/k8s/service.rs @@ -7,15 +7,10 @@ use super::{ }; use either::Either; use k8s_openapi::api::core::v1::{Service, ServiceSpec, ServiceStatus}; -use k8s_openapi::apimachinery::pkg::apis::meta::v1::{ - ObjectMeta, OwnerReference as K8sOwnerReference, -}; +use k8s_openapi::apimachinery::pkg::apis::meta::v1::{ObjectMeta, OwnerReference}; use kube::{ - api::{ - Api, DeleteParams, ListParams, Object, ObjectList, OwnerReference as KubeOwnerReference, - PatchParams, PostParams, - }, - client::APIClient, + api::{Api, DeleteParams, ListParams, Object, ObjectList, Patch, PatchParams, PostParams}, + client::Client, }; use log::{error, info, trace}; use std::collections::BTreeMap; @@ -26,13 +21,13 @@ use std::collections::BTreeMap; /// /// ```no_run /// use akri_shared::k8s::service; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { /// let selector = "environment=production,app=nginx"; -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// for svc in service::find_services_with_selector(&selector, api_client).await.unwrap() { /// println!("found svc: {}", svc.metadata.name) /// } @@ -40,19 +35,17 @@ use std::collections::BTreeMap; /// ``` pub async fn find_services_with_selector( selector: &str, - kube_client: APIClient, -) -> Result< - ObjectList>, - Box, -> { + kube_client: Client, +) -> Result, anyhow::Error> { trace!("find_services_with_selector with selector={:?}", &selector); - let svcs = Api::v1Service(kube_client); + // TODO kagold: make namespaced + let svc_client: Api = Api::all(kube_client); let svc_list_params = ListParams { label_selector: Some(selector.to_string()), ..Default::default() }; trace!("find_services_with_selector PRE svcs.list(...).await?"); - let result = svcs.list(&svc_list_params).await; + let result = svc_client.list(&svc_list_params).await; trace!("find_services_with_selector return"); Ok(result?) } @@ -97,11 +90,11 @@ pub fn create_service_app_name( /// OwnershipType, /// service /// }; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// use k8s_openapi::api::core::v1::ServiceSpec; /// -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// let svc = service::create_new_service_from_spec( /// "svc_namespace", /// "capability_instance", @@ -143,25 +136,18 @@ pub fn create_new_service_from_spec( ); } - let owner_references: Vec = vec![K8sOwnerReference { + let owner_references: Vec = vec![OwnerReference { api_version: ownership.get_api_version(), kind: ownership.get_kind(), - controller: Some(ownership.get_controller()), - block_owner_deletion: Some(ownership.get_block_owner_deletion()), + controller: ownership.get_controller(), + block_owner_deletion: ownership.get_block_owner_deletion(), name: ownership.get_name(), uid: ownership.get_uid(), }]; let mut spec = svc_spec.clone(); let mut modified_selector: BTreeMap; - match spec.selector { - Some(selector) => { - modified_selector = selector; - } - None => { - modified_selector = BTreeMap::new(); - } - } + modified_selector = spec.selector; modified_selector.insert(CONTROLLER_LABEL_ID.to_string(), API_NAMESPACE.to_string()); if node_specific_svc { modified_selector.insert( @@ -174,17 +160,17 @@ pub fn create_new_service_from_spec( configuration_name.to_string(), ); } - spec.selector = Some(modified_selector); + spec.selector = modified_selector; let new_svc = Service { spec: Some(spec), - metadata: Some(ObjectMeta { + metadata: ObjectMeta { name: Some(app_name), namespace: Some(svc_namespace.to_string()), - labels: Some(labels), - owner_references: Some(owner_references), + labels, + owner_references, ..Default::default() - }), + }, ..Default::default() }; @@ -201,13 +187,13 @@ pub fn create_new_service_from_spec( /// OwnershipType, /// service /// }; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { /// let selector = "environment=production,app=nginx"; -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// for svc in service::find_services_with_selector(&selector, api_client).await.unwrap() { /// let mut svc = svc; /// service::update_ownership( @@ -227,35 +213,26 @@ pub fn update_ownership( ownership: OwnershipInfo, replace_references: bool, ) -> Result<(), Box> { + let ownership_ref = OwnerReference { + api_version: ownership.get_api_version(), + kind: ownership.get_kind(), + controller: ownership.get_controller(), + block_owner_deletion: ownership.get_block_owner_deletion(), + name: ownership.get_name(), + uid: ownership.get_uid(), + }; if replace_references { // Replace all existing ownerReferences with specified ownership - svc_to_update.metadata.ownerReferences = vec![KubeOwnerReference { - apiVersion: ownership.get_api_version(), - kind: ownership.get_kind(), - controller: ownership.get_controller(), - blockOwnerDeletion: ownership.get_block_owner_deletion(), - name: ownership.get_name(), - uid: ownership.get_uid(), - }]; + svc_to_update.metadata.owner_references = vec![ownership_ref]; } else { // Add ownership to list IFF the UID doesn't already exist if !svc_to_update .metadata - .ownerReferences + .owner_references .iter() .any(|x| x.uid == ownership.get_uid()) { - svc_to_update - .metadata - .ownerReferences - .push(KubeOwnerReference { - apiVersion: ownership.get_api_version(), - kind: ownership.get_kind(), - controller: ownership.get_controller(), - blockOwnerDeletion: ownership.get_block_owner_deletion(), - name: ownership.get_name(), - uid: ownership.get_uid(), - }); + svc_to_update.metadata.owner_references.push(ownership_ref); } } Ok(()) @@ -267,7 +244,7 @@ mod svcspec_tests { use super::*; use env_logger; - use kube::api::{Object, ObjectMeta, TypeMeta}; + use kube::api::{Object, ObjectMeta}; pub type TestServiceObject = Object; #[test] @@ -321,13 +298,10 @@ mod svcspec_tests { metadata: ObjectMeta::default(), spec: ServiceSpec::default(), status: Some(ServiceStatus::default()), - types: TypeMeta { - apiVersion: None, - kind: None, - }, + types: None, }; - assert_eq!(0, svc.metadata.ownerReferences.len()); + assert_eq!(0, svc.metadata.owner_references.len()); let mut svc = svc; update_ownership( &mut svc, @@ -339,9 +313,9 @@ mod svcspec_tests { true, ) .unwrap(); - assert_eq!(1, svc.metadata.ownerReferences.len()); - assert_eq!("object1", &svc.metadata.ownerReferences[0].name); - assert_eq!("uid1", &svc.metadata.ownerReferences[0].uid); + assert_eq!(1, svc.metadata.owner_references.len()); + assert_eq!("object1", &svc.metadata.owner_references[0].name); + assert_eq!("uid1", &svc.metadata.owner_references[0].uid); update_ownership( &mut svc, @@ -353,9 +327,9 @@ mod svcspec_tests { true, ) .unwrap(); - assert_eq!(1, svc.metadata.ownerReferences.len()); - assert_eq!("object2", &svc.metadata.ownerReferences[0].name); - assert_eq!("uid2", &svc.metadata.ownerReferences[0].uid); + assert_eq!(1, svc.metadata.owner_references.len()); + assert_eq!("object2", &svc.metadata.owner_references[0].name); + assert_eq!("uid2", &svc.metadata.owner_references[0].uid); } #[test] @@ -366,13 +340,10 @@ mod svcspec_tests { metadata: ObjectMeta::default(), spec: ServiceSpec::default(), status: Some(ServiceStatus::default()), - types: TypeMeta { - apiVersion: None, - kind: None, - }, + types: None, }; - assert_eq!(0, svc.metadata.ownerReferences.len()); + assert_eq!(0, svc.metadata.owner_references.len()); let mut svc = svc; update_ownership( &mut svc, @@ -384,9 +355,9 @@ mod svcspec_tests { false, ) .unwrap(); - assert_eq!(1, svc.metadata.ownerReferences.len()); - assert_eq!("object1", &svc.metadata.ownerReferences[0].name); - assert_eq!("uid1", &svc.metadata.ownerReferences[0].uid); + assert_eq!(1, svc.metadata.owner_references.len()); + assert_eq!("object1", &svc.metadata.owner_references[0].name); + assert_eq!("uid1", &svc.metadata.owner_references[0].uid); update_ownership( &mut svc, @@ -398,11 +369,11 @@ mod svcspec_tests { false, ) .unwrap(); - assert_eq!(2, svc.metadata.ownerReferences.len()); - assert_eq!("object1", &svc.metadata.ownerReferences[0].name); - assert_eq!("uid1", &svc.metadata.ownerReferences[0].uid); - assert_eq!("object2", &svc.metadata.ownerReferences[1].name); - assert_eq!("uid2", &svc.metadata.ownerReferences[1].uid); + assert_eq!(2, svc.metadata.owner_references.len()); + assert_eq!("object1", &svc.metadata.owner_references[0].name); + assert_eq!("uid1", &svc.metadata.owner_references[0].uid); + assert_eq!("object2", &svc.metadata.owner_references[1].name); + assert_eq!("uid2", &svc.metadata.owner_references[1].uid); // Test that trying to add the same UID doesn't result in // duplicate @@ -416,11 +387,11 @@ mod svcspec_tests { false, ) .unwrap(); - assert_eq!(2, svc.metadata.ownerReferences.len()); - assert_eq!("object1", &svc.metadata.ownerReferences[0].name); - assert_eq!("uid1", &svc.metadata.ownerReferences[0].uid); - assert_eq!("object2", &svc.metadata.ownerReferences[1].name); - assert_eq!("uid2", &svc.metadata.ownerReferences[1].uid); + assert_eq!(2, svc.metadata.owner_references.len()); + assert_eq!("object1", &svc.metadata.owner_references[0].name); + assert_eq!("uid1", &svc.metadata.owner_references[0].uid); + assert_eq!("object2", &svc.metadata.owner_references[1].name); + assert_eq!("uid2", &svc.metadata.owner_references[1].uid); } #[test] @@ -441,7 +412,7 @@ mod svcspec_tests { "this-node-selector".to_string(), ); let svc_spec = ServiceSpec { - selector: Some(preexisting_selector), + selector: preexisting_selector, ..Default::default() }; @@ -463,30 +434,19 @@ mod svcspec_tests { ); // Validate the metadata name/namesapce - assert_eq!(&app_name, &svc.metadata.clone().unwrap().name.unwrap()); - assert_eq!( - &svc_namespace, - &svc.metadata.clone().unwrap().namespace.unwrap() - ); + assert_eq!(&app_name, &svc.metadata.clone().name.unwrap()); + assert_eq!(&svc_namespace, &svc.metadata.clone().namespace.unwrap()); // Validate the labels added assert_eq!( &&app_name, - &svc.metadata - .clone() - .unwrap() - .labels - .unwrap() - .get(APP_LABEL_ID) - .unwrap() + &svc.metadata.clone().labels.get(APP_LABEL_ID).unwrap() ); assert_eq!( &&API_NAMESPACE.to_string(), &svc.metadata .clone() - .unwrap() .labels - .unwrap() .get(CONTROLLER_LABEL_ID) .unwrap() ); @@ -495,9 +455,7 @@ mod svcspec_tests { &&instance_name, &svc.metadata .clone() - .unwrap() .labels - .unwrap() .get(AKRI_INSTANCE_LABEL_NAME) .unwrap() ); @@ -506,9 +464,7 @@ mod svcspec_tests { &&configuration_name, &svc.metadata .clone() - .unwrap() .labels - .unwrap() .get(AKRI_CONFIGURATION_LABEL_NAME) .unwrap() ); @@ -517,44 +473,21 @@ mod svcspec_tests { // Validate ownerReference assert_eq!( object_name, - svc.metadata - .clone() - .unwrap() - .owner_references - .unwrap() - .get(0) - .unwrap() - .name + svc.metadata.clone().owner_references.get(0).unwrap().name ); assert_eq!( object_uid, - svc.metadata - .clone() - .unwrap() - .owner_references - .unwrap() - .get(0) - .unwrap() - .uid + svc.metadata.clone().owner_references.get(0).unwrap().uid ); assert_eq!( "Pod", - &svc.metadata - .clone() - .unwrap() - .owner_references - .unwrap() - .get(0) - .unwrap() - .kind + &svc.metadata.clone().owner_references.get(0).unwrap().kind ); assert_eq!( "core/v1", &svc.metadata .clone() - .unwrap() .owner_references - .unwrap() .get(0) .unwrap() .api_version @@ -562,9 +495,7 @@ mod svcspec_tests { assert!(svc .metadata .clone() - .unwrap() .owner_references - .unwrap() .get(0) .unwrap() .controller @@ -572,9 +503,7 @@ mod svcspec_tests { assert!(svc .metadata .clone() - .unwrap() .owner_references - .unwrap() .get(0) .unwrap() .block_owner_deletion @@ -587,8 +516,6 @@ mod svcspec_tests { .as_ref() .unwrap() .selector - .as_ref() - .unwrap() .get("do-not-change") .unwrap() ); @@ -599,8 +526,6 @@ mod svcspec_tests { .as_ref() .unwrap() .selector - .as_ref() - .unwrap() .get(CONTROLLER_LABEL_ID) .unwrap() ); @@ -611,8 +536,6 @@ mod svcspec_tests { .as_ref() .unwrap() .selector - .as_ref() - .unwrap() .get(AKRI_INSTANCE_LABEL_NAME) .unwrap() ); @@ -623,8 +546,6 @@ mod svcspec_tests { .as_ref() .unwrap() .selector - .as_ref() - .unwrap() .get(AKRI_CONFIGURATION_LABEL_NAME) .unwrap() ); @@ -639,26 +560,25 @@ mod svcspec_tests { /// /// ```no_run /// use akri_shared::k8s::service; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// use k8s_openapi::api::core::v1::Service; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// service::create_service(&Service::default(), "svc_namespace", api_client).await.unwrap(); /// # } /// ``` pub async fn create_service( svc_to_create: &Service, namespace: &str, - kube_client: APIClient, -) -> Result<(), Box> { + kube_client: Client, +) -> Result<(), anyhow::Error> { trace!("create_service enter"); - let services = Api::v1Service(kube_client).within(&namespace); - let svc_as_u8 = serde_json::to_vec(&svc_to_create)?; + let services: Api = Api::namespaced(kube_client, namespace); info!("create_service svcs.create(...).await?:"); - match services.create(&PostParams::default(), svc_as_u8).await { + match services.create(&PostParams::default(), svc_to_create).await { Ok(created_svc) => { info!( "create_service services.create return: {:?}", @@ -680,7 +600,7 @@ pub async fn create_service( serde_json::to_string(&svc_to_create), e ); - Err(e.into()) + Err(anyhow::anyhow!(e)) } } } @@ -691,22 +611,22 @@ pub async fn create_service( /// /// ```no_run /// use akri_shared::k8s::service; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// service::remove_service("svc_to_remove", "svc_namespace", api_client).await.unwrap(); /// # } /// ``` pub async fn remove_service( svc_to_remove: &str, namespace: &str, - kube_client: APIClient, -) -> Result<(), Box> { + kube_client: Client, +) -> Result<(), anyhow::Error> { trace!("remove_service enter"); - let svcs = Api::v1Service(kube_client).within(&namespace); + let svcs: Api = Api::namespaced(kube_client, namespace); info!("remove_service svcs.create(...).await?:"); match svcs.delete(svc_to_remove, &DeleteParams::default()).await { Ok(deleted_svc) => match deleted_svc { @@ -731,7 +651,7 @@ pub async fn remove_service( "remove_service svcs.delete [{:?}] returned kube error: {:?}", &svc_to_remove, ae ); - Err(ae.into()) + Err(anyhow::anyhow!(ae)) } } Err(e) => { @@ -739,7 +659,7 @@ pub async fn remove_service( "remove_service svcs.delete [{:?}] error: {:?}", &svc_to_remove, e ); - Err(e.into()) + Err(anyhow::anyhow!(e)) } } } @@ -750,17 +670,17 @@ pub async fn remove_service( /// /// ```no_run /// use akri_shared::k8s::service; -/// use kube::client::APIClient; +/// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { /// let selector = "environment=production,app=nginx"; -/// let api_client = APIClient::new(config::incluster_config().unwrap()); +/// let api_client = Client::new(config::incluster_config().unwrap()); /// for svc in service::find_services_with_selector(&selector, api_client).await.unwrap() { /// let svc_name = &svc.metadata.name.clone(); /// let svc_namespace = &svc.metadata.namespace.as_ref().unwrap().clone(); -/// let loop_api_client = APIClient::new(config::incluster_config().unwrap()); +/// let loop_api_client = Client::new(config::incluster_config().unwrap()); /// let updated_svc = service::update_service( /// &svc, /// &svc_name, @@ -770,21 +690,24 @@ pub async fn remove_service( /// # } /// ``` pub async fn update_service( - svc_to_update: &Object, + svc_to_update: &Service, name: &str, namespace: &str, - kube_client: APIClient, -) -> Result<(), Box> { + kube_client: Client, +) -> Result<(), anyhow::Error> { trace!( "update_service enter name:{} namespace: {}", &name, &namespace ); - let svcs = Api::v1Service(kube_client).within(&namespace); - let svc_as_u8 = serde_json::to_vec(&svc_to_update)?; + let svcs: Api = Api::namespaced(kube_client, namespace); + let svc_as_u8 = serde_json::to_vec(svc_to_update)?; info!("remove_service svcs.patch(...).await?:"); - match svcs.patch(name, &PatchParams::default(), svc_as_u8).await { + match svcs + .patch(name, &PatchParams::default(), &Patch::Apply(&svc_as_u8)) + .await + { Ok(_service_modified) => { log::trace!("update_service return"); Ok(()) @@ -794,11 +717,11 @@ pub async fn update_service( "update_service kube_client.request returned kube error: {:?}", ae ); - Err(ae.into()) + Err(anyhow::anyhow!(ae)) } Err(e) => { log::trace!("update_service kube_client.request error: {:?}", e); - Err(e.into()) + Err(anyhow::anyhow!(e)) } } } diff --git a/shared/src/lib.rs b/shared/src/lib.rs index ed15298c3..b7ff0352f 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -2,7 +2,6 @@ extern crate k8s_openapi; #[macro_use] extern crate serde_derive; extern crate serde_yaml; -extern crate tokio_core; pub mod akri; pub mod k8s; diff --git a/shared/src/os/mod.rs b/shared/src/os/mod.rs index e378c3f09..4933f4179 100644 --- a/shared/src/os/mod.rs +++ b/shared/src/os/mod.rs @@ -1,5 +1,5 @@ pub mod env_var; -pub mod signal; +// pub mod signal; /// Provide file operations pub mod file { diff --git a/shared/src/uds/unix_stream.rs b/shared/src/uds/unix_stream.rs index 97c0beffe..a84126380 100644 --- a/shared/src/uds/unix_stream.rs +++ b/shared/src/uds/unix_stream.rs @@ -1,12 +1,13 @@ /// Module to enable UDS with tonic grpc. /// This is unix only since the underlying UnixStream and UnixListener libraries are unix only. +/// Module to enable UDS with tonic grpc. +/// This is unix only since the underlying UnixStream and UnixListener libraries are unix only. use std::{ - convert::TryFrom, pin::Pin, task::{Context, Poll}, - time::{Duration, SystemTime, UNIX_EPOCH}, }; -use tokio::io::{AsyncRead, AsyncWrite}; + +use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use tonic::transport::server::Connected; #[derive(Debug)] @@ -18,8 +19,8 @@ impl AsyncRead for UnixStream { fn poll_read( mut self: Pin<&mut Self>, cx: &mut Context<'_>, - buf: &mut [u8], - ) -> Poll> { + buf: &mut ReadBuf<'_>, + ) -> Poll> { Pin::new(&mut self.0).poll_read(cx, buf) } } @@ -37,12 +38,18 @@ impl AsyncWrite for UnixStream { Pin::new(&mut self.0).poll_flush(cx) } - fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_shutdown( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll> { Pin::new(&mut self.0).poll_shutdown(cx) } } pub async fn try_connect(socket_path: &str) -> Result<(), anyhow::Error> { + use std::convert::TryFrom; + use std::time::{Duration, SystemTime, UNIX_EPOCH}; + // Test that server is running, trying for at most 10 seconds // Similar to grpc.timeout, which is yet to be implemented for tonic // See issue: https://github.com/hyperium/tonic/issues/75 @@ -71,7 +78,7 @@ pub async fn try_connect(socket_path: &str) -> Result<(), anyhow::Error> { { connected = true } else { - tokio::time::delay_for(Duration::from_secs(1)).await + tokio::time::sleep(Duration::from_secs(1)).await } } if connected { diff --git a/webhooks/validating/configuration/Cargo.toml b/webhooks/validating/configuration/Cargo.toml index 614cfe1b1..917036308 100644 --- a/webhooks/validating/configuration/Cargo.toml +++ b/webhooks/validating/configuration/Cargo.toml @@ -10,8 +10,9 @@ actix-web = { version = "3.3.2", features = ["openssl"] } actix-rt = "2.2.0" akri-shared = { path = "../../../shared" } clap = "3.0.0-beta.2" -k8s-openapi = { version = "0.6.0", features = ["v1_16"] } -kube = { version = "0.23.0", features = ["openapi"] } +kube = { version = "0.57.0", features = ["derive"] } +kube-runtime = "0.57.0" +k8s-openapi = { version = "0.12.0", default-features = false, features = ["v1_16"] } openapi = { git = "https://github.com/DazWilkin/openapi-admission-v1", tag = "v1.1.0" } openssl = "0.10" rustls = "0.19.0" diff --git a/webhooks/validating/configuration/src/main.rs b/webhooks/validating/configuration/src/main.rs index 3ca1b3304..ec50e20af 100644 --- a/webhooks/validating/configuration/src/main.rs +++ b/webhooks/validating/configuration/src/main.rs @@ -1,5 +1,5 @@ use actix_web::{post, web, App, HttpResponse, HttpServer, Responder}; -use akri_shared::akri::configuration::KubeAkriConfig; +use akri_shared::akri::configuration::Configuration; use clap::Arg; use k8s_openapi::apimachinery::pkg::runtime::RawExtension; use openapi::models::{ @@ -115,7 +115,7 @@ fn validate_configuration(rqst: &AdmissionRequest) -> AdmissionResponse { let x: RawExtension = serde_json::from_value(raw.clone()) .expect("Could not parse as Kubernetes RawExtension"); let y = serde_json::to_string(&x).unwrap(); - let config: KubeAkriConfig = + let config: Configuration = serde_json::from_str(y.as_str()).expect("Could not parse as Akri Configuration"); let reserialized = serde_json::to_string(&config).unwrap(); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); From 56d83750a8ec530800c4bf0569e4a4d12adfb819 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Tue, 10 Aug 2021 16:43:28 -0700 Subject: [PATCH 02/22] compile shared library --- Cargo.lock | 3078 +---------------- Cargo.toml | 30 +- agent/Cargo.toml | 6 +- agent/src/util/v1beta1.rs | 236 +- controller/Cargo.toml | 6 +- controller/src/util/instance_action.rs | 14 +- controller/src/util/node_watcher.rs | 1 + controller/src/util/pod_watcher.rs | 34 +- discovery-utils/src/discovery/v0.rs | 200 +- .../udev-video-broker/src/util/camera.rs | 111 +- shared/Cargo.toml | 6 +- shared/src/akri/configuration.rs | 23 +- shared/src/akri/instance.rs | 23 +- shared/src/k8s/mod.rs | 64 +- shared/src/k8s/node.rs | 4 +- shared/src/k8s/pod.rs | 155 +- shared/src/k8s/service.rs | 139 +- webhooks/validating/configuration/Cargo.toml | 6 +- webhooks/validating/configuration/src/main.rs | 10 +- 19 files changed, 756 insertions(+), 3390 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 28cdb757f..7eae4dade 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,383 +2,12 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "actix" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "543c47e7827f8fcc9d1445bd98ba402137bfce80ee2187429de49c52b5131bd3" -dependencies = [ - "actix-rt 2.2.0", - "actix_derive", - "bitflags", - "bytes 1.0.1", - "crossbeam-channel", - "futures-core", - "futures-sink", - "futures-task", - "futures-util", - "log", - "once_cell", - "parking_lot 0.11.1", - "pin-project-lite 0.2.7", - "smallvec 1.6.1", - "tokio 1.9.0", - "tokio-util 0.6.7", -] - -[[package]] -name = "actix-codec" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78d1833b3838dbe990df0f1f87baf640cf6146e898166afe401839d1b001e570" -dependencies = [ - "bitflags", - "bytes 0.5.6", - "futures-core", - "futures-sink", - "log", - "pin-project 0.4.28", - "tokio 0.2.25", - "tokio-util 0.3.1", -] - -[[package]] -name = "actix-connect" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177837a10863f15ba8d3ae3ec12fac1099099529ed20083a27fdfe247381d0dc" -dependencies = [ - "actix-codec", - "actix-rt 1.1.1", - "actix-service", - "actix-utils", - "derive_more", - "either", - "futures-util", - "http", - "log", - "openssl", - "tokio-openssl", - "trust-dns-proto", - "trust-dns-resolver", -] - -[[package]] -name = "actix-http" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452299e87817ae5673910e53c243484ca38be3828db819b6011736fc6982e874" -dependencies = [ - "actix-codec", - "actix-connect", - "actix-rt 1.1.1", - "actix-service", - "actix-threadpool", - "actix-tls", - "actix-utils", - "base64 0.13.0", - "bitflags", - "brotli2", - "bytes 0.5.6", - "cookie", - "copyless", - "derive_more", - "either", - "encoding_rs", - "flate2", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "h2 0.2.7", - "http", - "httparse", - "indexmap", - "itoa", - "language-tags", - "lazy_static", - "log", - "mime", - "percent-encoding 2.1.0", - "pin-project 1.0.8", - "rand 0.7.3", - "regex", - "serde", - "serde_json", - "serde_urlencoded 0.7.0", - "sha-1 0.9.7", - "slab", - "time 0.2.27", -] - -[[package]] -name = "actix-macros" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ca8ce00b267af8ccebbd647de0d61e0674b6e61185cc7a592ff88772bed655" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "actix-macros" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f86cd6857c135e6e9fe57b1619a88d1f94a7df34c00e11fe13e64fd3438837" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "actix-router" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ad299af73649e1fc893e333ccf86f377751eb95ff875d095131574c6f43452c" -dependencies = [ - "bytestring", - "http", - "log", - "regex", - "serde", -] - -[[package]] -name = "actix-rt" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" -dependencies = [ - "actix-macros 0.1.3", - "actix-threadpool", - "copyless", - "futures-channel", - "futures-util", - "smallvec 1.6.1", - "tokio 0.2.25", -] - -[[package]] -name = "actix-rt" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7d7cd957c9ed92288a7c3c96af81fa5291f65247a76a34dac7b6af74e52ba0" -dependencies = [ - "actix-macros 0.2.1", - "futures-core", - "tokio 1.9.0", -] - -[[package]] -name = "actix-server" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45407e6e672ca24784baa667c5d32ef109ccdd8d5e0b5ebb9ef8a67f4dfb708e" -dependencies = [ - "actix-codec", - "actix-rt 1.1.1", - "actix-service", - "actix-utils", - "futures-channel", - "futures-util", - "log", - "mio 0.6.23", - "mio-uds", - "num_cpus", - "slab", - "socket2 0.3.19", -] - -[[package]] -name = "actix-service" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0052435d581b5be835d11f4eb3bce417c8af18d87ddf8ace99f8e67e595882bb" -dependencies = [ - "futures-util", - "pin-project 0.4.28", -] - -[[package]] -name = "actix-testing" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47239ca38799ab74ee6a8a94d1ce857014b2ac36f242f70f3f75a66f691e791c" -dependencies = [ - "actix-macros 0.1.3", - "actix-rt 1.1.1", - "actix-server", - "actix-service", - "log", - "socket2 0.3.19", -] - -[[package]] -name = "actix-threadpool" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d209f04d002854b9afd3743032a27b066158817965bf5d036824d19ac2cc0e30" -dependencies = [ - "derive_more", - "futures-channel", - "lazy_static", - "log", - "num_cpus", - "parking_lot 0.11.1", - "threadpool", -] - -[[package]] -name = "actix-tls" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24789b7d7361cf5503a504ebe1c10806896f61e96eca9a7350e23001aca715fb" -dependencies = [ - "actix-codec", - "actix-service", - "actix-utils", - "futures-util", - "openssl", - "tokio-openssl", -] - -[[package]] -name = "actix-utils" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9022dec56632d1d7979e59af14f0597a28a830a9c1c7fec8b2327eb9f16b5a" -dependencies = [ - "actix-codec", - "actix-rt 1.1.1", - "actix-service", - "bitflags", - "bytes 0.5.6", - "either", - "futures-channel", - "futures-sink", - "futures-util", - "log", - "pin-project 0.4.28", - "slab", -] - -[[package]] -name = "actix-web" -version = "3.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e641d4a172e7faa0862241a20ff4f1f5ab0ab7c279f00c2d4587b77483477b86" -dependencies = [ - "actix-codec", - "actix-http", - "actix-macros 0.1.3", - "actix-router", - "actix-rt 1.1.1", - "actix-server", - "actix-service", - "actix-testing", - "actix-threadpool", - "actix-tls", - "actix-utils", - "actix-web-codegen", - "awc", - "bytes 0.5.6", - "derive_more", - "encoding_rs", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "log", - "mime", - "openssl", - "pin-project 1.0.8", - "regex", - "serde", - "serde_json", - "serde_urlencoded 0.7.0", - "socket2 0.3.19", - "time 0.2.27", - "tinyvec", - "url 2.2.2", -] - -[[package]] -name = "actix-web-codegen" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad26f77093333e0e7c6ffe54ebe3582d908a104e448723eec6d43d08b07143fb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "actix_derive" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "adler" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "agent" -version = "0.6.12" -dependencies = [ - "akri-debug-echo", - "akri-discovery-utils", - "akri-onvif", - "akri-opcua", - "akri-shared", - "akri-udev", - "anyhow", - "async-stream 0.3.2", - "async-trait", - "blake2", - "cfg-if 1.0.0", - "chrono", - "env_logger 0.8.4", - "futures 0.3.16", - "futures-core", - "futures-util", - "h2 0.3.3", - "hyper 0.14.11", - "k8s-openapi", - "kube", - "kube-runtime", - "lazy_static", - "log", - "mock_instant", - "mockall", - "mockall_double", - "prometheus 0.11.0", - "prost 0.7.0", - "prost-types 0.7.0", - "rand 0.8.4", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "tempfile", - "tokio 1.9.0", - "tokio-stream", - "tonic 0.4.3", - "tonic-build 0.4.2", - "tower 0.4.8", - "url 2.2.2", - "uuid", -] - [[package]] name = "aho-corasick" version = "0.7.18" @@ -388,101 +17,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "akri-debug-echo" -version = "0.6.12" -dependencies = [ - "akri-discovery-utils", - "akri-shared", - "anyhow", - "async-trait", - "env_logger 0.8.4", - "futures-util", - "log", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "tokio 1.9.0", - "tokio-stream", - "tonic 0.4.3", -] - -[[package]] -name = "akri-discovery-utils" -version = "0.6.12" -dependencies = [ - "akri-shared", - "anyhow", - "async-stream 0.3.2", - "async-trait", - "futures 0.3.16", - "log", - "prost 0.7.0", - "serde", - "serde_derive", - "serde_yaml", - "tempfile", - "tokio 1.9.0", - "tokio-stream", - "tonic 0.4.3", - "tonic-build 0.4.2", - "tower 0.4.8", -] - -[[package]] -name = "akri-onvif" -version = "0.6.12" -dependencies = [ - "akri-discovery-utils", - "akri-shared", - "anyhow", - "async-trait", - "bytes 0.5.6", - "env_logger 0.8.4", - "futures-util", - "hyper 0.13.10", - "log", - "mockall", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "sxd-document", - "sxd-xpath", - "tokio 1.9.0", - "tokio-stream", - "tonic 0.4.3", - "uuid", - "xml-rs", - "yaserde", - "yaserde_derive", -] - -[[package]] -name = "akri-opcua" -version = "0.6.12" -dependencies = [ - "akri-discovery-utils", - "akri-shared", - "anyhow", - "async-trait", - "env_logger 0.8.4", - "futures-util", - "log", - "mockall", - "opcua-client", - "prost 0.6.1", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "tokio 1.9.0", - "tokio-stream", - "tonic 0.4.3", - "url 2.2.2", -] - [[package]] name = "akri-shared" version = "0.6.12" @@ -490,8 +24,8 @@ dependencies = [ "anyhow", "async-trait", "either", - "env_logger 0.6.2", - "futures 0.3.16", + "env_logger", + "futures", "futures-util", "hyper 0.14.11", "k8s-openapi", @@ -499,7 +33,7 @@ dependencies = [ "kube-runtime", "log", "mockall", - "prometheus 0.11.0", + "prometheus", "rand 0.8.4", "schemars", "serde", @@ -508,178 +42,27 @@ dependencies = [ "serde_yaml", "tokio 1.9.0", "tokio-stream", - "tonic 0.4.3", - "tower 0.4.8", + "tonic", + "tower", "warp", ] -[[package]] -name = "akri-udev" -version = "0.6.12" -dependencies = [ - "akri-discovery-utils", - "anyhow", - "async-trait", - "env_logger 0.8.4", - "futures-util", - "log", - "mockall", - "pest", - "pest_derive", - "prost 0.6.1", - "regex", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "tokio 1.9.0", - "tokio-stream", - "tonic 0.4.3", - "udev", -] - [[package]] name = "anyhow" version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "595d3cfa7a60d4555cb5067b99f07142a08ea778de5cf993f7b75c7d8fabc486" -[[package]] -name = "async-channel" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "once_cell", - "slab", -] - -[[package]] -name = "async-global-executor" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" -dependencies = [ - "async-channel", - "async-executor", - "async-io", - "async-mutex", - "blocking", - "futures-lite", - "num_cpus", - "once_cell", -] - -[[package]] -name = "async-io" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" -dependencies = [ - "concurrent-queue", - "futures-lite", - "libc", - "log", - "once_cell", - "parking", - "polling", - "slab", - "socket2 0.4.1", - "waker-fn", - "winapi 0.3.9", -] - -[[package]] -name = "async-lock" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-mutex" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-std" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9f06685bad74e0570f5213741bea82158279a4103d988e57bfada11ad230341" -dependencies = [ - "async-channel", - "async-global-executor", - "async-io", - "async-lock", - "crossbeam-utils 0.8.5", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "num_cpus", - "once_cell", - "pin-project-lite 0.2.7", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-stream" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22068c0c19514942eefcfd4daf8976ef1aad84e61539f95cd200c35202f80af5" -dependencies = [ - "async-stream-impl 0.2.1", - "futures-core", -] - [[package]] name = "async-stream" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" dependencies = [ - "async-stream-impl 0.3.2", + "async-stream-impl", "futures-core", ] -[[package]] -name = "async-stream-impl" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f9db3b38af870bf7e5cc649167533b493928e50744e2c30ae350230b414670" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "async-stream-impl" version = "0.3.2" @@ -691,12 +74,6 @@ dependencies = [ "syn", ] -[[package]] -name = "async-task" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" - [[package]] name = "async-trait" version = "0.1.51" @@ -708,12 +85,6 @@ dependencies = [ "syn", ] -[[package]] -name = "atomic-waker" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" - [[package]] name = "atty" version = "0.2.14" @@ -731,46 +102,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "awc" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b381e490e7b0cfc37ebc54079b0413d8093ef43d14a4e4747083f7fa47a9e691" -dependencies = [ - "actix-codec", - "actix-http", - "actix-rt 1.1.1", - "actix-service", - "base64 0.13.0", - "bytes 0.5.6", - "cfg-if 1.0.0", - "derive_more", - "futures-core", - "log", - "mime", - "openssl", - "percent-encoding 2.1.0", - "rand 0.7.3", - "serde", - "serde_json", - "serde_urlencoded 0.7.0", -] - -[[package]] -name = "base-x" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" - -[[package]] -name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder", -] - [[package]] name = "base64" version = "0.12.3" @@ -789,79 +120,13 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -[[package]] -name = "blake2" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a5720225ef5daecf08657f23791354e1685a8c91a4c60c7f3d3b2892f978f4" -dependencies = [ - "crypto-mac", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array 0.14.4", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "blocking" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9" -dependencies = [ - "async-channel", - "async-task", - "atomic-waker", - "fastrand", - "futures-lite", - "once_cell", -] - -[[package]] -name = "brotli-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "brotli2" -version = "0.3.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "brotli-sys", - "libc", + "generic-array", ] [[package]] @@ -874,34 +139,12 @@ dependencies = [ "safemem", ] -[[package]] -name = "bumpalo" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - [[package]] name = "bytes" version = "0.5.6" @@ -914,21 +157,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" -[[package]] -name = "bytestring" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d" -dependencies = [ - "bytes 1.0.1", -] - -[[package]] -name = "cache-padded" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" - [[package]] name = "cc" version = "1.0.69" @@ -957,114 +185,10 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time 0.1.44", + "time", "winapi 0.3.9", ] -[[package]] -name = "clap" -version = "3.0.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142" -dependencies = [ - "atty", - "bitflags", - "clap_derive", - "indexmap", - "lazy_static", - "os_str_bytes", - "strsim", - "termcolor", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "clap_derive" -version = "3.0.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - -[[package]] -name = "concurrent-queue" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" -dependencies = [ - "cache-padded", -] - -[[package]] -name = "const_fn" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" - -[[package]] -name = "controller" -version = "0.6.12" -dependencies = [ - "akri-shared", - "anyhow", - "async-std", - "async-trait", - "chrono", - "env_logger 0.8.4", - "futures 0.3.16", - "k8s-openapi", - "kube", - "kube-runtime", - "lazy_static", - "log", - "mockall", - "prometheus 0.12.0", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "tokio 1.9.0", -] - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "cookie" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" -dependencies = [ - "percent-encoding 2.1.0", - "time 0.2.27", - "version_check", -] - -[[package]] -name = "copyless" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" - [[package]] name = "core-foundation" version = "0.9.1" @@ -1099,94 +223,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils 0.8.5", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" -dependencies = [ - "cfg-if 1.0.0", - "lazy_static", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array 0.14.4", - "subtle", -] - -[[package]] -name = "ctor" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d" -dependencies = [ - "quote", - "syn", -] - [[package]] name = "darling" version = "0.12.4" @@ -1232,17 +268,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "debug-echo-discovery-handler" -version = "0.6.12" -dependencies = [ - "akri-debug-echo", - "akri-discovery-utils", - "env_logger 0.8.4", - "log", - "tokio 1.9.0", -] - [[package]] name = "derivative" version = "2.2.0" @@ -1254,41 +279,19 @@ dependencies = [ "syn", ] -[[package]] -name = "derive_more" -version = "0.99.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version 0.3.3", - "syn", -] - [[package]] name = "difference" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.4", + "generic-array", ] [[package]] @@ -1312,12 +315,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "doc-comment" version = "0.3.3" @@ -1348,27 +345,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "encoding_rs" -version = "0.8.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "enum-as-inner" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "env_logger" version = "0.6.2" @@ -1376,52 +352,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" dependencies = [ "atty", - "humantime 1.3.0", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "env_logger" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" -dependencies = [ - "atty", - "humantime 2.1.0", + "humantime", "log", "regex", "termcolor", ] -[[package]] -name = "event-listener" -version = "2.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fastrand" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" -dependencies = [ - "instant", -] - -[[package]] -name = "fixedbitset" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" - [[package]] name = "flate2" version = "1.0.20" @@ -1471,7 +407,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -1496,12 +432,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -[[package]] -name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - [[package]] name = "futures" version = "0.3.16" @@ -1550,21 +480,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b0e06c393068f3a6ef246c75cdca793d6a46347e75286933e5e75fd2fd11582" -[[package]] -name = "futures-lite" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite 0.2.7", - "waker-fn", -] - [[package]] name = "futures-macro" version = "0.3.16" @@ -1603,30 +518,12 @@ dependencies = [ "futures-macro", "futures-sink", "futures-task", - "memchr", - "pin-project-lite 0.2.7", - "pin-utils", - "proc-macro-hack", - "proc-macro-nested", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", + "memchr", + "pin-project-lite 0.2.7", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", ] [[package]] @@ -1639,16 +536,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "gethostname" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e692e296bfac1d2533ef168d0b60ff5897b8b70a4009276834014dd8924cc028" -dependencies = [ - "libc", - "winapi 0.3.9", -] - [[package]] name = "getrandom" version = "0.1.16" @@ -1671,19 +558,6 @@ dependencies = [ "wasi 0.10.0+wasi-snapshot-preview1", ] -[[package]] -name = "gloo-timers" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "h2" version = "0.2.7" @@ -1741,8 +615,8 @@ dependencies = [ "headers-core", "http", "mime", - "sha-1 0.9.7", - "time 0.1.44", + "sha-1", + "time", ] [[package]] @@ -1754,15 +628,6 @@ dependencies = [ "http", ] -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "hermit-abi" version = "0.1.19" @@ -1778,17 +643,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hostname" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", -] - [[package]] name = "http" version = "0.2.4" @@ -1848,12 +702,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "hyper" version = "0.13.10" @@ -1933,17 +781,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.2.3" @@ -1992,33 +829,6 @@ dependencies = [ "libc", ] -[[package]] -name = "ipconfig" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" -dependencies = [ - "socket2 0.3.19", - "widestring", - "winapi 0.3.9", - "winreg 0.6.2", -] - -[[package]] -name = "ipnet" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" - -[[package]] -name = "itertools" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.9.0" @@ -2035,12 +845,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] -name = "js-sys" -version = "0.3.51" +name = "json-patch" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" +checksum = "f995a3c8f2bc3dd52a18a583e90f9ec109c047fa1603a853e46bcda14d2e279d" dependencies = [ - "wasm-bindgen", + "serde", + "serde_json", + "treediff", ] [[package]] @@ -2056,12 +868,14 @@ dependencies = [ [[package]] name = "k8s-openapi" -version = "0.12.0" -source = "git+https://github.com/kazk/k8s-openapi?branch=add-schema#9ee8bec4bc28ab7a53a785d5db9f2d05909b4fcb" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "748acc444200aa3528dc131a8048e131a9e75a611a52d152e276e99199313d1a" dependencies = [ "base64 0.13.0", "bytes 1.0.1", "chrono", + "schemars", "serde", "serde-value", "serde_json", @@ -2079,16 +893,16 @@ dependencies = [ [[package]] name = "kube" -version = "0.57.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8152fba26129a09bf30179092753b399760a305a218b8bc558f9a2087b5c1d70" +checksum = "f2bfa22c305a6d817b57a7afcd2e6ee23c80c6c93933edb02f210fdf73f837cc" dependencies = [ "base64 0.13.0", "bytes 1.0.1", "chrono", "dirs-next", "either", - "futures 0.3.16", + "futures", "http", "http-body 0.4.2", "hyper 0.14.11", @@ -2108,20 +922,22 @@ dependencies = [ "tokio 1.9.0", "tokio-native-tls", "tokio-util 0.6.7", - "tower 0.4.8", + "tower", "tower-http", "tracing", ] [[package]] name = "kube-core" -version = "0.57.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36b767df01404bb99fb75ac2ceded28ce34c30fdcffbb4346e2c44d30756bfba" +checksum = "9c33d2272d8e530938bafc6cf4ac76f2a6f6c9ca684defcfab6c357913a43bcc" dependencies = [ "form_urlencoded", "http", + "json-patch", "k8s-openapi", + "once_cell", "serde", "serde_json", "thiserror", @@ -2129,9 +945,9 @@ dependencies = [ [[package]] name = "kube-derive" -version = "0.57.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d0e5489859d9430689f64e69cacc9bf8cb68556f436c73a6a308d4e256b7a0" +checksum = "53dc9fa719dd21d1a4c155cf8936f618a687f3590885e09d9261727cd5dc56a5" dependencies = [ "darling", "proc-macro2", @@ -2142,38 +958,26 @@ dependencies = [ [[package]] name = "kube-runtime" -version = "0.57.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8358421de932e06d0521700fc8ecfc7058c95509e0770d2da88be78cd737c07" +checksum = "cb40d5730a3ac47b7153c7ad0494a66881bbdf0c17ead478b714dd82c9dba259" dependencies = [ "dashmap", "derivative", - "futures 0.3.16", + "futures", + "json-patch", "k8s-openapi", "kube", "pin-project 1.0.8", "serde", - "smallvec 1.6.1", + "serde_json", + "smallvec", "snafu", "tokio 1.9.0", "tokio-util 0.6.7", + "tracing", ] -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - -[[package]] -name = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - [[package]] name = "lazy_static" version = "1.4.0" @@ -2186,31 +990,12 @@ version = "0.2.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" -[[package]] -name = "libudev-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" -dependencies = [ - "libc", - "pkg-config", -] - [[package]] name = "linked-hash-map" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - [[package]] name = "lock_api" version = "0.4.4" @@ -2227,57 +1012,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ "cfg-if 1.0.0", - "value-bag", -] - -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", ] -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - [[package]] name = "matches" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" -[[package]] -name = "memoffset" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" -dependencies = [ - "autocfg", -] - [[package]] name = "mime" version = "0.3.16" @@ -2336,17 +1084,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio 0.6.23", -] - [[package]] name = "miow" version = "0.2.2" @@ -2368,15 +1105,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "mock_instant" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "717e29a243b81f8130e31e24e04fb151b04a44b5a7d05370935f7d937e9de06d" -dependencies = [ - "once_cell", -] - [[package]] name = "mockall" version = "0.9.1" @@ -2404,24 +1132,6 @@ dependencies = [ "syn", ] -[[package]] -name = "mockall_double" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e25b78d34b2b713b1d000d629079755cfc166e6a65f9f4c1c012a94305467c5" -dependencies = [ - "cfg-if 1.0.0", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "multimap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" - [[package]] name = "multipart" version = "0.17.1" @@ -2499,151 +1209,32 @@ name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "once_cell" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" - -[[package]] -name = "onvif-discovery-handler" -version = "0.6.12" -dependencies = [ - "akri-discovery-utils", - "akri-onvif", - "env_logger 0.8.4", - "log", - "tokio 1.9.0", -] - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "opcua-client" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0af3d9776871cb836aa6e3f57407b3c798c7c9f46ea9fae0835f8514f89585a1" -dependencies = [ - "chrono", - "futures 0.1.31", - "lazy_static", - "log", - "opcua-core", - "opcua-crypto", - "opcua-types", - "serde", - "serde_derive", - "time 0.1.44", - "tokio 0.1.22", - "tokio-codec", - "tokio-io", - "tokio-timer", -] - -[[package]] -name = "opcua-core" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7dd64d0071fb9e3c1409c8ad416c3df865053209a183bbf017ee193afbda7e9" -dependencies = [ - "bytes 0.4.12", - "chrono", - "futures 0.1.31", - "lazy_static", - "log", - "opcua-crypto", - "opcua-types", - "regex", - "serde", - "serde_derive", - "serde_yaml", - "tokio 0.1.22", - "tokio-io", - "url 1.7.2", -] - -[[package]] -name = "opcua-crypto" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5754e8be576bf03903a7c71b5a0a6e40a267fcc6742c83974399cdc7146362e" -dependencies = [ - "bytes 0.4.12", - "chrono", - "gethostname", - "lazy_static", - "log", - "opcua-types", - "openssl", - "serde", - "serde_derive", -] - -[[package]] -name = "opcua-discovery-handler" -version = "0.6.12" -dependencies = [ - "akri-discovery-utils", - "akri-opcua", - "env_logger 0.8.4", - "log", - "tokio 1.9.0", -] - -[[package]] -name = "opcua-types" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "247dd311285d4f846219b3809c048719d3a1fd6c7b01ba16b0a6651290913d61" -dependencies = [ - "base64 0.12.3", - "bitflags", - "byteorder", - "chrono", - "lazy_static", - "log", - "regex", - "serde", - "serde_derive", - "uuid", +dependencies = [ + "autocfg", ] [[package]] -name = "openapi" -version = "1.1.0" -source = "git+https://github.com/DazWilkin/openapi-admission-v1?tag=v1.1.0#60a9ba6bd64efda65cb136a21e0d6a53e962c415" +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "reqwest", - "serde", - "serde_derive", - "serde_json", - "url 1.7.2", + "hermit-abi", + "libc", ] +[[package]] +name = "once_cell" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "openssl" version = "0.10.35" @@ -2686,29 +1277,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "os_str_bytes" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85" - -[[package]] -name = "parking" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" - -[[package]] -name = "parking_lot" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.6.2", - "rustc_version 0.2.3", -] - [[package]] name = "parking_lot" version = "0.11.1" @@ -2716,23 +1284,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", - "lock_api 0.4.4", - "parking_lot_core 0.8.3", -] - -[[package]] -name = "parking_lot_core" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall 0.1.57", - "rustc_version 0.2.3", - "smallvec 0.6.14", - "winapi 0.3.9", + "lock_api", + "parking_lot_core", ] [[package]] @@ -2744,8 +1297,8 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.2.9", - "smallvec 1.6.1", + "redox_syscall", + "smallvec", "winapi 0.3.9", ] @@ -2760,77 +1313,12 @@ dependencies = [ "regex", ] -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "peresil" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f658886ed52e196e850cfbbfddab9eaa7f6d90dd0929e264c31e5cec07e09e57" - -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" -dependencies = [ - "maplit", - "pest", - "sha-1 0.8.2", -] - -[[package]] -name = "petgraph" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" -dependencies = [ - "fixedbitset", - "indexmap", -] - [[package]] name = "pin-project" version = "0.4.28" @@ -2895,19 +1383,6 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" -[[package]] -name = "polling" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "log", - "wepoll-ffi", - "winapi 0.3.9", -] - [[package]] name = "ppv-lite86" version = "0.2.10" @@ -2943,30 +1418,6 @@ dependencies = [ "treeline", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro-hack" version = "0.5.19" @@ -3012,40 +1463,13 @@ dependencies = [ "fnv", "lazy_static", "libc", - "parking_lot 0.11.1", + "parking_lot", "procfs", "protobuf", "regex", "thiserror", ] -[[package]] -name = "prometheus" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5986aa8d62380092d2f50f8b1cdba9cb9b6731ffd4b25b51fd126b6c3e05b99c" -dependencies = [ - "cfg-if 1.0.0", - "fnv", - "lazy_static", - "libc", - "memchr", - "parking_lot 0.11.1", - "procfs", - "protobuf", - "thiserror", -] - -[[package]] -name = "prost" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" -dependencies = [ - "bytes 0.5.6", - "prost-derive 0.6.1", -] - [[package]] name = "prost" version = "0.7.0" @@ -3053,56 +1477,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" dependencies = [ "bytes 1.0.1", - "prost-derive 0.7.0", -] - -[[package]] -name = "prost-build" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" -dependencies = [ - "bytes 0.5.6", - "heck", - "itertools 0.8.2", - "log", - "multimap", - "petgraph", - "prost 0.6.1", - "prost-types 0.6.1", - "tempfile", - "which 3.1.1", -] - -[[package]] -name = "prost-build" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" -dependencies = [ - "bytes 1.0.1", - "heck", - "itertools 0.9.0", - "log", - "multimap", - "petgraph", - "prost 0.7.0", - "prost-types 0.7.0", - "tempfile", - "which 4.2.2", -] - -[[package]] -name = "prost-derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" -dependencies = [ - "anyhow", - "itertools 0.8.2", - "proc-macro2", - "quote", - "syn", + "prost-derive", ] [[package]] @@ -3112,32 +1487,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" dependencies = [ "anyhow", - "itertools 0.9.0", + "itertools", "proc-macro2", "quote", "syn", ] -[[package]] -name = "prost-types" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa" -dependencies = [ - "bytes 0.5.6", - "prost 0.6.1", -] - -[[package]] -name = "prost-types" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" -dependencies = [ - "bytes 1.0.1", - "prost 0.7.0", -] - [[package]] name = "protobuf" version = "2.24.1" @@ -3170,7 +1525,6 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", - "rand_pcg", ] [[package]] @@ -3224,179 +1578,66 @@ dependencies = [ ] [[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core 0.6.3", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "redox_syscall" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" -dependencies = [ - "getrandom 0.2.3", - "redox_syscall 0.2.9", -] - -[[package]] -name = "regex" -version = "1.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "reqwest" -version = "0.11.4" +name = "rand_hc" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "base64 0.13.0", - "bytes 1.0.1", - "encoding_rs", - "futures-core", - "futures-util", - "http", - "http-body 0.4.2", - "hyper 0.14.11", - "ipnet", - "js-sys", - "lazy_static", - "log", - "mime", - "mime_guess", - "percent-encoding 2.1.0", - "pin-project-lite 0.2.7", - "serde", - "serde_json", - "serde_urlencoded 0.7.0", - "tokio 1.9.0", - "url 2.2.2", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg 0.7.0", + "rand_core 0.5.1", ] [[package]] -name = "resolv-conf" -version = "0.7.0" +name = "rand_hc" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ - "hostname", - "quick-error", + "rand_core 0.6.3", ] [[package]] -name = "ring" -version = "0.16.20" +name = "redox_syscall" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi 0.3.9", + "bitflags", ] [[package]] -name = "rscam" -version = "0.5.5" +name = "redox_users" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89056084211cd54924fedf2e2199b906409d1f795cfd8e7e3271061742457018" +checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ - "libc", + "getrandom 0.2.3", + "redox_syscall", ] [[package]] -name = "rustc_version" -version = "0.2.3" +name = "regex" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ - "semver 0.9.0", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "rustc_version" -version = "0.3.3" +name = "regex-syntax" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] -name = "rustls" -version = "0.19.1" +name = "remove_dir_all" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "base64 0.13.0", - "log", - "ring", - "sct", - "webpki", + "winapi 0.3.9", ] [[package]] @@ -3457,16 +1698,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "security-framework" version = "2.3.1" @@ -3490,39 +1721,6 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser 0.7.0", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser 0.10.2", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" version = "1.0.127" @@ -3585,19 +1783,7 @@ dependencies = [ "dtoa", "itoa", "serde", - "url 2.2.2", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", + "url", ] [[package]] @@ -3612,37 +1798,19 @@ dependencies = [ "yaml-rust", ] -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - [[package]] name = "sha-1" version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81" dependencies = [ - "block-buffer 0.9.0", + "block-buffer", "cfg-if 1.0.0", "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest", + "opaque-debug", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -3658,15 +1826,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" -[[package]] -name = "smallvec" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] - [[package]] name = "smallvec" version = "1.6.1" @@ -3717,103 +1876,12 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "standback" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" -dependencies = [ - "version_check", -] - -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version 0.2.3", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "sxd-document" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d82f37be9faf1b10a82c4bd492b74f698e40082f0f40de38ab275f31d42078" -dependencies = [ - "peresil", - "typed-arena", -] - -[[package]] -name = "sxd-xpath" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36e39da5d30887b5690e29de4c5ebb8ddff64ebd9933f98a01daaa4fd11b36ea" -dependencies = [ - "peresil", - "quick-error", - "sxd-document", -] - [[package]] name = "syn" version = "1.0.74" @@ -3834,7 +1902,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "rand 0.8.4", - "redox_syscall 0.2.9", + "redox_syscall", "remove_dir_all", "winapi 0.3.9", ] @@ -3848,15 +1916,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789" -dependencies = [ - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.26" @@ -3877,15 +1936,6 @@ dependencies = [ "syn", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "time" version = "0.1.44" @@ -3897,44 +1947,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "time" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros", - "version_check", - "winapi 0.3.9", -] - -[[package]] -name = "time-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", -] - [[package]] name = "tinyvec" version = "1.3.1" @@ -3950,30 +1962,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" -[[package]] -name = "tokio" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "mio 0.6.23", - "num_cpus", - "tokio-codec", - "tokio-current-thread", - "tokio-executor", - "tokio-fs", - "tokio-io", - "tokio-reactor", - "tokio-sync", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", - "tokio-udp", - "tokio-uds", -] - [[package]] name = "tokio" version = "0.2.25" @@ -3985,16 +1973,10 @@ dependencies = [ "futures-core", "iovec", "lazy_static", - "libc", "memchr", "mio 0.6.23", - "mio-uds", - "num_cpus", "pin-project-lite 0.1.12", - "signal-hook-registry", "slab", - "tokio-macros 0.2.6", - "winapi 0.3.9", ] [[package]] @@ -4010,85 +1992,21 @@ dependencies = [ "mio 0.7.13", "num_cpus", "once_cell", - "parking_lot 0.11.1", + "parking_lot", "pin-project-lite 0.2.7", "signal-hook-registry", - "tokio-macros 1.3.0", + "tokio-macros", "winapi 0.3.9", ] -[[package]] -name = "tokio-codec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "tokio-io", -] - -[[package]] -name = "tokio-current-thread" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" -dependencies = [ - "futures 0.1.31", - "tokio-executor", -] - -[[package]] -name = "tokio-executor" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures 0.1.31", -] - -[[package]] -name = "tokio-fs" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" -dependencies = [ - "futures 0.1.31", - "tokio-io", - "tokio-threadpool", -] - -[[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "log", -] - [[package]] name = "tokio-io-timeout" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9" dependencies = [ - "pin-project-lite 0.2.7", - "tokio 1.9.0", -] - -[[package]] -name = "tokio-macros" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "pin-project-lite 0.2.7", + "tokio 1.9.0", ] [[package]] @@ -4112,46 +2030,6 @@ dependencies = [ "tokio 1.9.0", ] -[[package]] -name = "tokio-openssl" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c4b08c5f4208e699ede3df2520aca2e82401b2de33f45e96696a074480be594" -dependencies = [ - "openssl", - "tokio 0.2.25", -] - -[[package]] -name = "tokio-reactor" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures 0.1.31", - "lazy_static", - "log", - "mio 0.6.23", - "num_cpus", - "parking_lot 0.9.0", - "slab", - "tokio-executor", - "tokio-io", - "tokio-sync", -] - -[[package]] -name = "tokio-rustls" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" -dependencies = [ - "rustls", - "tokio 1.9.0", - "webpki", -] - [[package]] name = "tokio-stream" version = "0.1.7" @@ -4163,59 +2041,6 @@ dependencies = [ "tokio 1.9.0", ] -[[package]] -name = "tokio-sync" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" -dependencies = [ - "fnv", - "futures 0.1.31", -] - -[[package]] -name = "tokio-tcp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "iovec", - "mio 0.6.23", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-threadpool" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" -dependencies = [ - "crossbeam-deque", - "crossbeam-queue", - "crossbeam-utils 0.7.2", - "futures 0.1.31", - "lazy_static", - "log", - "num_cpus", - "slab", - "tokio-executor", -] - -[[package]] -name = "tokio-timer" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures 0.1.31", - "slab", - "tokio-executor", -] - [[package]] name = "tokio-tungstenite" version = "0.11.0" @@ -4229,53 +2054,6 @@ dependencies = [ "tungstenite", ] -[[package]] -name = "tokio-udp" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "log", - "mio 0.6.23", - "tokio-codec", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-uds" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "iovec", - "libc", - "log", - "mio 0.6.23", - "mio-uds", - "tokio-codec", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-util" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" -dependencies = [ - "bytes 0.5.6", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.1.12", - "tokio 0.2.25", -] - [[package]] name = "tokio-util" version = "0.3.1" @@ -4305,43 +2083,13 @@ dependencies = [ "tokio 1.9.0", ] -[[package]] -name = "tonic" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08283643b1d483eb7f3fc77069e63b5cba3e4db93514b3d45470e67f123e4e48" -dependencies = [ - "async-stream 0.2.1", - "async-trait", - "base64 0.10.1", - "bytes 0.5.6", - "futures-core", - "futures-util", - "http", - "http-body 0.3.1", - "hyper 0.13.10", - "percent-encoding 1.0.1", - "pin-project 0.4.28", - "prost 0.6.1", - "prost-derive 0.6.1", - "tokio 0.2.25", - "tokio-util 0.2.0", - "tower 0.3.1", - "tower-balance", - "tower-load", - "tower-make", - "tower-service", - "tracing", - "tracing-futures", -] - [[package]] name = "tonic" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ac42cd97ac6bd2339af5bcabf105540e21e45636ec6fa6aae5e85d44db31be0" dependencies = [ - "async-stream 0.3.2", + "async-stream", "async-trait", "base64 0.13.0", "bytes 1.0.1", @@ -4351,62 +2099,19 @@ dependencies = [ "http", "http-body 0.4.2", "hyper 0.14.11", - "percent-encoding 2.1.0", + "percent-encoding", "pin-project 1.0.8", - "prost 0.7.0", - "prost-derive 0.7.0", + "prost", + "prost-derive", "tokio 1.9.0", - "tokio-rustls", "tokio-stream", "tokio-util 0.6.7", - "tower 0.4.8", + "tower", "tower-service", "tracing", "tracing-futures", ] -[[package]] -name = "tonic-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0436413ba71545bcc6c2b9a0f9d78d72deb0123c6a75ccdfe7c056f9930f5e52" -dependencies = [ - "proc-macro2", - "prost-build 0.6.1", - "quote", - "syn", -] - -[[package]] -name = "tonic-build" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c695de27302f4697191dda1c7178131a8cb805463dda02864acb80fe1322fdcf" -dependencies = [ - "proc-macro2", - "prost-build 0.7.0", - "quote", - "syn", -] - -[[package]] -name = "tower" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3169017c090b7a28fce80abaad0ab4f5566423677c9331bb320af7e49cfe62" -dependencies = [ - "futures-core", - "tower-buffer", - "tower-discover", - "tower-layer", - "tower-limit", - "tower-load-shed", - "tower-retry", - "tower-service", - "tower-timeout", - "tower-util", -] - [[package]] name = "tower" version = "0.4.8" @@ -4416,193 +2121,46 @@ dependencies = [ "futures-core", "futures-util", "indexmap", - "pin-project 1.0.8", - "rand 0.8.4", - "slab", - "tokio 1.9.0", - "tokio-stream", - "tokio-util 0.6.7", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-balance" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a792277613b7052448851efcf98a2c433e6f1d01460832dc60bef676bc275d4c" -dependencies = [ - "futures-core", - "futures-util", - "indexmap", - "pin-project 0.4.28", - "rand 0.7.3", - "slab", - "tokio 0.2.25", - "tower-discover", - "tower-layer", - "tower-load", - "tower-make", - "tower-ready-cache", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-buffer" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4887dc2a65d464c8b9b66e0e4d51c2fd6cf5b3373afc72805b0a60bce00446a" -dependencies = [ - "futures-core", - "pin-project 0.4.28", - "tokio 0.2.25", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-discover" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6b5000c3c54d269cc695dff28136bb33d08cbf1df2c48129e143ab65bf3c2a" -dependencies = [ - "futures-core", - "pin-project 0.4.28", - "tower-service", -] - -[[package]] -name = "tower-http" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b56efe69aa0ad2b5da6b942e57ea9f6fe683b7a314d4ff48662e2c8838de1" -dependencies = [ - "bytes 1.0.1", - "futures-core", - "futures-util", - "http", - "http-body 0.4.2", - "pin-project 1.0.8", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-layer" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" - -[[package]] -name = "tower-limit" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c3040c5dbed68abffaa0d4517ac1a454cd741044f33ab0eefab6b8d1361404" -dependencies = [ - "futures-core", - "pin-project 0.4.28", - "tokio 0.2.25", - "tower-layer", - "tower-load", - "tower-service", -] - -[[package]] -name = "tower-load" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc79fc3afd07492b7966d7efa7c6c50f8ed58d768a6075dd7ae6591c5d2017b" -dependencies = [ - "futures-core", - "log", - "pin-project 0.4.28", - "tokio 0.2.25", - "tower-discover", - "tower-service", -] - -[[package]] -name = "tower-load-shed" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f021e23900173dc315feb4b6922510dae3e79c689b74c089112066c11f0ae4e" -dependencies = [ - "futures-core", - "pin-project 0.4.28", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-make" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce50370d644a0364bf4877ffd4f76404156a248d104e2cc234cd391ea5cdc965" -dependencies = [ - "tokio 0.2.25", - "tower-service", -] - -[[package]] -name = "tower-ready-cache" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eabb6620e5481267e2ec832c780b31cad0c15dcb14ed825df5076b26b591e1f" -dependencies = [ - "futures-core", - "futures-util", - "indexmap", - "log", - "tokio 0.2.25", + "pin-project 1.0.8", + "rand 0.8.4", + "slab", + "tokio 1.9.0", + "tokio-stream", + "tokio-util 0.6.7", + "tower-layer", "tower-service", + "tracing", ] [[package]] -name = "tower-retry" -version = "0.3.0" +name = "tower-http" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6727956aaa2f8957d4d9232b308fe8e4e65d99db30f42b225646e86c9b6a952" +checksum = "0b7b56efe69aa0ad2b5da6b942e57ea9f6fe683b7a314d4ff48662e2c8838de1" dependencies = [ + "base64 0.13.0", + "bytes 1.0.1", "futures-core", - "pin-project 0.4.28", - "tokio 0.2.25", + "futures-util", + "http", + "http-body 0.4.2", + "pin-project 1.0.8", "tower-layer", "tower-service", + "tracing", ] [[package]] -name = "tower-service" +name = "tower-layer" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" - -[[package]] -name = "tower-timeout" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "127b8924b357be938823eaaec0608c482d40add25609481027b96198b2e4b31e" -dependencies = [ - "pin-project 0.4.28", - "tokio 0.2.25", - "tower-layer", - "tower-service", -] +checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" [[package]] -name = "tower-util" +name = "tower-service" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1093c19826d33807c72511e68f73b4a0469a3f22c2bd5f7d5212178b4b89674" -dependencies = [ - "futures-core", - "futures-util", - "pin-project 0.4.28", - "tower-service", -] +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" @@ -4648,49 +2206,19 @@ dependencies = [ ] [[package]] -name = "treeline" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" - -[[package]] -name = "trust-dns-proto" -version = "0.19.7" +name = "treediff" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cad71a0c0d68ab9941d2fb6e82f8fb2e86d9945b94e1661dd0aaea2b88215a9" +checksum = "761e8d5ad7ce14bb82b7e61ccc0ca961005a275a060b9644a2431aa11553c2ff" dependencies = [ - "async-trait", - "cfg-if 1.0.0", - "enum-as-inner", - "futures 0.3.16", - "idna 0.2.3", - "lazy_static", - "log", - "rand 0.7.3", - "smallvec 1.6.1", - "thiserror", - "tokio 0.2.25", - "url 2.2.2", + "serde_json", ] [[package]] -name = "trust-dns-resolver" -version = "0.19.7" +name = "treeline" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710f593b371175db53a26d0b38ed2978fafb9e9e8d3868b1acd753ea18df0ceb" -dependencies = [ - "cfg-if 0.1.10", - "futures 0.3.16", - "ipconfig", - "lazy_static", - "log", - "lru-cache", - "resolv-conf", - "smallvec 1.6.1", - "thiserror", - "tokio 0.2.25", - "trust-dns-proto", -] +checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" [[package]] name = "try-lock" @@ -4712,8 +2240,8 @@ dependencies = [ "input_buffer", "log", "rand 0.7.3", - "sha-1 0.9.7", - "url 2.2.2", + "sha-1", + "url", "utf-8", ] @@ -4726,62 +2254,12 @@ dependencies = [ "memchr", ] -[[package]] -name = "typed-arena" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d" - [[package]] name = "typenum" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "udev" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048df778e99eea028c08cca7853b9b521df6948b59bb29ab8bb737c057f58e6d" -dependencies = [ - "libc", - "libudev-sys", -] - -[[package]] -name = "udev-discovery-handler" -version = "0.6.12" -dependencies = [ - "akri-discovery-utils", - "akri-udev", - "env_logger 0.8.4", - "log", - "tokio 1.9.0", -] - -[[package]] -name = "udev-video-broker" -version = "0.6.12" -dependencies = [ - "akri-shared", - "env_logger 0.8.4", - "futures 0.1.31", - "lazy_static", - "log", - "prometheus 0.12.0", - "prost 0.6.1", - "rscam", - "tokio 0.2.25", - "tonic 0.1.1", - "tonic-build 0.1.1", -] - [[package]] name = "unicase" version = "2.6.0" @@ -4809,41 +2287,12 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" - -[[package]] -name = "unicode-width" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" - [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.2.2" @@ -4851,9 +2300,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", - "idna 0.2.3", + "idna", "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -4868,49 +2317,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom 0.2.3", -] - -[[package]] -name = "value-bag" -version = "1.0.0-alpha.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd320e1520f94261153e96f7534476ad869c14022aee1e59af7c778075d840ae" -dependencies = [ - "ctor", - "version_check", -] - [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - [[package]] name = "want" version = "0.3.0" @@ -4928,7 +2346,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f41be6df54c97904af01aa23e613d4521eed7ab23537cede692d4058f6449407" dependencies = [ "bytes 0.5.6", - "futures 0.3.16", + "futures", "headers", "http", "hyper 0.13.10", @@ -4940,7 +2358,7 @@ dependencies = [ "scoped-tls", "serde", "serde_json", - "serde_urlencoded 0.6.1", + "serde_urlencoded", "tokio 0.2.25", "tokio-tungstenite", "tower-service", @@ -4961,148 +2379,6 @@ version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" -[[package]] -name = "wasm-bindgen" -version = "0.2.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" -dependencies = [ - "cfg-if 1.0.0", - "serde", - "serde_json", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" - -[[package]] -name = "web-sys" -version = "0.3.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webhook-configuration" -version = "0.6.12" -dependencies = [ - "actix", - "actix-rt 2.2.0", - "actix-web", - "akri-shared", - "clap", - "k8s-openapi", - "kube", - "kube-runtime", - "openapi", - "openssl", - "rustls", - "serde", - "serde_json", -] - -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "wepoll-ffi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" -dependencies = [ - "cc", -] - -[[package]] -name = "which" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" -dependencies = [ - "libc", -] - -[[package]] -name = "which" -version = "4.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" -dependencies = [ - "either", - "lazy_static", - "libc", -] - -[[package]] -name = "widestring" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" - [[package]] name = "winapi" version = "0.2.8" @@ -5146,24 +2422,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "winreg" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "winreg" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -5174,12 +2432,6 @@ dependencies = [ "winapi-build", ] -[[package]] -name = "xml-rs" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" - [[package]] name = "yaml-rust" version = "0.4.5" @@ -5188,25 +2440,3 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] - -[[package]] -name = "yaserde" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc096efbee9ec8fee0600a15bb4fd651ccc14570cb05b6d4dd66b0325e4a0b5e" -dependencies = [ - "log", - "xml-rs", -] - -[[package]] -name = "yaserde_derive" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9af81f1d48039716dd825cf4a7d61d39583f8b12705994abb446bae749a977bb" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] diff --git a/Cargo.toml b/Cargo.toml index 4af5b45fe..1bb68d2fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,23 +3,23 @@ # [patch.crates-io] # h2 = { git = "https://github.com/kate-goldenring/h2", branch = "master" } -[patch.crates-io] -k8s-openapi = { git = "https://github.com/kazk/k8s-openapi", branch = "add-schema" } +# [patch.crates-io] +# k8s-openapi = { git = "https://github.com/kazk/k8s-openapi", branch = "add-schema" } [workspace] members = [ "shared", - "agent", - "controller", - "samples/brokers/udev-video-broker", - "webhooks/validating/configuration", - "discovery-utils", - "discovery-handlers/debug-echo", - "discovery-handlers/onvif", - "discovery-handlers/opcua", - "discovery-handlers/udev", - "discovery-handler-modules/debug-echo-discovery-handler", - "discovery-handler-modules/onvif-discovery-handler", - "discovery-handler-modules/opcua-discovery-handler", - "discovery-handler-modules/udev-discovery-handler", + # "agent", + # "controller", + # "samples/brokers/udev-video-broker", + # "webhooks/validating/configuration", + # "discovery-utils", + # "discovery-handlers/debug-echo", + # "discovery-handlers/onvif", + # "discovery-handlers/opcua", + # "discovery-handlers/udev", + # "discovery-handler-modules/debug-echo-discovery-handler", + # "discovery-handler-modules/onvif-discovery-handler", + # "discovery-handler-modules/opcua-discovery-handler", + # "discovery-handler-modules/udev-discovery-handler", ] diff --git a/agent/Cargo.toml b/agent/Cargo.toml index c53a4c4af..2e819d31e 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -25,9 +25,9 @@ futures-core = "0.3" futures-util = "0.3" hyper = "0.14.2" h2 = "0.3.0" -kube = { version = "0.57.0", features = ["derive"] } -kube-runtime = "0.57.0" -k8s-openapi = { version = "0.12.0", default-features = false, features = ["v1_16"] } +kube = { version = "0.59.0", features = ["derive"] } +kube-runtime = "0.59.0" +k8s-openapi = { version = "0.13.0", default-features = false, features = ["schemars", "v1_16"] } lazy_static = "1.4" log = "0.4" mockall_double = "0.2.0" diff --git a/agent/src/util/v1beta1.rs b/agent/src/util/v1beta1.rs index b01a89c37..6cea16015 100644 --- a/agent/src/util/v1beta1.rs +++ b/agent/src/util/v1beta1.rs @@ -136,7 +136,7 @@ pub struct DeviceSpec { } #[doc = r" Generated client implementations."] pub mod registration_client { - #![allow(unused_variables, dead_code, missing_docs)] + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; #[doc = " Registration is the service advertised by the Kubelet"] #[doc = " Only when Kubelet answers with a success code to a Register Request"] @@ -144,6 +144,7 @@ pub mod registration_client { #[doc = " Registration may fail when device plugin version is not supported by"] #[doc = " Kubelet or the registered resourceName is already taken by another"] #[doc = " active device plugin. Device plugin is expected to terminate upon registration failure"] + #[derive(Debug, Clone)] pub struct RegistrationClient { inner: tonic::client::Grpc, } @@ -161,17 +162,43 @@ pub mod registration_client { impl RegistrationClient where T: tonic::client::GrpcService, - T::ResponseBody: Body + HttpBody + Send + 'static, + T::ResponseBody: Body + Send + Sync + 'static, T::Error: Into, - ::Error: Into + Send, + ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = tonic::client::Grpc::with_interceptor(inner, interceptor); - Self { inner } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> RegistrationClient> + where + F: tonic::service::Interceptor, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + >>::Error: + Into + Send + Sync, + { + RegistrationClient::new(InterceptedService::new(inner, interceptor)) + } + #[doc = r" Compress requests with `gzip`."] + #[doc = r""] + #[doc = r" This requires the server to support it otherwise it might respond with an"] + #[doc = r" error."] + pub fn send_gzip(mut self) -> Self { + self.inner = self.inner.send_gzip(); + self + } + #[doc = r" Enable decompressing responses with `gzip`."] + pub fn accept_gzip(mut self) -> Self { + self.inner = self.inner.accept_gzip(); + self } pub async fn register( &mut self, @@ -188,24 +215,13 @@ pub mod registration_client { self.inner.unary(request.into_request(), path, codec).await } } - impl Clone for RegistrationClient { - fn clone(&self) -> Self { - Self { - inner: self.inner.clone(), - } - } - } - impl std::fmt::Debug for RegistrationClient { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "RegistrationClient {{ ... }}") - } - } } #[doc = r" Generated client implementations."] pub mod device_plugin_client { - #![allow(unused_variables, dead_code, missing_docs)] + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; #[doc = " DevicePlugin is the service advertised by Device Plugins"] + #[derive(Debug, Clone)] pub struct DevicePluginClient { inner: tonic::client::Grpc, } @@ -223,17 +239,43 @@ pub mod device_plugin_client { impl DevicePluginClient where T: tonic::client::GrpcService, - T::ResponseBody: Body + HttpBody + Send + 'static, + T::ResponseBody: Body + Send + Sync + 'static, T::Error: Into, - ::Error: Into + Send, + ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = tonic::client::Grpc::with_interceptor(inner, interceptor); - Self { inner } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> DevicePluginClient> + where + F: tonic::service::Interceptor, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + >>::Error: + Into + Send + Sync, + { + DevicePluginClient::new(InterceptedService::new(inner, interceptor)) + } + #[doc = r" Compress requests with `gzip`."] + #[doc = r""] + #[doc = r" This requires the server to support it otherwise it might respond with an"] + #[doc = r" error."] + pub fn send_gzip(mut self) -> Self { + self.inner = self.inner.send_gzip(); + self + } + #[doc = r" Enable decompressing responses with `gzip`."] + pub fn accept_gzip(mut self) -> Self { + self.inner = self.inner.accept_gzip(); + self } #[doc = " GetDevicePluginOptions returns options to be communicated with Device"] #[doc = " Manager"] @@ -311,22 +353,10 @@ pub mod device_plugin_client { self.inner.unary(request.into_request(), path, codec).await } } - impl Clone for DevicePluginClient { - fn clone(&self) -> Self { - Self { - inner: self.inner.clone(), - } - } - } - impl std::fmt::Debug for DevicePluginClient { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "DevicePluginClient {{ ... }}") - } - } } #[doc = r" Generated server implementations."] pub mod registration_server { - #![allow(unused_variables, dead_code, missing_docs)] + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; #[doc = "Generated trait containing gRPC methods that should be implemented for use with RegistrationServer."] #[async_trait] @@ -345,24 +375,31 @@ pub mod registration_server { #[derive(Debug)] pub struct RegistrationServer { inner: _Inner, + accept_compression_encodings: (), + send_compression_encodings: (), } - struct _Inner(Arc, Option); + struct _Inner(Arc); impl RegistrationServer { pub fn new(inner: T) -> Self { let inner = Arc::new(inner); - let inner = _Inner(inner, None); - Self { inner } + let inner = _Inner(inner); + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = Arc::new(inner); - let inner = _Inner(inner, Some(interceptor.into())); - Self { inner } + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) } } - impl Service> for RegistrationServer + impl tonic::codegen::Service> for RegistrationServer where T: Registration, - B: HttpBody + Send + Sync + 'static, + B: Body + Send + Sync + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; @@ -389,17 +426,17 @@ pub mod registration_server { Box::pin(fut) } } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { - let interceptor = inner.1.clone(); let inner = inner.0; let method = RegisterSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = if let Some(interceptor) = interceptor { - tonic::server::Grpc::with_interceptor(codec, interceptor) - } else { - tonic::server::Grpc::new(codec) - }; + let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -410,7 +447,7 @@ pub mod registration_server { .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") - .body(tonic::body::BoxBody::empty()) + .body(empty_body()) .unwrap()) }), } @@ -419,12 +456,16 @@ pub mod registration_server { impl Clone for RegistrationServer { fn clone(&self) -> Self { let inner = self.inner.clone(); - Self { inner } + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone(), self.1.clone()) + Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { @@ -438,7 +479,7 @@ pub mod registration_server { } #[doc = r" Generated server implementations."] pub mod device_plugin_server { - #![allow(unused_variables, dead_code, missing_docs)] + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; #[doc = "Generated trait containing gRPC methods that should be implemented for use with DevicePluginServer."] #[async_trait] @@ -480,24 +521,31 @@ pub mod device_plugin_server { #[derive(Debug)] pub struct DevicePluginServer { inner: _Inner, + accept_compression_encodings: (), + send_compression_encodings: (), } - struct _Inner(Arc, Option); + struct _Inner(Arc); impl DevicePluginServer { pub fn new(inner: T) -> Self { let inner = Arc::new(inner); - let inner = _Inner(inner, None); - Self { inner } + let inner = _Inner(inner); + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = Arc::new(inner); - let inner = _Inner(inner, Some(interceptor.into())); - Self { inner } + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) } } - impl Service> for DevicePluginServer + impl tonic::codegen::Service> for DevicePluginServer where T: DevicePlugin, - B: HttpBody + Send + Sync + 'static, + B: Body + Send + Sync + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; @@ -522,17 +570,17 @@ pub mod device_plugin_server { Box::pin(fut) } } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { - let interceptor = inner.1.clone(); let inner = inner.0; let method = GetDevicePluginOptionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = if let Some(interceptor) = interceptor { - tonic::server::Grpc::with_interceptor(codec, interceptor) - } else { - tonic::server::Grpc::new(codec) - }; + let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -552,17 +600,17 @@ pub mod device_plugin_server { Box::pin(fut) } } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { - let interceptor = inner.1; let inner = inner.0; let method = ListAndWatchSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = if let Some(interceptor) = interceptor { - tonic::server::Grpc::with_interceptor(codec, interceptor) - } else { - tonic::server::Grpc::new(codec) - }; + let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.server_streaming(method, req).await; Ok(res) }; @@ -583,17 +631,17 @@ pub mod device_plugin_server { Box::pin(fut) } } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { - let interceptor = inner.1.clone(); let inner = inner.0; let method = AllocateSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = if let Some(interceptor) = interceptor { - tonic::server::Grpc::with_interceptor(codec, interceptor) - } else { - tonic::server::Grpc::new(codec) - }; + let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -617,17 +665,17 @@ pub mod device_plugin_server { Box::pin(fut) } } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { - let interceptor = inner.1.clone(); let inner = inner.0; let method = PreStartContainerSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = if let Some(interceptor) = interceptor { - tonic::server::Grpc::with_interceptor(codec, interceptor) - } else { - tonic::server::Grpc::new(codec) - }; + let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -638,7 +686,7 @@ pub mod device_plugin_server { .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") - .body(tonic::body::BoxBody::empty()) + .body(empty_body()) .unwrap()) }), } @@ -647,12 +695,16 @@ pub mod device_plugin_server { impl Clone for DevicePluginServer { fn clone(&self) -> Self { let inner = self.inner.clone(); - Self { inner } + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone(), self.1.clone()) + Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { diff --git a/controller/Cargo.toml b/controller/Cargo.toml index f61ccdb19..0dd085b7d 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -14,9 +14,9 @@ chrono = "0.4.10" env_logger = "0.8.3" futures = "0.3.1" anyhow = "1.0.38" -kube = { version = "0.57.0", features = ["derive"] } -kube-runtime = "0.57.0" -k8s-openapi = { version = "0.12.0", default-features = false, features = ["v1_16"] } +kube = { version = "0.59.0", features = ["derive"] } +kube-runtime = "0.59.0" +k8s-openapi = { version = "0.13.0", default-features = false, features = ["schemars", "v1_16"] } lazy_static = "1.4" log = "0.4" prometheus = { version = "0.12.0", features = ["process"] } diff --git a/controller/src/util/instance_action.rs b/controller/src/util/instance_action.rs index 1764177ce..28634a7eb 100644 --- a/controller/src/util/instance_action.rs +++ b/controller/src/util/instance_action.rs @@ -178,10 +178,8 @@ fn determine_action_for_pod( // Early exits above ensure unwrap will not panic let pod_phase = k8s_pod.status.as_ref().unwrap().phase.as_ref().unwrap(); - - if k8s_pod - .metadata - .labels + let labels = k8s_pod.metadata.labels.as_ref().or(Some(&std::collections::BTreeMap::new())).unwrap(); + if labels .get(AKRI_TARGET_NODE_LABEL_NAME) .is_none() { @@ -193,15 +191,11 @@ fn determine_action_for_pod( } // Early exits above ensure unwrap will not panic - let node_to_run_pod_on = k8s_pod - .metadata - .labels + let node_to_run_pod_on = labels .get(AKRI_TARGET_NODE_LABEL_NAME) .unwrap(); - if k8s_pod - .metadata - .labels + if labels .get(AKRI_INSTANCE_LABEL_NAME) .is_none() { diff --git a/controller/src/util/node_watcher.rs b/controller/src/util/node_watcher.rs index e442c6450..772976361 100644 --- a/controller/src/util/node_watcher.rs +++ b/controller/src/util/node_watcher.rs @@ -176,6 +176,7 @@ impl NodeWatcher { .as_ref() .unwrap_or(&NodeStatus::default()) .conditions + .unwrap() .iter() .filter_map(|condition| { if condition.type_ == "Ready" { diff --git a/controller/src/util/pod_watcher.rs b/controller/src/util/pod_watcher.rs index d6dbf6559..bf6829069 100644 --- a/controller/src/util/pod_watcher.rs +++ b/controller/src/util/pod_watcher.rs @@ -121,14 +121,14 @@ impl BrokerPodWatcher { ) -> Result<(), Box> { trace!("handle_pod - enter [event: {:?}]", event); match event { - WatchEvent::Added(pod) | WatchEvent::Modified(pod) => { + Event::Applied(pod) => { trace!("handle_pod - pod name {:?}", &pod.metadata.name); let phase = self.get_pod_phase(&pod); trace!("handle_pod - pod phase {:?}", &phase); match phase.as_str() { "Unknown" | "Pending" => { self.known_pods - .insert(pod.metadata.name.clone(), PodState::Pending); + .insert(pod.metadata.name.clone().ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?, PodState::Pending); } "Running" => { self.handle_running_pod_if_needed(&pod, kube_interface) @@ -143,13 +143,13 @@ impl BrokerPodWatcher { } } } - WatchEvent::Deleted(pod) => { + Event::Deleted(pod) => { trace!("handle_pod - Deleted: {:?}", &pod.metadata.name); self.handle_deleted_pod_if_needed(&pod, kube_interface) .await?; } - WatchEvent::Error(err) => { - trace!("handle_pod - error for Pod: {}", err); + Event::Restarted(pods) => { + trace!("handle_pod - pod watcher restarted. Pods are : {:?}", pods); } }; Ok(()) @@ -163,7 +163,8 @@ impl BrokerPodWatcher { kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_running_pod_if_needed - enter"); - let pod_name = pod.metadata.name.clone(); + let pod_name = pod.metadata.name.clone().ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; + // map_err(|_| anyhow::format_err!("could not parse url"))? let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending); trace!( "handle_running_pod_if_needed - last_known_state: {:?}", @@ -189,7 +190,7 @@ impl BrokerPodWatcher { kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_ended_pod_if_needed - enter"); - let pod_name = pod.metadata.name.clone(); + let pod_name = pod.metadata.name.clone().ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending); trace!( "handle_ended_pod_if_needed - last_known_state: {:?}", @@ -215,7 +216,7 @@ impl BrokerPodWatcher { kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_deleted_pod_if_needed - enter"); - let pod_name = pod.metadata.name.clone(); + let pod_name = pod.metadata.name.clone().ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending); trace!( "handle_deleted_pod_if_needed - last_known_state: {:?}", @@ -238,14 +239,11 @@ impl BrokerPodWatcher { pod: &Pod, ) -> Result<(String, String), Box> { trace!("get_instance_and_configuration_from_pod - enter"); - let instance_id = pod - .metadata - .labels + let labels = pod.metadata.labels.as_ref().ok_or("Pod doesn't have labels")?; + let instance_id = labels .get(AKRI_INSTANCE_LABEL_NAME) .ok_or("No configuration name found.")?; - let config_name = pod - .metadata - .labels + let config_name = labels .get(AKRI_CONFIGURATION_LABEL_NAME) .ok_or("No instance id found.")?; Ok((instance_id.to_string(), config_name.to_string())) @@ -261,7 +259,7 @@ impl BrokerPodWatcher { ) -> Result<(), Box> { trace!("handle_non_running_pod - enter"); let namespace = pod.metadata.namespace.as_ref().ok_or(format!( - "Namespace not found for pod: {}", + "Namespace not found for pod: {:?}", &pod.metadata.name ))?; let (instance_id, config_name) = self.get_instance_and_configuration_from_pod(pod)?; @@ -387,7 +385,7 @@ impl BrokerPodWatcher { ) -> Result<(), Box> { trace!("handle_running_pod - enter"); let namespace = pod.metadata.namespace.as_ref().ok_or(format!( - "Namespace not found for pod: {}", + "Namespace not found for pod: {:?}", &pod.metadata.name ))?; let (instance_name, configuration_name) = @@ -466,7 +464,7 @@ impl BrokerPodWatcher { { for existing_svc in existing_svcs { let mut existing_svc = existing_svc.clone(); - let svc_name = existing_svc.metadata.name.clone(); + let svc_name = existing_svc.metadata.name.clone().ok_or(anyhow::format_err!("Service {:?} does not have name", existing_svc))?; let svc_namespace = existing_svc.metadata.namespace.as_ref().unwrap().clone(); trace!( "create_or_update_service - Update existing svc={:?}", @@ -598,7 +596,7 @@ mod tests { use super::super::shared_test_utils::config_for_tests::PodList; use super::*; use akri_shared::{k8s::MockKubeInterface, os::file}; - use kube::ErrorResponse; + use kube::error::ErrorResponse; fn create_pods_with_phase(result_file: &'static str, specified_phase: &'static str) -> PodList { let pods_json = file::read_file_to_string(result_file); diff --git a/discovery-utils/src/discovery/v0.rs b/discovery-utils/src/discovery/v0.rs index 03c377332..f21bb2105 100644 --- a/discovery-utils/src/discovery/v0.rs +++ b/discovery-utils/src/discovery/v0.rs @@ -94,10 +94,11 @@ pub struct DeviceSpec { } #[doc = r" Generated client implementations."] pub mod registration_client { - #![allow(unused_variables, dead_code, missing_docs)] + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; #[doc = " Registration is the service advertised by the Akri Agent."] #[doc = " Any `DiscoveryHandler` can register with the Akri Agent."] + #[derive(Debug, Clone)] pub struct RegistrationClient { inner: tonic::client::Grpc, } @@ -115,17 +116,43 @@ pub mod registration_client { impl RegistrationClient where T: tonic::client::GrpcService, - T::ResponseBody: Body + HttpBody + Send + 'static, + T::ResponseBody: Body + Send + Sync + 'static, T::Error: Into, - ::Error: Into + Send, + ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = tonic::client::Grpc::with_interceptor(inner, interceptor); - Self { inner } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> RegistrationClient> + where + F: tonic::service::Interceptor, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + >>::Error: + Into + Send + Sync, + { + RegistrationClient::new(InterceptedService::new(inner, interceptor)) + } + #[doc = r" Compress requests with `gzip`."] + #[doc = r""] + #[doc = r" This requires the server to support it otherwise it might respond with an"] + #[doc = r" error."] + pub fn send_gzip(mut self) -> Self { + self.inner = self.inner.send_gzip(); + self + } + #[doc = r" Enable decompressing responses with `gzip`."] + pub fn accept_gzip(mut self) -> Self { + self.inner = self.inner.accept_gzip(); + self } pub async fn register_discovery_handler( &mut self, @@ -143,23 +170,12 @@ pub mod registration_client { self.inner.unary(request.into_request(), path, codec).await } } - impl Clone for RegistrationClient { - fn clone(&self) -> Self { - Self { - inner: self.inner.clone(), - } - } - } - impl std::fmt::Debug for RegistrationClient { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "RegistrationClient {{ ... }}") - } - } } #[doc = r" Generated client implementations."] pub mod discovery_handler_client { - #![allow(unused_variables, dead_code, missing_docs)] + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; + #[derive(Debug, Clone)] pub struct DiscoveryHandlerClient { inner: tonic::client::Grpc, } @@ -177,17 +193,43 @@ pub mod discovery_handler_client { impl DiscoveryHandlerClient where T: tonic::client::GrpcService, - T::ResponseBody: Body + HttpBody + Send + 'static, + T::ResponseBody: Body + Send + Sync + 'static, T::Error: Into, - ::Error: Into + Send, + ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = tonic::client::Grpc::with_interceptor(inner, interceptor); - Self { inner } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> DiscoveryHandlerClient> + where + F: tonic::service::Interceptor, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + >>::Error: + Into + Send + Sync, + { + DiscoveryHandlerClient::new(InterceptedService::new(inner, interceptor)) + } + #[doc = r" Compress requests with `gzip`."] + #[doc = r""] + #[doc = r" This requires the server to support it otherwise it might respond with an"] + #[doc = r" error."] + pub fn send_gzip(mut self) -> Self { + self.inner = self.inner.send_gzip(); + self + } + #[doc = r" Enable decompressing responses with `gzip`."] + pub fn accept_gzip(mut self) -> Self { + self.inner = self.inner.accept_gzip(); + self } pub async fn discover( &mut self, @@ -207,22 +249,10 @@ pub mod discovery_handler_client { .await } } - impl Clone for DiscoveryHandlerClient { - fn clone(&self) -> Self { - Self { - inner: self.inner.clone(), - } - } - } - impl std::fmt::Debug for DiscoveryHandlerClient { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "DiscoveryHandlerClient {{ ... }}") - } - } } #[doc = r" Generated server implementations."] pub mod registration_server { - #![allow(unused_variables, dead_code, missing_docs)] + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; #[doc = "Generated trait containing gRPC methods that should be implemented for use with RegistrationServer."] #[async_trait] @@ -237,24 +267,31 @@ pub mod registration_server { #[derive(Debug)] pub struct RegistrationServer { inner: _Inner, + accept_compression_encodings: (), + send_compression_encodings: (), } - struct _Inner(Arc, Option); + struct _Inner(Arc); impl RegistrationServer { pub fn new(inner: T) -> Self { let inner = Arc::new(inner); - let inner = _Inner(inner, None); - Self { inner } + let inner = _Inner(inner); + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = Arc::new(inner); - let inner = _Inner(inner, Some(interceptor.into())); - Self { inner } + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) } } - impl Service> for RegistrationServer + impl tonic::codegen::Service> for RegistrationServer where T: Registration, - B: HttpBody + Send + Sync + 'static, + B: Body + Send + Sync + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; @@ -285,17 +322,17 @@ pub mod registration_server { Box::pin(fut) } } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { - let interceptor = inner.1.clone(); let inner = inner.0; let method = RegisterDiscoveryHandlerSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = if let Some(interceptor) = interceptor { - tonic::server::Grpc::with_interceptor(codec, interceptor) - } else { - tonic::server::Grpc::new(codec) - }; + let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -306,7 +343,7 @@ pub mod registration_server { .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") - .body(tonic::body::BoxBody::empty()) + .body(empty_body()) .unwrap()) }), } @@ -315,12 +352,16 @@ pub mod registration_server { impl Clone for RegistrationServer { fn clone(&self) -> Self { let inner = self.inner.clone(); - Self { inner } + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone(), self.1.clone()) + Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { @@ -334,7 +375,7 @@ pub mod registration_server { } #[doc = r" Generated server implementations."] pub mod discovery_handler_server { - #![allow(unused_variables, dead_code, missing_docs)] + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; #[doc = "Generated trait containing gRPC methods that should be implemented for use with DiscoveryHandlerServer."] #[async_trait] @@ -352,24 +393,31 @@ pub mod discovery_handler_server { #[derive(Debug)] pub struct DiscoveryHandlerServer { inner: _Inner, + accept_compression_encodings: (), + send_compression_encodings: (), } - struct _Inner(Arc, Option); + struct _Inner(Arc); impl DiscoveryHandlerServer { pub fn new(inner: T) -> Self { let inner = Arc::new(inner); - let inner = _Inner(inner, None); - Self { inner } + let inner = _Inner(inner); + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = Arc::new(inner); - let inner = _Inner(inner, Some(interceptor.into())); - Self { inner } + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) } } - impl Service> for DiscoveryHandlerServer + impl tonic::codegen::Service> for DiscoveryHandlerServer where T: DiscoveryHandler, - B: HttpBody + Send + Sync + 'static, + B: Body + Send + Sync + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; @@ -401,17 +449,17 @@ pub mod discovery_handler_server { Box::pin(fut) } } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { - let interceptor = inner.1; let inner = inner.0; let method = DiscoverSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = if let Some(interceptor) = interceptor { - tonic::server::Grpc::with_interceptor(codec, interceptor) - } else { - tonic::server::Grpc::new(codec) - }; + let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.server_streaming(method, req).await; Ok(res) }; @@ -422,7 +470,7 @@ pub mod discovery_handler_server { .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") - .body(tonic::body::BoxBody::empty()) + .body(empty_body()) .unwrap()) }), } @@ -431,12 +479,16 @@ pub mod discovery_handler_server { impl Clone for DiscoveryHandlerServer { fn clone(&self) -> Self { let inner = self.inner.clone(); - Self { inner } + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone(), self.1.clone()) + Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { diff --git a/samples/brokers/udev-video-broker/src/util/camera.rs b/samples/brokers/udev-video-broker/src/util/camera.rs index dd8ecb32b..58b176209 100644 --- a/samples/brokers/udev-video-broker/src/util/camera.rs +++ b/samples/brokers/udev-video-broker/src/util/camera.rs @@ -2,15 +2,16 @@ pub struct NotifyRequest {} #[derive(Clone, PartialEq, ::prost::Message)] pub struct NotifyResponse { - #[prost(bytes, tag = "1")] - pub frame: std::vec::Vec, + #[prost(bytes = "vec", tag = "1")] + pub frame: ::prost::alloc::vec::Vec, #[prost(string, tag = "2")] - pub camera: std::string::String, + pub camera: ::prost::alloc::string::String, } #[doc = r" Generated client implementations."] pub mod camera_client { - #![allow(unused_variables, dead_code, missing_docs)] + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; + #[derive(Debug, Clone)] pub struct CameraClient { inner: tonic::client::Grpc, } @@ -28,17 +29,43 @@ pub mod camera_client { impl CameraClient where T: tonic::client::GrpcService, - T::ResponseBody: Body + HttpBody + Send + 'static, + T::ResponseBody: Body + Send + Sync + 'static, T::Error: Into, - ::Error: Into + Send, + ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = tonic::client::Grpc::with_interceptor(inner, interceptor); - Self { inner } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> CameraClient> + where + F: tonic::service::Interceptor, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + >>::Error: + Into + Send + Sync, + { + CameraClient::new(InterceptedService::new(inner, interceptor)) + } + #[doc = r" Compress requests with `gzip`."] + #[doc = r""] + #[doc = r" This requires the server to support it otherwise it might respond with an"] + #[doc = r" error."] + pub fn send_gzip(mut self) -> Self { + self.inner = self.inner.send_gzip(); + self + } + #[doc = r" Enable decompressing responses with `gzip`."] + pub fn accept_gzip(mut self) -> Self { + self.inner = self.inner.accept_gzip(); + self } pub async fn get_frame( &mut self, @@ -55,17 +82,10 @@ pub mod camera_client { self.inner.unary(request.into_request(), path, codec).await } } - impl Clone for CameraClient { - fn clone(&self) -> Self { - Self { - inner: self.inner.clone(), - } - } - } } #[doc = r" Generated server implementations."] pub mod camera_server { - #![allow(unused_variables, dead_code, missing_docs)] + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; #[doc = "Generated trait containing gRPC methods that should be implemented for use with CameraServer."] #[async_trait] @@ -76,34 +96,46 @@ pub mod camera_server { ) -> Result, tonic::Status>; } #[derive(Debug)] - #[doc(hidden)] pub struct CameraServer { inner: _Inner, + accept_compression_encodings: (), + send_compression_encodings: (), } - struct _Inner(Arc, Option); + struct _Inner(Arc); impl CameraServer { pub fn new(inner: T) -> Self { let inner = Arc::new(inner); - let inner = _Inner(inner, None); - Self { inner } + let inner = _Inner(inner); + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = Arc::new(inner); - let inner = _Inner(inner, Some(interceptor.into())); - Self { inner } + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) } } - impl Service> for CameraServer { + impl tonic::codegen::Service> for CameraServer + where + T: Camera, + B: Body + Send + Sync + 'static, + B::Error: Into + Send + 'static, + { type Response = http::Response; type Error = Never; type Future = BoxFuture; fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) } - fn call(&mut self, req: http::Request) -> Self::Future { + fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/camera.Camera/GetFrame" => { + #[allow(non_camel_case_types)] struct GetFrameSvc(pub Arc); impl tonic::server::UnaryService for GetFrameSvc { type Response = super::NotifyResponse; @@ -113,21 +145,21 @@ pub mod camera_server { request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); - let fut = async move { inner.get_frame(request).await }; + let fut = async move { (*inner).get_frame(request).await }; Box::pin(fut) } } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { - let interceptor = inner.1.clone(); let inner = inner.0; let method = GetFrameSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = if let Some(interceptor) = interceptor { - tonic::server::Grpc::with_interceptor(codec, interceptor) - } else { - tonic::server::Grpc::new(codec) - }; + let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -137,7 +169,8 @@ pub mod camera_server { Ok(http::Response::builder() .status(200) .header("grpc-status", "12") - .body(tonic::body::BoxBody::empty()) + .header("content-type", "application/grpc") + .body(empty_body()) .unwrap()) }), } @@ -146,12 +179,16 @@ pub mod camera_server { impl Clone for CameraServer { fn clone(&self) -> Self { let inner = self.inner.clone(); - Self { inner } + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone(), self.1.clone()) + Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 59f3813f3..86cdbec09 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -14,9 +14,9 @@ futures = "0.3.1" futures-util = "0.3" env_logger = "0.6.1" hyper = { version = "0.14.2", package = "hyper" } -kube = { version = "0.57.0", features = ["derive"] } -kube-runtime = "0.57.0" -k8s-openapi = { version = "0.12.0", default-features = false, features = ["v1_16", "schema"] } +kube = { version = "0.59.0", features = ["derive"] } +kube-runtime = "0.59.0" +k8s-openapi = { version = "0.13.0", default-features = false, features = ["schemars", "v1_16"] } log = "0.4" mockall = "0.9.0" prometheus = { version = "0.11.0", features = ["process"] } diff --git a/shared/src/akri/configuration.rs b/shared/src/akri/configuration.rs index 9d898d8a3..83fd873ed 100644 --- a/shared/src/akri/configuration.rs +++ b/shared/src/akri/configuration.rs @@ -4,13 +4,8 @@ // in favor of camelCase) // #![allow(non_camel_case_types)] - -use super::API_CONFIGURATIONS; -use super::API_NAMESPACE; -use super::API_VERSION; use k8s_openapi::api::core::v1::PodSpec; use k8s_openapi::api::core::v1::ServiceSpec; -use k8s_openapi::Schema; use kube::CustomResource; use kube::{ api::{Api, ListParams, ObjectList}, @@ -39,9 +34,6 @@ pub struct DiscoveryHandlerInfo { /// capabilities. For any specific capability found that is described by this /// configuration, an Instance /// is created. -// TODO: use kube-rs's CustomResource utility as done in instance.rs once -// k8s-openapi has added added support for JsonSchema on K8s objects. -// Issue to track: https://github.com/Arnavion/k8s-openapi/issues/86 #[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema)] // group = API_NAMESPACE and version = API_VERSION #[kube(group = "akri.sh", version = "v0", kind = "Configuration", namespaced)] @@ -61,7 +53,6 @@ pub struct ConfigurationSpec { /// node that can access any capability described by this /// configuration #[serde(default, skip_serializing_if = "Option::is_none")] - #[schemars(schema_with = "pod_spec_schema")] pub broker_pod_spec: Option, /// This defines a service that should be created to access @@ -70,7 +61,6 @@ pub struct ConfigurationSpec { /// can be found. For each Instance, there is at most 1 /// instance service. #[serde(default, skip_serializing_if = "Option::is_none")] - #[schemars(schema_with = "service_spec_schema")] pub instance_service_spec: Option, /// This defines a service that should be created to access @@ -78,7 +68,6 @@ pub struct ConfigurationSpec { /// configuration. For each Configuration, there is at most /// 1 device capability service. #[serde(default, skip_serializing_if = "Option::is_none")] - #[schemars(schema_with = "service_spec_schema")] pub configuration_service_spec: Option, /// This defines some properties that will be set as @@ -90,14 +79,6 @@ pub struct ConfigurationSpec { pub broker_properties: HashMap, } -fn pod_spec_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { - serde_json::from_value(PodSpec::schema()).unwrap() -} - -fn service_spec_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { - serde_json::from_value(ServiceSpec::schema()).unwrap() -} - /// Get Configurations for a given namespace /// /// Example: @@ -109,7 +90,7 @@ fn service_spec_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::sche /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// let dccs = configuration::get_configurations(&api_client).await.unwrap(); /// # } /// ``` @@ -149,7 +130,7 @@ pub async fn get_configurations( /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// let config = configuration::find_configuration( /// "config-1", /// "default", diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs index 63f370f3d..585479bf7 100644 --- a/shared/src/akri/instance.rs +++ b/shared/src/akri/instance.rs @@ -4,7 +4,6 @@ use kube::{ Client, CustomResource, }; -use k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1beta1 as apiexts; use k8s_openapi::apimachinery::pkg::apis::meta::v1::OwnerReference; use schemars::JsonSchema; use std::collections::HashMap; @@ -64,7 +63,7 @@ pub struct InstanceSpec { /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// let instances = instance::get_instances(&api_client).await.unwrap(); /// # } /// ``` @@ -105,7 +104,7 @@ pub async fn get_instances( /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// let instance = instance::find_instance( /// "config-1", /// "default", @@ -150,16 +149,16 @@ pub async fn find_instance( /// Example: /// /// ```no_run -/// use akri_shared::akri::instance::Instance; +/// use akri_shared::akri::instance::InstanceSpec; /// use akri_shared::akri::instance; /// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// let instance = instance::create_instance( -/// &Instance { +/// &InstanceSpec { /// configuration_name: "capability_configuration_name".to_string(), /// shared: true, /// nodes: Vec::new(), @@ -187,14 +186,14 @@ pub async fn create_instance( let mut instance = Instance::new(name, instance_to_create.clone()); instance.metadata = ObjectMeta { name: Some(name.to_string()), - owner_references: vec![OwnerReference { + owner_references: Some(vec![OwnerReference { api_version: format!("{}/{}", API_NAMESPACE, API_VERSION), kind: "Configuration".to_string(), controller: Some(true), block_owner_deletion: Some(true), name: owner_config_name.to_string(), uid: owner_config_uid.to_string(), - }], + }]), ..Default::default() }; log::trace!( @@ -233,7 +232,7 @@ pub async fn create_instance( /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// let instance = instance::delete_instance( /// "instance-1", /// "default", @@ -273,16 +272,16 @@ pub async fn delete_instance( /// Example: /// /// ```no_run -/// use akri_shared::akri::instance::Instance; +/// use akri_shared::akri::instance::InstanceSpec; /// use akri_shared::akri::instance; /// use kube::client::Client; /// use kube::config; /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// let instance = instance::update_instance( -/// &Instance { +/// &InstanceSpec { /// configuration_name: "capability_configuration_name".to_string(), /// shared: true, /// nodes: Vec::new(), diff --git a/shared/src/k8s/mod.rs b/shared/src/k8s/mod.rs index dd2b32d02..7760cc7f1 100644 --- a/shared/src/k8s/mod.rs +++ b/shared/src/k8s/mod.rs @@ -7,14 +7,12 @@ use super::akri::{ API_NAMESPACE, API_VERSION, }; use async_trait::async_trait; -use futures::executor::block_on; use k8s_openapi::api::core::v1::{ - Node, Pod, PodSpec, PodStatus, Service, ServiceSpec, ServiceStatus, + Node, Pod, Service, }; use kube::{ - api::{Object, ObjectList}, + api::ObjectList, client::Client, - config, }; use mockall::{automock, predicate::*}; @@ -213,7 +211,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// let node = kube.find_node("node-a").await.unwrap(); /// # } /// ``` @@ -234,7 +232,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// let interesting_pods = kube.find_pods_with_label("label=interesting").await.unwrap(); /// # } /// ``` @@ -254,7 +252,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// let pods_on_node_a = kube.find_pods_with_field("spec.nodeName=node-a").await.unwrap(); /// # } /// ``` @@ -275,7 +273,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// kube.create_pod(&Pod::default(), "pod_namespace").await.unwrap(); /// # } /// ``` @@ -296,7 +294,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// kube.remove_pod("pod_to_remove", "pod_namespace").await.unwrap(); /// # } /// ``` @@ -318,7 +316,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// let interesting_services = kube.find_services("label=interesting").await.unwrap(); /// # } /// ``` @@ -339,7 +337,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// kube.create_service(&Service::default(), "service_namespace").await.unwrap(); /// # } /// ``` @@ -360,7 +358,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// kube.remove_service("service_to_remove", "service_namespace").await.unwrap(); /// # } /// ``` @@ -382,10 +380,10 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// let selector = "environment=production,app=nginx"; /// for svc in kube.find_services(&selector).await.unwrap() { - /// let svc_name = &svc.metadata.name.clone(); + /// let svc_name = &svc.metadata.name.clone().unwrap(); /// let svc_namespace = &svc.metadata.namespace.as_ref().unwrap().clone(); /// let updated_svc = kube.update_service( /// &svc, @@ -413,7 +411,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// let config = kube.find_configuration("config-1", "config-namespace").await.unwrap(); /// # } /// ``` @@ -434,7 +432,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// let dccs = kube.get_configurations().await.unwrap(); /// # } /// ``` @@ -454,7 +452,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// let instance = kube.find_instance("instance-1", "instance-namespace").await.unwrap(); /// # } /// ``` @@ -471,7 +469,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// let instances = kube.get_instances().await.unwrap(); /// # } /// ``` @@ -487,13 +485,13 @@ impl KubeInterface for KubeImpl { /// ```no_run /// use akri_shared::k8s; /// use akri_shared::k8s::KubeInterface; - /// use akri_shared::akri::instance::Instance; + /// use akri_shared::akri::instance::InstanceSpec; /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// kube.create_instance( - /// &Instance{ + /// &InstanceSpec{ /// configuration_name: "capability_configuration_name".to_string(), /// shared: true, /// nodes: Vec::new(), @@ -535,7 +533,7 @@ impl KubeInterface for KubeImpl { /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// kube.delete_instance( /// "instance-1", /// "instance-namespace" @@ -556,13 +554,13 @@ impl KubeInterface for KubeImpl { /// ```no_run /// use akri_shared::k8s; /// use akri_shared::k8s::KubeInterface; - /// use akri_shared::akri::instance::Instance; + /// use akri_shared::akri::instance::InstanceSpec; /// /// # #[tokio::main] /// # async fn main() { - /// let kube = k8s::KubeImpl::new().await?; + /// let kube = k8s::KubeImpl::new().await.unwrap(); /// kube.update_instance( - /// &Instance{ + /// &InstanceSpec{ /// configuration_name: "capability_configuration_name".to_string(), /// shared: true, /// nodes: Vec::new(), @@ -657,8 +655,8 @@ pub mod test_ownership { ownership.get_api_version() ); assert_eq!("Configuration", &ownership.get_kind()); - assert_eq!(true, ownership.get_controller()); - assert_eq!(true, ownership.get_block_owner_deletion()); + assert_eq!(true, ownership.get_controller().unwrap()); + assert_eq!(true, ownership.get_block_owner_deletion().unwrap()); assert_eq!(name, &ownership.get_name()); assert_eq!(uid, &ownership.get_uid()); } @@ -673,8 +671,8 @@ pub mod test_ownership { ownership.get_api_version() ); assert_eq!("Instance", &ownership.get_kind()); - assert_eq!(true, ownership.get_controller()); - assert_eq!(true, ownership.get_block_owner_deletion()); + assert_eq!(true, ownership.get_controller().unwrap()); + assert_eq!(true, ownership.get_block_owner_deletion().unwrap()); assert_eq!(name, &ownership.get_name()); assert_eq!(uid, &ownership.get_uid()); } @@ -685,8 +683,8 @@ pub mod test_ownership { let ownership = OwnershipInfo::new(OwnershipType::Pod, name.to_string(), uid.to_string()); assert_eq!("core/v1", ownership.get_api_version()); assert_eq!("Pod", &ownership.get_kind()); - assert_eq!(true, ownership.get_controller()); - assert_eq!(true, ownership.get_block_owner_deletion()); + assert_eq!(true, ownership.get_controller().unwrap()); + assert_eq!(true, ownership.get_block_owner_deletion().unwrap()); assert_eq!(name, &ownership.get_name()); assert_eq!(uid, &ownership.get_uid()); } @@ -698,8 +696,8 @@ pub mod test_ownership { OwnershipInfo::new(OwnershipType::Service, name.to_string(), uid.to_string()); assert_eq!("core/v1", ownership.get_api_version()); assert_eq!("Service", &ownership.get_kind()); - assert_eq!(true, ownership.get_controller()); - assert_eq!(true, ownership.get_block_owner_deletion()); + assert_eq!(true, ownership.get_controller().unwrap()); + assert_eq!(true, ownership.get_block_owner_deletion().unwrap()); assert_eq!(name, &ownership.get_name()); assert_eq!(uid, &ownership.get_uid()); } diff --git a/shared/src/k8s/node.rs b/shared/src/k8s/node.rs index 2e5a52884..dc63f8d5c 100644 --- a/shared/src/k8s/node.rs +++ b/shared/src/k8s/node.rs @@ -1,6 +1,6 @@ use k8s_openapi::api::core::v1::Node; use kube::{ - api::{Api, Object}, + api::Api, client::Client, }; use log::trace; @@ -17,7 +17,7 @@ use log::trace; /// # #[tokio::main] /// # async fn main() { /// let label_selector = Some("environment=production,app=nginx".to_string()); -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// let node = node::find_node("node-a", api_client).await.unwrap(); /// # } /// ``` diff --git a/shared/src/k8s/pod.rs b/shared/src/k8s/pod.rs index 4e1e879cf..88be54713 100644 --- a/shared/src/k8s/pod.rs +++ b/shared/src/k8s/pod.rs @@ -5,12 +5,12 @@ use super::{ use either::Either; use k8s_openapi::api::core::v1::{ Affinity, NodeAffinity, NodeSelector, NodeSelectorRequirement, NodeSelectorTerm, Pod, PodSpec, - PodStatus, ResourceRequirements, + ResourceRequirements, }; use k8s_openapi::apimachinery::pkg::api::resource::Quantity; use k8s_openapi::apimachinery::pkg::apis::meta::v1::{ObjectMeta, OwnerReference}; use kube::{ - api::{Api, DeleteParams, ListParams, Object, ObjectList, PostParams}, + api::{Api, DeleteParams, ListParams, ObjectList, PostParams}, client::Client, }; use log::{error, info, trace}; @@ -34,9 +34,9 @@ pub const AKRI_TARGET_NODE_LABEL_NAME: &str = "akri.sh/target-node"; /// # #[tokio::main] /// # async fn main() { /// let label_selector = Some("environment=production,app=nginx".to_string()); -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// for pod in pod::find_pods_with_selector(label_selector, None, api_client).await.unwrap() { -/// println!("found pod: {}", pod.metadata.name) +/// println!("found pod: {}", pod.metadata.name.unwrap()) /// } /// # } /// ``` @@ -49,9 +49,9 @@ pub const AKRI_TARGET_NODE_LABEL_NAME: &str = "akri.sh/target-node"; /// # #[tokio::main] /// # async fn main() { /// let field_selector = Some("spec.nodeName=node-a".to_string()); -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// for pod in pod::find_pods_with_selector(None, field_selector, api_client).await.unwrap() { -/// println!("found pod: {}", pod.metadata.name) +/// println!("found pod: {}", pod.metadata.name.unwrap()) /// } /// # } /// ``` @@ -128,7 +128,9 @@ type ResourceQuantityType = BTreeMap; /// use kube::config; /// use k8s_openapi::api::core::v1::PodSpec; /// -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// # #[tokio::main] +/// # async fn main() { +/// let api_client = Client::try_default().await.unwrap(); /// let svc = pod::create_new_pod_from_spec( /// "pod_namespace", /// "capability_instance", @@ -142,6 +144,7 @@ type ResourceQuantityType = BTreeMap; /// "node-a", /// true, /// &PodSpec::default()).unwrap(); +/// # } /// ``` pub fn create_new_pod_from_spec( pod_namespace: &str, @@ -188,35 +191,42 @@ pub fn create_new_pod_from_spec( let mut modified_pod_spec = pod_spec.clone(); - for container in &mut modified_pod_spec.containers { - let mut incoming_limits: ResourceQuantityType = BTreeMap::new(); - let mut incoming_requests: ResourceQuantityType = BTreeMap::new(); + let insert_akri_resources = | map: &mut ResourceQuantityType | { + if map.contains_key(RESOURCE_REQUIREMENTS_KEY) { + let placeholder_value = map + .get(RESOURCE_REQUIREMENTS_KEY) + .unwrap() + .clone(); + map.insert(resource_limit_name.to_string(), placeholder_value); + map.remove(RESOURCE_REQUIREMENTS_KEY); + } + }; + for container in &mut modified_pod_spec.containers { if let Some(resources) = container.resources.as_ref() { - incoming_limits = resources.limits.clone(); - if incoming_limits.contains_key(RESOURCE_REQUIREMENTS_KEY) { - let placeholder_value = incoming_limits - .get(RESOURCE_REQUIREMENTS_KEY) - .unwrap() - .clone(); - incoming_limits.insert(resource_limit_name.to_string(), placeholder_value); - incoming_limits.remove(RESOURCE_REQUIREMENTS_KEY); - } - incoming_requests = resources.requests.clone(); - if incoming_requests.contains_key(RESOURCE_REQUIREMENTS_KEY) { - let placeholder_value = incoming_requests - .get(RESOURCE_REQUIREMENTS_KEY) - .unwrap() - .clone(); - incoming_requests.insert(resource_limit_name.to_string(), placeholder_value); - incoming_requests.remove(RESOURCE_REQUIREMENTS_KEY); - } + container.resources = Some(ResourceRequirements { + limits: { + match resources.limits.clone() { + Some(mut map) => { + insert_akri_resources(&mut map); + Some(map) + }, + None => None + } + }, + requests: { + match resources.requests.clone() { + Some(mut map) => { + insert_akri_resources(&mut map); + Some(map) + }, + None => None + } + }, + }); }; - container.resources = Some(ResourceRequirements { - limits: incoming_limits, - requests: incoming_requests, - }); + } // Ensure that the modified PodSpec has the required Affinity settings @@ -233,11 +243,11 @@ pub fn create_new_pod_from_spec( }) .node_selector_terms .push(NodeSelectorTerm { - match_fields: vec![NodeSelectorRequirement { + match_fields: Some(vec![NodeSelectorRequirement { key: OBJECT_NAME_FIELD.to_string(), operator: NODE_SELECTOR_OP_IN.to_string(), // need to find if there is an equivalent to: v1.NODE_SELECTOR_OP_IN, - values: vec![node_to_run_pod_on.to_string()], - }], + values: Some(vec![node_to_run_pod_on.to_string()]), + }]), ..Default::default() }); @@ -246,8 +256,8 @@ pub fn create_new_pod_from_spec( metadata: ObjectMeta { name: Some(app_name), namespace: Some(pod_namespace.to_string()), - labels: labels, - owner_references: owner_references, + labels: Some(labels), + owner_references: Some(owner_references), ..Default::default() }, ..Default::default() @@ -339,8 +349,8 @@ mod broker_podspec_tests { vec![Container { image: Some(image.clone()), resources: Some(ResourceRequirements { - limits: placeholder_limits, - requests: placeholder_requests, + limits: Some(placeholder_limits), + requests: Some(placeholder_requests), }), ..Default::default() }], @@ -363,16 +373,16 @@ mod broker_podspec_tests { Container { image: Some("image1".to_string()), resources: Some(ResourceRequirements { - limits: placeholder_limits1, - requests: placeholder_requests1, + limits: Some(placeholder_limits1), + requests: Some(placeholder_requests1), }), ..Default::default() }, Container { image: Some("image2".to_string()), resources: Some(ResourceRequirements { - limits: placeholder_limits2, - requests: placeholder_requests2, + limits: Some(placeholder_limits2), + requests: Some(placeholder_requests2), }), ..Default::default() }, @@ -390,11 +400,11 @@ mod broker_podspec_tests { node_affinity: Some(NodeAffinity { required_during_scheduling_ignored_during_execution: Some(NodeSelector { node_selector_terms: vec![NodeSelectorTerm { - match_fields: vec![NodeSelectorRequirement { + match_fields: Some(vec![NodeSelectorRequirement { key: "do-not-change-this".to_string(), operator: NODE_SELECTOR_OP_IN.to_string(), // need to find if there is an equivalent to: v1.NODE_SELECTOR_OP_IN, - values: vec!["existing-node-affinity".to_string()], - }], + values: Some(vec!["existing-node-affinity".to_string()]), + }]), ..Default::default() }], //..Default::default() @@ -443,13 +453,13 @@ mod broker_podspec_tests { // Validate the labels added assert_eq!( &&app_name, - &pod.metadata.clone().labels.get(APP_LABEL_ID).unwrap() + &pod.metadata.clone().labels.unwrap().get(APP_LABEL_ID).unwrap() ); assert_eq!( &&API_NAMESPACE.to_string(), &pod.metadata .clone() - .labels + .labels.unwrap() .get(CONTROLLER_LABEL_ID) .unwrap() ); @@ -457,7 +467,7 @@ mod broker_podspec_tests { &&configuration_name, &pod.metadata .clone() - .labels + .labels.unwrap() .get(AKRI_CONFIGURATION_LABEL_NAME) .unwrap() ); @@ -465,7 +475,7 @@ mod broker_podspec_tests { &&instance_name, &pod.metadata .clone() - .labels + .labels.unwrap() .get(AKRI_INSTANCE_LABEL_NAME) .unwrap() ); @@ -473,7 +483,7 @@ mod broker_podspec_tests { &&node_to_run_pod_on, &pod.metadata .clone() - .labels + .labels.unwrap() .get(AKRI_TARGET_NODE_LABEL_NAME) .unwrap() ); @@ -481,21 +491,22 @@ mod broker_podspec_tests { // Validate ownerReference assert_eq!( instance_name, - pod.metadata.clone().owner_references.get(0).unwrap().name + pod.metadata.clone(). owner_references.unwrap().get(0).unwrap().name ); assert_eq!( instance_uid, - pod.metadata.clone().owner_references.get(0).unwrap().uid + pod.metadata.clone(). owner_references.unwrap().get(0).unwrap().uid ); assert_eq!( "Instance", - &pod.metadata.clone().owner_references.get(0).unwrap().kind + &pod.metadata.clone(). owner_references.unwrap().get(0).unwrap().kind ); assert_eq!( &format!("{}/{}", API_NAMESPACE, API_VERSION), &pod.metadata .clone() .owner_references + .unwrap() .get(0) .unwrap() .api_version @@ -504,6 +515,7 @@ mod broker_podspec_tests { .metadata .clone() .owner_references + .unwrap() .get(0) .unwrap() .controller @@ -512,6 +524,7 @@ mod broker_podspec_tests { .metadata .clone() .owner_references + .unwrap() .get(0) .unwrap() .block_owner_deletion @@ -548,7 +561,8 @@ mod broker_podspec_tests { .node_selector_terms .get(0) .unwrap() - .match_fields + .match_fields.as_ref() + .unwrap() .get(0) .unwrap() .key @@ -567,7 +581,8 @@ mod broker_podspec_tests { .node_selector_terms .get(0) .unwrap() - .match_fields + .match_fields.as_ref() + .unwrap() .get(0) .unwrap() .operator @@ -586,10 +601,10 @@ mod broker_podspec_tests { .node_selector_terms .get(0) .unwrap() - .match_fields + .match_fields.as_ref().unwrap() .get(0) .unwrap() - .values + .values.as_ref().unwrap() ); // Validate the affinity added @@ -607,7 +622,7 @@ mod broker_podspec_tests { .node_selector_terms .get(1) .unwrap() - .match_fields + .match_fields.as_ref().unwrap() .get(0) .unwrap() .key @@ -626,7 +641,7 @@ mod broker_podspec_tests { .node_selector_terms .get(1) .unwrap() - .match_fields + .match_fields.as_ref().unwrap() .get(0) .unwrap() .operator @@ -645,10 +660,10 @@ mod broker_podspec_tests { .node_selector_terms .get(1) .unwrap() - .match_fields + .match_fields.as_ref().unwrap() .get(0) .unwrap() - .values + .values.as_ref().unwrap() ); // Validate image name remanes unchanged @@ -678,7 +693,7 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .limits + .limits.as_ref().unwrap() .contains_key("do-not-change-this") ); assert_eq!( @@ -692,7 +707,7 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .requests + .requests.as_ref().unwrap() .contains_key("do-not-change-this") ); // Validate the limits/requires added @@ -707,7 +722,7 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .limits + .limits.as_ref().unwrap() .contains_key(RESOURCE_REQUIREMENTS_KEY) ); assert_eq!( @@ -721,7 +736,7 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .requests + .requests.as_ref().unwrap() .contains_key(RESOURCE_REQUIREMENTS_KEY) ); assert_eq!( @@ -735,7 +750,7 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .limits + .limits.as_ref().unwrap() .contains_key(&resource_limit_name.clone()) ); assert_eq!( @@ -749,7 +764,7 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .requests + .requests.as_ref().unwrap() .contains_key(&resource_limit_name.clone()) ); } @@ -769,7 +784,7 @@ mod broker_podspec_tests { /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// pod::create_pod(&Pod::default(), "pod_namespace", api_client).await.unwrap(); /// # } /// ``` @@ -824,7 +839,7 @@ pub async fn create_pod( /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// pod::remove_pod("pod_to_remove", "pod_namespace", api_client).await.unwrap(); /// # } /// ``` diff --git a/shared/src/k8s/service.rs b/shared/src/k8s/service.rs index ac1e0e10d..0123bf77e 100644 --- a/shared/src/k8s/service.rs +++ b/shared/src/k8s/service.rs @@ -6,10 +6,10 @@ use super::{ OwnershipInfo, ERROR_NOT_FOUND, }; use either::Either; -use k8s_openapi::api::core::v1::{Service, ServiceSpec, ServiceStatus}; +use k8s_openapi::api::core::v1::{Service, ServiceSpec}; use k8s_openapi::apimachinery::pkg::apis::meta::v1::{ObjectMeta, OwnerReference}; use kube::{ - api::{Api, DeleteParams, ListParams, Object, ObjectList, Patch, PatchParams, PostParams}, + api::{Api, DeleteParams, ListParams, ObjectList, Patch, PatchParams, PostParams}, client::Client, }; use log::{error, info, trace}; @@ -27,9 +27,9 @@ use std::collections::BTreeMap; /// # #[tokio::main] /// # async fn main() { /// let selector = "environment=production,app=nginx"; -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// for svc in service::find_services_with_selector(&selector, api_client).await.unwrap() { -/// println!("found svc: {}", svc.metadata.name) +/// println!("found svc: {}", svc.metadata.name.unwrap()) /// } /// # } /// ``` @@ -94,7 +94,9 @@ pub fn create_service_app_name( /// use kube::config; /// use k8s_openapi::api::core::v1::ServiceSpec; /// -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// # #[tokio::main] +/// # async fn main() { +/// let api_client = Client::try_default().await.unwrap(); /// let svc = service::create_new_service_from_spec( /// "svc_namespace", /// "capability_instance", @@ -106,6 +108,7 @@ pub fn create_service_app_name( /// ), /// &ServiceSpec::default(), /// true).unwrap(); +/// # } /// ``` pub fn create_new_service_from_spec( svc_namespace: &str, @@ -146,8 +149,7 @@ pub fn create_new_service_from_spec( }]; let mut spec = svc_spec.clone(); - let mut modified_selector: BTreeMap; - modified_selector = spec.selector; + let mut modified_selector: BTreeMap = spec.selector.unwrap_or(BTreeMap::new()); modified_selector.insert(CONTROLLER_LABEL_ID.to_string(), API_NAMESPACE.to_string()); if node_specific_svc { modified_selector.insert( @@ -160,15 +162,15 @@ pub fn create_new_service_from_spec( configuration_name.to_string(), ); } - spec.selector = modified_selector; + spec.selector = Some(modified_selector); let new_svc = Service { spec: Some(spec), metadata: ObjectMeta { name: Some(app_name), namespace: Some(svc_namespace.to_string()), - labels, - owner_references, + labels: Some(labels), + owner_references: Some(owner_references), ..Default::default() }, ..Default::default() @@ -193,7 +195,7 @@ pub fn create_new_service_from_spec( /// # #[tokio::main] /// # async fn main() { /// let selector = "environment=production,app=nginx"; -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// for svc in service::find_services_with_selector(&selector, api_client).await.unwrap() { /// let mut svc = svc; /// service::update_ownership( @@ -209,7 +211,7 @@ pub fn create_new_service_from_spec( /// # } /// ``` pub fn update_ownership( - svc_to_update: &mut Object, + svc_to_update: &mut Service, ownership: OwnershipInfo, replace_references: bool, ) -> Result<(), Box> { @@ -221,19 +223,19 @@ pub fn update_ownership( name: ownership.get_name(), uid: ownership.get_uid(), }; - if replace_references { + if replace_references || svc_to_update.metadata.owner_references.is_none() { // Replace all existing ownerReferences with specified ownership - svc_to_update.metadata.owner_references = vec![ownership_ref]; + svc_to_update.metadata.owner_references = Some(vec![ownership_ref]); } else { // Add ownership to list IFF the UID doesn't already exist if !svc_to_update - .metadata - .owner_references - .iter() - .any(|x| x.uid == ownership.get_uid()) - { - svc_to_update.metadata.owner_references.push(ownership_ref); - } + .metadata + .owner_references.as_ref().unwrap().iter() + .any(|x| x.uid == ownership.get_uid()) { + svc_to_update + .metadata + .owner_references.as_mut().unwrap().push(ownership_ref); + } } Ok(()) } @@ -244,8 +246,8 @@ mod svcspec_tests { use super::*; use env_logger; - use kube::api::{Object, ObjectMeta}; - pub type TestServiceObject = Object; + use kube::api::ObjectMeta; + use k8s_openapi::api::core::v1::ServiceStatus; #[test] fn test_create_service_app_name() { @@ -294,15 +296,13 @@ mod svcspec_tests { fn test_update_ownership_replace() { let _ = env_logger::builder().is_test(true).try_init(); - let svc = TestServiceObject { + let mut svc = Service { metadata: ObjectMeta::default(), - spec: ServiceSpec::default(), + spec: Some(ServiceSpec::default()), status: Some(ServiceStatus::default()), - types: None, }; - assert_eq!(0, svc.metadata.owner_references.len()); - let mut svc = svc; + assert!(svc.metadata.owner_references.is_none()); update_ownership( &mut svc, OwnershipInfo { @@ -313,9 +313,9 @@ mod svcspec_tests { true, ) .unwrap(); - assert_eq!(1, svc.metadata.owner_references.len()); - assert_eq!("object1", &svc.metadata.owner_references[0].name); - assert_eq!("uid1", &svc.metadata.owner_references[0].uid); + assert_eq!(1, svc.metadata.owner_references.as_ref().unwrap().len()); + assert_eq!("object1", &svc.metadata.owner_references.as_ref().unwrap()[0].name); + assert_eq!("uid1", &svc.metadata.owner_references.as_ref().unwrap()[0].uid); update_ownership( &mut svc, @@ -327,23 +327,22 @@ mod svcspec_tests { true, ) .unwrap(); - assert_eq!(1, svc.metadata.owner_references.len()); - assert_eq!("object2", &svc.metadata.owner_references[0].name); - assert_eq!("uid2", &svc.metadata.owner_references[0].uid); + assert_eq!(1, svc.metadata.owner_references.as_ref().unwrap().len()); + assert_eq!("object2", &svc.metadata.owner_references.as_ref().unwrap()[0].name); + assert_eq!("uid2", &svc.metadata.owner_references.as_ref().unwrap()[0].uid); } #[test] fn test_update_ownership_append() { let _ = env_logger::builder().is_test(true).try_init(); - let svc = TestServiceObject { + let svc = Service { metadata: ObjectMeta::default(), - spec: ServiceSpec::default(), + spec: Some(ServiceSpec::default()), status: Some(ServiceStatus::default()), - types: None, }; - assert_eq!(0, svc.metadata.owner_references.len()); + assert!(svc.metadata.owner_references.is_none()); let mut svc = svc; update_ownership( &mut svc, @@ -355,9 +354,9 @@ mod svcspec_tests { false, ) .unwrap(); - assert_eq!(1, svc.metadata.owner_references.len()); - assert_eq!("object1", &svc.metadata.owner_references[0].name); - assert_eq!("uid1", &svc.metadata.owner_references[0].uid); + assert_eq!(1, svc.metadata.owner_references.as_ref().unwrap().len()); + assert_eq!("object1", &svc.metadata.owner_references.as_ref().unwrap()[0].name); + assert_eq!("uid1", &svc.metadata.owner_references.as_ref().unwrap()[0].uid); update_ownership( &mut svc, @@ -369,11 +368,11 @@ mod svcspec_tests { false, ) .unwrap(); - assert_eq!(2, svc.metadata.owner_references.len()); - assert_eq!("object1", &svc.metadata.owner_references[0].name); - assert_eq!("uid1", &svc.metadata.owner_references[0].uid); - assert_eq!("object2", &svc.metadata.owner_references[1].name); - assert_eq!("uid2", &svc.metadata.owner_references[1].uid); + assert_eq!(2, svc.metadata.owner_references.as_ref().unwrap().len()); + assert_eq!("object1", &svc.metadata.owner_references.as_ref().unwrap()[0].name); + assert_eq!("uid1", &svc.metadata.owner_references.as_ref().unwrap()[0].uid); + assert_eq!("object2", &svc.metadata.owner_references.as_ref().unwrap()[1].name); + assert_eq!("uid2", &svc.metadata.owner_references.as_ref().unwrap()[1].uid); // Test that trying to add the same UID doesn't result in // duplicate @@ -387,11 +386,11 @@ mod svcspec_tests { false, ) .unwrap(); - assert_eq!(2, svc.metadata.owner_references.len()); - assert_eq!("object1", &svc.metadata.owner_references[0].name); - assert_eq!("uid1", &svc.metadata.owner_references[0].uid); - assert_eq!("object2", &svc.metadata.owner_references[1].name); - assert_eq!("uid2", &svc.metadata.owner_references[1].uid); + assert_eq!(2, svc.metadata.owner_references.as_ref().unwrap().len()); + assert_eq!("object1", &svc.metadata.owner_references.as_ref().unwrap()[0].name); + assert_eq!("uid1", &svc.metadata.owner_references.as_ref().unwrap()[0].uid); + assert_eq!("object2", &svc.metadata.owner_references.as_ref().unwrap()[1].name); + assert_eq!("uid2", &svc.metadata.owner_references.as_ref().unwrap()[1].uid); } #[test] @@ -412,7 +411,7 @@ mod svcspec_tests { "this-node-selector".to_string(), ); let svc_spec = ServiceSpec { - selector: preexisting_selector, + selector: Some(preexisting_selector), ..Default::default() }; @@ -440,13 +439,14 @@ mod svcspec_tests { // Validate the labels added assert_eq!( &&app_name, - &svc.metadata.clone().labels.get(APP_LABEL_ID).unwrap() + &svc.metadata.clone().labels.unwrap().get(APP_LABEL_ID).unwrap() ); assert_eq!( &&API_NAMESPACE.to_string(), &svc.metadata .clone() .labels + .unwrap() .get(CONTROLLER_LABEL_ID) .unwrap() ); @@ -456,6 +456,7 @@ mod svcspec_tests { &svc.metadata .clone() .labels + .unwrap() .get(AKRI_INSTANCE_LABEL_NAME) .unwrap() ); @@ -465,6 +466,7 @@ mod svcspec_tests { &svc.metadata .clone() .labels + .unwrap() .get(AKRI_CONFIGURATION_LABEL_NAME) .unwrap() ); @@ -473,21 +475,22 @@ mod svcspec_tests { // Validate ownerReference assert_eq!( object_name, - svc.metadata.clone().owner_references.get(0).unwrap().name + svc.metadata.clone().owner_references.as_ref().unwrap().get(0).unwrap().name ); assert_eq!( object_uid, - svc.metadata.clone().owner_references.get(0).unwrap().uid + svc.metadata.clone().owner_references.as_ref().unwrap().get(0).unwrap().uid ); assert_eq!( "Pod", - &svc.metadata.clone().owner_references.get(0).unwrap().kind + &svc.metadata.clone().owner_references.as_ref().unwrap().get(0).unwrap().kind ); assert_eq!( "core/v1", &svc.metadata .clone() .owner_references + .unwrap() .get(0) .unwrap() .api_version @@ -496,6 +499,7 @@ mod svcspec_tests { .metadata .clone() .owner_references + .unwrap() .get(0) .unwrap() .controller @@ -504,6 +508,7 @@ mod svcspec_tests { .metadata .clone() .owner_references + .unwrap() .get(0) .unwrap() .block_owner_deletion @@ -515,7 +520,8 @@ mod svcspec_tests { &svc.spec .as_ref() .unwrap() - .selector + .selector.as_ref() + .unwrap() .get("do-not-change") .unwrap() ); @@ -525,7 +531,8 @@ mod svcspec_tests { &svc.spec .as_ref() .unwrap() - .selector + .selector.as_ref() + .unwrap() .get(CONTROLLER_LABEL_ID) .unwrap() ); @@ -535,7 +542,8 @@ mod svcspec_tests { &svc.spec .as_ref() .unwrap() - .selector + .selector.as_ref() + .unwrap() .get(AKRI_INSTANCE_LABEL_NAME) .unwrap() ); @@ -545,7 +553,8 @@ mod svcspec_tests { &svc.spec .as_ref() .unwrap() - .selector + .selector.as_ref() + .unwrap() .get(AKRI_CONFIGURATION_LABEL_NAME) .unwrap() ); @@ -566,7 +575,7 @@ mod svcspec_tests { /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// service::create_service(&Service::default(), "svc_namespace", api_client).await.unwrap(); /// # } /// ``` @@ -616,7 +625,7 @@ pub async fn create_service( /// /// # #[tokio::main] /// # async fn main() { -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// service::remove_service("svc_to_remove", "svc_namespace", api_client).await.unwrap(); /// # } /// ``` @@ -676,11 +685,11 @@ pub async fn remove_service( /// # #[tokio::main] /// # async fn main() { /// let selector = "environment=production,app=nginx"; -/// let api_client = Client::new(config::incluster_config().unwrap()); +/// let api_client = Client::try_default().await.unwrap(); /// for svc in service::find_services_with_selector(&selector, api_client).await.unwrap() { -/// let svc_name = &svc.metadata.name.clone(); +/// let svc_name = &svc.metadata.name.clone().unwrap(); /// let svc_namespace = &svc.metadata.namespace.as_ref().unwrap().clone(); -/// let loop_api_client = Client::new(config::incluster_config().unwrap()); +/// let loop_api_client = Client::try_default().await.unwrap(); /// let updated_svc = service::update_service( /// &svc, /// &svc_name, diff --git a/webhooks/validating/configuration/Cargo.toml b/webhooks/validating/configuration/Cargo.toml index 917036308..3a432148f 100644 --- a/webhooks/validating/configuration/Cargo.toml +++ b/webhooks/validating/configuration/Cargo.toml @@ -10,9 +10,9 @@ actix-web = { version = "3.3.2", features = ["openssl"] } actix-rt = "2.2.0" akri-shared = { path = "../../../shared" } clap = "3.0.0-beta.2" -kube = { version = "0.57.0", features = ["derive"] } -kube-runtime = "0.57.0" -k8s-openapi = { version = "0.12.0", default-features = false, features = ["v1_16"] } +kube = { version = "0.59.0", features = ["derive"] } +kube-runtime = "0.59.0" +k8s-openapi = { version = "0.13.0", default-features = false, features = ["schemars", "v1_16"] } openapi = { git = "https://github.com/DazWilkin/openapi-admission-v1", tag = "v1.1.0" } openssl = "0.10" rustls = "0.19.0" diff --git a/webhooks/validating/configuration/src/main.rs b/webhooks/validating/configuration/src/main.rs index ec50e20af..f82b82b45 100644 --- a/webhooks/validating/configuration/src/main.rs +++ b/webhooks/validating/configuration/src/main.rs @@ -680,10 +680,10 @@ mod tests { } // Akri Configuration schema tests - use kube::api::{Object, Void}; + use kube::api::{NotUsed, Object}; #[test] fn test_creationtimestamp_is_filtered() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); @@ -692,7 +692,7 @@ mod tests { #[test] fn test_deletiontimestamp_is_filtered() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); @@ -701,7 +701,7 @@ mod tests { #[test] fn test_managedfields_is_filtered() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); @@ -710,7 +710,7 @@ mod tests { #[test] fn test_generation_becomes_f64() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); From f527dff67f9aca3ad41d976303f1a48e71ec9078 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Wed, 11 Aug 2021 19:20:40 -0700 Subject: [PATCH 03/22] Update dependencies --- Cargo.lock | 2715 ++++++++++++++++- Cargo.toml | 29 +- agent/Cargo.toml | 16 +- agent/src/util/config_action.rs | 98 +- agent/src/util/device_plugin_builder.rs | 11 +- agent/src/util/device_plugin_service.rs | 40 +- agent/src/util/discovery_operator.rs | 8 +- agent/src/util/registration.rs | 7 +- agent/src/util/slot_reconciliation.rs | 9 +- controller/Cargo.toml | 4 +- controller/src/util/instance_action.rs | 91 +- controller/src/util/node_watcher.rs | 101 +- controller/src/util/pod_watcher.rs | 111 +- controller/src/util/shared_test_utils.rs | 32 +- .../debug-echo-discovery-handler/Cargo.toml | 4 +- .../onvif-discovery-handler/Cargo.toml | 4 +- .../opcua-discovery-handler/Cargo.toml | 4 +- .../udev-discovery-handler/Cargo.toml | 4 +- discovery-handlers/debug-echo/Cargo.toml | 6 +- .../debug-echo/src/discovery_handler.rs | 7 +- discovery-handlers/onvif/Cargo.toml | 14 +- .../onvif/src/discovery_handler.rs | 8 +- discovery-handlers/opcua/Cargo.toml | 10 +- .../opcua/src/discovery_handler.rs | 8 +- discovery-handlers/udev/Cargo.toml | 8 +- .../udev/src/discovery_handler.rs | 4 +- discovery-utils/Cargo.toml | 10 +- samples/brokers/udev-video-broker/Cargo.toml | 11 +- samples/brokers/udev-video-broker/src/main.rs | 20 +- .../src/util/camera_service.rs | 2 +- shared/Cargo.toml | 14 +- shared/src/akri/configuration.rs | 6 +- shared/src/akri/instance.rs | 6 +- shared/src/k8s/mod.rs | 123 +- shared/src/k8s/node.rs | 14 +- shared/src/k8s/pod.rs | 114 +- shared/src/k8s/service.rs | 147 +- shared/src/os/mod.rs | 1 - shared/src/os/signal.rs | 54 - shared/src/uds/unix_stream.rs | 25 +- test/json/local-instance.json | 2 + test/json/shared-instance-list-slots.json | 2 + test/json/shared-instance-list.json | 2 + test/json/shared-instance-update.json | 2 + test/json/shared-instance.json | 2 + 45 files changed, 3147 insertions(+), 763 deletions(-) delete mode 100644 shared/src/os/signal.rs diff --git a/Cargo.lock b/Cargo.lock index 7eae4dade..2368397bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,383 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "actix" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "543c47e7827f8fcc9d1445bd98ba402137bfce80ee2187429de49c52b5131bd3" +dependencies = [ + "actix-rt 2.2.0", + "actix_derive", + "bitflags", + "bytes 1.0.1", + "crossbeam-channel", + "futures-core", + "futures-sink", + "futures-task", + "futures-util", + "log", + "once_cell", + "parking_lot 0.11.1", + "pin-project-lite 0.2.7", + "smallvec 1.6.1", + "tokio 1.9.0", + "tokio-util 0.6.7", +] + +[[package]] +name = "actix-codec" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78d1833b3838dbe990df0f1f87baf640cf6146e898166afe401839d1b001e570" +dependencies = [ + "bitflags", + "bytes 0.5.6", + "futures-core", + "futures-sink", + "log", + "pin-project 0.4.28", + "tokio 0.2.25", + "tokio-util 0.3.1", +] + +[[package]] +name = "actix-connect" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177837a10863f15ba8d3ae3ec12fac1099099529ed20083a27fdfe247381d0dc" +dependencies = [ + "actix-codec", + "actix-rt 1.1.1", + "actix-service", + "actix-utils", + "derive_more", + "either", + "futures-util", + "http", + "log", + "openssl", + "tokio-openssl", + "trust-dns-proto", + "trust-dns-resolver", +] + +[[package]] +name = "actix-http" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cb8958da437716f3f31b0e76f8daf36554128517d7df37ceba7df00f09622ee" +dependencies = [ + "actix-codec", + "actix-connect", + "actix-rt 1.1.1", + "actix-service", + "actix-threadpool", + "actix-tls", + "actix-utils", + "base64 0.13.0", + "bitflags", + "brotli2", + "bytes 0.5.6", + "cookie", + "copyless", + "derive_more", + "either", + "encoding_rs", + "flate2", + "futures-channel", + "futures-core", + "futures-util", + "fxhash", + "h2 0.2.7", + "http", + "httparse", + "indexmap", + "itoa", + "language-tags", + "lazy_static", + "log", + "mime", + "percent-encoding 2.1.0", + "pin-project 1.0.8", + "rand 0.7.3", + "regex", + "serde", + "serde_json", + "serde_urlencoded", + "sha-1 0.9.7", + "slab", + "time 0.2.27", +] + +[[package]] +name = "actix-macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ca8ce00b267af8ccebbd647de0d61e0674b6e61185cc7a592ff88772bed655" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "actix-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2f86cd6857c135e6e9fe57b1619a88d1f94a7df34c00e11fe13e64fd3438837" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "actix-router" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ad299af73649e1fc893e333ccf86f377751eb95ff875d095131574c6f43452c" +dependencies = [ + "bytestring", + "http", + "log", + "regex", + "serde", +] + +[[package]] +name = "actix-rt" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" +dependencies = [ + "actix-macros 0.1.3", + "actix-threadpool", + "copyless", + "futures-channel", + "futures-util", + "smallvec 1.6.1", + "tokio 0.2.25", +] + +[[package]] +name = "actix-rt" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d7cd957c9ed92288a7c3c96af81fa5291f65247a76a34dac7b6af74e52ba0" +dependencies = [ + "actix-macros 0.2.1", + "futures-core", + "tokio 1.9.0", +] + +[[package]] +name = "actix-server" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45407e6e672ca24784baa667c5d32ef109ccdd8d5e0b5ebb9ef8a67f4dfb708e" +dependencies = [ + "actix-codec", + "actix-rt 1.1.1", + "actix-service", + "actix-utils", + "futures-channel", + "futures-util", + "log", + "mio 0.6.23", + "mio-uds", + "num_cpus", + "slab", + "socket2 0.3.19", +] + +[[package]] +name = "actix-service" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0052435d581b5be835d11f4eb3bce417c8af18d87ddf8ace99f8e67e595882bb" +dependencies = [ + "futures-util", + "pin-project 0.4.28", +] + +[[package]] +name = "actix-testing" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47239ca38799ab74ee6a8a94d1ce857014b2ac36f242f70f3f75a66f691e791c" +dependencies = [ + "actix-macros 0.1.3", + "actix-rt 1.1.1", + "actix-server", + "actix-service", + "log", + "socket2 0.3.19", +] + +[[package]] +name = "actix-threadpool" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d209f04d002854b9afd3743032a27b066158817965bf5d036824d19ac2cc0e30" +dependencies = [ + "derive_more", + "futures-channel", + "lazy_static", + "log", + "num_cpus", + "parking_lot 0.11.1", + "threadpool", +] + +[[package]] +name = "actix-tls" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24789b7d7361cf5503a504ebe1c10806896f61e96eca9a7350e23001aca715fb" +dependencies = [ + "actix-codec", + "actix-service", + "actix-utils", + "futures-util", + "openssl", + "tokio-openssl", +] + +[[package]] +name = "actix-utils" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9022dec56632d1d7979e59af14f0597a28a830a9c1c7fec8b2327eb9f16b5a" +dependencies = [ + "actix-codec", + "actix-rt 1.1.1", + "actix-service", + "bitflags", + "bytes 0.5.6", + "either", + "futures-channel", + "futures-sink", + "futures-util", + "log", + "pin-project 0.4.28", + "slab", +] + +[[package]] +name = "actix-web" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e641d4a172e7faa0862241a20ff4f1f5ab0ab7c279f00c2d4587b77483477b86" +dependencies = [ + "actix-codec", + "actix-http", + "actix-macros 0.1.3", + "actix-router", + "actix-rt 1.1.1", + "actix-server", + "actix-service", + "actix-testing", + "actix-threadpool", + "actix-tls", + "actix-utils", + "actix-web-codegen", + "awc", + "bytes 0.5.6", + "derive_more", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "fxhash", + "log", + "mime", + "openssl", + "pin-project 1.0.8", + "regex", + "serde", + "serde_json", + "serde_urlencoded", + "socket2 0.3.19", + "time 0.2.27", + "tinyvec", + "url 2.2.2", +] + +[[package]] +name = "actix-web-codegen" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad26f77093333e0e7c6ffe54ebe3582d908a104e448723eec6d43d08b07143fb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "actix_derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "adler" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "agent" +version = "0.6.11" +dependencies = [ + "akri-debug-echo", + "akri-discovery-utils", + "akri-onvif", + "akri-opcua", + "akri-shared", + "akri-udev", + "anyhow", + "async-stream", + "async-trait", + "blake2", + "cfg-if 1.0.0", + "chrono", + "env_logger", + "futures 0.3.16", + "futures-core", + "futures-util", + "h2 0.3.3", + "hyper", + "k8s-openapi", + "kube", + "kube-runtime", + "lazy_static", + "log", + "mock_instant", + "mockall", + "mockall_double", + "prometheus 0.12.0", + "prost", + "prost-types", + "rand 0.8.4", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tempfile", + "tokio 1.9.0", + "tokio-stream", + "tonic", + "tonic-build", + "tower", + "url 2.2.2", + "uuid", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -17,6 +388,101 @@ dependencies = [ "memchr", ] +[[package]] +name = "akri-debug-echo" +version = "0.6.11" +dependencies = [ + "akri-discovery-utils", + "akri-shared", + "anyhow", + "async-trait", + "env_logger", + "futures-util", + "log", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tokio 1.9.0", + "tokio-stream", + "tonic", +] + +[[package]] +name = "akri-discovery-utils" +version = "0.6.11" +dependencies = [ + "akri-shared", + "anyhow", + "async-stream", + "async-trait", + "futures 0.3.16", + "log", + "prost", + "serde", + "serde_derive", + "serde_yaml", + "tempfile", + "tokio 1.9.0", + "tokio-stream", + "tonic", + "tonic-build", + "tower", +] + +[[package]] +name = "akri-onvif" +version = "0.6.11" +dependencies = [ + "akri-discovery-utils", + "akri-shared", + "anyhow", + "async-trait", + "bytes 1.0.1", + "env_logger", + "futures-util", + "hyper", + "log", + "mockall", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "sxd-document", + "sxd-xpath", + "tokio 1.9.0", + "tokio-stream", + "tonic", + "uuid", + "xml-rs", + "yaserde", + "yaserde_derive", +] + +[[package]] +name = "akri-opcua" +version = "0.6.11" +dependencies = [ + "akri-discovery-utils", + "akri-shared", + "anyhow", + "async-trait", + "env_logger", + "futures-util", + "log", + "mockall", + "opcua-client", + "prost", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tokio 1.9.0", + "tokio-stream", + "tonic", + "url 2.2.2", +] + [[package]] name = "akri-shared" version = "0.6.12" @@ -25,15 +491,15 @@ dependencies = [ "async-trait", "either", "env_logger", - "futures", + "futures 0.3.16", "futures-util", - "hyper 0.14.11", + "hyper", "k8s-openapi", "kube", "kube-runtime", "log", "mockall", - "prometheus", + "prometheus 0.11.0", "rand 0.8.4", "schemars", "serde", @@ -47,12 +513,142 @@ dependencies = [ "warp", ] +[[package]] +name = "akri-udev" +version = "0.6.11" +dependencies = [ + "akri-discovery-utils", + "anyhow", + "async-trait", + "env_logger", + "futures-util", + "log", + "mockall", + "pest", + "pest_derive", + "prost", + "regex", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tokio 1.9.0", + "tokio-stream", + "tonic", + "udev", +] + [[package]] name = "anyhow" version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "595d3cfa7a60d4555cb5067b99f07142a08ea778de5cf993f7b75c7d8fabc486" +[[package]] +name = "async-channel" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "once_cell", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" +dependencies = [ + "async-channel", + "async-executor", + "async-io", + "async-mutex", + "blocking", + "futures-lite", + "num_cpus", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" +dependencies = [ + "concurrent-queue", + "futures-lite", + "libc", + "log", + "once_cell", + "parking", + "polling", + "slab", + "socket2 0.4.1", + "waker-fn", + "winapi 0.3.9", +] + +[[package]] +name = "async-lock" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-mutex" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-std" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f06685bad74e0570f5213741bea82158279a4103d988e57bfada11ad230341" +dependencies = [ + "async-channel", + "async-global-executor", + "async-io", + "async-lock", + "crossbeam-utils 0.8.5", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "num_cpus", + "once_cell", + "pin-project-lite 0.2.7", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + [[package]] name = "async-stream" version = "0.3.2" @@ -74,6 +670,12 @@ dependencies = [ "syn", ] +[[package]] +name = "async-task" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" + [[package]] name = "async-trait" version = "0.1.51" @@ -85,6 +687,12 @@ dependencies = [ "syn", ] +[[package]] +name = "atomic-waker" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" + [[package]] name = "atty" version = "0.2.14" @@ -103,30 +711,127 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] -name = "base64" -version = "0.12.3" +name = "awc" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b381e490e7b0cfc37ebc54079b0413d8093ef43d14a4e4747083f7fa47a9e691" +dependencies = [ + "actix-codec", + "actix-http", + "actix-rt 1.1.1", + "actix-service", + "base64 0.13.0", + "bytes 0.5.6", + "cfg-if 1.0.0", + "derive_more", + "futures-core", + "log", + "mime", + "openssl", + "percent-encoding 2.1.0", + "rand 0.7.3", + "serde", + "serde_json", + "serde_urlencoded", +] + +[[package]] +name = "base-x" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "blake2" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a5720225ef5daecf08657f23791354e1685a8c91a4c60c7f3d3b2892f978f4" +dependencies = [ + "crypto-mac", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "block-padding" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] [[package]] -name = "base64" -version = "0.13.0" +name = "blocking" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9" +dependencies = [ + "async-channel", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", + "once_cell", +] [[package]] -name = "bitflags" -version = "1.2.1" +name = "brotli-sys" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" +dependencies = [ + "cc", + "libc", +] [[package]] -name = "block-buffer" -version = "0.9.0" +name = "brotli2" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" dependencies = [ - "generic-array", + "brotli-sys", + "libc", ] [[package]] @@ -139,12 +844,34 @@ dependencies = [ "safemem", ] +[[package]] +name = "bumpalo" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +dependencies = [ + "byteorder", + "iovec", +] + [[package]] name = "bytes" version = "0.5.6" @@ -157,6 +884,21 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +[[package]] +name = "bytestring" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d" +dependencies = [ + "bytes 1.0.1", +] + +[[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" + [[package]] name = "cc" version = "1.0.69" @@ -185,10 +927,114 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time", + "time 0.1.44", "winapi 0.3.9", ] +[[package]] +name = "clap" +version = "3.0.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142" +dependencies = [ + "atty", + "bitflags", + "clap_derive", + "indexmap", + "lazy_static", + "os_str_bytes", + "strsim", + "termcolor", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "clap_derive" +version = "3.0.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "concurrent-queue" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +dependencies = [ + "cache-padded", +] + +[[package]] +name = "const_fn" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" + +[[package]] +name = "controller" +version = "0.6.11" +dependencies = [ + "akri-shared", + "anyhow", + "async-std", + "async-trait", + "chrono", + "env_logger", + "futures 0.3.16", + "k8s-openapi", + "kube", + "kube-runtime", + "lazy_static", + "log", + "mockall", + "prometheus 0.12.0", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tokio 1.9.0", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cookie" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" +dependencies = [ + "percent-encoding 2.1.0", + "time 0.2.27", + "version_check", +] + +[[package]] +name = "copyless" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" + [[package]] name = "core-foundation" version = "0.9.1" @@ -223,6 +1069,94 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils 0.8.5", +] + +[[package]] +name = "crossbeam-deque" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "crossbeam-utils 0.7.2", + "lazy_static", + "maybe-uninit", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" +dependencies = [ + "cfg-if 0.1.10", + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "lazy_static", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +dependencies = [ + "cfg-if 1.0.0", + "lazy_static", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.4", + "subtle", +] + +[[package]] +name = "ctor" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "darling" version = "0.12.4" @@ -268,6 +1202,17 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "debug-echo-discovery-handler" +version = "0.6.11" +dependencies = [ + "akri-debug-echo", + "akri-discovery-utils", + "env_logger", + "log", + "tokio 1.9.0", +] + [[package]] name = "derivative" version = "2.2.0" @@ -279,19 +1224,41 @@ dependencies = [ "syn", ] +[[package]] +name = "derive_more" +version = "0.99.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version 0.3.3", + "syn", +] + [[package]] name = "difference" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array", + "generic-array 0.14.4", ] [[package]] @@ -315,6 +1282,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "doc-comment" version = "0.3.3" @@ -345,11 +1318,32 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "encoding_rs" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "enum-as-inner" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "env_logger" -version = "0.6.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" dependencies = [ "atty", "humantime", @@ -358,6 +1352,33 @@ dependencies = [ "termcolor", ] +[[package]] +name = "event-listener" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "fastrand" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" +dependencies = [ + "instant", +] + +[[package]] +name = "fixedbitset" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" + [[package]] name = "flate2" version = "1.0.20" @@ -407,7 +1428,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", - "percent-encoding", + "percent-encoding 2.1.0", ] [[package]] @@ -432,6 +1453,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +[[package]] +name = "futures" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" + [[package]] name = "futures" version = "0.3.16" @@ -480,6 +1507,21 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b0e06c393068f3a6ef246c75cdca793d6a46347e75286933e5e75fd2fd11582" +[[package]] +name = "futures-lite" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite 0.2.7", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.16" @@ -526,6 +1568,24 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + [[package]] name = "generic-array" version = "0.14.4" @@ -536,6 +1596,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "gethostname" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e692e296bfac1d2533ef168d0b60ff5897b8b70a4009276834014dd8924cc028" +dependencies = [ + "libc", + "winapi 0.3.9", +] + [[package]] name = "getrandom" version = "0.1.16" @@ -558,6 +1628,19 @@ dependencies = [ "wasi 0.10.0+wasi-snapshot-preview1", ] +[[package]] +name = "gloo-timers" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "h2" version = "0.2.7" @@ -615,8 +1698,8 @@ dependencies = [ "headers-core", "http", "mime", - "sha-1", - "time", + "sha-1 0.9.7", + "time 0.1.44", ] [[package]] @@ -628,6 +1711,15 @@ dependencies = [ "http", ] +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "hermit-abi" version = "0.1.19" @@ -643,6 +1735,17 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi 0.3.9", +] + [[package]] name = "http" version = "0.2.4" @@ -654,16 +1757,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" -dependencies = [ - "bytes 0.5.6", - "http", -] - [[package]] name = "http-body" version = "0.4.2" @@ -681,12 +1774,6 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" -[[package]] -name = "httpdate" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" - [[package]] name = "httpdate" version = "1.0.1" @@ -695,36 +1782,9 @@ checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" [[package]] name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] - -[[package]] -name = "hyper" -version = "0.13.10" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" -dependencies = [ - "bytes 0.5.6", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.2.7", - "http", - "http-body 0.3.1", - "httparse", - "httpdate 0.3.2", - "itoa", - "pin-project 1.0.8", - "socket2 0.3.19", - "tokio 0.2.25", - "tower-service", - "tracing", - "want", -] +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" @@ -738,9 +1798,9 @@ dependencies = [ "futures-util", "h2 0.3.3", "http", - "http-body 0.4.2", + "http-body", "httparse", - "httpdate 1.0.1", + "httpdate", "itoa", "pin-project-lite 0.2.7", "socket2 0.4.1", @@ -756,7 +1816,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.11", + "hyper", "pin-project-lite 0.2.7", "tokio 1.9.0", "tokio-io-timeout", @@ -769,7 +1829,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes 1.0.1", - "hyper 0.14.11", + "hyper", "native-tls", "tokio 1.9.0", "tokio-native-tls", @@ -781,6 +1841,17 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "0.2.3" @@ -804,11 +1875,11 @@ dependencies = [ [[package]] name = "input_buffer" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19a8a95243d5a0398cae618ec29477c6e3cb631152be5c19481f80bc71559754" +checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413" dependencies = [ - "bytes 0.5.6", + "bytes 1.0.1", ] [[package]] @@ -829,11 +1900,29 @@ dependencies = [ "libc", ] +[[package]] +name = "ipconfig" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" +dependencies = [ + "socket2 0.3.19", + "widestring", + "winapi 0.3.9", + "winreg 0.6.2", +] + +[[package]] +name = "ipnet" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" + [[package]] name = "itertools" -version = "0.9.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" dependencies = [ "either", ] @@ -844,6 +1933,15 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +[[package]] +name = "js-sys" +version = "0.3.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce791b7ca6638aae45be056e068fc756d871eb3b3b10b8efa62d1c9cec616752" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "json-patch" version = "0.2.6" @@ -902,10 +2000,10 @@ dependencies = [ "chrono", "dirs-next", "either", - "futures", + "futures 0.3.16", "http", - "http-body 0.4.2", - "hyper 0.14.11", + "http-body", + "hyper", "hyper-timeout", "hyper-tls", "jsonpath_lib", @@ -964,20 +2062,35 @@ checksum = "cb40d5730a3ac47b7153c7ad0494a66881bbdf0c17ead478b714dd82c9dba259" dependencies = [ "dashmap", "derivative", - "futures", + "futures 0.3.16", "json-patch", "k8s-openapi", "kube", "pin-project 1.0.8", "serde", "serde_json", - "smallvec", + "smallvec 1.6.1", "snafu", "tokio 1.9.0", "tokio-util 0.6.7", "tracing", ] +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" + [[package]] name = "lazy_static" version = "1.4.0" @@ -990,12 +2103,31 @@ version = "0.2.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" +[[package]] +name = "libudev-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "linked-hash-map" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + [[package]] name = "lock_api" version = "0.4.4" @@ -1012,20 +2144,57 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ "cfg-if 1.0.0", + "value-bag", ] +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "matches" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + [[package]] name = "memchr" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +[[package]] +name = "memoffset" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +dependencies = [ + "autocfg", +] + [[package]] name = "mime" version = "0.3.16" @@ -1084,6 +2253,17 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio 0.6.23", +] + [[package]] name = "miow" version = "0.2.2" @@ -1105,11 +2285,20 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "mock_instant" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "717e29a243b81f8130e31e24e04fb151b04a44b5a7d05370935f7d937e9de06d" +dependencies = [ + "once_cell", +] + [[package]] name = "mockall" -version = "0.9.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d614ad23f9bb59119b8b5670a85c7ba92c5e9adf4385c81ea00c51c8be33d5" +checksum = "6ab571328afa78ae322493cacca3efac6a0f2e0a67305b4df31fd439ef129ac0" dependencies = [ "cfg-if 1.0.0", "downcast", @@ -1122,9 +2311,21 @@ dependencies = [ [[package]] name = "mockall_derive" -version = "0.9.1" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e25b214433f669161f414959594216d8e6ba83b6679d3db96899c0b4639033" +dependencies = [ + "cfg-if 1.0.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "mockall_double" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd4234635bca06fc96c7368d038061e0aae1b00a764dc817e900dc974e3deea" +checksum = "3e25b78d34b2b713b1d000d629079755cfc166e6a65f9f4c1c012a94305467c5" dependencies = [ "cfg-if 1.0.0", "proc-macro2", @@ -1132,6 +2333,12 @@ dependencies = [ "syn", ] +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + [[package]] name = "multipart" version = "0.17.1" @@ -1198,42 +2405,161 @@ dependencies = [ name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" + +[[package]] +name = "onvif-discovery-handler" +version = "0.6.11" +dependencies = [ + "akri-discovery-utils", + "akri-onvif", + "env_logger", + "log", + "tokio 1.9.0", +] + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "opcua-client" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0af3d9776871cb836aa6e3f57407b3c798c7c9f46ea9fae0835f8514f89585a1" +dependencies = [ + "chrono", + "futures 0.1.31", + "lazy_static", + "log", + "opcua-core", + "opcua-crypto", + "opcua-types", + "serde", + "serde_derive", + "time 0.1.44", + "tokio 0.1.22", + "tokio-codec", + "tokio-io", + "tokio-timer", +] + +[[package]] +name = "opcua-core" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7dd64d0071fb9e3c1409c8ad416c3df865053209a183bbf017ee193afbda7e9" dependencies = [ - "autocfg", - "num-traits", + "bytes 0.4.12", + "chrono", + "futures 0.1.31", + "lazy_static", + "log", + "opcua-crypto", + "opcua-types", + "regex", + "serde", + "serde_derive", + "serde_yaml", + "tokio 0.1.22", + "tokio-io", + "url 1.7.2", ] [[package]] -name = "num-traits" -version = "0.2.14" +name = "opcua-crypto" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "a5754e8be576bf03903a7c71b5a0a6e40a267fcc6742c83974399cdc7146362e" dependencies = [ - "autocfg", + "bytes 0.4.12", + "chrono", + "gethostname", + "lazy_static", + "log", + "opcua-types", + "openssl", + "serde", + "serde_derive", ] [[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +name = "opcua-discovery-handler" +version = "0.6.11" dependencies = [ - "hermit-abi", - "libc", + "akri-discovery-utils", + "akri-opcua", + "env_logger", + "log", + "tokio 1.9.0", ] [[package]] -name = "once_cell" -version = "1.8.0" +name = "opcua-types" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "247dd311285d4f846219b3809c048719d3a1fd6c7b01ba16b0a6651290913d61" +dependencies = [ + "base64 0.12.3", + "bitflags", + "byteorder", + "chrono", + "lazy_static", + "log", + "regex", + "serde", + "serde_derive", + "uuid", +] [[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +name = "openapi" +version = "1.1.0" +source = "git+https://github.com/DazWilkin/openapi-admission-v1?tag=v1.1.0#60a9ba6bd64efda65cb136a21e0d6a53e962c415" +dependencies = [ + "reqwest", + "serde", + "serde_derive", + "serde_json", + "url 1.7.2", +] [[package]] name = "openssl" @@ -1277,6 +2603,29 @@ dependencies = [ "num-traits", ] +[[package]] +name = "os_str_bytes" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85" + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + +[[package]] +name = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.6.2", + "rustc_version 0.2.3", +] + [[package]] name = "parking_lot" version = "0.11.1" @@ -1284,8 +2633,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", - "lock_api", - "parking_lot_core", + "lock_api 0.4.4", + "parking_lot_core 0.8.3", +] + +[[package]] +name = "parking_lot_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall 0.1.57", + "rustc_version 0.2.3", + "smallvec 0.6.14", + "winapi 0.3.9", ] [[package]] @@ -1297,8 +2661,8 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall", - "smallvec", + "redox_syscall 0.2.9", + "smallvec 1.6.1", "winapi 0.3.9", ] @@ -1313,12 +2677,77 @@ dependencies = [ "regex", ] +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" + [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "peresil" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f658886ed52e196e850cfbbfddab9eaa7f6d90dd0929e264c31e5cec07e09e57" + +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +dependencies = [ + "maplit", + "pest", + "sha-1 0.8.2", +] + +[[package]] +name = "petgraph" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" +dependencies = [ + "fixedbitset", + "indexmap", +] + [[package]] name = "pin-project" version = "0.4.28" @@ -1383,6 +2812,19 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +[[package]] +name = "polling" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "log", + "wepoll-ffi", + "winapi 0.3.9", +] + [[package]] name = "ppv-lite86" version = "0.2.10" @@ -1418,6 +2860,30 @@ dependencies = [ "treeline", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro-hack" version = "0.5.19" @@ -1463,28 +2929,63 @@ dependencies = [ "fnv", "lazy_static", "libc", - "parking_lot", + "parking_lot 0.11.1", "procfs", "protobuf", "regex", "thiserror", ] +[[package]] +name = "prometheus" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5986aa8d62380092d2f50f8b1cdba9cb9b6731ffd4b25b51fd126b6c3e05b99c" +dependencies = [ + "cfg-if 1.0.0", + "fnv", + "lazy_static", + "libc", + "memchr", + "parking_lot 0.11.1", + "procfs", + "protobuf", + "thiserror", +] + [[package]] name = "prost" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" dependencies = [ "bytes 1.0.1", "prost-derive", ] +[[package]] +name = "prost-build" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" +dependencies = [ + "bytes 1.0.1", + "heck", + "itertools", + "log", + "multimap", + "petgraph", + "prost", + "prost-types", + "tempfile", + "which", +] + [[package]] name = "prost-derive" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" dependencies = [ "anyhow", "itertools", @@ -1493,6 +2994,16 @@ dependencies = [ "syn", ] +[[package]] +name = "prost-types" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" +dependencies = [ + "bytes 1.0.1", + "prost", +] + [[package]] name = "protobuf" version = "2.24.1" @@ -1595,6 +3106,12 @@ dependencies = [ "rand_core 0.6.3", ] +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + [[package]] name = "redox_syscall" version = "0.2.9" @@ -1611,7 +3128,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ "getrandom 0.2.3", - "redox_syscall", + "redox_syscall 0.2.9", ] [[package]] @@ -1640,6 +3157,104 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "reqwest" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" +dependencies = [ + "base64 0.13.0", + "bytes 1.0.1", + "encoding_rs", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "mime_guess", + "percent-encoding 2.1.0", + "pin-project-lite 0.2.7", + "serde", + "serde_json", + "serde_urlencoded", + "tokio 1.9.0", + "url 2.2.2", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.7.0", +] + +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi 0.3.9", +] + +[[package]] +name = "rscam" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89056084211cd54924fedf2e2199b906409d1f795cfd8e7e3271061742457018" +dependencies = [ + "libc", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64 0.13.0", + "log", + "ring", + "sct", + "webpki", +] + [[package]] name = "ryu" version = "1.0.5" @@ -1698,6 +3313,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "security-framework" version = "2.3.1" @@ -1721,6 +3346,39 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser 0.10.2", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + [[package]] name = "serde" version = "1.0.127" @@ -1776,14 +3434,14 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" dependencies = [ - "dtoa", + "form_urlencoded", "itoa", + "ryu", "serde", - "url", ] [[package]] @@ -1798,19 +3456,37 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + [[package]] name = "sha-1" version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if 1.0.0", "cpufeatures", - "digest", - "opaque-debug", + "digest 0.9.0", + "opaque-debug 0.3.0", ] +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -1826,6 +3502,15 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" +[[package]] +name = "smallvec" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +dependencies = [ + "maybe-uninit", +] + [[package]] name = "smallvec" version = "1.6.1" @@ -1876,12 +3561,103 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version 0.2.3", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "sxd-document" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94d82f37be9faf1b10a82c4bd492b74f698e40082f0f40de38ab275f31d42078" +dependencies = [ + "peresil", + "typed-arena", +] + +[[package]] +name = "sxd-xpath" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36e39da5d30887b5690e29de4c5ebb8ddff64ebd9933f98a01daaa4fd11b36ea" +dependencies = [ + "peresil", + "quick-error", + "sxd-document", +] + [[package]] name = "syn" version = "1.0.74" @@ -1902,7 +3678,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "rand 0.8.4", - "redox_syscall", + "redox_syscall 0.2.9", "remove_dir_all", "winapi 0.3.9", ] @@ -1916,6 +3692,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789" +dependencies = [ + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.26" @@ -1936,6 +3721,15 @@ dependencies = [ "syn", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" version = "0.1.44" @@ -1947,6 +3741,44 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "time" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check", + "winapi 0.3.9", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn", +] + [[package]] name = "tinyvec" version = "1.3.1" @@ -1962,6 +3794,30 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "tokio" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "mio 0.6.23", + "num_cpus", + "tokio-codec", + "tokio-current-thread", + "tokio-executor", + "tokio-fs", + "tokio-io", + "tokio-reactor", + "tokio-sync", + "tokio-tcp", + "tokio-threadpool", + "tokio-timer", + "tokio-udp", + "tokio-uds", +] + [[package]] name = "tokio" version = "0.2.25" @@ -1969,14 +3825,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" dependencies = [ "bytes 0.5.6", - "fnv", "futures-core", "iovec", "lazy_static", + "libc", "memchr", "mio 0.6.23", + "mio-uds", "pin-project-lite 0.1.12", + "signal-hook-registry", "slab", + "winapi 0.3.9", ] [[package]] @@ -1992,13 +3851,66 @@ dependencies = [ "mio 0.7.13", "num_cpus", "once_cell", - "parking_lot", + "parking_lot 0.11.1", "pin-project-lite 0.2.7", "signal-hook-registry", "tokio-macros", "winapi 0.3.9", ] +[[package]] +name = "tokio-codec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "tokio-io", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" +dependencies = [ + "futures 0.1.31", + "tokio-executor", +] + +[[package]] +name = "tokio-executor" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures 0.1.31", +] + +[[package]] +name = "tokio-fs" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" +dependencies = [ + "futures 0.1.31", + "tokio-io", + "tokio-threadpool", +] + +[[package]] +name = "tokio-io" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "log", +] + [[package]] name = "tokio-io-timeout" version = "1.1.1" @@ -2031,27 +3943,153 @@ dependencies = [ ] [[package]] -name = "tokio-stream" -version = "0.1.7" +name = "tokio-openssl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c4b08c5f4208e699ede3df2520aca2e82401b2de33f45e96696a074480be594" +dependencies = [ + "openssl", + "tokio 0.2.25", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures 0.1.31", + "lazy_static", + "log", + "mio 0.6.23", + "num_cpus", + "parking_lot 0.9.0", + "slab", + "tokio-executor", + "tokio-io", + "tokio-sync", +] + +[[package]] +name = "tokio-rustls" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +dependencies = [ + "rustls", + "tokio 1.9.0", + "webpki", +] + +[[package]] +name = "tokio-stream" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" +dependencies = [ + "futures-core", + "pin-project-lite 0.2.7", + "tokio 1.9.0", +] + +[[package]] +name = "tokio-sync" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" +dependencies = [ + "fnv", + "futures 0.1.31", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "iovec", + "mio 0.6.23", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" +dependencies = [ + "crossbeam-deque", + "crossbeam-queue", + "crossbeam-utils 0.7.2", + "futures 0.1.31", + "lazy_static", + "log", + "num_cpus", + "slab", + "tokio-executor", +] + +[[package]] +name = "tokio-timer" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures 0.1.31", + "slab", + "tokio-executor", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b" +dependencies = [ + "futures-util", + "log", + "pin-project 1.0.8", + "tokio 1.9.0", + "tungstenite", +] + +[[package]] +name = "tokio-udp" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" +checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" dependencies = [ - "futures-core", - "pin-project-lite 0.2.7", - "tokio 1.9.0", + "bytes 0.4.12", + "futures 0.1.31", + "log", + "mio 0.6.23", + "tokio-codec", + "tokio-io", + "tokio-reactor", ] [[package]] -name = "tokio-tungstenite" -version = "0.11.0" +name = "tokio-uds" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9e878ad426ca286e4dcae09cbd4e1973a7f8987d97570e2469703dd7f5720c" +checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" dependencies = [ - "futures-util", + "bytes 0.4.12", + "futures 0.1.31", + "iovec", + "libc", "log", - "pin-project 0.4.28", - "tokio 0.2.25", - "tungstenite", + "mio 0.6.23", + "mio-uds", + "tokio-codec", + "tokio-io", + "tokio-reactor", ] [[package]] @@ -2085,9 +4123,9 @@ dependencies = [ [[package]] name = "tonic" -version = "0.4.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ac42cd97ac6bd2339af5bcabf105540e21e45636ec6fa6aae5e85d44db31be0" +checksum = "796c5e1cd49905e65dd8e700d4cb1dffcbfdb4fc9d017de08c1a537afd83627c" dependencies = [ "async-stream", "async-trait", @@ -2097,21 +4135,36 @@ dependencies = [ "futures-util", "h2 0.3.3", "http", - "http-body 0.4.2", - "hyper 0.14.11", - "percent-encoding", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding 2.1.0", "pin-project 1.0.8", "prost", "prost-derive", "tokio 1.9.0", + "tokio-rustls", "tokio-stream", "tokio-util 0.6.7", "tower", + "tower-layer", "tower-service", "tracing", "tracing-futures", ] +[[package]] +name = "tonic-build" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12b52d07035516c2b74337d2ac7746075e7dcae7643816c1b12c5ff8a7484c08" +dependencies = [ + "proc-macro2", + "prost-build", + "quote", + "syn", +] + [[package]] name = "tower" version = "0.4.8" @@ -2143,7 +4196,7 @@ dependencies = [ "futures-core", "futures-util", "http", - "http-body 0.4.2", + "http-body", "pin-project 1.0.8", "tower-layer", "tower-service", @@ -2220,6 +4273,45 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" +[[package]] +name = "trust-dns-proto" +version = "0.19.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cad71a0c0d68ab9941d2fb6e82f8fb2e86d9945b94e1661dd0aaea2b88215a9" +dependencies = [ + "async-trait", + "cfg-if 1.0.0", + "enum-as-inner", + "futures 0.3.16", + "idna 0.2.3", + "lazy_static", + "log", + "rand 0.7.3", + "smallvec 1.6.1", + "thiserror", + "tokio 0.2.25", + "url 2.2.2", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.19.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710f593b371175db53a26d0b38ed2978fafb9e9e8d3868b1acd753ea18df0ceb" +dependencies = [ + "cfg-if 0.1.10", + "futures 0.3.16", + "ipconfig", + "lazy_static", + "log", + "lru-cache", + "resolv-conf", + "smallvec 1.6.1", + "thiserror", + "tokio 0.2.25", + "trust-dns-proto", +] + [[package]] name = "try-lock" version = "0.2.3" @@ -2228,20 +4320,20 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "tungstenite" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0308d80d86700c5878b9ef6321f020f29b1bb9d5ff3cab25e75e23f3a492a23" +checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24" dependencies = [ - "base64 0.12.3", + "base64 0.13.0", "byteorder", - "bytes 0.5.6", + "bytes 1.0.1", "http", "httparse", "input_buffer", "log", - "rand 0.7.3", - "sha-1", - "url", + "rand 0.8.4", + "sha-1 0.9.7", + "url 2.2.2", "utf-8", ] @@ -2254,12 +4346,61 @@ dependencies = [ "memchr", ] +[[package]] +name = "typed-arena" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d" + [[package]] name = "typenum" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + +[[package]] +name = "udev" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048df778e99eea028c08cca7853b9b521df6948b59bb29ab8bb737c057f58e6d" +dependencies = [ + "libc", + "libudev-sys", +] + +[[package]] +name = "udev-discovery-handler" +version = "0.6.11" +dependencies = [ + "akri-discovery-utils", + "akri-udev", + "env_logger", + "log", + "tokio 1.9.0", +] + +[[package]] +name = "udev-video-broker" +version = "0.6.11" +dependencies = [ + "akri-shared", + "env_logger", + "lazy_static", + "log", + "prometheus 0.12.0", + "prost", + "rscam", + "tokio 1.9.0", + "tonic", + "tonic-build", +] + [[package]] name = "unicase" version = "2.6.0" @@ -2287,29 +4428,52 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" + +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" -version = "2.2.2" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" dependencies = [ - "form_urlencoded", - "idna", + "idna 0.1.5", "matches", - "percent-encoding", + "percent-encoding 1.0.1", ] [[package]] -name = "urlencoding" -version = "1.3.3" +name = "url" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a1f0175e03a0973cf4afd476bef05c26e228520400eb1fd473ad417b1c00ffb" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna 0.2.3", + "matches", + "percent-encoding 2.1.0", +] [[package]] name = "utf-8" @@ -2317,18 +4481,49 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.3", +] + +[[package]] +name = "value-bag" +version = "1.0.0-alpha.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd320e1520f94261153e96f7534476ad869c14022aee1e59af7c778075d840ae" +dependencies = [ + "ctor", + "version_check", +] + [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version_check" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + [[package]] name = "want" version = "0.3.0" @@ -2341,30 +4536,31 @@ dependencies = [ [[package]] name = "warp" -version = "0.2.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41be6df54c97904af01aa23e613d4521eed7ab23537cede692d4058f6449407" +checksum = "332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054" dependencies = [ - "bytes 0.5.6", - "futures", + "bytes 1.0.1", + "futures 0.3.16", "headers", "http", - "hyper 0.13.10", + "hyper", "log", "mime", "mime_guess", "multipart", - "pin-project 0.4.28", + "percent-encoding 2.1.0", + "pin-project 1.0.8", "scoped-tls", "serde", "serde_json", "serde_urlencoded", - "tokio 0.2.25", + "tokio 1.9.0", + "tokio-stream", "tokio-tungstenite", + "tokio-util 0.6.7", "tower-service", "tracing", - "tracing-futures", - "urlencoding", ] [[package]] @@ -2379,6 +4575,139 @@ version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +[[package]] +name = "wasm-bindgen" +version = "0.2.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b608ecc8f4198fe8680e2ed18eccab5f0cd4caaf3d83516fa5fb2e927fda2586" +dependencies = [ + "cfg-if 1.0.0", + "serde", + "serde_json", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "580aa3a91a63d23aac5b6b267e2d13cb4f363e31dce6c352fca4752ae12e479f" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16646b21c3add8e13fdb8f20172f8a28c3dbf62f45406bcff0233188226cfe0c" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171ebf0ed9e1458810dfcb31f2e766ad6b3a89dbda42d8901f2b268277e5f09c" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2657dd393f03aa2a659c25c6ae18a13a4048cebd220e147933ea837efc589f" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0c4a743a309662d45f4ede961d7afa4ba4131a59a639f29b0069c3798bbcc2" + +[[package]] +name = "web-sys" +version = "0.3.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c70a82d842c9979078c772d4a1344685045f1a5628f677c2b2eab4dd7d2696" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webhook-configuration" +version = "0.6.11" +dependencies = [ + "actix", + "actix-rt 2.2.0", + "actix-web", + "akri-shared", + "clap", + "k8s-openapi", + "kube", + "kube-runtime", + "openapi", + "openssl", + "rustls", + "serde", + "serde_json", +] + +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "wepoll-ffi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" +dependencies = [ + "cc", +] + +[[package]] +name = "which" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" +dependencies = [ + "either", + "lazy_static", + "libc", +] + +[[package]] +name = "widestring" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" + [[package]] name = "winapi" version = "0.2.8" @@ -2422,6 +4751,24 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "winreg" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -2432,6 +4779,12 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "xml-rs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" + [[package]] name = "yaml-rust" version = "0.4.5" @@ -2440,3 +4793,27 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] + +[[package]] +name = "yaserde" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2776ec5bb20e76d89268e87e1ea66c078b94f55e9771e4d648adda3019f87fc" +dependencies = [ + "log", + "xml-rs", +] + +[[package]] +name = "yaserde_derive" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0b0a4701f203ebaecce4971a6bb8575aa07b617bdc39ddfc6ffeff3a38530d" +dependencies = [ + "heck", + "log", + "proc-macro2", + "quote", + "syn", + "xml-rs", +] diff --git a/Cargo.toml b/Cargo.toml index 1bb68d2fc..de8d6115c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,23 +3,20 @@ # [patch.crates-io] # h2 = { git = "https://github.com/kate-goldenring/h2", branch = "master" } -# [patch.crates-io] -# k8s-openapi = { git = "https://github.com/kazk/k8s-openapi", branch = "add-schema" } - [workspace] members = [ "shared", - # "agent", - # "controller", - # "samples/brokers/udev-video-broker", - # "webhooks/validating/configuration", - # "discovery-utils", - # "discovery-handlers/debug-echo", - # "discovery-handlers/onvif", - # "discovery-handlers/opcua", - # "discovery-handlers/udev", - # "discovery-handler-modules/debug-echo-discovery-handler", - # "discovery-handler-modules/onvif-discovery-handler", - # "discovery-handler-modules/opcua-discovery-handler", - # "discovery-handler-modules/udev-discovery-handler", + "agent", + "controller", + "samples/brokers/udev-video-broker", + "webhooks/validating/configuration", + "discovery-utils", + "discovery-handlers/debug-echo", + "discovery-handlers/onvif", + "discovery-handlers/opcua", + "discovery-handlers/udev", + "discovery-handler-modules/debug-echo-discovery-handler", + "discovery-handler-modules/onvif-discovery-handler", + "discovery-handler-modules/opcua-discovery-handler", + "discovery-handler-modules/udev-discovery-handler", ] diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 2e819d31e..6abe835b7 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -19,7 +19,7 @@ async-trait = "0.1.0" blake2 = "0.9.0" chrono = "0.4.10" cfg-if = "1.0.0" -env_logger = "0.8.3" +env_logger = "0.9.0" futures = { version = "0.3.1", package = "futures" } futures-core = "0.3" futures-util = "0.3" @@ -31,9 +31,9 @@ k8s-openapi = { version = "0.13.0", default-features = false, features = ["schem lazy_static = "1.4" log = "0.4" mockall_double = "0.2.0" -prometheus = { version = "0.11.0", features = ["process"] } -prost = "0.7" -prost-types = "0.7" +prometheus = { version = "0.12.0", features = ["process"] } +prost = "0.8.0" +prost-types = "0.8.0" rand = "0.8.2" serde = "1.0.104" serde_json = "1.0.45" @@ -41,14 +41,14 @@ serde_yaml = "0.8.11" serde_derive = "1.0.104" tokio = { version = "1.0", features = ["rt-multi-thread", "time", "fs", "macros", "net"] } tokio-stream = { version = "0.1", features = ["net"] } -tonic = "0.4.0" +tonic = "0.5.2" # TODO kagold maybe dont need tower -tower = "0.4.4" +tower = "0.4.8" url = "2.1.0" uuid = { version = "0.8.1", features = ["v4"] } [build-dependencies] -tonic-build = "0.4.0" +tonic-build = "0.5.2" [dev-dependencies] # for testing using a simple discovery handler @@ -56,7 +56,7 @@ akri-discovery-utils = { path = "../discovery-utils", features = ["mock-discover akri-onvif = { path = "../discovery-handlers/onvif" } akri-opcua = { path = "../discovery-handlers/opcua" } akri-udev = { path = "../discovery-handlers/udev"} -mockall = "0.9.0" +mockall = "0.10.2" mock_instant = { version = "0.2", features = ["sync"] } tempfile = "3.1.0" diff --git a/agent/src/util/config_action.rs b/agent/src/util/config_action.rs index bcd473942..954f29445 100644 --- a/agent/src/util/config_action.rs +++ b/agent/src/util/config_action.rs @@ -9,12 +9,13 @@ use super::{ registration::RegisteredDiscoveryHandlerMap, }; use akri_shared::{ - akri::{configuration::Configuration, API_CONFIGURATIONS, API_NAMESPACE, API_VERSION}, + akri::configuration::Configuration, k8s, k8s::{try_delete_instance, KubeInterface}, }; use futures::{StreamExt, TryStreamExt}; -use kube::api::{Api, ListParams, WatchEvent}; +use kube::api::{Api, ListParams}; +use kube_runtime::watcher::{watcher, Event}; use log::{info, trace}; use std::{collections::HashMap, sync::Arc}; use tokio::sync::{broadcast, mpsc, Mutex}; @@ -90,45 +91,52 @@ async fn watch_for_config_changes( new_discovery_handler_sender: broadcast::Sender, ) -> Result<(), Box> { trace!("watch_for_config_changes - start"); - let configurations_api = Api::::all(kube_interface.get_kube_client()); - loop { - let mut stream = configurations_api - .watch(&ListParams::default(), API_VERSION) - .await? - .boxed(); - - // Currently, this does not handle None except to break the - // while. - while let Some(event) = stream.try_next().await? { - let new_discovery_handler_sender = new_discovery_handler_sender.clone(); - handle_config( - kube_interface, - event, - config_map.clone(), - discovery_handler_map.clone(), - new_discovery_handler_sender, - ) - .await? - } + let resource = Api::::all(kube_interface.get_kube_client()); + let watcher = watcher(resource, ListParams::default()); + let mut informer = watcher.boxed(); + // Currently, this does not handle None except to break the + // while. + while let Some(event) = informer.try_next().await? { + let new_discovery_handler_sender = new_discovery_handler_sender.clone(); + handle_config( + kube_interface, + event, + config_map.clone(), + discovery_handler_map.clone(), + new_discovery_handler_sender, + ) + .await? } + Ok(()) } /// This takes an event off the Configuration stream and delegates it to the /// correct function based on the event type. async fn handle_config( kube_interface: &impl KubeInterface, - event: WatchEvent, + event: Event, config_map: ConfigMap, discovery_handler_map: RegisteredDiscoveryHandlerMap, new_discovery_handler_sender: broadcast::Sender, ) -> Result<(), Box> { trace!("handle_config - something happened to a configuration"); match event { - WatchEvent::Added(config) => { + Event::Applied(config) => { info!( - "handle_config - added Configuration {:?}", - config.metadata.name + "handle_config - applied Configuration {:?}", + config.metadata.name, ); + // Applied events can either be newly added Configurations or modified Configurations. + // If modified delete all associated instances and device plugins and then recreate them to reflect updated config + // TODO: more gracefully handle modified Configurations by determining what changed rather than delete/re-add + if config_map + .lock() + .await + .contains_key(config.metadata.name.as_ref().unwrap()) + { + handle_config_delete(kube_interface, &config, config_map.clone()).await?; + } + tokio::spawn(async move { handle_config_add( Arc::new(Box::new(k8s::KubeImpl::new().await.unwrap())), @@ -142,7 +150,7 @@ async fn handle_config( }); Ok(()) } - WatchEvent::Deleted(config) => { + Event::Deleted(config) => { info!( "handle_config - deleted Configuration {:?}", config.metadata.name, @@ -150,29 +158,10 @@ async fn handle_config( handle_config_delete(kube_interface, &config, config_map).await?; Ok(()) } - // If a config is updated, delete all associated instances and device plugins and then recreate them to reflect updated config - WatchEvent::Modified(config) => { - info!( - "handle_config - modified Configuration {:?}", - config.metadata.name, - ); - handle_config_delete(kube_interface, &config, config_map.clone()).await?; - tokio::spawn(async move { - handle_config_add( - Arc::new(Box::new(k8s::KubeImpl::new().await.unwrap())), - &config, - config_map, - discovery_handler_map, - new_discovery_handler_sender, - ) - .await - .unwrap(); - }); - Ok(()) - } - WatchEvent::Error(ref e) => { - error!("handle_config - error for Configuration: {}", e); - Ok(()) + Event::Restarted(_configs) => { + // TODO: determine whether this can be handled. For now, bubble up error to restart controller. + // TODO: use anyhow! + None.ok_or("Configuration watcher restarted due to watch stream dropping")? } } } @@ -322,7 +311,7 @@ mod config_action_tests { let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = fs::read_to_string(path_to_config).expect("Unable to read file"); let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); - let config_name = config.metadata.name.clone(); + let config_name = config.metadata.name.clone().unwrap(); let mut list_and_watch_message_receivers = Vec::new(); let mut visible_discovery_results = Vec::new(); let mut mock = MockKubeInterface::new(); @@ -334,7 +323,7 @@ mod config_action_tests { ) .await; let (stop_discovery_sender, mut stop_discovery_receiver) = broadcast::channel(2); - let (mut finished_discovery_sender, finished_discovery_receiver) = mpsc::channel(2); + let (finished_discovery_sender, finished_discovery_receiver) = mpsc::channel(2); let mut map: HashMap = HashMap::new(); map.insert( config_name.clone(), @@ -409,10 +398,11 @@ mod config_action_tests { }); // Loop until the Configuration and single discovered Instance are added to the ConfigMap + let config_name = config.metadata.name.unwrap(); let mut x: i8 = 0; while x < 5 { tokio::time::sleep(std::time::Duration::from_millis(200)).await; - if let Some(config_info) = config_map.lock().await.get(&config.metadata.name) { + if let Some(config_info) = config_map.lock().await.get(&config_name) { if config_info.instance_map.lock().await.len() == 1 { break; } @@ -493,7 +483,7 @@ mod config_action_tests { let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = fs::read_to_string(path_to_config).expect("Unable to read file"); let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); - let config_name = config.metadata.name.clone(); + let config_name = config.metadata.name.clone().unwrap(); let config_map: ConfigMap = Arc::new(Mutex::new(HashMap::new())); let first_add_handle = run_and_test_handle_config_add( discovery_handler_map.clone(), diff --git a/agent/src/util/device_plugin_builder.rs b/agent/src/util/device_plugin_builder.rs index 9c43cefb0..dc3f75d78 100644 --- a/agent/src/util/device_plugin_builder.rs +++ b/agent/src/util/device_plugin_builder.rs @@ -13,7 +13,6 @@ use akri_shared::{ uds::unix_stream, }; use async_trait::async_trait; -use futures::stream::TryStreamExt; use futures::TryFutureExt; use log::{info, trace}; #[cfg(test)] @@ -174,7 +173,7 @@ impl DevicePluginBuilderInterface for DevicePluginBuilder { capability_id: &str, socket_name: &str, instance_name: &str, - mut server_ender_sender: mpsc::Sender<()>, + server_ender_sender: mpsc::Sender<()>, kubelet_socket: &str, ) -> Result<(), Box> { info!( @@ -288,7 +287,8 @@ pub mod tests { async fn test_register() { let device_plugins_dirs = Builder::new().prefix("device-plugins").tempdir().unwrap(); let kubelet_socket = device_plugins_dirs.path().join("kubelet.sock"); - let kubelet_socket_str = kubelet_socket.clone().to_str().unwrap(); + let kubelet_socket_clone = kubelet_socket.clone(); + let kubelet_socket_str = kubelet_socket_clone.to_str().unwrap(); // Start kubelet registration server let registration = MockRegistration { @@ -325,7 +325,8 @@ pub mod tests { let (server_ender_sender, mut server_ender_receiver) = mpsc::channel(1); let device_plugins_dirs = Builder::new().prefix("device-plugins").tempdir().unwrap(); let kubelet_socket = device_plugins_dirs.path().join("kubelet.sock"); - let kubelet_socket_str = kubelet_socket.clone().to_str().unwrap(); + let kubelet_socket_clone = kubelet_socket.clone(); + let kubelet_socket_str = kubelet_socket_clone.to_str().unwrap(); // Try to register when no registration service exists assert!(device_plugin_builder @@ -340,8 +341,6 @@ pub mod tests { .is_err()); // Start kubelet registration server - let mut uds = - UnixListener::bind(kubelet_socket.clone()).expect("Failed to bind to socket path"); let registration = MockRegistration { return_error: true }; let service = RegistrationServer::new(registration); task::spawn(async move { diff --git a/agent/src/util/device_plugin_service.rs b/agent/src/util/device_plugin_service.rs index 97bb91e3f..38bba7126 100644 --- a/agent/src/util/device_plugin_service.rs +++ b/agent/src/util/device_plugin_service.rs @@ -18,30 +18,18 @@ use akri_shared::{ k8s, k8s::KubeInterface, }; -use futures::{Stream, TryFutureExt}; +use futures::Stream; use log::{error, info, trace}; #[cfg(test)] use mock_instant::Instant; #[cfg(not(test))] use std::time::Instant; -use std::{ - collections::HashMap, - convert::TryFrom, - env, - path::Path, - pin::Pin, - sync::Arc, - time::{Duration, SystemTime, UNIX_EPOCH}, -}; +use std::{collections::HashMap, pin::Pin, sync::Arc, time::Duration}; use tokio::{ sync::{broadcast, mpsc, Mutex}, - task, - time::{sleep, timeout}, -}; -use tonic::{ - transport::{Endpoint, Server, Uri}, - Code, Request, Response, Status, + time::timeout, }; +use tonic::{Code, Request, Response, Status}; /// Message sent in channel to `list_and_watch`. /// Dictates what action `list_and_watch` should take upon being awoken. @@ -151,7 +139,7 @@ impl DevicePlugin for DevicePluginService { let mut list_and_watch_message_receiver = self.list_and_watch_message_sender.subscribe(); // Create a channel that list_and_watch can periodically send updates to kubelet on - let (mut kubelet_update_sender, kubelet_update_receiver) = + let (kubelet_update_sender, kubelet_update_receiver) = mpsc::channel(KUBELET_UPDATE_CHANNEL_CAPACITY); // Spawn thread so can send kubelet the receiving end of the channel to listen on tokio::spawn(async move { @@ -850,8 +838,8 @@ mod device_plugin_service_tests { let kube_akri_config_yaml = fs::read_to_string(path_to_config).expect("Unable to read file"); let kube_akri_config: Configuration = serde_yaml::from_str(&kube_akri_config_yaml).unwrap(); - let device_instance_name = - get_device_instance_name("b494b6", &kube_akri_config.metadata.name); + let config_name = kube_akri_config.metadata.name.as_ref().unwrap(); + let device_instance_name = get_device_instance_name("b494b6", config_name); let unique_time = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH); let device_endpoint: String = format!( "{}-{}.sock", @@ -883,7 +871,7 @@ mod device_plugin_service_tests { instance_name: device_instance_name, endpoint: device_endpoint, config: kube_akri_config.spec.clone(), - config_name: kube_akri_config.metadata.name, + config_name: config_name.to_string(), config_uid: kube_akri_config.metadata.uid.unwrap(), config_namespace: kube_akri_config.metadata.namespace.unwrap(), shared: false, @@ -918,7 +906,7 @@ mod device_plugin_service_tests { fn get_kube_not_found_error() -> kube::Error { // Mock error thrown when instance not found - kube::Error::Api(kube::ErrorResponse { + kube::Error::Api(kube::error::ErrorResponse { status: "Failure".to_string(), message: "instances.akri.sh \"akri-blah-901a7b\" not found".to_string(), reason: "NotFound".to_string(), @@ -1000,7 +988,7 @@ mod device_plugin_service_tests { .withf(move |name: &str, namespace: &str| { namespace == config_namespace && name == instance_name }) - .returning(move |_, _| Err(get_kube_not_found_error())); + .returning(move |_, _| Err(get_kube_not_found_error().into())); let instance_name = device_plugin_service.instance_name.clone(); let config_namespace = device_plugin_service.config_namespace.clone(); mock.expect_create_instance() @@ -1114,7 +1102,7 @@ mod device_plugin_service_tests { }) .returning(move |_, _| { let error = Error::new(ErrorKind::InvalidInput, "Configuration doesn't exist"); - Err(Box::new(error)) + Err(error.into()) }); assert!( try_create_instance(Arc::new(device_plugin_service), Arc::new(mock)) @@ -1144,7 +1132,7 @@ mod device_plugin_service_tests { .withf(move |name: &str, namespace: &str| { namespace == config_namespace && name == instance_name }) - .returning(move |_, _| Err(get_kube_not_found_error())); + .returning(move |_, _| Err(get_kube_not_found_error().into())); let instance_name = device_plugin_service.instance_name.clone(); let config_namespace = device_plugin_service.config_namespace.clone(); mock.expect_create_instance() @@ -1156,7 +1144,7 @@ mod device_plugin_service_tests { && owner_name == config_name && owner_uid == config_uid }) - .returning(move |_, _, _, _, _| Err(None.ok_or("failure")?)); + .returning(move |_, _, _, _, _| Err(anyhow::anyhow!("failure"))); let dps = Arc::new(device_plugin_service); assert!(try_create_instance(dps.clone(), Arc::new(mock)) @@ -1305,7 +1293,7 @@ mod device_plugin_service_tests { .withf(move |name: &str, namespace: &str| { namespace == instance_namespace && name == instance_name }) - .returning(move |_, _| Err(get_kube_not_found_error())); + .returning(move |_, _| Err(get_kube_not_found_error().into())); let devices = build_list_and_watch_response(Arc::new(device_plugin_service), Arc::new(mock)) .await diff --git a/agent/src/util/discovery_operator.rs b/agent/src/util/discovery_operator.rs index c081b7082..668ef3036 100644 --- a/agent/src/util/discovery_operator.rs +++ b/agent/src/util/discovery_operator.rs @@ -895,7 +895,7 @@ pub mod tests { discovery_results, list_and_watch_message_receivers, connectivity_status, - &config.metadata.name, + config.metadata.name.as_ref().unwrap(), ) } @@ -1231,7 +1231,7 @@ pub mod tests { let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = std::fs::read_to_string(path_to_config).expect("Unable to read file"); let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); - let config_name = config.metadata.name.clone(); + let config_name = config.metadata.name.clone().unwrap(); INSTANCE_COUNT_METRIC .with_label_values(&[&config_name, "true"]) .set(0); @@ -1291,7 +1291,7 @@ pub mod tests { for _x in 0..tries { println!("try number {}", _x); keep_looping = false; - tokio::time::delay_for(Duration::from_millis(100)).await; + tokio::time::sleep(Duration::from_millis(100)).await; let unwrapped_instance_map = instance_map.lock().await.clone(); if check_empty && unwrapped_instance_map.is_empty() { map_is_empty = true; @@ -1408,7 +1408,7 @@ pub mod tests { let path_to_config = "../test/yaml/config-a.yaml"; let config_yaml = std::fs::read_to_string(path_to_config).expect("Unable to read file"); let config: Configuration = serde_yaml::from_str(&config_yaml).unwrap(); - let config_name = config.metadata.name.clone(); + let config_name = config.metadata.name.clone().unwrap(); let mut list_and_watch_message_receivers = Vec::new(); let mut visible_discovery_results = Vec::new(); let discovery_handler_map: RegisteredDiscoveryHandlerMap = diff --git a/agent/src/util/registration.rs b/agent/src/util/registration.rs index 0b3bf99ff..dd6f47afc 100644 --- a/agent/src/util/registration.rs +++ b/agent/src/util/registration.rs @@ -6,10 +6,9 @@ use akri_discovery_utils::discovery::v0::{ registration_server::{Registration, RegistrationServer}, Empty, RegisterDiscoveryHandlerRequest, }; -use akri_shared::{ - os::env_var::{ActualEnvVarQuery, EnvVarQuery}, - uds::unix_stream, -}; +#[cfg(any(test, feature = "agent-full"))] +use akri_shared::os::env_var::{ActualEnvVarQuery, EnvVarQuery}; +use akri_shared::uds::unix_stream; use futures::TryFutureExt; #[cfg(test)] use mock_instant::Instant; diff --git a/agent/src/util/slot_reconciliation.rs b/agent/src/util/slot_reconciliation.rs index 02f9bb968..172f5ffce 100644 --- a/agent/src/util/slot_reconciliation.rs +++ b/agent/src/util/slot_reconciliation.rs @@ -140,6 +140,8 @@ impl DevicePluginSlotReconciler { .as_ref() .unwrap_or(&PodStatus::default()) .conditions + .as_ref() + .unwrap_or(&Vec::new()) .iter() .any(|condition| condition.type_ == "ContainersReady" && condition.status != "True") }); @@ -344,8 +346,8 @@ pub async fn periodic_slot_reconciliation( mod reconcile_tests { use super::*; use akri_shared::{akri::instance::KubeAkriInstanceList, k8s::MockKubeInterface, os::file}; - use k8s_openapi::api::core::v1::{PodSpec, PodStatus}; - use kube::api::{Object, ObjectList}; + use k8s_openapi::api::core::v1::Pod; + use kube::api::ObjectList; fn configure_get_node_slots(mock: &mut MockSlotQuery, result: HashSet, error: bool) { mock.expect_get_node_slots().times(1).returning(move || { @@ -376,8 +378,7 @@ mod reconcile_tests { .withf(move |s| s == selector) .returning(move |_| { let pods_json = file::read_file_to_string(result_file); - let pods: ObjectList> = - serde_json::from_str(&pods_json).unwrap(); + let pods: ObjectList = serde_json::from_str(&pods_json).unwrap(); Ok(pods) }); } diff --git a/controller/Cargo.toml b/controller/Cargo.toml index 0dd085b7d..d3058f98f 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -11,7 +11,7 @@ akri-shared = { path = "../shared" } async-std = "1.5.0" async-trait = "0.1.0" chrono = "0.4.10" -env_logger = "0.8.3" +env_logger = "0.9.0" futures = "0.3.1" anyhow = "1.0.38" kube = { version = "0.59.0", features = ["derive"] } @@ -27,4 +27,4 @@ serde_yaml = "0.8.11" tokio = { version = "1.0.2", features = ["full"] } [dev-dependencies] -mockall = "0.9.0" +mockall = "0.10.2" diff --git a/controller/src/util/instance_action.rs b/controller/src/util/instance_action.rs index 28634a7eb..316e617f2 100644 --- a/controller/src/util/instance_action.rs +++ b/controller/src/util/instance_action.rs @@ -1,10 +1,7 @@ use super::super::BROKER_POD_COUNT_METRIC; use super::{pod_action::PodAction, pod_action::PodActionInfo}; use akri_shared::{ - akri::{ - configuration::Configuration, instance::Instance, AKRI_PREFIX, API_INSTANCES, - API_NAMESPACE, API_VERSION, - }, + akri::{configuration::Configuration, instance::Instance, AKRI_PREFIX}, k8s, k8s::{ pod, @@ -15,7 +12,8 @@ use akri_shared::{ use async_std::sync::Mutex; use futures::{StreamExt, TryStreamExt}; use k8s_openapi::api::core::v1::Pod; -use kube::api::{Api, ListParams, Object, WatchEvent}; +use kube::api::{Api, ListParams}; +use kube_runtime::watcher::{watcher, Event}; use log::{error, info, trace}; use std::collections::HashMap; use std::sync::Arc; @@ -80,40 +78,40 @@ async fn internal_do_instance_watch( kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("internal_do_instance_watch - enter"); - let instances_api = Api::::all(kube_interface.get_kube_client()); - loop { - let mut stream = instances_api.watch(&ListParams::default(), API_VERSION).await?.boxed(); - - // Currently, this does not handle None except to break the - // while. - while let Some(status) = stream.try_next().await? { - // Aquire lock to ensure cleanup_instance_and_configuration_svcs and the - // inner loop handle_instance call in internal_do_instance_watch - // cannot execute at the same time. - let _lock = synchronization.lock().await; - trace!("internal_do_instance_watch - aquired sync lock"); - handle_instance(status, kube_interface).await?; - } + let resource = Api::::all(kube_interface.get_kube_client()); + let watcher = watcher(resource, ListParams::default()); + let mut informer = watcher.boxed(); + // Currently, this does not handle None except to break the + // while. + while let Some(event) = informer.try_next().await? { + // Aquire lock to ensure cleanup_instance_and_configuration_svcs and the + // inner loop handle_instance call in internal_do_instance_watch + // cannot execute at the same time. + let _lock = synchronization.lock().await; + trace!("internal_do_instance_watch - aquired sync lock"); + handle_instance(event, kube_interface).await?; } + Ok(()) } /// This takes an event off the Instance stream and delegates it to the /// correct function based on the event type. async fn handle_instance( - event: WatchEvent, + event: Event, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_instance - enter"); match event { - WatchEvent::Added(instance) => { + Event::Applied(instance) => { info!( - "handle_instance - added Akri Instance {:?}: {:?}", + "handle_instance - added or modified Akri Instance {:?}: {:?}", instance.metadata.name, instance.spec ); + // TODO: rename `InstanceAction::Add` to reflect that this could also be an Update event. handle_instance_change(&instance, &InstanceAction::Add, kube_interface).await?; Ok(()) } - WatchEvent::Deleted(instance) => { + Event::Deleted(instance) => { info!( "handle_instance - deleted Akri Instance {:?}: {:?}", instance.metadata.name, instance.spec @@ -121,17 +119,10 @@ async fn handle_instance( handle_instance_change(&instance, &InstanceAction::Remove, kube_interface).await?; Ok(()) } - WatchEvent::Modified(instance) => { - info!( - "handle_instance - modified Akri Instance {:?}: {:?}", - instance.metadata.name, instance.spec - ); - handle_instance_change(&instance, &InstanceAction::Update, kube_interface).await?; - Ok(()) - } - WatchEvent::Error(ref e) => { - trace!("handle_instance - error for Akri Instance: {}", e); - Ok(()) + Event::Restarted(_instances) => { + // TODO: determine whether this can be handled. For now, bubble up error to restart controller. + // TODO: use anyhow! + None.ok_or("Instance watcher restarted due to watch stream dropping")? } } } @@ -178,11 +169,18 @@ fn determine_action_for_pod( // Early exits above ensure unwrap will not panic let pod_phase = k8s_pod.status.as_ref().unwrap().phase.as_ref().unwrap(); - let labels = k8s_pod.metadata.labels.as_ref().or(Some(&std::collections::BTreeMap::new())).unwrap(); - if labels - .get(AKRI_TARGET_NODE_LABEL_NAME) - .is_none() - { + let labels = match &k8s_pod.metadata.labels { + Some(labels) => labels, + None => { + error!( + "determine_action_for_pod - no {} label found for {:?}", + AKRI_TARGET_NODE_LABEL_NAME, &k8s_pod.metadata.name + ); + return; + } + }; + + if labels.get(AKRI_TARGET_NODE_LABEL_NAME).is_none() { error!( "determine_action_for_pod - no {} label found for {:?}", AKRI_TARGET_NODE_LABEL_NAME, &k8s_pod.metadata.name @@ -191,14 +189,9 @@ fn determine_action_for_pod( } // Early exits above ensure unwrap will not panic - let node_to_run_pod_on = labels - .get(AKRI_TARGET_NODE_LABEL_NAME) - .unwrap(); + let node_to_run_pod_on = labels.get(AKRI_TARGET_NODE_LABEL_NAME).unwrap(); - if labels - .get(AKRI_INSTANCE_LABEL_NAME) - .is_none() - { + if labels.get(AKRI_INSTANCE_LABEL_NAME).is_none() { error!( "determine_action_for_pod - no {} label found for {:?}", AKRI_INSTANCE_LABEL_NAME, &k8s_pod.metadata.name @@ -780,9 +773,9 @@ mod handle_instance_tests { let instance: Instance = serde_json::from_str(&instance_json).unwrap(); handle_instance( match action { - InstanceAction::Add => WatchEvent::Added(instance), - InstanceAction::Update => WatchEvent::Modified(instance), - InstanceAction::Remove => WatchEvent::Deleted(instance), + InstanceAction::Add => Event::Applied(instance), + InstanceAction::Update => Event::Applied(instance), + InstanceAction::Remove => Event::Deleted(instance), }, mock, ) diff --git a/controller/src/util/node_watcher.rs b/controller/src/util/node_watcher.rs index 772976361..3c3a4c5ea 100644 --- a/controller/src/util/node_watcher.rs +++ b/controller/src/util/node_watcher.rs @@ -1,15 +1,15 @@ use akri_shared::{ akri::{ instance::{Instance, InstanceSpec}, - NODE_VERSION, retry::{random_delay, MAX_INSTANCE_UPDATE_TRIES}, }, k8s, k8s::KubeInterface, }; -use futures::StreamExt; +use futures::{StreamExt, TryStreamExt}; use k8s_openapi::api::core::v1::{Node, NodeStatus}; -use kube::api::{Api, ListParams, WatchEvent}; +use kube::api::{Api, ListParams}; +use kube_runtime::watcher::{watcher, Event}; use log::trace; use std::collections::HashMap; @@ -54,17 +54,16 @@ impl NodeWatcher { ) -> Result<(), Box> { trace!("watch - enter"); let kube_interface = k8s::KubeImpl::new().await?; - let nodes_api = Api::::all(kube_interface.get_kube_client()); - - loop { - let mut nodes = nodes_api.watch(&ListParams::default(), NODE_VERSION).await?.boxed(); - - // Currently, this does not handle None except to break the - // while. - while let Some(event) = nodes.next().await { - self.handle_node(event?, &kube_interface).await?; - } + let resource = Api::::all(kube_interface.get_kube_client()); + let watcher = watcher(resource, ListParams::default()); + let mut informer = watcher.boxed(); + // Currently, this does not handle None except to break the + // while. + while let Some(event) = informer.try_next().await? { + self.handle_node(event, &kube_interface).await?; } + + Ok(()) } /// This takes an event off the Node stream and if a Node is no longer @@ -87,43 +86,40 @@ impl NodeWatcher { /// non-Running Node. async fn handle_node( &mut self, - event: WatchEvent, + event: Event, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_node - enter"); match event { - WatchEvent::Added(node) => { - trace!("handle_node - Added: {:?}", &node.metadata.name); + Event::Applied(node) => { + trace!("handle_node - Applied: {:?}", &node.metadata.name); if self.is_node_ready(&node) { self.known_nodes .insert(node.metadata.name.unwrap(), NodeState::Running); } else { - self.known_nodes - .insert(node.metadata.name.unwrap(), NodeState::Known); - } - } - WatchEvent::Modified(node) => { - trace!("handle_node - Modified: {:?}", &node.metadata.name); - trace!( - "handle_node - Modified with Node Status {:?} and NodeSpec: {:?}", - &node.status, - &node.spec - ); - if self.is_node_ready(&node) { - self.known_nodes - .insert(node.metadata.name.unwrap(), NodeState::Running); - } else { - self.call_handle_node_disappearance_if_needed(&node, kube_interface) - .await?; + // If Node is not Running, check if it was previously added and now terminated + match self.known_nodes.get(node.metadata.name.as_ref().unwrap()) { + Some(_previous_node) => { + self.call_handle_node_disappearance_if_needed(&node, kube_interface) + .await?; + } + None => { + // New Node was added + self.known_nodes + .insert(node.metadata.name.unwrap(), NodeState::Known); + } + } } } - WatchEvent::Deleted(node) => { + Event::Deleted(node) => { trace!("handle_node - Deleted: {:?}", &node.metadata.name); self.call_handle_node_disappearance_if_needed(&node, kube_interface) .await?; } - WatchEvent::Error(e) => { - trace!("handle_node - error for Node: {}", e); + Event::Restarted(_nodes) => { + // TODO: determine whether this can be handled. For now, bubble up error to restart controller. + // TODO: use anyhow! + None.ok_or("Node watcher restarted due to watch stream dropping")? } }; Ok(()) @@ -176,7 +172,8 @@ impl NodeWatcher { .as_ref() .unwrap_or(&NodeStatus::default()) .conditions - .unwrap() + .as_ref() + .unwrap_or(&Vec::new()) .iter() .filter_map(|condition| { if condition.type_ == "Ready" { @@ -211,10 +208,15 @@ impl NodeWatcher { ); for instance in instances.items { let instance_name = instance.metadata.name.clone().unwrap(); - let instance_namespace = instance.metadata.namespace.as_ref().ok_or(anyhow::Error::msg(format!( - "Namespace not found for instance: {:?}", - instance_name - )))?; + let instance_namespace = + instance + .metadata + .namespace + .as_ref() + .ok_or(anyhow::Error::msg(format!( + "Namespace not found for instance: {:?}", + instance_name + )))?; trace!( "handle_node_disappearance - make sure node is not referenced here: {:?}", @@ -369,7 +371,7 @@ mod tests { let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); node_watcher - .handle_node(WatchEvent::Added(node), &MockKubeInterface::new()) + .handle_node(Event::Applied(node), &MockKubeInterface::new()) .await .unwrap(); @@ -389,7 +391,7 @@ mod tests { let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); node_watcher - .handle_node(WatchEvent::Added(node), &MockKubeInterface::new()) + .handle_node(Event::Applied(node), &MockKubeInterface::new()) .await .unwrap(); @@ -408,6 +410,10 @@ mod tests { let node_json = file::read_file_to_string("../test/json/node-b-not-ready.json"); let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); + // Add Node to known_nodes with original Running state + node_watcher + .known_nodes + .insert("node-b".to_string(), NodeState::Running); let instance_file = "../test/json/shared-instance-update.json"; let instance_json = file::read_file_to_string(instance_file); @@ -433,7 +439,7 @@ mod tests { ); node_watcher - .handle_node(WatchEvent::Modified(node), &mock) + .handle_node(Event::Applied(node), &mock) .await .unwrap(); @@ -455,7 +461,7 @@ mod tests { let mock = MockKubeInterface::new(); node_watcher - .handle_node(WatchEvent::Modified(node), &mock) + .handle_node(Event::Applied(node), &mock) .await .unwrap(); @@ -499,7 +505,7 @@ mod tests { ); node_watcher - .handle_node(WatchEvent::Deleted(node), &mock) + .handle_node(Event::Deleted(node), &mock) .await .unwrap(); @@ -623,8 +629,7 @@ mod tests { ); let node_json = file::read_file_to_string(node_file); - let kube_object_node: Node = - serde_json::from_str(&node_json).unwrap(); + let kube_object_node: Node = serde_json::from_str(&node_json).unwrap(); let node_watcher = NodeWatcher::new(); assert_eq!( diff --git a/controller/src/util/pod_watcher.rs b/controller/src/util/pod_watcher.rs index bf6829069..605071636 100644 --- a/controller/src/util/pod_watcher.rs +++ b/controller/src/util/pod_watcher.rs @@ -14,7 +14,7 @@ use akri_shared::{ use async_std::sync::Mutex; use futures::{StreamExt, TryStreamExt}; use k8s_openapi::api::core::v1::{Pod, ServiceSpec}; -use kube::api::{Api, ListParams, WatchEvent}; +use kube::api::{Api, ListParams}; use kube_runtime::watcher::{watcher, Event}; use log::trace; use std::{collections::HashMap, sync::Arc}; @@ -82,18 +82,19 @@ impl BrokerPodWatcher { trace!("watch - enter"); let kube_interface = k8s::KubeImpl::new().await?; let resource = Api::::all(kube_interface.get_kube_client()); - let watcher = watcher(resource, ListParams::default().labels(AKRI_TARGET_NODE_LABEL_NAME)); + let watcher = watcher( + resource, + ListParams::default().labels(AKRI_TARGET_NODE_LABEL_NAME), + ); let mut informer = watcher.boxed(); let synchronization = Arc::new(Mutex::new(())); - - loop { - // Currently, this does not handle None except to break the - // while. - while let Some(event) = informer.try_next().await? { - let _lock = synchronization.lock().await; - self.handle_pod(event, &kube_interface).await?; - } + // Currently, this does not handle None except to break the + // while. + while let Some(event) = informer.try_next().await? { + let _lock = synchronization.lock().await; + self.handle_pod(event, &kube_interface).await?; } + Ok(()) } /// Gets Pods phase and returns "Unknown" if no phase exists @@ -127,8 +128,13 @@ impl BrokerPodWatcher { trace!("handle_pod - pod phase {:?}", &phase); match phase.as_str() { "Unknown" | "Pending" => { - self.known_pods - .insert(pod.metadata.name.clone().ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?, PodState::Pending); + self.known_pods.insert( + pod.metadata + .name + .clone() + .ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?, + PodState::Pending, + ); } "Running" => { self.handle_running_pod_if_needed(&pod, kube_interface) @@ -148,8 +154,12 @@ impl BrokerPodWatcher { self.handle_deleted_pod_if_needed(&pod, kube_interface) .await?; } - Event::Restarted(pods) => { - trace!("handle_pod - pod watcher restarted. Pods are : {:?}", pods); + Event::Restarted(_pods) => { + // TODO: determine whether this can be handled by looking through `pods` which is the list of + // previously `Applied` events and reconciling. Also, would need to handle missed `Deleted` events. + // For now, bubble up error to restart controller. + // TODO: use anyhow! + None.ok_or("Pod watcher restarted due to watch stream dropping")?; } }; Ok(()) @@ -163,8 +173,11 @@ impl BrokerPodWatcher { kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_running_pod_if_needed - enter"); - let pod_name = pod.metadata.name.clone().ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; - // map_err(|_| anyhow::format_err!("could not parse url"))? + let pod_name = pod + .metadata + .name + .clone() + .ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending); trace!( "handle_running_pod_if_needed - last_known_state: {:?}", @@ -190,7 +203,11 @@ impl BrokerPodWatcher { kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_ended_pod_if_needed - enter"); - let pod_name = pod.metadata.name.clone().ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; + let pod_name = pod + .metadata + .name + .clone() + .ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending); trace!( "handle_ended_pod_if_needed - last_known_state: {:?}", @@ -216,7 +233,11 @@ impl BrokerPodWatcher { kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_deleted_pod_if_needed - enter"); - let pod_name = pod.metadata.name.clone().ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; + let pod_name = pod + .metadata + .name + .clone() + .ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending); trace!( "handle_deleted_pod_if_needed - last_known_state: {:?}", @@ -239,7 +260,11 @@ impl BrokerPodWatcher { pod: &Pod, ) -> Result<(String, String), Box> { trace!("get_instance_and_configuration_from_pod - enter"); - let labels = pod.metadata.labels.as_ref().ok_or("Pod doesn't have labels")?; + let labels = pod + .metadata + .labels + .as_ref() + .ok_or("Pod doesn't have labels")?; let instance_id = labels .get(AKRI_INSTANCE_LABEL_NAME) .ok_or("No configuration name found.")?; @@ -464,7 +489,14 @@ impl BrokerPodWatcher { { for existing_svc in existing_svcs { let mut existing_svc = existing_svc.clone(); - let svc_name = existing_svc.metadata.name.clone().ok_or(anyhow::format_err!("Service {:?} does not have name", existing_svc))?; + let svc_name = existing_svc + .metadata + .name + .clone() + .ok_or(anyhow::format_err!( + "Service {:?} does not have name", + existing_svc + ))?; let svc_namespace = existing_svc.metadata.namespace.as_ref().unwrap().clone(); trace!( "create_or_update_service - Update existing svc={:?}", @@ -596,7 +628,6 @@ mod tests { use super::super::shared_test_utils::config_for_tests::PodList; use super::*; use akri_shared::{k8s::MockKubeInterface, os::file}; - use kube::error::ErrorResponse; fn create_pods_with_phase(result_file: &'static str, specified_phase: &'static str) -> PodList { let pods_json = file::read_file_to_string(result_file); @@ -611,22 +642,12 @@ mod tests { #[tokio::test] async fn test_handle_pod_error() { let _ = env_logger::builder().is_test(true).try_init(); - let mut pod_watcher = BrokerPodWatcher::new(); trace!("test_handle_pod_error WatchEvent::Error"); - pod_watcher - .handle_pod( - WatchEvent::Error(ErrorResponse { - status: "status".to_string(), - message: "message".to_string(), - reason: "reason".to_string(), - code: 0, - }), - &MockKubeInterface::new(), - ) + assert!(pod_watcher + .handle_pod(Event::Restarted(Vec::new()), &MockKubeInterface::new(),) .await - .unwrap(); - trace!("test_handle_pod_error pod_watcher:{:?}", &pod_watcher); + .is_err()); assert_eq!(0, pod_watcher.known_pods.len()); } @@ -646,7 +667,7 @@ mod tests { &phase ); pod_watcher - .handle_pod(WatchEvent::Added(pod), &MockKubeInterface::new()) + .handle_pod(Event::Applied(pod), &MockKubeInterface::new()) .await .unwrap(); trace!( @@ -680,7 +701,7 @@ mod tests { &phase ); pod_watcher - .handle_pod(WatchEvent::Modified(pod), &MockKubeInterface::new()) + .handle_pod(Event::Applied(pod), &MockKubeInterface::new()) .await .unwrap(); trace!( @@ -739,7 +760,7 @@ mod tests { ); pod_watcher - .handle_pod(WatchEvent::Modified(pod), &mock) + .handle_pod(Event::Applied(pod), &mock) .await .unwrap(); trace!( @@ -797,7 +818,7 @@ mod tests { ); pod_watcher - .handle_pod(WatchEvent::Modified(pod), &mock) + .handle_pod(Event::Applied(pod), &mock) .await .unwrap(); trace!( @@ -859,7 +880,7 @@ mod tests { ); pod_watcher - .handle_pod(WatchEvent::Modified(pod), &mock) + .handle_pod(Event::Applied(pod), &mock) .await .unwrap(); trace!( @@ -921,7 +942,7 @@ mod tests { ); pod_watcher - .handle_pod(WatchEvent::Deleted(pod), &mock) + .handle_pod(Event::Deleted(pod), &mock) .await .unwrap(); trace!( @@ -955,7 +976,7 @@ mod tests { &phase ); pod_watcher - .handle_pod(WatchEvent::Added(pod), &MockKubeInterface::new()) + .handle_pod(Event::Applied(pod), &MockKubeInterface::new()) .await .unwrap(); trace!( @@ -976,7 +997,7 @@ mod tests { &phase ); pod_watcher - .handle_pod(WatchEvent::Modified(pod), &MockKubeInterface::new()) + .handle_pod(Event::Applied(pod), &MockKubeInterface::new()) .await .unwrap(); trace!( @@ -1125,6 +1146,8 @@ mod tests { instanceless_pod .metadata .labels + .as_mut() + .unwrap() .remove(AKRI_INSTANCE_LABEL_NAME); assert!(pod_watcher .get_instance_and_configuration_from_pod(&instanceless_pod) @@ -1134,6 +1157,8 @@ mod tests { configurationless_pod .metadata .labels + .as_mut() + .unwrap() .remove(AKRI_CONFIGURATION_LABEL_NAME); assert!(pod_watcher .get_instance_and_configuration_from_pod(&configurationless_pod) @@ -1285,7 +1310,7 @@ mod tests { false, ); mock.expect_create_service() - .returning(move |_, _| Err(None.ok_or("failure")?)); + .returning(move |_, _| Err(anyhow::anyhow!("Failure"))); let ownership = OwnershipInfo::new( OwnershipType::Instance, diff --git a/controller/src/util/shared_test_utils.rs b/controller/src/util/shared_test_utils.rs index 1fe4e7996..a7b5a62b8 100644 --- a/controller/src/util/shared_test_utils.rs +++ b/controller/src/util/shared_test_utils.rs @@ -29,12 +29,14 @@ pub mod config_for_tests { .returning(move |_, _| { if result_error { // Return error that instance could not be found - Err(anyhow::anyhow!(kube::Error::Api(kube::error::ErrorResponse { - status: "Failure".to_string(), - message: "instances.akri.sh \"akri-blah-901a7b\" not found".to_string(), - reason: "NotFound".to_string(), - code: akri_shared::k8s::ERROR_NOT_FOUND, - }))) + Err(anyhow::anyhow!(kube::Error::Api( + kube::error::ErrorResponse { + status: "Failure".to_string(), + message: "instances.akri.sh \"akri-blah-901a7b\" not found".to_string(), + reason: "NotFound".to_string(), + code: akri_shared::k8s::ERROR_NOT_FOUND, + } + ))) } else { let dci_json = file::read_file_to_string(result_file); let dci: Instance = serde_json::from_str(&dci_json).unwrap(); @@ -165,15 +167,12 @@ pub mod config_for_tests { ); mock.expect_create_service() .withf(move |svc_to_create, ns| { - svc_to_create - .metadata - .name - .as_ref() - .unwrap() - == svc_name + svc_to_create.metadata.name.as_ref().unwrap() == svc_name && svc_to_create .metadata .labels + .as_ref() + .unwrap() .get(label_id) .unwrap() == label_value @@ -259,15 +258,12 @@ pub mod config_for_tests { mock.expect_create_pod() .times(1) .withf(move |pod_to_create, namespace| { - pod_to_create - .metadata - .name - .as_ref() - .unwrap() - == pod_name + pod_to_create.metadata.name.as_ref().unwrap() == pod_name && pod_to_create .metadata .labels + .as_ref() + .unwrap() .get(label_id) .unwrap() == label_value diff --git a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml index 080f00c45..df3fc51e5 100644 --- a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml @@ -9,6 +9,6 @@ edition = "2018" [dependencies] akri-discovery-utils = { path = "../../discovery-utils" } akri-debug-echo = { path = "../../discovery-handlers/debug-echo" } -env_logger = "0.8.3" +env_logger = "0.9.0" log = "0.4" -tokio = { version = "1.0" } +tokio = { version = "1.0.1" } diff --git a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml index 37c08c27c..d1f76f1e7 100644 --- a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml @@ -9,6 +9,6 @@ edition = "2018" [dependencies] akri-discovery-utils = { path = "../../discovery-utils" } akri-onvif = { path = "../../discovery-handlers/onvif" } -env_logger = "0.8.3" +env_logger = "0.9.0" log = "0.4" -tokio = { version = "1.0" } \ No newline at end of file +tokio = { version = "1.0.1" } \ No newline at end of file diff --git a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml index 877584eb5..5ccfe6e95 100644 --- a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml @@ -9,6 +9,6 @@ edition = "2018" [dependencies] akri-discovery-utils = { path = "../../discovery-utils" } akri-opcua = { path = "../../discovery-handlers/opcua" } -env_logger = "0.8.3" +env_logger = "0.9.0" log = "0.4" -tokio = { version = "1.0" } \ No newline at end of file +tokio = { version = "1.0.1" } \ No newline at end of file diff --git a/discovery-handler-modules/udev-discovery-handler/Cargo.toml b/discovery-handler-modules/udev-discovery-handler/Cargo.toml index 242d9ec9a..af71970b6 100644 --- a/discovery-handler-modules/udev-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/udev-discovery-handler/Cargo.toml @@ -9,6 +9,6 @@ edition = "2018" [dependencies] akri-discovery-utils = { path = "../../discovery-utils" } akri-udev = { path = "../../discovery-handlers/udev" } -env_logger = "0.8.3" +env_logger = "0.9.0" log = "0.4" -tokio = { version = "1.0" } +tokio = { version = "1.0.1" } diff --git a/discovery-handlers/debug-echo/Cargo.toml b/discovery-handlers/debug-echo/Cargo.toml index 95e370263..1542109e4 100644 --- a/discovery-handlers/debug-echo/Cargo.toml +++ b/discovery-handlers/debug-echo/Cargo.toml @@ -10,16 +10,16 @@ edition = "2018" akri-discovery-utils = { path = "../../discovery-utils" } anyhow = "1.0.38" async-trait = "0.1.0" -env_logger = "0.8.3" +env_logger = "0.9.0" futures-util = "0.3" log = "0.4" serde = "1.0.104" serde_json = "1.0.45" serde_yaml = "0.8.11" serde_derive = "1.0.104" -tokio = { version = "1.0", features = ["time", "net", "sync"] } +tokio = { version = "1.0.1", features = ["time", "net", "sync"] } tokio-stream = { version = "0.1", features = ["net"] } -tonic = { version = "0.4.0", features = ["tls"] } +tonic = { version = "0.5.2", features = ["tls"] } [dev-dependencies] akri-shared = { path = "../../shared" } \ No newline at end of file diff --git a/discovery-handlers/debug-echo/src/discovery_handler.rs b/discovery-handlers/debug-echo/src/discovery_handler.rs index 2c7e8fd54..b51aaa2c2 100644 --- a/discovery-handlers/debug-echo/src/discovery_handler.rs +++ b/discovery-handlers/debug-echo/src/discovery_handler.rs @@ -127,7 +127,9 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { sleep(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; } }); - Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new(discovered_devices_receiver))) + Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new( + discovered_devices_receiver, + ))) } } @@ -194,7 +196,8 @@ mod tests { .discover(discover_request) .await .unwrap() - .into_inner().into_inner(); + .into_inner() + .into_inner(); let devices = stream.recv().await.unwrap().unwrap().devices; assert_eq!(1, devices.len()); assert_eq!(devices[0], device); diff --git a/discovery-handlers/onvif/Cargo.toml b/discovery-handlers/onvif/Cargo.toml index f26229c89..a34a24e50 100644 --- a/discovery-handlers/onvif/Cargo.toml +++ b/discovery-handlers/onvif/Cargo.toml @@ -11,10 +11,10 @@ akri-discovery-utils = { path = "../../discovery-utils" } akri-shared = { path = "../../shared" } anyhow = "1.0.38" async-trait = "0.1.0" -bytes = "0.5" -env_logger = "0.8.3" +bytes = "1.0.1" +env_logger = "0.9.0" futures-util = "0.3" -hyper = { version = "0.13.5", package = "hyper" } +hyper = { version = "0.14.11", package = "hyper" } log = "0.4" serde = "1.0.104" serde_json = "1.0.45" @@ -24,11 +24,11 @@ sxd-document = "0.3.0" sxd-xpath = "0.4.0" tokio = { version = "1.0", features = ["time", "net", "sync"] } tokio-stream = { version = "0.1", features = ["net"] } -tonic = { version = "0.4.0", features = ["tls"] } +tonic = { version = "0.5.2", features = ["tls"] } uuid = { version = "0.8.1", features = ["v4"] } xml-rs = { version = "0.8.0" } -yaserde = "0.6.0" -yaserde_derive = "0.6.0" +yaserde = "0.7.1" +yaserde_derive = "0.7.1" [dev-dependencies] -mockall = "0.9.0" \ No newline at end of file +mockall = "0.10.2" \ No newline at end of file diff --git a/discovery-handlers/onvif/src/discovery_handler.rs b/discovery-handlers/onvif/src/discovery_handler.rs index 00bc10f1c..bd549a89c 100644 --- a/discovery-handlers/onvif/src/discovery_handler.rs +++ b/discovery-handlers/onvif/src/discovery_handler.rs @@ -67,7 +67,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { info!("discover - called for ONVIF protocol"); let register_sender = self.register_sender.clone(); let discover_request = request.get_ref(); - let (mut discovered_devices_sender, discovered_devices_receiver) = + let (discovered_devices_sender, discovered_devices_receiver) = mpsc::channel(DISCOVERED_DEVICES_CHANNEL_CAPACITY); let discovery_handler_config: OnvifDiscoveryDetails = deserialize_discovery_details(&discover_request.discovery_details) @@ -124,7 +124,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { "discover - for ONVIF failed to send discovery response with error {}", e ); - if let Some(mut sender) = register_sender { + if let Some(sender) = register_sender { sender.send(()).await.unwrap(); } break; @@ -133,7 +133,9 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { sleep(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; } }); - Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new(discovered_devices_receiver))) + Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new( + discovered_devices_receiver, + ))) } } diff --git a/discovery-handlers/opcua/Cargo.toml b/discovery-handlers/opcua/Cargo.toml index 65c6b9267..5b678c632 100644 --- a/discovery-handlers/opcua/Cargo.toml +++ b/discovery-handlers/opcua/Cargo.toml @@ -11,19 +11,19 @@ akri-discovery-utils = { path = "../../discovery-utils" } akri-shared = { path = "../../shared" } anyhow = "1.0.38" async-trait = "0.1.0" -env_logger = "0.8.3" +env_logger = "0.9.0" futures-util = "0.3" log = "0.4" opcua-client = "0.8.0" -prost = "0.6" +prost = "0.8.0" serde = "1.0.104" serde_json = "1.0.45" serde_yaml = "0.8.11" serde_derive = "1.0.1" -tokio = { version = "1.0", features = ["time", "net", "sync"] } +tokio = { version = "1.0.2", features = ["time", "net", "sync"] } tokio-stream = { version = "0.1", features = ["net"] } -tonic = { version = "0.4.0", features = ["tls"] } +tonic = { version = "0.5.2", features = ["tls"] } url = "2.2.0" [dev-dependencies] -mockall = "0.9.0" \ No newline at end of file +mockall = "0.10.2" \ No newline at end of file diff --git a/discovery-handlers/opcua/src/discovery_handler.rs b/discovery-handlers/opcua/src/discovery_handler.rs index 138dd741e..cc50e23a5 100644 --- a/discovery-handlers/opcua/src/discovery_handler.rs +++ b/discovery-handlers/opcua/src/discovery_handler.rs @@ -79,7 +79,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { info!("discover - called for OPC UA protocol"); let register_sender = self.register_sender.clone(); let discover_request = request.get_ref(); - let (mut discovered_devices_sender, discovered_devices_receiver) = + let (discovered_devices_sender, discovered_devices_receiver) = mpsc::channel(DISCOVERED_DEVICES_CHANNEL_CAPACITY); let discovery_handler_config: OpcuaDiscoveryDetails = deserialize_discovery_details(&discover_request.discovery_details) @@ -141,7 +141,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { "discover - for OPC UA failed to send discovery response with error {}", e ); - if let Some(mut sender) = register_sender { + if let Some(sender) = register_sender { sender.send(()).await.unwrap(); } break; @@ -150,7 +150,9 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { sleep(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; } }); - Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new(discovered_devices_receiver))) + Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new( + discovered_devices_receiver, + ))) } } diff --git a/discovery-handlers/udev/Cargo.toml b/discovery-handlers/udev/Cargo.toml index cc0315048..a82dc6765 100644 --- a/discovery-handlers/udev/Cargo.toml +++ b/discovery-handlers/udev/Cargo.toml @@ -10,12 +10,12 @@ edition = "2018" akri-discovery-utils = { path = "../../discovery-utils" } anyhow = "1.0.38" async-trait = "0.1.0" -env_logger = "0.8.3" +env_logger = "0.9.0" futures-util = "0.3" log = "0.4" pest = "2.0" pest_derive = "2.0" -prost = "0.6" +prost = "0.8.0" regex = "1" serde = "1.0.104" serde_json = "1.0.45" @@ -23,8 +23,8 @@ serde_yaml = "0.8.11" serde_derive = "1.0.104" tokio = { version = "1.0", features = ["time", "net", "sync"] } tokio-stream = { version = "0.1", features = ["net"] } -tonic = { version = "0.4.0", features = ["tls"] } +tonic = { version = "0.5.2", features = ["tls"] } udev = "0.5" [dev-dependencies] -mockall = "0.9.0" \ No newline at end of file +mockall = "0.10.2" \ No newline at end of file diff --git a/discovery-handlers/udev/src/discovery_handler.rs b/discovery-handlers/udev/src/discovery_handler.rs index c38293024..44cdb5451 100644 --- a/discovery-handlers/udev/src/discovery_handler.rs +++ b/discovery-handlers/udev/src/discovery_handler.rs @@ -121,7 +121,9 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { sleep(Duration::from_secs(DISCOVERY_INTERVAL_SECS)).await; } }); - Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new(discovered_devices_receiver))) + Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new( + discovered_devices_receiver, + ))) } } diff --git a/discovery-utils/Cargo.toml b/discovery-utils/Cargo.toml index f2d16f3ce..f3d764e25 100644 --- a/discovery-utils/Cargo.toml +++ b/discovery-utils/Cargo.toml @@ -13,15 +13,15 @@ anyhow = "1.0.38" async-trait = { version = "0.1.0", optional = true } futures = { version = "0.3.1", package = "futures" } log = "0.4" -prost = "0.7" +prost = "0.8" serde = "1.0" serde_derive = "1.0" serde_yaml = "0.8.11" tempfile = { version = "3.1.0", optional = true } -tokio = { version = "1.0", features = ["time", "net", "sync"] } +tokio = { version = "1.0.1", features = ["time", "net", "sync"] } tokio-stream = { version = "0.1", features = ["net"] } -tonic = { version = "0.4.0", features = ["tls"] } -tower = "0.4.4" +tonic = { version = "0.5.2", features = ["tls"] } +tower = "0.4.8" [features] mock-discovery-handler = ["async-trait", "tempfile"] @@ -31,4 +31,4 @@ async-trait = "0.1.0" tempfile = "3.1.0" [build-dependencies] -tonic-build = "0.4.0" \ No newline at end of file +tonic-build = "0.5.2" \ No newline at end of file diff --git a/samples/brokers/udev-video-broker/Cargo.toml b/samples/brokers/udev-video-broker/Cargo.toml index 067c5abc8..e45b2cf47 100644 --- a/samples/brokers/udev-video-broker/Cargo.toml +++ b/samples/brokers/udev-video-broker/Cargo.toml @@ -8,15 +8,14 @@ edition = "2018" [dependencies] akri-shared = { path = "../../../shared" } -env_logger = "0.8.3" -futures = { version = "0.1", package = "futures" } +env_logger = "0.9.0" lazy_static = "1.4" log = "0.4.3" prometheus = { version = "0.12.0", features = ["process"] } -prost = "0.6" -tokio = { version = "0.2", features = ["rt-threaded", "time", "stream", "fs", "macros", "uds"] } -tonic = "0.1" +prost = "0.8.0" +tokio = { version = "1.0.1", features = ["time", "fs", "macros", "signal"] } +tonic = "0.5.2" rscam = "0.5.5" [build-dependencies] -tonic-build = "0.1.1" \ No newline at end of file +tonic-build = "0.5.2" \ No newline at end of file diff --git a/samples/brokers/udev-video-broker/src/main.rs b/samples/brokers/udev-video-broker/src/main.rs index 529a550eb..407186b68 100644 --- a/samples/brokers/udev-video-broker/src/main.rs +++ b/samples/brokers/udev-video-broker/src/main.rs @@ -3,14 +3,11 @@ mod util; extern crate lazy_static; use akri_shared::{ akri::{metrics::run_metrics_server, API_NAMESPACE}, - os::{ - env_var::{ActualEnvVarQuery, EnvVarQuery}, - signal, - }, + os::env_var::{ActualEnvVarQuery, EnvVarQuery}, }; -use futures::Future; use log::{info, trace}; use prometheus::IntCounter; +use tokio::signal; use util::{camera_capturer, camera_service}; lazy_static! { @@ -36,13 +33,6 @@ async fn main() -> Result<(), Box run_metrics_server().await.unwrap(); }); - // Set up shutdown channel - let (exit_tx, exit_rx) = std::sync::mpsc::channel::<()>(); - let _shutdown_signal = signal::shutdown().then(|_| { - trace!("{} Udev Broker shutdown signal received", API_NAMESPACE); - exit_tx.send(()) - }); - let env_var_query = ActualEnvVarQuery {}; let devnode = get_video_devnode(&env_var_query); @@ -51,9 +41,9 @@ async fn main() -> Result<(), Box .await .unwrap(); - trace!("Waiting for shutdown signal"); - // wait for exit signal - exit_rx.recv().unwrap(); + trace!("Waiting for ctrl C shutdown signal"); + // Wait for exit signal + signal::ctrl_c().await?; trace!("Udev broker ending"); Ok(()) diff --git a/samples/brokers/udev-video-broker/src/util/camera_service.rs b/samples/brokers/udev-video-broker/src/util/camera_service.rs index 79e491678..88bf31a2b 100644 --- a/samples/brokers/udev-video-broker/src/util/camera_service.rs +++ b/samples/brokers/udev-video-broker/src/util/camera_service.rs @@ -98,7 +98,7 @@ pub async fn serve(devnode: &str, camera_capturer: RsCamera) -> Result<(), Strin } Err(e) => { trace!("Unable to connect to server, continue polling: {:?}", e); - tokio::time::delay_for(Duration::from_secs(1)).await; + tokio::time::sleep(Duration::from_secs(1)).await; false } }; diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 86cdbec09..f1bd46bf5 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -12,13 +12,13 @@ either = '*' anyhow = "1.0.38" futures = "0.3.1" futures-util = "0.3" -env_logger = "0.6.1" +env_logger = "0.9.0" hyper = { version = "0.14.2", package = "hyper" } kube = { version = "0.59.0", features = ["derive"] } kube-runtime = "0.59.0" k8s-openapi = { version = "0.13.0", default-features = false, features = ["schemars", "v1_16"] } log = "0.4" -mockall = "0.9.0" +mockall = "0.10.2" prometheus = { version = "0.11.0", features = ["process"] } rand = "0.8.3" schemars = "0.8.0" @@ -26,9 +26,9 @@ serde = "1.0" serde_derive = "1.0" serde_json = "1.0" serde_yaml = "0.8" -tokio = { version = "1.0.2", features = ["full"] } +tokio = { version = "1.0.1", features = ["full"] } +# TODO: is this needed? tokio-stream = { version = "0.1", features = ["net"] } -tonic = "0.4.0" -tower = "0.4.4" -# tokio-signal = "0.2" -warp = "0.2" +tonic = "0.5.2" +tower = "0.4.8" +warp = "0.3.1" diff --git a/shared/src/akri/configuration.rs b/shared/src/akri/configuration.rs index 83fd873ed..edb95884c 100644 --- a/shared/src/akri/configuration.rs +++ b/shared/src/akri/configuration.rs @@ -94,9 +94,7 @@ pub struct ConfigurationSpec { /// let dccs = configuration::get_configurations(&api_client).await.unwrap(); /// # } /// ``` -pub async fn get_configurations( - kube_client: &Client, -) -> Result { +pub async fn get_configurations(kube_client: &Client) -> Result { // TODO kagold: pass in namespace and use Api::namespaced let configurations_client: Api = Api::all(kube_client.clone()); let lp = ListParams::default(); @@ -148,7 +146,7 @@ pub async fn find_configuration( log::trace!("find_configuration getting instance with name {}", name); - match configurations_client.get(&name).await { + match configurations_client.get(name).await { Ok(configuration_retrieved) => { log::trace!("find_configuration return"); Ok(configuration_retrieved) diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs index 585479bf7..334b4f311 100644 --- a/shared/src/akri/instance.rs +++ b/shared/src/akri/instance.rs @@ -67,9 +67,7 @@ pub struct InstanceSpec { /// let instances = instance::get_instances(&api_client).await.unwrap(); /// # } /// ``` -pub async fn get_instances( - kube_client: &Client, -) -> Result { +pub async fn get_instances(kube_client: &Client) -> Result { log::trace!("get_instances enter"); // TODO kagold: pass in namespace and use Api::namespaced let instances_client: Api = Api::all(kube_client.clone()); @@ -123,7 +121,7 @@ pub async fn find_instance( log::trace!("find_instance getting instance with name {}", name); - match instances_client.get(&name).await { + match instances_client.get(name).await { Ok(instance_retrieved) => { log::trace!("find_instance return"); Ok(instance_retrieved) diff --git a/shared/src/k8s/mod.rs b/shared/src/k8s/mod.rs index 7760cc7f1..6ab5868f4 100644 --- a/shared/src/k8s/mod.rs +++ b/shared/src/k8s/mod.rs @@ -7,13 +7,8 @@ use super::akri::{ API_NAMESPACE, API_VERSION, }; use async_trait::async_trait; -use k8s_openapi::api::core::v1::{ - Node, Pod, Service, -}; -use kube::{ - api::ObjectList, - client::Client, -}; +use k8s_openapi::api::core::v1::{Node, Pod, Service}; +use kube::{api::ObjectList, client::Client}; use mockall::{automock, predicate::*}; pub mod node; @@ -95,40 +90,14 @@ impl OwnershipInfo { pub trait KubeInterface: Send + Sync { fn get_kube_client(&self) -> Client; - async fn find_node( - &self, - name: &str, - ) -> Result; + async fn find_node(&self, name: &str) -> Result; - async fn find_pods_with_label( - &self, - selector: &str, - ) -> Result< - ObjectList, - anyhow::Error, - >; - async fn find_pods_with_field( - &self, - selector: &str, - ) -> Result< - ObjectList, - anyhow::Error, - >; - async fn create_pod( - &self, - pod_to_create: &Pod, - namespace: &str, - ) -> Result<(), anyhow::Error>; - async fn remove_pod( - &self, - pod_to_remove: &str, - namespace: &str, - ) -> Result<(), anyhow::Error>; + async fn find_pods_with_label(&self, selector: &str) -> Result, anyhow::Error>; + async fn find_pods_with_field(&self, selector: &str) -> Result, anyhow::Error>; + async fn create_pod(&self, pod_to_create: &Pod, namespace: &str) -> Result<(), anyhow::Error>; + async fn remove_pod(&self, pod_to_remove: &str, namespace: &str) -> Result<(), anyhow::Error>; - async fn find_services( - &self, - selector: &str, - ) -> Result, anyhow::Error>; + async fn find_services(&self, selector: &str) -> Result, anyhow::Error>; async fn create_service( &self, svc_to_create: &Service, @@ -151,14 +120,10 @@ pub trait KubeInterface: Send + Sync { name: &str, namespace: &str, ) -> Result; - async fn get_configurations( - &self, - ) -> Result; + async fn get_configurations(&self) -> Result; async fn find_instance(&self, name: &str, namespace: &str) -> Result; - async fn get_instances( - &self, - ) -> Result; + async fn get_instances(&self) -> Result; async fn create_instance( &self, instance_to_create: &InstanceSpec, @@ -167,11 +132,7 @@ pub trait KubeInterface: Send + Sync { owner_config_name: &str, owner_config_uid: &str, ) -> Result<(), anyhow::Error>; - async fn delete_instance( - &self, - name: &str, - namespace: &str, - ) -> Result<(), anyhow::Error>; + async fn delete_instance(&self, name: &str, namespace: &str) -> Result<(), anyhow::Error>; async fn update_instance( &self, instance_to_update: &InstanceSpec, @@ -187,7 +148,7 @@ pub struct KubeImpl { impl KubeImpl { /// Create new instance of KubeImpl - pub async fn new() -> Result { + pub async fn new() -> Result { Ok(KubeImpl { client: Client::try_default().await?, }) @@ -215,10 +176,7 @@ impl KubeInterface for KubeImpl { /// let node = kube.find_node("node-a").await.unwrap(); /// # } /// ``` - async fn find_node( - &self, - name: &str, - ) -> Result { + async fn find_node(&self, name: &str) -> Result { node::find_node(name, self.get_kube_client()).await } @@ -236,10 +194,7 @@ impl KubeInterface for KubeImpl { /// let interesting_pods = kube.find_pods_with_label("label=interesting").await.unwrap(); /// # } /// ``` - async fn find_pods_with_label( - &self, - selector: &str, - ) -> Result, anyhow::Error> { + async fn find_pods_with_label(&self, selector: &str) -> Result, anyhow::Error> { pod::find_pods_with_selector(Some(selector.to_string()), None, self.get_kube_client()).await } /// Get Kuberenetes pods with specified field selector @@ -256,10 +211,7 @@ impl KubeInterface for KubeImpl { /// let pods_on_node_a = kube.find_pods_with_field("spec.nodeName=node-a").await.unwrap(); /// # } /// ``` - async fn find_pods_with_field( - &self, - selector: &str, - ) -> Result, anyhow::Error> { + async fn find_pods_with_field(&self, selector: &str) -> Result, anyhow::Error> { pod::find_pods_with_selector(None, Some(selector.to_string()), self.get_kube_client()).await } /// Create Kuberenetes pod @@ -277,11 +229,7 @@ impl KubeInterface for KubeImpl { /// kube.create_pod(&Pod::default(), "pod_namespace").await.unwrap(); /// # } /// ``` - async fn create_pod( - &self, - pod_to_create: &Pod, - namespace: &str, - ) -> Result<(), anyhow::Error> { + async fn create_pod(&self, pod_to_create: &Pod, namespace: &str) -> Result<(), anyhow::Error> { pod::create_pod(pod_to_create, namespace, self.get_kube_client()).await } /// Remove Kubernetes pod @@ -298,11 +246,7 @@ impl KubeInterface for KubeImpl { /// kube.remove_pod("pod_to_remove", "pod_namespace").await.unwrap(); /// # } /// ``` - async fn remove_pod( - &self, - pod_to_remove: &str, - namespace: &str, - ) -> Result<(), anyhow::Error> { + async fn remove_pod(&self, pod_to_remove: &str, namespace: &str) -> Result<(), anyhow::Error> { pod::remove_pod(pod_to_remove, namespace, self.get_kube_client()).await } @@ -320,10 +264,7 @@ impl KubeInterface for KubeImpl { /// let interesting_services = kube.find_services("label=interesting").await.unwrap(); /// # } /// ``` - async fn find_services( - &self, - selector: &str, - ) -> Result, anyhow::Error> { + async fn find_services(&self, selector: &str) -> Result, anyhow::Error> { service::find_services_with_selector(selector, self.get_kube_client()).await } /// Create Kubernetes service @@ -436,9 +377,7 @@ impl KubeInterface for KubeImpl { /// let dccs = kube.get_configurations().await.unwrap(); /// # } /// ``` - async fn get_configurations( - &self, - ) -> Result { + async fn get_configurations(&self) -> Result { configuration::get_configurations(&self.get_kube_client()).await } @@ -473,9 +412,7 @@ impl KubeInterface for KubeImpl { /// let instances = kube.get_instances().await.unwrap(); /// # } /// ``` - async fn get_instances( - &self, - ) -> Result { + async fn get_instances(&self) -> Result { instance::get_instances(&self.get_kube_client()).await } /// Create Akri Instance @@ -540,11 +477,7 @@ impl KubeInterface for KubeImpl { /// ).await.unwrap(); /// # } /// ``` - async fn delete_instance( - &self, - name: &str, - namespace: &str, - ) -> Result<(), anyhow::Error> { + async fn delete_instance(&self, name: &str, namespace: &str) -> Result<(), anyhow::Error> { instance::delete_instance(name, namespace, &self.get_kube_client()).await } /// Update Akri Instance @@ -608,13 +541,13 @@ pub async fn try_delete_instance( Err(e) => { if let Some(kube::Error::Api(ae)) = e.downcast_ref::() { if ae.code == ERROR_NOT_FOUND { - log::trace!( - "try_delete_instance - discovered Instance {} already deleted", - instance_name - ); - break; - } - log::error!("try_delete_instance - when looking up Instance {}, got kube API error: {:?}", instance_name, ae); + log::trace!( + "try_delete_instance - discovered Instance {} already deleted", + instance_name + ); + break; + } + log::error!("try_delete_instance - when looking up Instance {}, got kube API error: {:?}", instance_name, ae); } } // Err(e) => { diff --git a/shared/src/k8s/node.rs b/shared/src/k8s/node.rs index dc63f8d5c..4f7f518fb 100644 --- a/shared/src/k8s/node.rs +++ b/shared/src/k8s/node.rs @@ -1,8 +1,5 @@ use k8s_openapi::api::core::v1::Node; -use kube::{ - api::Api, - client::Client, -}; +use kube::{api::Api, client::Client}; use log::trace; /// Get Kubernetes Node with a given name @@ -21,14 +18,11 @@ use log::trace; /// let node = node::find_node("node-a", api_client).await.unwrap(); /// # } /// ``` -pub async fn find_node( - name: &str, - kube_client: Client, -) -> Result { - trace!("find_node with name={:?}", &name); +pub async fn find_node(name: &str, kube_client: Client) -> Result { + trace!("find_node with name={}", name); let nodes: Api = Api::all(kube_client); trace!("find_node PRE nodes.get(...).await?"); - let result = nodes.get(&name).await; + let result = nodes.get(name).await; trace!("find_node return"); Ok(result?) } diff --git a/shared/src/k8s/pod.rs b/shared/src/k8s/pod.rs index 88be54713..73471a71c 100644 --- a/shared/src/k8s/pod.rs +++ b/shared/src/k8s/pod.rs @@ -191,12 +191,9 @@ pub fn create_new_pod_from_spec( let mut modified_pod_spec = pod_spec.clone(); - let insert_akri_resources = | map: &mut ResourceQuantityType | { + let insert_akri_resources = |map: &mut ResourceQuantityType| { if map.contains_key(RESOURCE_REQUIREMENTS_KEY) { - let placeholder_value = map - .get(RESOURCE_REQUIREMENTS_KEY) - .unwrap() - .clone(); + let placeholder_value = map.get(RESOURCE_REQUIREMENTS_KEY).unwrap().clone(); map.insert(resource_limit_name.to_string(), placeholder_value); map.remove(RESOURCE_REQUIREMENTS_KEY); } @@ -210,8 +207,8 @@ pub fn create_new_pod_from_spec( Some(mut map) => { insert_akri_resources(&mut map); Some(map) - }, - None => None + } + None => None, } }, requests: { @@ -219,14 +216,12 @@ pub fn create_new_pod_from_spec( Some(mut map) => { insert_akri_resources(&mut map); Some(map) - }, - None => None + } + None => None, } }, }); }; - - } // Ensure that the modified PodSpec has the required Affinity settings @@ -453,13 +448,19 @@ mod broker_podspec_tests { // Validate the labels added assert_eq!( &&app_name, - &pod.metadata.clone().labels.unwrap().get(APP_LABEL_ID).unwrap() + &pod.metadata + .clone() + .labels + .unwrap() + .get(APP_LABEL_ID) + .unwrap() ); assert_eq!( &&API_NAMESPACE.to_string(), &pod.metadata .clone() - .labels.unwrap() + .labels + .unwrap() .get(CONTROLLER_LABEL_ID) .unwrap() ); @@ -467,7 +468,8 @@ mod broker_podspec_tests { &&configuration_name, &pod.metadata .clone() - .labels.unwrap() + .labels + .unwrap() .get(AKRI_CONFIGURATION_LABEL_NAME) .unwrap() ); @@ -475,7 +477,8 @@ mod broker_podspec_tests { &&instance_name, &pod.metadata .clone() - .labels.unwrap() + .labels + .unwrap() .get(AKRI_INSTANCE_LABEL_NAME) .unwrap() ); @@ -483,7 +486,8 @@ mod broker_podspec_tests { &&node_to_run_pod_on, &pod.metadata .clone() - .labels.unwrap() + .labels + .unwrap() .get(AKRI_TARGET_NODE_LABEL_NAME) .unwrap() ); @@ -491,15 +495,33 @@ mod broker_podspec_tests { // Validate ownerReference assert_eq!( instance_name, - pod.metadata.clone(). owner_references.unwrap().get(0).unwrap().name + pod.metadata + .clone() + .owner_references + .unwrap() + .get(0) + .unwrap() + .name ); assert_eq!( instance_uid, - pod.metadata.clone(). owner_references.unwrap().get(0).unwrap().uid + pod.metadata + .clone() + .owner_references + .unwrap() + .get(0) + .unwrap() + .uid ); assert_eq!( "Instance", - &pod.metadata.clone(). owner_references.unwrap().get(0).unwrap().kind + &pod.metadata + .clone() + .owner_references + .unwrap() + .get(0) + .unwrap() + .kind ); assert_eq!( &format!("{}/{}", API_NAMESPACE, API_VERSION), @@ -561,7 +583,8 @@ mod broker_podspec_tests { .node_selector_terms .get(0) .unwrap() - .match_fields.as_ref() + .match_fields + .as_ref() .unwrap() .get(0) .unwrap() @@ -581,7 +604,8 @@ mod broker_podspec_tests { .node_selector_terms .get(0) .unwrap() - .match_fields.as_ref() + .match_fields + .as_ref() .unwrap() .get(0) .unwrap() @@ -601,10 +625,14 @@ mod broker_podspec_tests { .node_selector_terms .get(0) .unwrap() - .match_fields.as_ref().unwrap() + .match_fields + .as_ref() + .unwrap() .get(0) .unwrap() - .values.as_ref().unwrap() + .values + .as_ref() + .unwrap() ); // Validate the affinity added @@ -622,7 +650,9 @@ mod broker_podspec_tests { .node_selector_terms .get(1) .unwrap() - .match_fields.as_ref().unwrap() + .match_fields + .as_ref() + .unwrap() .get(0) .unwrap() .key @@ -641,7 +671,9 @@ mod broker_podspec_tests { .node_selector_terms .get(1) .unwrap() - .match_fields.as_ref().unwrap() + .match_fields + .as_ref() + .unwrap() .get(0) .unwrap() .operator @@ -660,10 +692,14 @@ mod broker_podspec_tests { .node_selector_terms .get(1) .unwrap() - .match_fields.as_ref().unwrap() + .match_fields + .as_ref() + .unwrap() .get(0) .unwrap() - .values.as_ref().unwrap() + .values + .as_ref() + .unwrap() ); // Validate image name remanes unchanged @@ -693,7 +729,9 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .limits.as_ref().unwrap() + .limits + .as_ref() + .unwrap() .contains_key("do-not-change-this") ); assert_eq!( @@ -707,7 +745,9 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .requests.as_ref().unwrap() + .requests + .as_ref() + .unwrap() .contains_key("do-not-change-this") ); // Validate the limits/requires added @@ -722,7 +762,9 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .limits.as_ref().unwrap() + .limits + .as_ref() + .unwrap() .contains_key(RESOURCE_REQUIREMENTS_KEY) ); assert_eq!( @@ -736,7 +778,9 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .requests.as_ref().unwrap() + .requests + .as_ref() + .unwrap() .contains_key(RESOURCE_REQUIREMENTS_KEY) ); assert_eq!( @@ -750,7 +794,9 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .limits.as_ref().unwrap() + .limits + .as_ref() + .unwrap() .contains_key(&resource_limit_name.clone()) ); assert_eq!( @@ -764,7 +810,9 @@ mod broker_podspec_tests { .resources .as_ref() .unwrap() - .requests.as_ref().unwrap() + .requests + .as_ref() + .unwrap() .contains_key(&resource_limit_name.clone()) ); } diff --git a/shared/src/k8s/service.rs b/shared/src/k8s/service.rs index 0123bf77e..20eba5f95 100644 --- a/shared/src/k8s/service.rs +++ b/shared/src/k8s/service.rs @@ -119,9 +119,9 @@ pub fn create_new_service_from_spec( node_specific_svc: bool, ) -> Result> { let app_name = create_service_app_name( - &configuration_name, - &instance_name, - &"svc".to_string(), + configuration_name, + instance_name, + "svc", node_specific_svc, ); let mut labels: BTreeMap = BTreeMap::new(); @@ -149,7 +149,7 @@ pub fn create_new_service_from_spec( }]; let mut spec = svc_spec.clone(); - let mut modified_selector: BTreeMap = spec.selector.unwrap_or(BTreeMap::new()); + let mut modified_selector: BTreeMap = spec.selector.unwrap_or_default(); modified_selector.insert(CONTROLLER_LABEL_ID.to_string(), API_NAMESPACE.to_string()); if node_specific_svc { modified_selector.insert( @@ -229,13 +229,20 @@ pub fn update_ownership( } else { // Add ownership to list IFF the UID doesn't already exist if !svc_to_update - .metadata - .owner_references.as_ref().unwrap().iter() - .any(|x| x.uid == ownership.get_uid()) { - svc_to_update - .metadata - .owner_references.as_mut().unwrap().push(ownership_ref); - } + .metadata + .owner_references + .as_ref() + .unwrap() + .iter() + .any(|x| x.uid == ownership.get_uid()) + { + svc_to_update + .metadata + .owner_references + .as_mut() + .unwrap() + .push(ownership_ref); + } } Ok(()) } @@ -246,8 +253,8 @@ mod svcspec_tests { use super::*; use env_logger; - use kube::api::ObjectMeta; use k8s_openapi::api::core::v1::ServiceStatus; + use kube::api::ObjectMeta; #[test] fn test_create_service_app_name() { @@ -314,8 +321,14 @@ mod svcspec_tests { ) .unwrap(); assert_eq!(1, svc.metadata.owner_references.as_ref().unwrap().len()); - assert_eq!("object1", &svc.metadata.owner_references.as_ref().unwrap()[0].name); - assert_eq!("uid1", &svc.metadata.owner_references.as_ref().unwrap()[0].uid); + assert_eq!( + "object1", + &svc.metadata.owner_references.as_ref().unwrap()[0].name + ); + assert_eq!( + "uid1", + &svc.metadata.owner_references.as_ref().unwrap()[0].uid + ); update_ownership( &mut svc, @@ -328,8 +341,14 @@ mod svcspec_tests { ) .unwrap(); assert_eq!(1, svc.metadata.owner_references.as_ref().unwrap().len()); - assert_eq!("object2", &svc.metadata.owner_references.as_ref().unwrap()[0].name); - assert_eq!("uid2", &svc.metadata.owner_references.as_ref().unwrap()[0].uid); + assert_eq!( + "object2", + &svc.metadata.owner_references.as_ref().unwrap()[0].name + ); + assert_eq!( + "uid2", + &svc.metadata.owner_references.as_ref().unwrap()[0].uid + ); } #[test] @@ -355,8 +374,14 @@ mod svcspec_tests { ) .unwrap(); assert_eq!(1, svc.metadata.owner_references.as_ref().unwrap().len()); - assert_eq!("object1", &svc.metadata.owner_references.as_ref().unwrap()[0].name); - assert_eq!("uid1", &svc.metadata.owner_references.as_ref().unwrap()[0].uid); + assert_eq!( + "object1", + &svc.metadata.owner_references.as_ref().unwrap()[0].name + ); + assert_eq!( + "uid1", + &svc.metadata.owner_references.as_ref().unwrap()[0].uid + ); update_ownership( &mut svc, @@ -369,10 +394,22 @@ mod svcspec_tests { ) .unwrap(); assert_eq!(2, svc.metadata.owner_references.as_ref().unwrap().len()); - assert_eq!("object1", &svc.metadata.owner_references.as_ref().unwrap()[0].name); - assert_eq!("uid1", &svc.metadata.owner_references.as_ref().unwrap()[0].uid); - assert_eq!("object2", &svc.metadata.owner_references.as_ref().unwrap()[1].name); - assert_eq!("uid2", &svc.metadata.owner_references.as_ref().unwrap()[1].uid); + assert_eq!( + "object1", + &svc.metadata.owner_references.as_ref().unwrap()[0].name + ); + assert_eq!( + "uid1", + &svc.metadata.owner_references.as_ref().unwrap()[0].uid + ); + assert_eq!( + "object2", + &svc.metadata.owner_references.as_ref().unwrap()[1].name + ); + assert_eq!( + "uid2", + &svc.metadata.owner_references.as_ref().unwrap()[1].uid + ); // Test that trying to add the same UID doesn't result in // duplicate @@ -387,10 +424,22 @@ mod svcspec_tests { ) .unwrap(); assert_eq!(2, svc.metadata.owner_references.as_ref().unwrap().len()); - assert_eq!("object1", &svc.metadata.owner_references.as_ref().unwrap()[0].name); - assert_eq!("uid1", &svc.metadata.owner_references.as_ref().unwrap()[0].uid); - assert_eq!("object2", &svc.metadata.owner_references.as_ref().unwrap()[1].name); - assert_eq!("uid2", &svc.metadata.owner_references.as_ref().unwrap()[1].uid); + assert_eq!( + "object1", + &svc.metadata.owner_references.as_ref().unwrap()[0].name + ); + assert_eq!( + "uid1", + &svc.metadata.owner_references.as_ref().unwrap()[0].uid + ); + assert_eq!( + "object2", + &svc.metadata.owner_references.as_ref().unwrap()[1].name + ); + assert_eq!( + "uid2", + &svc.metadata.owner_references.as_ref().unwrap()[1].uid + ); } #[test] @@ -439,7 +488,12 @@ mod svcspec_tests { // Validate the labels added assert_eq!( &&app_name, - &svc.metadata.clone().labels.unwrap().get(APP_LABEL_ID).unwrap() + &svc.metadata + .clone() + .labels + .unwrap() + .get(APP_LABEL_ID) + .unwrap() ); assert_eq!( &&API_NAMESPACE.to_string(), @@ -475,15 +529,36 @@ mod svcspec_tests { // Validate ownerReference assert_eq!( object_name, - svc.metadata.clone().owner_references.as_ref().unwrap().get(0).unwrap().name + svc.metadata + .clone() + .owner_references + .as_ref() + .unwrap() + .get(0) + .unwrap() + .name ); assert_eq!( object_uid, - svc.metadata.clone().owner_references.as_ref().unwrap().get(0).unwrap().uid + svc.metadata + .clone() + .owner_references + .as_ref() + .unwrap() + .get(0) + .unwrap() + .uid ); assert_eq!( "Pod", - &svc.metadata.clone().owner_references.as_ref().unwrap().get(0).unwrap().kind + &svc.metadata + .clone() + .owner_references + .as_ref() + .unwrap() + .get(0) + .unwrap() + .kind ); assert_eq!( "core/v1", @@ -520,7 +595,8 @@ mod svcspec_tests { &svc.spec .as_ref() .unwrap() - .selector.as_ref() + .selector + .as_ref() .unwrap() .get("do-not-change") .unwrap() @@ -531,7 +607,8 @@ mod svcspec_tests { &svc.spec .as_ref() .unwrap() - .selector.as_ref() + .selector + .as_ref() .unwrap() .get(CONTROLLER_LABEL_ID) .unwrap() @@ -542,7 +619,8 @@ mod svcspec_tests { &svc.spec .as_ref() .unwrap() - .selector.as_ref() + .selector + .as_ref() .unwrap() .get(AKRI_INSTANCE_LABEL_NAME) .unwrap() @@ -553,7 +631,8 @@ mod svcspec_tests { &svc.spec .as_ref() .unwrap() - .selector.as_ref() + .selector + .as_ref() .unwrap() .get(AKRI_CONFIGURATION_LABEL_NAME) .unwrap() diff --git a/shared/src/os/mod.rs b/shared/src/os/mod.rs index 4933f4179..15b0e7942 100644 --- a/shared/src/os/mod.rs +++ b/shared/src/os/mod.rs @@ -1,5 +1,4 @@ pub mod env_var; -// pub mod signal; /// Provide file operations pub mod file { diff --git a/shared/src/os/signal.rs b/shared/src/os/signal.rs deleted file mode 100644 index e064f1471..000000000 --- a/shared/src/os/signal.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Taken from iotedge: -// https://raw.githubusercontent.com/Azure/iotedge/master/edgelet/iotedged/src/signal.rs -// iotedge added this credit: -// Adapted from the conduit proxy signal handling: -// https://github.com/runconduit/conduit/blob/master/proxy/src/signal.rs - -use futures_old::Future; - -pub type ShutdownSignal = Box + Send>; - -/// Get shutdown signal to handle SIGINT and SIGTERM -pub fn shutdown() -> ShutdownSignal { - imp::shutdown() -} - -#[cfg(unix)] -mod imp { - use super::ShutdownSignal; - use futures_old::{future, Future, Stream}; - use log::trace; - use std::fmt; - use tokio_signal::unix::{Signal, SIGINT, SIGTERM}; - - pub(super) fn shutdown() -> ShutdownSignal { - let signals = [SIGINT, SIGTERM].iter().map(|&sig| { - Signal::new(sig) - .flatten_stream() - .into_future() - .map(move |_| { - trace!("Received {}, starting shutdown", DisplaySignal(sig)); - }) - }); - let on_any_signal = future::select_all(signals) - .map(|_| ()) - .map_err(|_| unreachable!("Signal never returns an error")); - Box::new(on_any_signal) - } - - /// This is used to store and handle specific shutdown signals - #[derive(Clone, Copy)] - struct DisplaySignal(i32); - - /// Implement Display for SIGINT and SIGTERM - impl fmt::Display for DisplaySignal { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let s = match self.0 { - SIGINT => "SIGINT", - SIGTERM => "SIGTERM", - other => return write!(f, "signal {}", other), - }; - f.write_str(s) - } - } -} diff --git a/shared/src/uds/unix_stream.rs b/shared/src/uds/unix_stream.rs index a84126380..43ec1fca2 100644 --- a/shared/src/uds/unix_stream.rs +++ b/shared/src/uds/unix_stream.rs @@ -1,9 +1,8 @@ /// Module to enable UDS with tonic grpc. /// This is unix only since the underlying UnixStream and UnixListener libraries are unix only. -/// Module to enable UDS with tonic grpc. -/// This is unix only since the underlying UnixStream and UnixListener libraries are unix only. use std::{ pin::Pin, + sync::Arc, task::{Context, Poll}, }; @@ -13,7 +12,22 @@ use tonic::transport::server::Connected; #[derive(Debug)] pub struct UnixStream(pub tokio::net::UnixStream); -impl Connected for UnixStream {} +impl Connected for UnixStream { + type ConnectInfo = UdsConnectInfo; + + fn connect_info(&self) -> Self::ConnectInfo { + UdsConnectInfo { + peer_addr: self.0.peer_addr().ok().map(Arc::new), + peer_cred: self.0.peer_cred().ok(), + } + } +} + +#[derive(Clone, Debug)] +pub struct UdsConnectInfo { + pub peer_addr: Option>, + pub peer_cred: Option, +} impl AsyncRead for UnixStream { fn poll_read( @@ -38,10 +52,7 @@ impl AsyncWrite for UnixStream { Pin::new(&mut self.0).poll_flush(cx) } - fn poll_shutdown( - mut self: Pin<&mut Self>, - cx: &mut Context<'_>, - ) -> Poll> { + fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { Pin::new(&mut self.0).poll_shutdown(cx) } } diff --git a/test/json/local-instance.json b/test/json/local-instance.json index a1d5be708..1dcb84c9d 100644 --- a/test/json/local-instance.json +++ b/test/json/local-instance.json @@ -1,4 +1,6 @@ { + "apiVersion": "v0", + "kind": "Instance", "metadata": { "name": "config-a-b494b6", "namespace": "config-a-namespace", diff --git a/test/json/shared-instance-list-slots.json b/test/json/shared-instance-list-slots.json index aca9e9d4f..e2f988821 100644 --- a/test/json/shared-instance-list-slots.json +++ b/test/json/shared-instance-list-slots.json @@ -2,6 +2,8 @@ "apiVersion": "v1", "items": [ { + "apiVersion": "v0", + "kind": "Instance", "metadata": { "name": "config-a-359973", "namespace": "config-a-namespace", diff --git a/test/json/shared-instance-list.json b/test/json/shared-instance-list.json index 33307e123..6e698ca37 100644 --- a/test/json/shared-instance-list.json +++ b/test/json/shared-instance-list.json @@ -2,6 +2,8 @@ "apiVersion": "v1", "items": [ { + "apiVersion": "v0", + "kind": "Instance", "metadata": { "name": "config-a-359973", "namespace": "config-a-namespace", diff --git a/test/json/shared-instance-update.json b/test/json/shared-instance-update.json index 8def737ef..2501aeef8 100644 --- a/test/json/shared-instance-update.json +++ b/test/json/shared-instance-update.json @@ -1,4 +1,6 @@ { + "apiVersion": "v0", + "kind": "Instance", "metadata": { "name": "config-a-359973", "namespace": "config-a-namespace", diff --git a/test/json/shared-instance.json b/test/json/shared-instance.json index d6bcb4c36..d35d99794 100644 --- a/test/json/shared-instance.json +++ b/test/json/shared-instance.json @@ -1,4 +1,6 @@ { + "apiVersion": "v0", + "kind": "Instance", "metadata": { "name": "config-a-359973", "namespace": "config-a-namespace", From b576811ba90436790c2bc7d5aa2b010d8da315b5 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Wed, 11 Aug 2021 19:47:47 -0700 Subject: [PATCH 04/22] clippy fixes --- Cargo.lock | 1042 +---------------- Cargo.toml | 2 +- agent/src/util/config_action.rs | 2 +- agent/src/util/crictl_containers.rs | 2 +- agent/src/util/device_plugin_service.rs | 4 +- agent/src/util/discovery_operator.rs | 18 +- agent/src/util/registration.rs | 6 +- controller/src/util/instance_action.rs | 24 +- controller/src/util/node_watcher.rs | 14 +- controller/src/util/pod_watcher.rs | 38 +- .../debug-echo/src/discovery_handler.rs | 2 +- .../onvif/src/discovery_handler.rs | 6 +- .../onvif/src/discovery_impl.rs | 4 +- .../onvif/src/discovery_utils.rs | 12 +- .../opcua/src/discovery_handler.rs | 4 +- .../opcua/src/discovery_impl.rs | 2 +- .../udev/src/discovery_handler.rs | 2 +- .../src/util/camera_capturer.rs | 4 +- shared/src/akri/configuration.rs | 2 +- shared/src/akri/instance.rs | 2 +- shared/src/k8s/mod.rs | 4 +- shared/src/k8s/pod.rs | 2 +- shared/src/k8s/service.rs | 8 +- shared/src/os/mod.rs | 2 +- webhooks/validating/configuration/src/main.rs | 8 +- 25 files changed, 122 insertions(+), 1094 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2368397bb..cfac276ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,329 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "actix" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "543c47e7827f8fcc9d1445bd98ba402137bfce80ee2187429de49c52b5131bd3" -dependencies = [ - "actix-rt 2.2.0", - "actix_derive", - "bitflags", - "bytes 1.0.1", - "crossbeam-channel", - "futures-core", - "futures-sink", - "futures-task", - "futures-util", - "log", - "once_cell", - "parking_lot 0.11.1", - "pin-project-lite 0.2.7", - "smallvec 1.6.1", - "tokio 1.9.0", - "tokio-util 0.6.7", -] - -[[package]] -name = "actix-codec" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78d1833b3838dbe990df0f1f87baf640cf6146e898166afe401839d1b001e570" -dependencies = [ - "bitflags", - "bytes 0.5.6", - "futures-core", - "futures-sink", - "log", - "pin-project 0.4.28", - "tokio 0.2.25", - "tokio-util 0.3.1", -] - -[[package]] -name = "actix-connect" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177837a10863f15ba8d3ae3ec12fac1099099529ed20083a27fdfe247381d0dc" -dependencies = [ - "actix-codec", - "actix-rt 1.1.1", - "actix-service", - "actix-utils", - "derive_more", - "either", - "futures-util", - "http", - "log", - "openssl", - "tokio-openssl", - "trust-dns-proto", - "trust-dns-resolver", -] - -[[package]] -name = "actix-http" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cb8958da437716f3f31b0e76f8daf36554128517d7df37ceba7df00f09622ee" -dependencies = [ - "actix-codec", - "actix-connect", - "actix-rt 1.1.1", - "actix-service", - "actix-threadpool", - "actix-tls", - "actix-utils", - "base64 0.13.0", - "bitflags", - "brotli2", - "bytes 0.5.6", - "cookie", - "copyless", - "derive_more", - "either", - "encoding_rs", - "flate2", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "h2 0.2.7", - "http", - "httparse", - "indexmap", - "itoa", - "language-tags", - "lazy_static", - "log", - "mime", - "percent-encoding 2.1.0", - "pin-project 1.0.8", - "rand 0.7.3", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "sha-1 0.9.7", - "slab", - "time 0.2.27", -] - -[[package]] -name = "actix-macros" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ca8ce00b267af8ccebbd647de0d61e0674b6e61185cc7a592ff88772bed655" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "actix-macros" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f86cd6857c135e6e9fe57b1619a88d1f94a7df34c00e11fe13e64fd3438837" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "actix-router" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ad299af73649e1fc893e333ccf86f377751eb95ff875d095131574c6f43452c" -dependencies = [ - "bytestring", - "http", - "log", - "regex", - "serde", -] - -[[package]] -name = "actix-rt" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" -dependencies = [ - "actix-macros 0.1.3", - "actix-threadpool", - "copyless", - "futures-channel", - "futures-util", - "smallvec 1.6.1", - "tokio 0.2.25", -] - -[[package]] -name = "actix-rt" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7d7cd957c9ed92288a7c3c96af81fa5291f65247a76a34dac7b6af74e52ba0" -dependencies = [ - "actix-macros 0.2.1", - "futures-core", - "tokio 1.9.0", -] - -[[package]] -name = "actix-server" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45407e6e672ca24784baa667c5d32ef109ccdd8d5e0b5ebb9ef8a67f4dfb708e" -dependencies = [ - "actix-codec", - "actix-rt 1.1.1", - "actix-service", - "actix-utils", - "futures-channel", - "futures-util", - "log", - "mio 0.6.23", - "mio-uds", - "num_cpus", - "slab", - "socket2 0.3.19", -] - -[[package]] -name = "actix-service" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0052435d581b5be835d11f4eb3bce417c8af18d87ddf8ace99f8e67e595882bb" -dependencies = [ - "futures-util", - "pin-project 0.4.28", -] - -[[package]] -name = "actix-testing" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47239ca38799ab74ee6a8a94d1ce857014b2ac36f242f70f3f75a66f691e791c" -dependencies = [ - "actix-macros 0.1.3", - "actix-rt 1.1.1", - "actix-server", - "actix-service", - "log", - "socket2 0.3.19", -] - -[[package]] -name = "actix-threadpool" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d209f04d002854b9afd3743032a27b066158817965bf5d036824d19ac2cc0e30" -dependencies = [ - "derive_more", - "futures-channel", - "lazy_static", - "log", - "num_cpus", - "parking_lot 0.11.1", - "threadpool", -] - -[[package]] -name = "actix-tls" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24789b7d7361cf5503a504ebe1c10806896f61e96eca9a7350e23001aca715fb" -dependencies = [ - "actix-codec", - "actix-service", - "actix-utils", - "futures-util", - "openssl", - "tokio-openssl", -] - -[[package]] -name = "actix-utils" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9022dec56632d1d7979e59af14f0597a28a830a9c1c7fec8b2327eb9f16b5a" -dependencies = [ - "actix-codec", - "actix-rt 1.1.1", - "actix-service", - "bitflags", - "bytes 0.5.6", - "either", - "futures-channel", - "futures-sink", - "futures-util", - "log", - "pin-project 0.4.28", - "slab", -] - -[[package]] -name = "actix-web" -version = "3.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e641d4a172e7faa0862241a20ff4f1f5ab0ab7c279f00c2d4587b77483477b86" -dependencies = [ - "actix-codec", - "actix-http", - "actix-macros 0.1.3", - "actix-router", - "actix-rt 1.1.1", - "actix-server", - "actix-service", - "actix-testing", - "actix-threadpool", - "actix-tls", - "actix-utils", - "actix-web-codegen", - "awc", - "bytes 0.5.6", - "derive_more", - "encoding_rs", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "log", - "mime", - "openssl", - "pin-project 1.0.8", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "socket2 0.3.19", - "time 0.2.27", - "tinyvec", - "url 2.2.2", -] - -[[package]] -name = "actix-web-codegen" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad26f77093333e0e7c6ffe54ebe3582d908a104e448723eec6d43d08b07143fb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "actix_derive" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "adler" version = "1.0.2" @@ -351,7 +28,7 @@ dependencies = [ "futures 0.3.16", "futures-core", "futures-util", - "h2 0.3.3", + "h2", "hyper", "k8s-openapi", "kube", @@ -599,7 +276,7 @@ dependencies = [ "parking", "polling", "slab", - "socket2 0.4.1", + "socket2", "waker-fn", "winapi 0.3.9", ] @@ -643,7 +320,7 @@ dependencies = [ "memchr", "num_cpus", "once_cell", - "pin-project-lite 0.2.7", + "pin-project-lite", "pin-utils", "slab", "wasm-bindgen-futures", @@ -710,37 +387,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "awc" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b381e490e7b0cfc37ebc54079b0413d8093ef43d14a4e4747083f7fa47a9e691" -dependencies = [ - "actix-codec", - "actix-http", - "actix-rt 1.1.1", - "actix-service", - "base64 0.13.0", - "bytes 0.5.6", - "cfg-if 1.0.0", - "derive_more", - "futures-core", - "log", - "mime", - "openssl", - "percent-encoding 2.1.0", - "rand 0.7.3", - "serde", - "serde_json", - "serde_urlencoded", -] - -[[package]] -name = "base-x" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" - [[package]] name = "base64" version = "0.12.3" @@ -814,26 +460,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "brotli-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "brotli2" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" -dependencies = [ - "brotli-sys", - "libc", -] - [[package]] name = "buf_redux" version = "0.8.4" @@ -872,27 +498,12 @@ dependencies = [ "iovec", ] -[[package]] -name = "bytes" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" - [[package]] name = "bytes" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" -[[package]] -name = "bytestring" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d" -dependencies = [ - "bytes 1.0.1", -] - [[package]] name = "cache-padded" version = "1.1.1" @@ -927,42 +538,10 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time 0.1.44", + "time", "winapi 0.3.9", ] -[[package]] -name = "clap" -version = "3.0.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142" -dependencies = [ - "atty", - "bitflags", - "clap_derive", - "indexmap", - "lazy_static", - "os_str_bytes", - "strsim", - "termcolor", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "clap_derive" -version = "3.0.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "cloudabi" version = "0.0.3" @@ -981,12 +560,6 @@ dependencies = [ "cache-padded", ] -[[package]] -name = "const_fn" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" - [[package]] name = "controller" version = "0.6.11" @@ -1012,29 +585,6 @@ dependencies = [ "tokio 1.9.0", ] -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "cookie" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" -dependencies = [ - "percent-encoding 2.1.0", - "time 0.2.27", - "version_check", -] - -[[package]] -name = "copyless" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" - [[package]] name = "core-foundation" version = "0.9.1" @@ -1069,16 +619,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils 0.8.5", -] - [[package]] name = "crossbeam-deque" version = "0.7.4" @@ -1224,19 +764,6 @@ dependencies = [ "syn", ] -[[package]] -name = "derive_more" -version = "0.99.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version 0.3.3", - "syn", -] - [[package]] name = "difference" version = "2.0.0" @@ -1282,12 +809,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "doc-comment" version = "0.3.3" @@ -1318,27 +839,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "encoding_rs" -version = "0.8.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "enum-as-inner" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "env_logger" version = "0.9.0" @@ -1518,7 +1018,7 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.7", + "pin-project-lite", "waker-fn", ] @@ -1561,22 +1061,13 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.7", + "pin-project-lite", "pin-utils", "proc-macro-hack", "proc-macro-nested", "slab", ] -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - [[package]] name = "generic-array" version = "0.12.4" @@ -1641,26 +1132,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "h2" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" -dependencies = [ - "bytes 0.5.6", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio 0.2.25", - "tokio-util 0.3.1", - "tracing", - "tracing-futures", -] - [[package]] name = "h2" version = "0.3.3" @@ -1676,7 +1147,7 @@ dependencies = [ "indexmap", "slab", "tokio 1.9.0", - "tokio-util 0.6.7", + "tokio-util", "tracing", ] @@ -1699,7 +1170,7 @@ dependencies = [ "http", "mime", "sha-1 0.9.7", - "time 0.1.44", + "time", ] [[package]] @@ -1735,17 +1206,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hostname" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", -] - [[package]] name = "http" version = "0.2.4" @@ -1765,7 +1225,7 @@ checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" dependencies = [ "bytes 1.0.1", "http", - "pin-project-lite 0.2.7", + "pin-project-lite", ] [[package]] @@ -1796,14 +1256,14 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.3", + "h2", "http", "http-body", "httparse", "httpdate", "itoa", - "pin-project-lite 0.2.7", - "socket2 0.4.1", + "pin-project-lite", + "socket2", "tokio 1.9.0", "tower-service", "tracing", @@ -1817,7 +1277,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ "hyper", - "pin-project-lite 0.2.7", + "pin-project-lite", "tokio 1.9.0", "tokio-io-timeout", ] @@ -1900,24 +1360,6 @@ dependencies = [ "libc", ] -[[package]] -name = "ipconfig" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" -dependencies = [ - "socket2 0.3.19", - "widestring", - "winapi 0.3.9", - "winreg 0.6.2", -] - -[[package]] -name = "ipnet" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" - [[package]] name = "itertools" version = "0.10.1" @@ -2019,7 +1461,7 @@ dependencies = [ "thiserror", "tokio 1.9.0", "tokio-native-tls", - "tokio-util 0.6.7", + "tokio-util", "tower", "tower-http", "tracing", @@ -2072,7 +1514,7 @@ dependencies = [ "smallvec 1.6.1", "snafu", "tokio 1.9.0", - "tokio-util 0.6.7", + "tokio-util", "tracing", ] @@ -2085,12 +1527,6 @@ dependencies = [ "log", ] -[[package]] -name = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - [[package]] name = "lazy_static" version = "1.4.0" @@ -2147,27 +1583,12 @@ dependencies = [ "value-bag", ] -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "maplit" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" -[[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - [[package]] name = "matches" version = "0.1.8" @@ -2474,7 +1895,7 @@ dependencies = [ "opcua-types", "serde", "serde_derive", - "time 0.1.44", + "time", "tokio 0.1.22", "tokio-codec", "tokio-io", @@ -2549,18 +1970,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "openapi" -version = "1.1.0" -source = "git+https://github.com/DazWilkin/openapi-admission-v1?tag=v1.1.0#60a9ba6bd64efda65cb136a21e0d6a53e962c415" -dependencies = [ - "reqwest", - "serde", - "serde_derive", - "serde_json", - "url 1.7.2", -] - [[package]] name = "openssl" version = "0.10.35" @@ -2603,12 +2012,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "os_str_bytes" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85" - [[package]] name = "parking" version = "2.0.0" @@ -2623,7 +2026,7 @@ checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" dependencies = [ "lock_api 0.3.4", "parking_lot_core 0.6.2", - "rustc_version 0.2.3", + "rustc_version", ] [[package]] @@ -2647,7 +2050,7 @@ dependencies = [ "cloudabi", "libc", "redox_syscall 0.1.57", - "rustc_version 0.2.3", + "rustc_version", "smallvec 0.6.14", "winapi 0.3.9", ] @@ -2788,12 +2191,6 @@ dependencies = [ "syn", ] -[[package]] -name = "pin-project-lite" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" - [[package]] name = "pin-project-lite" version = "0.2.7" @@ -2846,42 +2243,18 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451" - -[[package]] -name = "predicates-tree" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2" -dependencies = [ - "predicates-core", - "treeline", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451" [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "predicates-tree" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2" dependencies = [ - "proc-macro2", - "quote", - "version_check", + "predicates-core", + "treeline", ] [[package]] @@ -3157,49 +2530,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "reqwest" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" -dependencies = [ - "base64 0.13.0", - "bytes 1.0.1", - "encoding_rs", - "futures-core", - "futures-util", - "http", - "http-body", - "hyper", - "ipnet", - "js-sys", - "lazy_static", - "log", - "mime", - "mime_guess", - "percent-encoding 2.1.0", - "pin-project-lite 0.2.7", - "serde", - "serde_json", - "serde_urlencoded", - "tokio 1.9.0", - "url 2.2.2", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg 0.7.0", -] - -[[package]] -name = "resolv-conf" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" -dependencies = [ - "hostname", - "quick-error", -] - [[package]] name = "ring" version = "0.16.20" @@ -3230,16 +2560,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0", -] - -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", + "semver", ] [[package]] @@ -3352,16 +2673,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser 0.10.2", + "semver-parser", ] [[package]] @@ -3370,15 +2682,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" version = "1.0.127" @@ -3481,12 +2784,6 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -3540,17 +2837,6 @@ dependencies = [ "syn", ] -[[package]] -name = "socket2" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "winapi 0.3.9", -] - [[package]] name = "socket2" version = "0.4.1" @@ -3567,64 +2853,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -[[package]] -name = "standback" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" -dependencies = [ - "version_check", -] - -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version 0.2.3", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "strsim" version = "0.10.0" @@ -3692,15 +2920,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789" -dependencies = [ - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.26" @@ -3721,15 +2940,6 @@ dependencies = [ "syn", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "time" version = "0.1.44" @@ -3741,44 +2951,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "time" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros", - "version_check", - "winapi 0.3.9", -] - -[[package]] -name = "time-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", -] - [[package]] name = "tinyvec" version = "1.3.1" @@ -3818,26 +2990,6 @@ dependencies = [ "tokio-uds", ] -[[package]] -name = "tokio" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" -dependencies = [ - "bytes 0.5.6", - "futures-core", - "iovec", - "lazy_static", - "libc", - "memchr", - "mio 0.6.23", - "mio-uds", - "pin-project-lite 0.1.12", - "signal-hook-registry", - "slab", - "winapi 0.3.9", -] - [[package]] name = "tokio" version = "1.9.0" @@ -3852,7 +3004,7 @@ dependencies = [ "num_cpus", "once_cell", "parking_lot 0.11.1", - "pin-project-lite 0.2.7", + "pin-project-lite", "signal-hook-registry", "tokio-macros", "winapi 0.3.9", @@ -3917,7 +3069,7 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9" dependencies = [ - "pin-project-lite 0.2.7", + "pin-project-lite", "tokio 1.9.0", ] @@ -3942,16 +3094,6 @@ dependencies = [ "tokio 1.9.0", ] -[[package]] -name = "tokio-openssl" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c4b08c5f4208e699ede3df2520aca2e82401b2de33f45e96696a074480be594" -dependencies = [ - "openssl", - "tokio 0.2.25", -] - [[package]] name = "tokio-reactor" version = "0.1.12" @@ -3989,7 +3131,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" dependencies = [ "futures-core", - "pin-project-lite 0.2.7", + "pin-project-lite", "tokio 1.9.0", ] @@ -4092,20 +3234,6 @@ dependencies = [ "tokio-reactor", ] -[[package]] -name = "tokio-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" -dependencies = [ - "bytes 0.5.6", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.1.12", - "tokio 0.2.25", -] - [[package]] name = "tokio-util" version = "0.6.7" @@ -4116,7 +3244,7 @@ dependencies = [ "futures-core", "futures-sink", "log", - "pin-project-lite 0.2.7", + "pin-project-lite", "slab", "tokio 1.9.0", ] @@ -4133,7 +3261,7 @@ dependencies = [ "bytes 1.0.1", "futures-core", "futures-util", - "h2 0.3.3", + "h2", "http", "http-body", "hyper", @@ -4145,7 +3273,7 @@ dependencies = [ "tokio 1.9.0", "tokio-rustls", "tokio-stream", - "tokio-util 0.6.7", + "tokio-util", "tower", "tower-layer", "tower-service", @@ -4179,7 +3307,7 @@ dependencies = [ "slab", "tokio 1.9.0", "tokio-stream", - "tokio-util 0.6.7", + "tokio-util", "tower-layer", "tower-service", "tracing", @@ -4223,7 +3351,7 @@ checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite 0.2.7", + "pin-project-lite", "tracing-attributes", "tracing-core", ] @@ -4273,45 +3401,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" -[[package]] -name = "trust-dns-proto" -version = "0.19.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cad71a0c0d68ab9941d2fb6e82f8fb2e86d9945b94e1661dd0aaea2b88215a9" -dependencies = [ - "async-trait", - "cfg-if 1.0.0", - "enum-as-inner", - "futures 0.3.16", - "idna 0.2.3", - "lazy_static", - "log", - "rand 0.7.3", - "smallvec 1.6.1", - "thiserror", - "tokio 0.2.25", - "url 2.2.2", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.19.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710f593b371175db53a26d0b38ed2978fafb9e9e8d3868b1acd753ea18df0ceb" -dependencies = [ - "cfg-if 0.1.10", - "futures 0.3.16", - "ipconfig", - "lazy_static", - "log", - "lru-cache", - "resolv-conf", - "smallvec 1.6.1", - "thiserror", - "tokio 0.2.25", - "trust-dns-proto", -] - [[package]] name = "try-lock" version = "0.2.3" @@ -4434,12 +3523,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" -[[package]] -name = "unicode-width" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" - [[package]] name = "unicode-xid" version = "0.2.2" @@ -4506,12 +3589,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.3" @@ -4558,7 +3635,7 @@ dependencies = [ "tokio 1.9.0", "tokio-stream", "tokio-tungstenite", - "tokio-util 0.6.7", + "tokio-util", "tower-service", "tracing", ] @@ -4582,8 +3659,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b608ecc8f4198fe8680e2ed18eccab5f0cd4caaf3d83516fa5fb2e927fda2586" dependencies = [ "cfg-if 1.0.0", - "serde", - "serde_json", "wasm-bindgen-macro", ] @@ -4653,25 +3728,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webhook-configuration" -version = "0.6.11" -dependencies = [ - "actix", - "actix-rt 2.2.0", - "actix-web", - "akri-shared", - "clap", - "k8s-openapi", - "kube", - "kube-runtime", - "openapi", - "openssl", - "rustls", - "serde", - "serde_json", -] - [[package]] name = "webpki" version = "0.21.4" @@ -4702,12 +3758,6 @@ dependencies = [ "libc", ] -[[package]] -name = "widestring" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" - [[package]] name = "winapi" version = "0.2.8" @@ -4751,24 +3801,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "winreg" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "winreg" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "ws2_32-sys" version = "0.2.1" diff --git a/Cargo.toml b/Cargo.toml index de8d6115c..25326070c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [ "agent", "controller", "samples/brokers/udev-video-broker", - "webhooks/validating/configuration", + # "webhooks/validating/configuration", "discovery-utils", "discovery-handlers/debug-echo", "discovery-handlers/onvif", diff --git a/agent/src/util/config_action.rs b/agent/src/util/config_action.rs index 954f29445..165d44d68 100644 --- a/agent/src/util/config_action.rs +++ b/agent/src/util/config_action.rs @@ -286,7 +286,7 @@ pub async fn delete_all_instances_in_map( .send(device_plugin_service::ListAndWatchMessageKind::End) .unwrap(); instance_map_locked.remove(&instance_name); - try_delete_instance(kube_interface, &instance_name, &namespace).await?; + try_delete_instance(kube_interface, &instance_name, namespace).await?; } Ok(()) } diff --git a/agent/src/util/crictl_containers.rs b/agent/src/util/crictl_containers.rs index 8a44179b0..e3dea472a 100644 --- a/agent/src/util/crictl_containers.rs +++ b/agent/src/util/crictl_containers.rs @@ -17,7 +17,7 @@ struct CriCtlContainer { /// This gets the usage slots for an instance by getting the annotations that were stored at id `AKRI_SLOT_ANNOTATION_NAME` during allocate. pub fn get_container_slot_usage(crictl_output: &str) -> HashSet { - match serde_json::from_str::(&crictl_output) { + match serde_json::from_str::(crictl_output) { Ok(crictl_output_parsed) => crictl_output_parsed .containers .iter() diff --git a/agent/src/util/device_plugin_service.rs b/agent/src/util/device_plugin_service.rs index 38bba7126..444d42ddc 100644 --- a/agent/src/util/device_plugin_service.rs +++ b/agent/src/util/device_plugin_service.rs @@ -396,7 +396,7 @@ async fn try_update_instance_device_usage( for x in 0..MAX_INSTANCE_UPDATE_TRIES { // Grab latest instance match kube_interface - .find_instance(&instance_name, &instance_namespace) + .find_instance(instance_name, instance_namespace) .await { Ok(instance_object) => instance = instance_object.spec, @@ -424,7 +424,7 @@ async fn try_update_instance_device_usage( .insert(device_usage_id.to_string(), value.clone()); match kube_interface - .update_instance(&instance, &instance_name, &instance_namespace) + .update_instance(&instance, instance_name, instance_namespace) .await { Ok(()) => { diff --git a/agent/src/util/discovery_operator.rs b/agent/src/util/discovery_operator.rs index 668ef3036..023598900 100644 --- a/agent/src/util/discovery_operator.rs +++ b/agent/src/util/discovery_operator.rs @@ -704,11 +704,11 @@ pub mod start_discovery { ) -> Result<(), Box> { loop { let deregistered; - match discovery_operator.get_stream(&endpoint).await { + match discovery_operator.get_stream(endpoint).await { Some(stream_type) => { // Since connection was established, be sure that the Discovery Handler is marked as having a client discovery_operator.set_discovery_handler_connectivity_status( - &endpoint, + endpoint, DiscoveryHandlerStatus::Active, ); match stream_type { @@ -716,14 +716,14 @@ pub mod start_discovery { match discovery_operator .internal_do_discover( kube_interface.clone(), - &dh_details, + dh_details, &mut stream, ) .await { Ok(_) => { discovery_operator.set_discovery_handler_connectivity_status( - &endpoint, + endpoint, DiscoveryHandlerStatus::Waiting, ); break; @@ -740,7 +740,7 @@ pub mod start_discovery { ) .await?; deregistered = discovery_operator - .mark_offline_or_deregister_discovery_handler(&endpoint) + .mark_offline_or_deregister_discovery_handler(endpoint) .await .unwrap(); } else { @@ -756,7 +756,7 @@ pub mod start_discovery { .await?; discovery_operator .set_discovery_handler_connectivity_status( - &endpoint, + endpoint, DiscoveryHandlerStatus::Waiting, ); break; @@ -768,13 +768,13 @@ pub mod start_discovery { discovery_operator .internal_do_discover( kube_interface.clone(), - &dh_details, + dh_details, &mut stream, ) .await .unwrap(); discovery_operator.set_discovery_handler_connectivity_status( - &endpoint, + endpoint, DiscoveryHandlerStatus::Waiting, ); break; @@ -783,7 +783,7 @@ pub mod start_discovery { } None => { deregistered = discovery_operator - .mark_offline_or_deregister_discovery_handler(&endpoint) + .mark_offline_or_deregister_discovery_handler(endpoint) .await .unwrap(); } diff --git a/agent/src/util/registration.rs b/agent/src/util/registration.rs index dd6f47afc..059e922bc 100644 --- a/agent/src/util/registration.rs +++ b/agent/src/util/registration.rs @@ -1,6 +1,6 @@ -use super::constants::{ - CLOSE_DISCOVERY_HANDLER_CONNECTION_CHANNEL_CAPACITY, ENABLE_DEBUG_ECHO_LABEL, -}; +use super::constants::CLOSE_DISCOVERY_HANDLER_CONNECTION_CHANNEL_CAPACITY; +#[cfg(any(test, feature = "agent-full"))] +use super::constants::ENABLE_DEBUG_ECHO_LABEL; use akri_discovery_utils::discovery::v0::{ register_discovery_handler_request::EndpointType, registration_server::{Registration, RegistrationServer}, diff --git a/controller/src/util/instance_action.rs b/controller/src/util/instance_action.rs index 316e617f2..12bd2bc98 100644 --- a/controller/src/util/instance_action.rs +++ b/controller/src/util/instance_action.rs @@ -258,7 +258,7 @@ async fn handle_deletion_work( &"pod".to_string() ); let pod_app_name = pod::create_pod_app_name( - &instance_name, + instance_name, context_node_name, instance_shared, &"pod".to_string(), @@ -269,7 +269,7 @@ async fn handle_deletion_work( &context_namespace ); kube_interface - .remove_pod(&pod_app_name, &context_namespace) + .remove_pod(&pod_app_name, context_namespace) .await?; trace!("handle_deletion_work - pod::remove_pod succeeded",); BROKER_POD_COUNT_METRIC @@ -348,9 +348,9 @@ async fn handle_addition_work( if let Some(broker_pod_spec) = &instance_configuration.spec.broker_pod_spec { let capability_id = format!("{}/{}", AKRI_PREFIX, instance_name); let new_pod = pod::create_new_pod_from_spec( - &instance_namespace, - &instance_name, - &instance_class_name, + instance_namespace, + instance_name, + instance_class_name, OwnershipInfo::new( OwnershipType::Instance, instance_name.to_string(), @@ -359,13 +359,13 @@ async fn handle_addition_work( &capability_id, &new_node.to_string(), instance_shared, - &broker_pod_spec, + broker_pod_spec, )?; trace!("handle_addition_work - New pod spec={:?}", new_pod); kube_interface - .create_pod(&new_pod, &instance_namespace) + .create_pod(&new_pod, instance_namespace) .await?; trace!("handle_addition_work - pod::create_pod succeeded",); BROKER_POD_COUNT_METRIC @@ -483,7 +483,7 @@ pub async fn handle_instance_change( &instance.spec.configuration_name ); let instance_configuration = match kube_interface - .find_configuration(&instance.spec.configuration_name, &instance_namespace) + .find_configuration(&instance.spec.configuration_name, instance_namespace) .await { Ok(config) => config, @@ -511,12 +511,12 @@ pub async fn handle_instance_change( for new_node in nodes_to_add { handle_addition_work( &instance_name, - &instance_uid, - &instance_namespace, + instance_uid, + instance_namespace, &instance.spec.configuration_name, instance.spec.shared, &new_node, - &instance_configuration_option.as_ref().unwrap(), + instance_configuration_option.as_ref().unwrap(), kube_interface, ) .await?; @@ -969,7 +969,7 @@ mod handle_instance_tests { )), }, ); - run_handle_instance_change_test(&mut mock, &instance_file, &InstanceAction::Update).await; + run_handle_instance_change_test(&mut mock, instance_file, &InstanceAction::Update).await; } /// Checks that the BROKER_POD_COUNT_METRIC is appropriately incremented diff --git a/controller/src/util/node_watcher.rs b/controller/src/util/node_watcher.rs index 3c3a4c5ea..7e40c8a41 100644 --- a/controller/src/util/node_watcher.rs +++ b/controller/src/util/node_watcher.rs @@ -227,21 +227,21 @@ impl NodeWatcher { for x in 0..MAX_INSTANCE_UPDATE_TRIES { match if x == 0 { self.try_remove_nodes_from_instance( - &vanished_node_name, + vanished_node_name, &instance_name, - &instance_namespace, + instance_namespace, &instance, kube_interface, ) .await } else { let retry_instance = kube_interface - .find_instance(&instance_name, &instance_namespace) + .find_instance(&instance_name, instance_namespace) .await?; self.try_remove_nodes_from_instance( - &vanished_node_name, + vanished_node_name, &instance_name, - &instance_namespace, + instance_namespace, &retry_instance, kube_interface, ) @@ -318,7 +318,7 @@ impl NodeWatcher { ); kube_interface - .update_instance(&modified_instance, &instance_name, &instance_namespace) + .update_instance(&modified_instance, instance_name, instance_namespace) .await } } @@ -561,7 +561,7 @@ mod tests { let node_watcher = NodeWatcher::new(); assert!(node_watcher - .handle_node_disappearance(&"foo-a", &mock,) + .handle_node_disappearance("foo-a", &mock) .await .is_err()); } diff --git a/controller/src/util/pod_watcher.rs b/controller/src/util/pod_watcher.rs index 605071636..ca8a27e9a 100644 --- a/controller/src/util/pod_watcher.rs +++ b/controller/src/util/pod_watcher.rs @@ -187,7 +187,7 @@ impl BrokerPodWatcher { // per transition into the Running state if last_known_state != &PodState::Running { trace!("handle_running_pod_if_needed - call handle_running_pod"); - self.handle_running_pod(&pod, kube_interface).await?; + self.handle_running_pod(pod, kube_interface).await?; self.known_pods.insert(pod_name, PodState::Running); } Ok(()) @@ -217,7 +217,7 @@ impl BrokerPodWatcher { // per transition into the Ended state if last_known_state != &PodState::Ended { trace!("handle_ended_pod_if_needed - call handle_non_running_pod"); - self.handle_non_running_pod(&pod, kube_interface).await?; + self.handle_non_running_pod(pod, kube_interface).await?; self.known_pods.insert(pod_name, PodState::Ended); } Ok(()) @@ -247,7 +247,7 @@ impl BrokerPodWatcher { // per transition into the Deleted state if last_known_state != &PodState::Deleted { trace!("handle_deleted_pod_if_needed - call handle_non_running_pod"); - self.handle_non_running_pod(&pod, kube_interface).await?; + self.handle_non_running_pod(pod, kube_interface).await?; self.known_pods.insert(pod_name, PodState::Deleted); } Ok(()) @@ -291,7 +291,7 @@ impl BrokerPodWatcher { self.find_pods_and_cleanup_svc_if_unsupported( &instance_id, &config_name, - &namespace, + namespace, true, kube_interface, ) @@ -299,14 +299,14 @@ impl BrokerPodWatcher { self.find_pods_and_cleanup_svc_if_unsupported( &instance_id, &config_name, - &namespace, + namespace, false, kube_interface, ) .await?; // Make sure instance has required Pods - if let Ok(instance) = kube_interface.find_instance(&instance_id, &namespace).await { + if let Ok(instance) = kube_interface.find_instance(&instance_id, namespace).await { super::instance_action::handle_instance_change( &instance, &super::instance_action::InstanceAction::Update, @@ -349,8 +349,8 @@ impl BrokerPodWatcher { ); let svc_name = service::create_service_app_name( - &configuration_name, - &instance_id, + configuration_name, + instance_id, &"svc".to_string(), handle_instance_svc, ); @@ -393,7 +393,7 @@ impl BrokerPodWatcher { &svc_name, &svc_namespace ); kube_interface - .remove_service(&svc_name, &svc_namespace) + .remove_service(svc_name, svc_namespace) .await?; trace!("cleanup_svc_if_unsupported - service::remove_service succeeded"); } @@ -416,7 +416,7 @@ impl BrokerPodWatcher { let (instance_name, configuration_name) = self.get_instance_and_configuration_from_pod(pod)?; let configuration = match kube_interface - .find_configuration(&configuration_name, &namespace) + .find_configuration(&configuration_name, namespace) .await { Ok(config) => config, @@ -431,7 +431,7 @@ impl BrokerPodWatcher { } }; let instance = match kube_interface - .find_instance(&instance_name, &namespace) + .find_instance(&instance_name, namespace) .await { Ok(instance) => instance, @@ -452,8 +452,8 @@ impl BrokerPodWatcher { .ok_or(format!("UID not found for instance: {}", instance_name))?; self.add_instance_and_configuration_services( &instance_name, - &instance_uid, - &namespace, + instance_uid, + namespace, &configuration_name, &configuration, kube_interface, @@ -514,9 +514,9 @@ impl BrokerPodWatcher { if create_new_service { let new_instance_svc = service::create_new_service_from_spec( - &namespace, - &instance_name, - &configuration_name, + namespace, + instance_name, + configuration_name, ownership.clone(), service_spec, is_instance_service, @@ -527,7 +527,7 @@ impl BrokerPodWatcher { ); kube_interface - .create_service(&new_instance_svc, &namespace) + .create_service(&new_instance_svc, namespace) .await?; trace!("create_or_update_service - service::create_service succeeded"); } @@ -1485,11 +1485,11 @@ mod tests { fn configure_for_handle_pod(mock: &mut MockKubeInterface, handle_pod: &HandlePod) { if let Some(running) = &handle_pod.running { - configure_for_running_pod_work(mock, &running); + configure_for_running_pod_work(mock, running); } if let Some(ended) = &handle_pod.ended { - configure_for_cleanup_broker_and_configuration_svcs(mock, &ended); + configure_for_cleanup_broker_and_configuration_svcs(mock, ended); } } } diff --git a/discovery-handlers/debug-echo/src/discovery_handler.rs b/discovery-handlers/debug-echo/src/discovery_handler.rs index b51aaa2c2..b5dd4d39e 100644 --- a/discovery-handlers/debug-echo/src/discovery_handler.rs +++ b/discovery-handlers/debug-echo/src/discovery_handler.rs @@ -174,7 +174,7 @@ mod tests { descriptions: - "foo1" "#; - let deserialized: DiscoveryHandlerInfo = serde_yaml::from_str(&debug_echo_yaml).unwrap(); + let deserialized: DiscoveryHandlerInfo = serde_yaml::from_str(debug_echo_yaml).unwrap(); let discovery_handler = DiscoveryHandlerImpl::new(None); let properties: HashMap = [( super::super::DEBUG_ECHO_DESCRIPTION_LABEL.to_string(), diff --git a/discovery-handlers/onvif/src/discovery_handler.rs b/discovery-handlers/onvif/src/discovery_handler.rs index bd549a89c..867b4f72a 100644 --- a/discovery-handlers/onvif/src/discovery_handler.rs +++ b/discovery-handlers/onvif/src/discovery_handler.rs @@ -209,9 +209,9 @@ mod tests { if let Some(ip_and_mac_) = ip_and_mac { configure_get_device_ip_and_mac_address( mock, - &ip_and_mac_.mock_uri, - &ip_and_mac_.mock_ip, - &ip_and_mac_.mock_mac, + ip_and_mac_.mock_uri, + ip_and_mac_.mock_ip, + ip_and_mac_.mock_mac, ) } } diff --git a/discovery-handlers/onvif/src/discovery_impl.rs b/discovery-handlers/onvif/src/discovery_impl.rs index f2826e4b1..1d850ab06 100644 --- a/discovery-handlers/onvif/src/discovery_impl.rs +++ b/discovery-handlers/onvif/src/discovery_impl.rs @@ -183,7 +183,7 @@ pub mod util { scopes: Option<&FilterList>, ) -> Vec { let response_envelope = - yaserde::de::from_str::(&discovery_response); + yaserde::de::from_str::(discovery_response); // The response envelope follows this format: // // https://10.0.0.1:5357/svc @@ -288,7 +288,7 @@ pub mod util { "get_discovery_response_socket - binding to: {:?}", local_socket_addr ); - let mut socket = UdpSocket::bind(local_socket_addr).await?; + let socket = UdpSocket::bind(local_socket_addr).await?; trace!( "get_discovery_response_socket - joining multicast: {:?} {:?}", &MULTI_IPV4_ADDR, diff --git a/discovery-handlers/onvif/src/discovery_utils.rs b/discovery-handlers/onvif/src/discovery_utils.rs index 29cb10586..184f87a13 100644 --- a/discovery-handlers/onvif/src/discovery_utils.rs +++ b/discovery-handlers/onvif/src/discovery_utils.rs @@ -100,7 +100,7 @@ struct HttpRequest {} impl HttpRequest { /// This converts an http response body into an sxd_document::Package fn handle_request_body(body: &str) -> Result { - let xml_as_tree = match parser::parse(&body) { + let xml_as_tree = match parser::parse(body) { Ok(xml_as_tree) => xml_as_tree, Err(e) => return Err(Error::new(ErrorKind::InvalidData, e).into()), }; @@ -157,7 +157,7 @@ impl Http for HttpRequest { .await? .freeze(); let response_body_str = std::str::from_utf8(&response_body)?; - match HttpRequest::handle_request_body(&response_body_str) { + match HttpRequest::handle_request_body(response_body_str) { Ok(dom) => Ok(dom), Err(e) => Err(Error::new(ErrorKind::InvalidData, e).into()), } @@ -244,7 +244,7 @@ async fn inner_get_device_service_uri( ) -> Result { let services_xml = match http .post( - &url, + url, &get_action(DEVICE_WSDL, "GetServices"), &GET_SERVICES_TEMPLATE.to_string(), ) @@ -296,7 +296,7 @@ async fn inner_get_device_profiles( ) -> Result, anyhow::Error> { let action = get_action(MEDIA_WSDL, "GetProfiles"); let message = GET_PROFILES_TEMPLATE.to_string(); - let profiles_xml = match http.post(&url, &action, &message).await { + let profiles_xml = match http.post(url, &action, &message).await { Ok(xml) => xml, Err(e) => { return Err(anyhow::format_err!( @@ -332,9 +332,9 @@ async fn inner_get_device_profile_streaming_uri( profile_token: &str, http: &impl Http, ) -> Result { - let stream_soap = get_stream_uri_message(&profile_token); + let stream_soap = get_stream_uri_message(profile_token); let stream_uri_xml = match http - .post(&url, &get_action(MEDIA_WSDL, "GetStreamUri"), &stream_soap) + .post(url, &get_action(MEDIA_WSDL, "GetStreamUri"), &stream_soap) .await { Ok(xml) => xml, diff --git a/discovery-handlers/opcua/src/discovery_handler.rs b/discovery-handlers/opcua/src/discovery_handler.rs index cc50e23a5..628ee8437 100644 --- a/discovery-handlers/opcua/src/discovery_handler.rs +++ b/discovery-handlers/opcua/src/discovery_handler.rs @@ -167,7 +167,7 @@ mod tests { opcuaDiscoveryMethod: standard: {} "#; - let dh_config: OpcuaDiscoveryDetails = deserialize_discovery_details(&yaml).unwrap(); + let dh_config: OpcuaDiscoveryDetails = deserialize_discovery_details(yaml).unwrap(); let serialized = serde_json::to_string(&dh_config).unwrap(); let expected_deserialized = r#"{"opcuaDiscoveryMethod":{"standard":{"discoveryUrls":["opc.tcp://localhost:4840/"]}}}"#; assert_eq!(expected_deserialized, serialized); @@ -186,7 +186,7 @@ mod tests { items: - "Some application name" "#; - let dh_config: OpcuaDiscoveryDetails = deserialize_discovery_details(&yaml).unwrap(); + let dh_config: OpcuaDiscoveryDetails = deserialize_discovery_details(yaml).unwrap(); let serialized = serde_json::to_string(&dh_config).unwrap(); let expected_serialized = r#"{"opcuaDiscoveryMethod":{"standard":{"discoveryUrls":["opc.tcp://127.0.0.1:4855/"]}},"applicationNames":{"items":["Some application name"],"action":"Include"}}"#; assert_eq!(expected_serialized, serialized); diff --git a/discovery-handlers/opcua/src/discovery_impl.rs b/discovery-handlers/opcua/src/discovery_impl.rs index 262421ee5..9a7129a23 100644 --- a/discovery-handlers/opcua/src/discovery_impl.rs +++ b/discovery-handlers/opcua/src/discovery_impl.rs @@ -161,7 +161,7 @@ fn get_discovery_url_from_application_description( /// This returns a socket address for the OPC UA DiscoveryURL else an error if not properly formatted fn get_socket_addr(url: &str) -> Result { - let url = Url::parse(&url).map_err(|_| anyhow::format_err!("could not parse url"))?; + let url = Url::parse(url).map_err(|_| anyhow::format_err!("could not parse url"))?; if url.scheme() != OPC_TCP_SCHEME { return Err(anyhow::format_err!( "format of OPC UA url {} is not valid", diff --git a/discovery-handlers/udev/src/discovery_handler.rs b/discovery-handlers/udev/src/discovery_handler.rs index 44cdb5451..9b12ec97b 100644 --- a/discovery-handlers/udev/src/discovery_handler.rs +++ b/discovery-handlers/udev/src/discovery_handler.rs @@ -60,7 +60,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { let mut devpaths: HashSet = HashSet::new(); udev_rules.iter().for_each(|rule| { let enumerator = udev_enumerator::create_enumerator(); - let paths = do_parse_and_find(enumerator, &rule).unwrap(); + let paths = do_parse_and_find(enumerator, rule).unwrap(); paths.into_iter().for_each(|path| { devpaths.insert(path); }); diff --git a/samples/brokers/udev-video-broker/src/util/camera_capturer.rs b/samples/brokers/udev-video-broker/src/util/camera_capturer.rs index 90e162308..3082ed988 100644 --- a/samples/brokers/udev-video-broker/src/util/camera_capturer.rs +++ b/samples/brokers/udev-video-broker/src/util/camera_capturer.rs @@ -41,9 +41,9 @@ pub fn build_and_start_camera_capturer(devnode: &str) -> RsCamera { .collect(); let format_string = get_format(&env_var_query, format_options); let format = format_string[..].as_bytes(); - let resolution_info = camera_capturer.resolutions(&format).unwrap(); + let resolution_info = camera_capturer.resolutions(format).unwrap(); let resolution = get_resolution(&env_var_query, resolution_info); - let interval_info = camera_capturer.intervals(&format, resolution).unwrap(); + let interval_info = camera_capturer.intervals(format, resolution).unwrap(); let interval = get_interval(&env_var_query, interval_info); trace!("build_and_start_camera_capturer - before starting camera"); camera_capturer diff --git a/shared/src/akri/configuration.rs b/shared/src/akri/configuration.rs index edb95884c..8492e2188 100644 --- a/shared/src/akri/configuration.rs +++ b/shared/src/akri/configuration.rs @@ -235,7 +235,7 @@ mod crd_serialization_tests { ]; for file in &files { log::trace!("test file: {}", &file); - let yaml = file::read_file_to_string(&file); + let yaml = file::read_file_to_string(file); log::trace!("test file contents: {}", &yaml); let deserialized: Configuration = serde_yaml::from_str(&yaml).unwrap(); log::trace!("test file deserialized: {:?}", &deserialized); diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs index 334b4f311..022b58be4 100644 --- a/shared/src/akri/instance.rs +++ b/shared/src/akri/instance.rs @@ -404,7 +404,7 @@ mod crd_serializeation_tests { "../test/yaml/akri-instance-usb-camera.yaml", ]; for file in &files { - let yaml = file::read_file_to_string(&file); + let yaml = file::read_file_to_string(file); let deserialized: Instance = serde_yaml::from_str(&yaml).unwrap(); let _ = serde_json::to_string(&deserialized).unwrap(); } diff --git a/shared/src/k8s/mod.rs b/shared/src/k8s/mod.rs index 6ab5868f4..61b74caac 100644 --- a/shared/src/k8s/mod.rs +++ b/shared/src/k8s/mod.rs @@ -525,7 +525,7 @@ pub async fn try_delete_instance( ) -> Result<(), anyhow::Error> { for x in 0..MAX_INSTANCE_UPDATE_TRIES { match kube_interface - .delete_instance(instance_name, &instance_namespace) + .delete_instance(instance_name, instance_namespace) .await { Ok(()) => { @@ -535,7 +535,7 @@ pub async fn try_delete_instance( Err(e) => { // Check if already was deleted else return error match kube_interface - .find_instance(&instance_name, &instance_namespace) + .find_instance(instance_name, instance_namespace) .await { Err(e) => { diff --git a/shared/src/k8s/pod.rs b/shared/src/k8s/pod.rs index 73471a71c..69ebc3916 100644 --- a/shared/src/k8s/pod.rs +++ b/shared/src/k8s/pod.rs @@ -342,7 +342,7 @@ mod broker_podspec_tests { do_pod_spec_creation_test( vec![image.clone()], vec![Container { - image: Some(image.clone()), + image: Some(image), resources: Some(ResourceRequirements { limits: Some(placeholder_limits), requests: Some(placeholder_requests), diff --git a/shared/src/k8s/service.rs b/shared/src/k8s/service.rs index 20eba5f95..bf217d0a3 100644 --- a/shared/src/k8s/service.rs +++ b/shared/src/k8s/service.rs @@ -118,12 +118,8 @@ pub fn create_new_service_from_spec( svc_spec: &ServiceSpec, node_specific_svc: bool, ) -> Result> { - let app_name = create_service_app_name( - configuration_name, - instance_name, - "svc", - node_specific_svc, - ); + let app_name = + create_service_app_name(configuration_name, instance_name, "svc", node_specific_svc); let mut labels: BTreeMap = BTreeMap::new(); labels.insert(APP_LABEL_ID.to_string(), app_name.clone()); labels.insert(CONTROLLER_LABEL_ID.to_string(), API_NAMESPACE.to_string()); diff --git a/shared/src/os/mod.rs b/shared/src/os/mod.rs index 15b0e7942..efe654007 100644 --- a/shared/src/os/mod.rs +++ b/shared/src/os/mod.rs @@ -14,7 +14,7 @@ pub mod file { } /// This will read a file (as provided by a relative path) into a String pub fn read_file_to_string(relative_path: &str) -> String { - let file_path = get_canonical_path(&relative_path); + let file_path = get_canonical_path(relative_path); fs::read_to_string(&file_path) .unwrap_or_else(|_| panic!("unable to read file: {}", &file_path)) } diff --git a/webhooks/validating/configuration/src/main.rs b/webhooks/validating/configuration/src/main.rs index f82b82b45..077094f7b 100644 --- a/webhooks/validating/configuration/src/main.rs +++ b/webhooks/validating/configuration/src/main.rs @@ -27,7 +27,7 @@ fn check( match v { serde_json::Value::Object(o) => { for (key, value) in o { - if let Err(e) = check(&value, &deserialized[key]) { + if let Err(e) = check(value, &deserialized[key]) { return Err(None.ok_or(format!( "input key ({:?}) not equal to parsed: ({:?})", key, e @@ -179,7 +179,7 @@ async fn validate(rqst: web::Json) -> impl Responder { match &rqst.request { Some(rqst) => { println!("Handler received: AdmissionRequest"); - let resp = validate_configuration(&rqst); + let resp = validate_configuration(rqst); let resp: AdmissionReview = AdmissionReview { api_version: Some("admission.k8s.io/v1".to_owned()), kind: Some("AdmissionReview".to_owned()), @@ -187,11 +187,11 @@ async fn validate(rqst: web::Json) -> impl Responder { response: Some(resp), }; let body = serde_json::to_string(&resp).expect("Valid AdmissionReview"); - return HttpResponse::Ok().body(body); + HttpResponse::Ok().body(body) } None => { println!("Handler received: Nothing"); - return HttpResponse::BadRequest().body(""); + HttpResponse::BadRequest().body("") } } } From 5a8c26c58bbc7c0d482521e65155e727182f60a2 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 12 Aug 2021 09:16:01 -0700 Subject: [PATCH 05/22] use watch API instead of watcher and more clippy fixes --- Cargo.lock | 3 +- Cargo.toml | 4 +- agent/src/util/config_action.rs | 72 ++++++++------ agent/src/util/device_plugin_builder.rs | 6 +- agent/src/util/device_plugin_service.rs | 2 +- agent/src/util/discovery_operator.rs | 82 +++++++--------- agent/src/util/embedded_discovery_handlers.rs | 6 +- controller/src/util/instance_action.rs | 45 +++++---- controller/src/util/node_watcher.rs | 80 ++++++++-------- controller/src/util/pod_watcher.rs | 96 +++++++++---------- shared/src/akri/mod.rs | 6 +- 11 files changed, 205 insertions(+), 197 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cfac276ca..e3e9cee21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1135,8 +1135,7 @@ dependencies = [ [[package]] name = "h2" version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" +source = "git+https://github.com/kate-goldenring/h2?branch=v0.3.3-patch#353943d123e9cb7b29e376ee8927be5deffe5f57" dependencies = [ "bytes 1.0.1", "fnv", diff --git a/Cargo.toml b/Cargo.toml index 25326070c..7dc0f379f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ # Patch to allow invalid authority headers provided by grpc-go / kubelet # Issue to track: https://github.com/grpc/grpc-go/issues/2628 -# [patch.crates-io] -# h2 = { git = "https://github.com/kate-goldenring/h2", branch = "master" } +[patch.crates-io] +h2 = { git = "https://github.com/kate-goldenring/h2", branch = "v0.3.3-patch" } [workspace] members = [ diff --git a/agent/src/util/config_action.rs b/agent/src/util/config_action.rs index 165d44d68..c10dd7d5b 100644 --- a/agent/src/util/config_action.rs +++ b/agent/src/util/config_action.rs @@ -14,8 +14,7 @@ use akri_shared::{ k8s::{try_delete_instance, KubeInterface}, }; use futures::{StreamExt, TryStreamExt}; -use kube::api::{Api, ListParams}; -use kube_runtime::watcher::{watcher, Event}; +use kube::api::{Api, ListParams, WatchEvent}; use log::{info, trace}; use std::{collections::HashMap, sync::Arc}; use tokio::sync::{broadcast, mpsc, Mutex}; @@ -55,7 +54,7 @@ pub async fn do_config_watch( let new_discovery_handler_sender = new_discovery_handler_sender.clone(); tasks.push(tokio::spawn(async move { handle_config_add( - Arc::new(Box::new(k8s::KubeImpl::new().await.unwrap())), + Arc::new(k8s::KubeImpl::new().await.unwrap()), &config, config_map, discovery_handler_map, @@ -92,11 +91,16 @@ async fn watch_for_config_changes( ) -> Result<(), Box> { trace!("watch_for_config_changes - start"); let resource = Api::::all(kube_interface.get_kube_client()); - let watcher = watcher(resource, ListParams::default()); - let mut informer = watcher.boxed(); + let mut stream = resource + .watch( + &ListParams::default(), + akri_shared::akri::API_VERSION_NUMBER, + ) + .await? + .boxed(); // Currently, this does not handle None except to break the // while. - while let Some(event) = informer.try_next().await? { + while let Some(event) = stream.try_next().await? { let new_discovery_handler_sender = new_discovery_handler_sender.clone(); handle_config( kube_interface, @@ -114,32 +118,21 @@ async fn watch_for_config_changes( /// correct function based on the event type. async fn handle_config( kube_interface: &impl KubeInterface, - event: Event, + event: WatchEvent, config_map: ConfigMap, discovery_handler_map: RegisteredDiscoveryHandlerMap, new_discovery_handler_sender: broadcast::Sender, ) -> Result<(), Box> { trace!("handle_config - something happened to a configuration"); match event { - Event::Applied(config) => { + WatchEvent::Added(config) => { info!( - "handle_config - applied Configuration {:?}", - config.metadata.name, + "handle_config - added Configuration {:?}", + config.metadata.name ); - // Applied events can either be newly added Configurations or modified Configurations. - // If modified delete all associated instances and device plugins and then recreate them to reflect updated config - // TODO: more gracefully handle modified Configurations by determining what changed rather than delete/re-add - if config_map - .lock() - .await - .contains_key(config.metadata.name.as_ref().unwrap()) - { - handle_config_delete(kube_interface, &config, config_map.clone()).await?; - } - tokio::spawn(async move { handle_config_add( - Arc::new(Box::new(k8s::KubeImpl::new().await.unwrap())), + Arc::new(k8s::KubeImpl::new().await.unwrap()), &config, config_map, discovery_handler_map, @@ -150,7 +143,7 @@ async fn handle_config( }); Ok(()) } - Event::Deleted(config) => { + WatchEvent::Deleted(config) => { info!( "handle_config - deleted Configuration {:?}", config.metadata.name, @@ -158,18 +151,38 @@ async fn handle_config( handle_config_delete(kube_interface, &config, config_map).await?; Ok(()) } - Event::Restarted(_configs) => { - // TODO: determine whether this can be handled. For now, bubble up error to restart controller. - // TODO: use anyhow! - None.ok_or("Configuration watcher restarted due to watch stream dropping")? + // If a config is updated, delete all associated instances and device plugins and then recreate them to reflect updated config + WatchEvent::Modified(config) => { + info!( + "handle_config - modified Configuration {:?}", + config.metadata.name, + ); + handle_config_delete(kube_interface, &config, config_map.clone()).await?; + tokio::spawn(async move { + handle_config_add( + Arc::new(k8s::KubeImpl::new().await.unwrap()), + &config, + config_map, + discovery_handler_map, + new_discovery_handler_sender, + ) + .await + .unwrap(); + }); + Ok(()) + } + WatchEvent::Error(ref e) => { + error!("handle_config - error for Configuration: {}", e); + Ok(()) } + WatchEvent::Bookmark(_) => Ok(()), } } /// This handles added Configuration by creating a new ConfigInfo for it and adding it to the ConfigMap. /// Then calls a function to continually observe the availability of instances associated with the Configuration. async fn handle_config_add( - kube_interface: Arc>, + kube_interface: Arc, config: &Configuration, config_map: ConfigMap, discovery_handler_map: RegisteredDiscoveryHandlerMap, @@ -380,8 +393,7 @@ mod config_action_tests { .expect_create_instance() .times(1) .returning(move |_, _, _, _, _| Ok(())); - let arc_mock_kube_interface: Arc> = - Arc::new(Box::new(mock_kube_interface)); + let arc_mock_kube_interface: Arc = Arc::new(mock_kube_interface); let config_add_config = config.clone(); let config_add_config_map = config_map.clone(); let config_add_discovery_handler_map = discovery_handler_map.clone(); diff --git a/agent/src/util/device_plugin_builder.rs b/agent/src/util/device_plugin_builder.rs index dc3f75d78..0a208cb9d 100644 --- a/agent/src/util/device_plugin_builder.rs +++ b/agent/src/util/device_plugin_builder.rs @@ -313,7 +313,7 @@ pub mod tests { "socket.sock", "random_instance", server_ender_sender, - &kubelet_socket_str + kubelet_socket_str ) .await .is_ok()); @@ -335,7 +335,7 @@ pub mod tests { "socket.sock", "random_instance", server_ender_sender.clone(), - &kubelet_socket_str + kubelet_socket_str ) .await .is_err()); @@ -359,7 +359,7 @@ pub mod tests { "socket.sock", "random_instance", server_ender_sender, - &kubelet_socket_str + kubelet_socket_str ) .await .is_ok()); diff --git a/agent/src/util/device_plugin_service.rs b/agent/src/util/device_plugin_service.rs index 444d42ddc..978f5eed6 100644 --- a/agent/src/util/device_plugin_service.rs +++ b/agent/src/util/device_plugin_service.rs @@ -821,7 +821,7 @@ mod device_plugin_service_tests { NodeName::ThisNode => "node-a", NodeName::OtherNode => "other", }; - instance_json = instance_json.replace("node-a", &host_name); + instance_json = instance_json.replace("node-a", host_name); instance_json = instance_json.replace("config-a-b494b6", &instance_name_clone); instance_json = instance_json.replace("\":\"\"", &format!("\":\"{}\"", device_usage_node)); diff --git a/agent/src/util/discovery_operator.rs b/agent/src/util/discovery_operator.rs index 023598900..c4bba25fa 100644 --- a/agent/src/util/discovery_operator.rs +++ b/agent/src/util/discovery_operator.rs @@ -204,7 +204,7 @@ impl DiscoveryOperator { #[allow(dead_code)] pub async fn internal_do_discover<'a>( &'a self, - kube_interface: Arc>, + kube_interface: Arc, dh_details: &'a DiscoveryDetails, stream: &'a mut dyn StreamingExt, ) -> Result<(), Status> { @@ -295,7 +295,7 @@ impl DiscoveryOperator { /// the associated Device Plugin and Instance are terminated and deleted, respectively. pub async fn delete_offline_instances( &self, - kube_interface: Arc>, + kube_interface: Arc, ) -> Result<(), Box> { trace!( "delete_offline_instances - entered for configuration {:?}", @@ -318,7 +318,7 @@ impl DiscoveryOperator { .await .unwrap(); k8s::try_delete_instance( - (*kube_interface_clone).as_ref(), + kube_interface_clone.as_ref(), &instance, self.config.metadata.namespace.as_ref().unwrap(), ) @@ -335,7 +335,7 @@ impl DiscoveryOperator { /// of the instance or deletes it if it is a local device. pub async fn handle_discovery_results( &self, - kube_interface: Arc>, + kube_interface: Arc, discovery_results: Vec, shared: bool, device_plugin_builder: Box, @@ -407,7 +407,7 @@ impl DiscoveryOperator { /// (A) non-local Instance is still not visible after 5 minutes or (B) local instance is still not visible. pub async fn update_instance_connectivity_status( &self, - kube_interface: Arc>, + kube_interface: Arc, currently_visible_instances: HashMap, shared: bool, ) -> Result<(), Box> { @@ -496,7 +496,7 @@ impl DiscoveryOperator { .await .unwrap(); k8s::try_delete_instance( - (*kube_interface).as_ref(), + kube_interface.as_ref(), &instance, self.config.metadata.namespace.as_ref().unwrap(), ) @@ -535,7 +535,7 @@ pub mod start_discovery { new_discovery_handler_sender: broadcast::Sender, stop_all_discovery_sender: broadcast::Sender<()>, finished_all_discovery_sender: &mut mpsc::Sender<()>, - kube_interface: Arc>, + kube_interface: Arc, ) -> Result<(), Box> { let config = discovery_operator.get_config(); info!( @@ -618,7 +618,7 @@ pub mod start_discovery { trace!("listen_for_new_discovery_handlers - received new registered discovery handler for configuration {:?}", discovery_operator.get_config().metadata.name); let new_discovery_operator = discovery_operator.clone(); discovery_tasks.push(tokio::spawn(async move { - do_discover(new_discovery_operator, Arc::new(Box::new(k8s::KubeImpl::new().await.unwrap()))).await.unwrap(); + do_discover(new_discovery_operator, Arc::new(k8s::KubeImpl::new().await.unwrap())).await.unwrap(); })); } } @@ -642,7 +642,7 @@ pub mod start_discovery { /// Removes the discovery handler from the `RegisteredDiscoveryHandlerMap` if it has been offline for longer than the grace period. pub async fn do_discover( discovery_operator: Arc, - kube_interface: Arc>, + kube_interface: Arc, ) -> Result<(), Box> { let mut discovery_tasks = Vec::new(); let config = discovery_operator.get_config(); @@ -698,7 +698,7 @@ pub mod start_discovery { /// Try to connect to discovery handler until connection has been established or grace period has passed async fn do_discover_on_discovery_handler<'a>( discovery_operator: Arc, - kube_interface: Arc>, + kube_interface: Arc, endpoint: &'a DiscoveryHandlerEndpoint, dh_details: &'a DiscoveryDetails, ) -> Result<(), Box> { @@ -914,7 +914,7 @@ pub mod tests { let (list_and_watch_message_sender, list_and_watch_message_receiver) = broadcast::channel(2); list_and_watch_message_receivers.push(list_and_watch_message_receiver); - let instance_name = get_device_instance_name(&device.id, &config_name); + let instance_name = get_device_instance_name(&device.id, config_name); ( instance_name, InstanceInfo { @@ -947,8 +947,7 @@ pub mod tests { .returning(move || instance_map_clone.clone()); mock }); - let mock = MockDiscoveryOperator::new(discovery_handler_map, config, instance_map); - mock + MockDiscoveryOperator::new(discovery_handler_map, config, instance_map) } // Creates a discovery handler with specified properties and adds it to the RegisteredDiscoveryHandlerMap. @@ -988,7 +987,7 @@ pub mod tests { name: name.to_string(), endpoint, shared, - close_discovery_handler_connection: close_discovery_handler_connection.clone(), + close_discovery_handler_connection: close_discovery_handler_connection, connectivity_status: DiscoveryHandlerStatus::Waiting, } } @@ -1115,8 +1114,7 @@ pub mod tests { .get(&DiscoveryHandlerEndpoint::Uds("socket.sock".to_string())) .unwrap() .clone() - .close_discovery_handler_connection - .clone(); + .close_discovery_handler_connection; mock_discovery_operator .expect_stop_all_discovery() .times(1) @@ -1129,8 +1127,7 @@ pub mod tests { tokio::sync::mpsc::channel(2); let thread_new_dh_sender = new_dh_sender.clone(); let thread_stop_all_discovery_sender = stop_all_discovery_sender.clone(); - let mock_kube_interface: Arc> = - Arc::new(Box::new(MockKubeInterface::new())); + let mock_kube_interface: Arc = Arc::new(MockKubeInterface::new()); let handle = tokio::spawn(async move { start_discovery::start_discovery( mock_discovery_operator, @@ -1212,8 +1209,7 @@ pub mod tests { .times(1) .returning(|_, _| ()) .in_sequence(&mut discovery_handler_status_seq); - let mock_kube_interface: Arc> = - Arc::new(Box::new(MockKubeInterface::new())); + let mock_kube_interface: Arc = Arc::new(MockKubeInterface::new()); start_discovery::do_discover(Arc::new(mock_discovery_operator), mock_kube_interface) .await .unwrap(); @@ -1224,8 +1220,7 @@ pub mod tests { let _ = env_logger::builder().is_test(true).try_init(); // Set node name for generating instance id std::env::set_var("AGENT_NODE_NAME", "node-a"); - let mock_kube_interface: Arc> = - Arc::new(Box::new(MockKubeInterface::new())); + let mock_kube_interface: Arc = Arc::new(MockKubeInterface::new()); let discovery_handler_map: RegisteredDiscoveryHandlerMap = Arc::new(std::sync::Mutex::new(HashMap::new())); let path_to_config = "../test/yaml/config-a.yaml"; @@ -1346,7 +1341,7 @@ pub mod tests { instance_map, )); discovery_operator - .delete_offline_instances(Arc::new(Box::new(mock))) + .delete_offline_instances(Arc::new(mock)) .await .unwrap(); @@ -1367,7 +1362,7 @@ pub mod tests { instance_map, )); discovery_operator - .delete_offline_instances(Arc::new(Box::new(mock))) + .delete_offline_instances(Arc::new(mock)) .await .unwrap(); @@ -1391,7 +1386,7 @@ pub mod tests { instance_map.clone(), )); discovery_operator - .delete_offline_instances(Arc::new(Box::new(mock))) + .delete_offline_instances(Arc::new(mock)) .await .unwrap(); // Make sure all instances are deleted from map. Note, first 3 arguments are ignored. @@ -1569,7 +1564,7 @@ pub mod tests { )); discovery_operator .update_instance_connectivity_status( - Arc::new(Box::new(mock)), + Arc::new(mock), currently_visible_instances, shared, ) @@ -1625,13 +1620,10 @@ pub mod tests { let endpoint = DiscoveryHandlerEndpoint::Uds("socket.sock".to_string()); let discovery_operator = setup_non_mocked_dh(discovery_handler_name, &endpoint); // Test that an online discovery handler is marked offline - assert_eq!( - discovery_operator - .mark_offline_or_deregister_discovery_handler(&endpoint) - .await - .unwrap(), - false - ); + assert!(!discovery_operator + .mark_offline_or_deregister_discovery_handler(&endpoint) + .await + .unwrap()); if let DiscoveryHandlerStatus::Offline(_) = discovery_operator .discovery_handler_map .lock() @@ -1649,13 +1641,10 @@ pub mod tests { panic!("DiscoveryHandlerStatus should be changed to offline"); } // Test that an offline discovery handler IS NOT deregistered if the time has not passed - assert_eq!( - discovery_operator - .mark_offline_or_deregister_discovery_handler(&endpoint) - .await - .unwrap(), - false - ); + assert!(!discovery_operator + .mark_offline_or_deregister_discovery_handler(&endpoint) + .await + .unwrap()); // Test that an offline discovery handler IS deregistered if the time has passed let mock_now = Instant::now(); @@ -1669,13 +1658,10 @@ pub mod tests { .get_mut(&endpoint) .unwrap() .connectivity_status = DiscoveryHandlerStatus::Offline(mock_now); - assert_eq!( - discovery_operator - .mark_offline_or_deregister_discovery_handler(&endpoint) - .await - .unwrap(), - true - ); + assert!(discovery_operator + .mark_offline_or_deregister_discovery_handler(&endpoint) + .await + .unwrap()); } #[tokio::test] @@ -1721,7 +1707,7 @@ pub mod tests { ) .await; // Make sure registration server has started - akri_shared::uds::unix_stream::try_connect(&endpoint) + akri_shared::uds::unix_stream::try_connect(endpoint) .await .unwrap(); discovery_operator diff --git a/agent/src/util/embedded_discovery_handlers.rs b/agent/src/util/embedded_discovery_handlers.rs index 2e0427fd5..541781f6e 100644 --- a/agent/src/util/embedded_discovery_handlers.rs +++ b/agent/src/util/embedded_discovery_handlers.rs @@ -93,7 +93,7 @@ mod tests { discoveryDetails: |+ udevRules: [] "#; - let deserialized: DiscoveryHandlerInfo = serde_yaml::from_str(&udev_yaml).unwrap(); + let deserialized: DiscoveryHandlerInfo = serde_yaml::from_str(udev_yaml).unwrap(); assert!(inner_get_discovery_handler(&deserialized, &mock_query).is_ok()); let yaml = r#" @@ -102,7 +102,7 @@ mod tests { opcuaDiscoveryMethod: standard: {} "#; - let deserialized: DiscoveryHandlerInfo = serde_yaml::from_str(&yaml).unwrap(); + let deserialized: DiscoveryHandlerInfo = serde_yaml::from_str(yaml).unwrap(); assert!(inner_get_discovery_handler(&deserialized, &mock_query).is_ok()); let deserialized = serde_json::from_str::( @@ -121,7 +121,7 @@ mod tests { descriptions: - "foo1" "#; - let deserialized: DiscoveryHandlerInfo = serde_yaml::from_str(&debug_echo_yaml).unwrap(); + let deserialized: DiscoveryHandlerInfo = serde_yaml::from_str(debug_echo_yaml).unwrap(); // Test that errors without environment var set let mut mock_query_without_var_set = MockEnvVarQuery::new(); mock_query_without_var_set diff --git a/controller/src/util/instance_action.rs b/controller/src/util/instance_action.rs index 12bd2bc98..5593c7d82 100644 --- a/controller/src/util/instance_action.rs +++ b/controller/src/util/instance_action.rs @@ -12,8 +12,7 @@ use akri_shared::{ use async_std::sync::Mutex; use futures::{StreamExt, TryStreamExt}; use k8s_openapi::api::core::v1::Pod; -use kube::api::{Api, ListParams}; -use kube_runtime::watcher::{watcher, Event}; +use kube::api::{Api, ListParams, WatchEvent}; use log::{error, info, trace}; use std::collections::HashMap; use std::sync::Arc; @@ -79,11 +78,16 @@ async fn internal_do_instance_watch( ) -> Result<(), Box> { trace!("internal_do_instance_watch - enter"); let resource = Api::::all(kube_interface.get_kube_client()); - let watcher = watcher(resource, ListParams::default()); - let mut informer = watcher.boxed(); + let mut stream = resource + .watch( + &ListParams::default(), + akri_shared::akri::API_VERSION_NUMBER, + ) + .await? + .boxed(); // Currently, this does not handle None except to break the // while. - while let Some(event) = informer.try_next().await? { + while let Some(event) = stream.try_next().await? { // Aquire lock to ensure cleanup_instance_and_configuration_svcs and the // inner loop handle_instance call in internal_do_instance_watch // cannot execute at the same time. @@ -97,21 +101,20 @@ async fn internal_do_instance_watch( /// This takes an event off the Instance stream and delegates it to the /// correct function based on the event type. async fn handle_instance( - event: Event, + event: WatchEvent, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_instance - enter"); match event { - Event::Applied(instance) => { + WatchEvent::Added(instance) => { info!( - "handle_instance - added or modified Akri Instance {:?}: {:?}", + "handle_instance - added Akri Instance {:?}: {:?}", instance.metadata.name, instance.spec ); - // TODO: rename `InstanceAction::Add` to reflect that this could also be an Update event. handle_instance_change(&instance, &InstanceAction::Add, kube_interface).await?; Ok(()) } - Event::Deleted(instance) => { + WatchEvent::Deleted(instance) => { info!( "handle_instance - deleted Akri Instance {:?}: {:?}", instance.metadata.name, instance.spec @@ -119,11 +122,19 @@ async fn handle_instance( handle_instance_change(&instance, &InstanceAction::Remove, kube_interface).await?; Ok(()) } - Event::Restarted(_instances) => { - // TODO: determine whether this can be handled. For now, bubble up error to restart controller. - // TODO: use anyhow! - None.ok_or("Instance watcher restarted due to watch stream dropping")? + WatchEvent::Modified(instance) => { + info!( + "handle_instance - modified Akri Instance {:?}: {:?}", + instance.metadata.name, instance.spec + ); + handle_instance_change(&instance, &InstanceAction::Update, kube_interface).await?; + Ok(()) + } + WatchEvent::Error(ref e) => { + trace!("handle_instance - error for Akri Instance: {}", e); + Ok(()) } + WatchEvent::Bookmark(_) => Ok(()), } } @@ -773,9 +784,9 @@ mod handle_instance_tests { let instance: Instance = serde_json::from_str(&instance_json).unwrap(); handle_instance( match action { - InstanceAction::Add => Event::Applied(instance), - InstanceAction::Update => Event::Applied(instance), - InstanceAction::Remove => Event::Deleted(instance), + InstanceAction::Add => WatchEvent::Added(instance), + InstanceAction::Update => WatchEvent::Modified(instance), + InstanceAction::Remove => WatchEvent::Deleted(instance), }, mock, ) diff --git a/controller/src/util/node_watcher.rs b/controller/src/util/node_watcher.rs index 7e40c8a41..f7201c992 100644 --- a/controller/src/util/node_watcher.rs +++ b/controller/src/util/node_watcher.rs @@ -8,8 +8,7 @@ use akri_shared::{ }; use futures::{StreamExt, TryStreamExt}; use k8s_openapi::api::core::v1::{Node, NodeStatus}; -use kube::api::{Api, ListParams}; -use kube_runtime::watcher::{watcher, Event}; +use kube::api::{Api, ListParams, WatchEvent}; use log::trace; use std::collections::HashMap; @@ -55,11 +54,16 @@ impl NodeWatcher { trace!("watch - enter"); let kube_interface = k8s::KubeImpl::new().await?; let resource = Api::::all(kube_interface.get_kube_client()); - let watcher = watcher(resource, ListParams::default()); - let mut informer = watcher.boxed(); + let mut stream = resource + .watch( + &ListParams::default(), + akri_shared::akri::API_VERSION_NUMBER, + ) + .await? + .boxed(); // Currently, this does not handle None except to break the // while. - while let Some(event) = informer.try_next().await? { + while let Some(event) = stream.try_next().await? { self.handle_node(event, &kube_interface).await?; } @@ -86,41 +90,45 @@ impl NodeWatcher { /// non-Running Node. async fn handle_node( &mut self, - event: Event, + event: WatchEvent, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_node - enter"); match event { - Event::Applied(node) => { - trace!("handle_node - Applied: {:?}", &node.metadata.name); + WatchEvent::Added(node) => { + trace!("handle_node - Added: {:?}", &node.metadata.name); if self.is_node_ready(&node) { self.known_nodes .insert(node.metadata.name.unwrap(), NodeState::Running); } else { - // If Node is not Running, check if it was previously added and now terminated - match self.known_nodes.get(node.metadata.name.as_ref().unwrap()) { - Some(_previous_node) => { - self.call_handle_node_disappearance_if_needed(&node, kube_interface) - .await?; - } - None => { - // New Node was added - self.known_nodes - .insert(node.metadata.name.unwrap(), NodeState::Known); - } - } + self.known_nodes + .insert(node.metadata.name.unwrap(), NodeState::Known); + } + } + WatchEvent::Modified(node) => { + trace!("handle_node - Modified: {:?}", &node.metadata.name); + trace!( + "handle_node - Modified with Node Status {:?} and NodeSpec: {:?}", + &node.status, + &node.spec + ); + if self.is_node_ready(&node) { + self.known_nodes + .insert(node.metadata.name.unwrap(), NodeState::Running); + } else { + self.call_handle_node_disappearance_if_needed(&node, kube_interface) + .await?; } } - Event::Deleted(node) => { + WatchEvent::Deleted(node) => { trace!("handle_node - Deleted: {:?}", &node.metadata.name); self.call_handle_node_disappearance_if_needed(&node, kube_interface) .await?; } - Event::Restarted(_nodes) => { - // TODO: determine whether this can be handled. For now, bubble up error to restart controller. - // TODO: use anyhow! - None.ok_or("Node watcher restarted due to watch stream dropping")? + WatchEvent::Error(e) => { + trace!("handle_node - error for Node: {}", e); } + WatchEvent::Bookmark(_) => {} }; Ok(()) } @@ -208,15 +216,9 @@ impl NodeWatcher { ); for instance in instances.items { let instance_name = instance.metadata.name.clone().unwrap(); - let instance_namespace = - instance - .metadata - .namespace - .as_ref() - .ok_or(anyhow::Error::msg(format!( - "Namespace not found for instance: {:?}", - instance_name - )))?; + let instance_namespace = instance.metadata.namespace.as_ref().ok_or_else(|| { + anyhow::anyhow!("Namespace not found for instance: {}", instance_name) + })?; trace!( "handle_node_disappearance - make sure node is not referenced here: {:?}", @@ -371,7 +373,7 @@ mod tests { let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); node_watcher - .handle_node(Event::Applied(node), &MockKubeInterface::new()) + .handle_node(WatchEvent::Added(node), &MockKubeInterface::new()) .await .unwrap(); @@ -391,7 +393,7 @@ mod tests { let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); node_watcher - .handle_node(Event::Applied(node), &MockKubeInterface::new()) + .handle_node(WatchEvent::Added(node), &MockKubeInterface::new()) .await .unwrap(); @@ -439,7 +441,7 @@ mod tests { ); node_watcher - .handle_node(Event::Applied(node), &mock) + .handle_node(WatchEvent::Modified(node), &mock) .await .unwrap(); @@ -461,7 +463,7 @@ mod tests { let mock = MockKubeInterface::new(); node_watcher - .handle_node(Event::Applied(node), &mock) + .handle_node(WatchEvent::Modified(node), &mock) .await .unwrap(); @@ -505,7 +507,7 @@ mod tests { ); node_watcher - .handle_node(Event::Deleted(node), &mock) + .handle_node(WatchEvent::Deleted(node), &mock) .await .unwrap(); diff --git a/controller/src/util/pod_watcher.rs b/controller/src/util/pod_watcher.rs index ca8a27e9a..be3553eef 100644 --- a/controller/src/util/pod_watcher.rs +++ b/controller/src/util/pod_watcher.rs @@ -14,8 +14,7 @@ use akri_shared::{ use async_std::sync::Mutex; use futures::{StreamExt, TryStreamExt}; use k8s_openapi::api::core::v1::{Pod, ServiceSpec}; -use kube::api::{Api, ListParams}; -use kube_runtime::watcher::{watcher, Event}; +use kube::api::{Api, ListParams, WatchEvent}; use log::trace; use std::{collections::HashMap, sync::Arc}; @@ -82,15 +81,17 @@ impl BrokerPodWatcher { trace!("watch - enter"); let kube_interface = k8s::KubeImpl::new().await?; let resource = Api::::all(kube_interface.get_kube_client()); - let watcher = watcher( - resource, - ListParams::default().labels(AKRI_TARGET_NODE_LABEL_NAME), - ); - let mut informer = watcher.boxed(); + let mut stream = resource + .watch( + &ListParams::default().labels(AKRI_TARGET_NODE_LABEL_NAME), + akri_shared::akri::POD_VERSION_NUMBER, + ) + .await? + .boxed(); let synchronization = Arc::new(Mutex::new(())); // Currently, this does not handle None except to break the // while. - while let Some(event) = informer.try_next().await? { + while let Some(event) = stream.try_next().await? { let _lock = synchronization.lock().await; self.handle_pod(event, &kube_interface).await?; } @@ -117,24 +118,19 @@ impl BrokerPodWatcher { /// ensure that the instance and configuration services are removed as needed. async fn handle_pod( &mut self, - event: Event, + event: WatchEvent, kube_interface: &impl KubeInterface, ) -> Result<(), Box> { trace!("handle_pod - enter [event: {:?}]", event); match event { - Event::Applied(pod) => { - trace!("handle_pod - pod name {:?}", &pod.metadata.name); + WatchEvent::Added(pod) | WatchEvent::Modified(pod) => { + trace!("handle_pod - pod name {:?}", pod.metadata.name); let phase = self.get_pod_phase(&pod); - trace!("handle_pod - pod phase {:?}", &phase); + trace!("handle_pod - pod phase {:?}", phase); match phase.as_str() { "Unknown" | "Pending" => { - self.known_pods.insert( - pod.metadata - .name - .clone() - .ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?, - PodState::Pending, - ); + self.known_pods + .insert(pod.metadata.name.unwrap(), PodState::Pending); } "Running" => { self.handle_running_pod_if_needed(&pod, kube_interface) @@ -145,22 +141,19 @@ impl BrokerPodWatcher { .await?; } _ => { - trace!("handle_pod - Unknown phase: {:?}", &phase); + trace!("handle_pod - Unknown phase: {:?}", phase); } } } - Event::Deleted(pod) => { - trace!("handle_pod - Deleted: {:?}", &pod.metadata.name); + WatchEvent::Deleted(pod) => { + trace!("handle_pod - Deleted: {:?}", pod.metadata.name); self.handle_deleted_pod_if_needed(&pod, kube_interface) .await?; } - Event::Restarted(_pods) => { - // TODO: determine whether this can be handled by looking through `pods` which is the list of - // previously `Applied` events and reconciling. Also, would need to handle missed `Deleted` events. - // For now, bubble up error to restart controller. - // TODO: use anyhow! - None.ok_or("Pod watcher restarted due to watch stream dropping")?; + WatchEvent::Error(err) => { + trace!("handle_pod - error for Pod: {}", err); } + WatchEvent::Bookmark(_) => {} }; Ok(()) } @@ -177,7 +170,7 @@ impl BrokerPodWatcher { .metadata .name .clone() - .ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; + .ok_or_else(|| anyhow::format_err!("Pod {:?} does not have name", pod))?; let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending); trace!( "handle_running_pod_if_needed - last_known_state: {:?}", @@ -207,7 +200,7 @@ impl BrokerPodWatcher { .metadata .name .clone() - .ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; + .ok_or_else(|| anyhow::format_err!("Pod {:?} does not have name", pod))?; let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending); trace!( "handle_ended_pod_if_needed - last_known_state: {:?}", @@ -237,7 +230,7 @@ impl BrokerPodWatcher { .metadata .name .clone() - .ok_or(anyhow::format_err!("Pod {:?} does not have name", pod))?; + .ok_or_else(|| anyhow::format_err!("Pod {:?} does not have name", pod))?; let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending); trace!( "handle_deleted_pod_if_needed - last_known_state: {:?}", @@ -489,14 +482,9 @@ impl BrokerPodWatcher { { for existing_svc in existing_svcs { let mut existing_svc = existing_svc.clone(); - let svc_name = existing_svc - .metadata - .name - .clone() - .ok_or(anyhow::format_err!( - "Service {:?} does not have name", - existing_svc - ))?; + let svc_name = existing_svc.metadata.name.clone().ok_or_else(|| { + anyhow::format_err!("Service {:?} does not have name", existing_svc) + })?; let svc_namespace = existing_svc.metadata.namespace.as_ref().unwrap().clone(); trace!( "create_or_update_service - Update existing svc={:?}", @@ -644,10 +632,18 @@ mod tests { let _ = env_logger::builder().is_test(true).try_init(); let mut pod_watcher = BrokerPodWatcher::new(); trace!("test_handle_pod_error WatchEvent::Error"); - assert!(pod_watcher - .handle_pod(Event::Restarted(Vec::new()), &MockKubeInterface::new(),) + pod_watcher + .handle_pod( + WatchEvent::Error(kube::error::ErrorResponse { + status: "status".to_string(), + message: "message".to_string(), + reason: "reason".to_string(), + code: 0, + }), + &MockKubeInterface::new(), + ) .await - .is_err()); + .unwrap(); assert_eq!(0, pod_watcher.known_pods.len()); } @@ -667,7 +663,7 @@ mod tests { &phase ); pod_watcher - .handle_pod(Event::Applied(pod), &MockKubeInterface::new()) + .handle_pod(WatchEvent::Added(pod), &MockKubeInterface::new()) .await .unwrap(); trace!( @@ -701,7 +697,7 @@ mod tests { &phase ); pod_watcher - .handle_pod(Event::Applied(pod), &MockKubeInterface::new()) + .handle_pod(WatchEvent::Modified(pod), &MockKubeInterface::new()) .await .unwrap(); trace!( @@ -760,7 +756,7 @@ mod tests { ); pod_watcher - .handle_pod(Event::Applied(pod), &mock) + .handle_pod(WatchEvent::Modified(pod), &mock) .await .unwrap(); trace!( @@ -818,7 +814,7 @@ mod tests { ); pod_watcher - .handle_pod(Event::Applied(pod), &mock) + .handle_pod(WatchEvent::Modified(pod), &mock) .await .unwrap(); trace!( @@ -880,7 +876,7 @@ mod tests { ); pod_watcher - .handle_pod(Event::Applied(pod), &mock) + .handle_pod(WatchEvent::Modified(pod), &mock) .await .unwrap(); trace!( @@ -942,7 +938,7 @@ mod tests { ); pod_watcher - .handle_pod(Event::Deleted(pod), &mock) + .handle_pod(WatchEvent::Deleted(pod), &mock) .await .unwrap(); trace!( @@ -976,7 +972,7 @@ mod tests { &phase ); pod_watcher - .handle_pod(Event::Applied(pod), &MockKubeInterface::new()) + .handle_pod(WatchEvent::Added(pod), &MockKubeInterface::new()) .await .unwrap(); trace!( @@ -997,7 +993,7 @@ mod tests { &phase ); pod_watcher - .handle_pod(Event::Applied(pod), &MockKubeInterface::new()) + .handle_pod(WatchEvent::Modified(pod), &MockKubeInterface::new()) .await .unwrap(); trace!( diff --git a/shared/src/akri/mod.rs b/shared/src/akri/mod.rs index 38c62aa4d..65e1ccd1b 100644 --- a/shared/src/akri/mod.rs +++ b/shared/src/akri/mod.rs @@ -1,7 +1,9 @@ /// Akri API Version pub const API_VERSION: &str = "v0"; -/// Akri API Version -pub const NODE_VERSION: &str = "v1"; +/// Akri API Version Number +pub const API_VERSION_NUMBER: &str = "0"; +/// Version of Pods that the Controller watches for +pub const POD_VERSION_NUMBER: &str = "1"; /// Akri CRD Namespace pub const API_NAMESPACE: &str = "akri.sh"; /// Akri Configuration CRD name From ae8abb91a97f380d9796ad707f06899f8dbed53f Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 12 Aug 2021 10:38:54 -0700 Subject: [PATCH 06/22] use old dependencies for Configuration validating webhook --- Cargo.lock | 1988 +++++++++++++++-- Cargo.toml | 2 +- webhooks/validating/configuration/Cargo.toml | 11 +- webhooks/validating/configuration/src/main.rs | 32 +- 4 files changed, 1847 insertions(+), 186 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e3e9cee21..aa8e0d52e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,329 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "actix" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3720d0064a0ce5c0de7bd93bdb0a6caebab2a9b5668746145d7b3b0c5da02914" +dependencies = [ + "actix-rt 2.2.0", + "actix_derive", + "bitflags", + "bytes 1.0.1", + "crossbeam-channel", + "futures-core", + "futures-sink", + "futures-task", + "futures-util", + "log", + "once_cell", + "parking_lot 0.11.1", + "pin-project-lite 0.2.7", + "smallvec 1.6.1", + "tokio 1.9.0", + "tokio-util 0.6.7", +] + +[[package]] +name = "actix-codec" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78d1833b3838dbe990df0f1f87baf640cf6146e898166afe401839d1b001e570" +dependencies = [ + "bitflags", + "bytes 0.5.6", + "futures-core", + "futures-sink", + "log", + "pin-project 0.4.28", + "tokio 0.2.25", + "tokio-util 0.3.1", +] + +[[package]] +name = "actix-connect" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177837a10863f15ba8d3ae3ec12fac1099099529ed20083a27fdfe247381d0dc" +dependencies = [ + "actix-codec", + "actix-rt 1.1.1", + "actix-service", + "actix-utils", + "derive_more", + "either", + "futures-util", + "http 0.2.4", + "log", + "openssl", + "tokio-openssl", + "trust-dns-proto", + "trust-dns-resolver", +] + +[[package]] +name = "actix-http" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cb8958da437716f3f31b0e76f8daf36554128517d7df37ceba7df00f09622ee" +dependencies = [ + "actix-codec", + "actix-connect", + "actix-rt 1.1.1", + "actix-service", + "actix-threadpool", + "actix-tls", + "actix-utils", + "base64 0.13.0", + "bitflags", + "brotli2", + "bytes 0.5.6", + "cookie", + "copyless", + "derive_more", + "either", + "encoding_rs", + "flate2", + "futures-channel", + "futures-core", + "futures-util", + "fxhash", + "h2 0.2.7", + "http 0.2.4", + "httparse", + "indexmap", + "itoa", + "language-tags", + "lazy_static", + "log", + "mime", + "percent-encoding 2.1.0", + "pin-project 1.0.8", + "rand 0.7.3", + "regex", + "serde", + "serde_json", + "serde_urlencoded 0.7.0", + "sha-1 0.9.7", + "slab", + "time 0.2.27", +] + +[[package]] +name = "actix-macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ca8ce00b267af8ccebbd647de0d61e0674b6e61185cc7a592ff88772bed655" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "actix-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2f86cd6857c135e6e9fe57b1619a88d1f94a7df34c00e11fe13e64fd3438837" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "actix-router" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ad299af73649e1fc893e333ccf86f377751eb95ff875d095131574c6f43452c" +dependencies = [ + "bytestring", + "http 0.2.4", + "log", + "regex", + "serde", +] + +[[package]] +name = "actix-rt" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" +dependencies = [ + "actix-macros 0.1.3", + "actix-threadpool", + "copyless", + "futures-channel", + "futures-util", + "smallvec 1.6.1", + "tokio 0.2.25", +] + +[[package]] +name = "actix-rt" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d7cd957c9ed92288a7c3c96af81fa5291f65247a76a34dac7b6af74e52ba0" +dependencies = [ + "actix-macros 0.2.1", + "futures-core", + "tokio 1.9.0", +] + +[[package]] +name = "actix-server" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45407e6e672ca24784baa667c5d32ef109ccdd8d5e0b5ebb9ef8a67f4dfb708e" +dependencies = [ + "actix-codec", + "actix-rt 1.1.1", + "actix-service", + "actix-utils", + "futures-channel", + "futures-util", + "log", + "mio 0.6.23", + "mio-uds", + "num_cpus", + "slab", + "socket2 0.3.19", +] + +[[package]] +name = "actix-service" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0052435d581b5be835d11f4eb3bce417c8af18d87ddf8ace99f8e67e595882bb" +dependencies = [ + "futures-util", + "pin-project 0.4.28", +] + +[[package]] +name = "actix-testing" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47239ca38799ab74ee6a8a94d1ce857014b2ac36f242f70f3f75a66f691e791c" +dependencies = [ + "actix-macros 0.1.3", + "actix-rt 1.1.1", + "actix-server", + "actix-service", + "log", + "socket2 0.3.19", +] + +[[package]] +name = "actix-threadpool" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d209f04d002854b9afd3743032a27b066158817965bf5d036824d19ac2cc0e30" +dependencies = [ + "derive_more", + "futures-channel", + "lazy_static", + "log", + "num_cpus", + "parking_lot 0.11.1", + "threadpool", +] + +[[package]] +name = "actix-tls" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24789b7d7361cf5503a504ebe1c10806896f61e96eca9a7350e23001aca715fb" +dependencies = [ + "actix-codec", + "actix-service", + "actix-utils", + "futures-util", + "openssl", + "tokio-openssl", +] + +[[package]] +name = "actix-utils" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9022dec56632d1d7979e59af14f0597a28a830a9c1c7fec8b2327eb9f16b5a" +dependencies = [ + "actix-codec", + "actix-rt 1.1.1", + "actix-service", + "bitflags", + "bytes 0.5.6", + "either", + "futures-channel", + "futures-sink", + "futures-util", + "log", + "pin-project 0.4.28", + "slab", +] + +[[package]] +name = "actix-web" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e641d4a172e7faa0862241a20ff4f1f5ab0ab7c279f00c2d4587b77483477b86" +dependencies = [ + "actix-codec", + "actix-http", + "actix-macros 0.1.3", + "actix-router", + "actix-rt 1.1.1", + "actix-server", + "actix-service", + "actix-testing", + "actix-threadpool", + "actix-tls", + "actix-utils", + "actix-web-codegen", + "awc", + "bytes 0.5.6", + "derive_more", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "fxhash", + "log", + "mime", + "openssl", + "pin-project 1.0.8", + "regex", + "serde", + "serde_json", + "serde_urlencoded 0.7.0", + "socket2 0.3.19", + "time 0.2.27", + "tinyvec", + "url 2.2.2", +] + +[[package]] +name = "actix-web-codegen" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad26f77093333e0e7c6ffe54ebe3582d908a104e448723eec6d43d08b07143fb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "actix_derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "adler" version = "1.0.2" @@ -10,36 +333,36 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "agent" -version = "0.6.11" +version = "0.6.12" dependencies = [ "akri-debug-echo", "akri-discovery-utils", "akri-onvif", "akri-opcua", - "akri-shared", + "akri-shared 0.6.12", "akri-udev", "anyhow", - "async-stream", + "async-stream 0.3.2", "async-trait", "blake2", "cfg-if 1.0.0", "chrono", - "env_logger", + "env_logger 0.9.0", "futures 0.3.16", "futures-core", "futures-util", - "h2", - "hyper", - "k8s-openapi", - "kube", + "h2 0.3.3", + "hyper 0.14.11", + "k8s-openapi 0.13.0", + "kube 0.59.0", "kube-runtime", "lazy_static", "log", "mock_instant", - "mockall", + "mockall 0.10.2", "mockall_double", "prometheus 0.12.0", - "prost", + "prost 0.8.0", "prost-types", "rand 0.8.4", "serde", @@ -49,9 +372,9 @@ dependencies = [ "tempfile", "tokio 1.9.0", "tokio-stream", - "tonic", + "tonic 0.5.2", "tonic-build", - "tower", + "tower 0.4.8", "url 2.2.2", "uuid", ] @@ -67,13 +390,13 @@ dependencies = [ [[package]] name = "akri-debug-echo" -version = "0.6.11" +version = "0.6.12" dependencies = [ "akri-discovery-utils", - "akri-shared", + "akri-shared 0.6.12", "anyhow", "async-trait", - "env_logger", + "env_logger 0.9.0", "futures-util", "log", "serde", @@ -82,45 +405,45 @@ dependencies = [ "serde_yaml", "tokio 1.9.0", "tokio-stream", - "tonic", + "tonic 0.5.2", ] [[package]] name = "akri-discovery-utils" -version = "0.6.11" +version = "0.6.12" dependencies = [ - "akri-shared", + "akri-shared 0.6.12", "anyhow", - "async-stream", + "async-stream 0.3.2", "async-trait", "futures 0.3.16", "log", - "prost", + "prost 0.8.0", "serde", "serde_derive", "serde_yaml", "tempfile", "tokio 1.9.0", "tokio-stream", - "tonic", + "tonic 0.5.2", "tonic-build", - "tower", + "tower 0.4.8", ] [[package]] name = "akri-onvif" -version = "0.6.11" +version = "0.6.12" dependencies = [ "akri-discovery-utils", - "akri-shared", + "akri-shared 0.6.12", "anyhow", "async-trait", "bytes 1.0.1", - "env_logger", + "env_logger 0.9.0", "futures-util", - "hyper", + "hyper 0.14.11", "log", - "mockall", + "mockall 0.10.2", "serde", "serde_derive", "serde_json", @@ -129,7 +452,7 @@ dependencies = [ "sxd-xpath", "tokio 1.9.0", "tokio-stream", - "tonic", + "tonic 0.5.2", "uuid", "xml-rs", "yaserde", @@ -138,28 +461,58 @@ dependencies = [ [[package]] name = "akri-opcua" -version = "0.6.11" +version = "0.6.12" dependencies = [ "akri-discovery-utils", - "akri-shared", + "akri-shared 0.6.12", "anyhow", "async-trait", - "env_logger", + "env_logger 0.9.0", "futures-util", "log", - "mockall", + "mockall 0.10.2", "opcua-client", - "prost", + "prost 0.8.0", "serde", "serde_derive", "serde_json", "serde_yaml", "tokio 1.9.0", "tokio-stream", - "tonic", + "tonic 0.5.2", "url 2.2.2", ] +[[package]] +name = "akri-shared" +version = "0.6.5" +source = "git+https://github.com/deislabs/akri?tag=v0.6.5#9a0d32faf0470c41dc1db381e8ce3469699ca808" +dependencies = [ + "anyhow", + "async-trait", + "either", + "env_logger 0.8.4", + "futures 0.1.31", + "futures 0.3.16", + "futures-util", + "k8s-openapi 0.6.0", + "kube 0.23.0", + "log", + "mockall 0.9.1", + "prometheus 0.11.0", + "rand 0.8.4", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tokio 0.2.25", + "tokio-core", + "tokio-signal", + "tonic 0.1.1", + "tower 0.3.1", + "warp 0.2.5", +] + [[package]] name = "akri-shared" version = "0.6.12" @@ -167,15 +520,15 @@ dependencies = [ "anyhow", "async-trait", "either", - "env_logger", + "env_logger 0.9.0", "futures 0.3.16", "futures-util", - "hyper", - "k8s-openapi", - "kube", + "hyper 0.14.11", + "k8s-openapi 0.13.0", + "kube 0.59.0", "kube-runtime", "log", - "mockall", + "mockall 0.10.2", "prometheus 0.11.0", "rand 0.8.4", "schemars", @@ -185,25 +538,25 @@ dependencies = [ "serde_yaml", "tokio 1.9.0", "tokio-stream", - "tonic", - "tower", - "warp", + "tonic 0.5.2", + "tower 0.4.8", + "warp 0.3.1", ] [[package]] name = "akri-udev" -version = "0.6.11" +version = "0.6.12" dependencies = [ "akri-discovery-utils", "anyhow", "async-trait", - "env_logger", + "env_logger 0.9.0", "futures-util", "log", - "mockall", + "mockall 0.10.2", "pest", "pest_derive", - "prost", + "prost 0.8.0", "regex", "serde", "serde_derive", @@ -211,10 +564,19 @@ dependencies = [ "serde_yaml", "tokio 1.9.0", "tokio-stream", - "tonic", + "tonic 0.5.2", "udev", ] +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "anyhow" version = "1.0.42" @@ -232,6 +594,19 @@ dependencies = [ "futures-core", ] +[[package]] +name = "async-compression" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443ccbb270374a2b1055fc72da40e1f237809cd6bb0e97e66d264cd138473a6" +dependencies = [ + "bytes 0.5.6", + "flate2", + "futures-core", + "memchr", + "pin-project-lite 0.2.7", +] + [[package]] name = "async-executor" version = "1.4.1" @@ -276,7 +651,7 @@ dependencies = [ "parking", "polling", "slab", - "socket2", + "socket2 0.4.1", "waker-fn", "winapi 0.3.9", ] @@ -320,22 +695,43 @@ dependencies = [ "memchr", "num_cpus", "once_cell", - "pin-project-lite", + "pin-project-lite 0.2.7", "pin-utils", "slab", "wasm-bindgen-futures", ] +[[package]] +name = "async-stream" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22068c0c19514942eefcfd4daf8976ef1aad84e61539f95cd200c35202f80af5" +dependencies = [ + "async-stream-impl 0.2.1", + "futures-core", +] + [[package]] name = "async-stream" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" dependencies = [ - "async-stream-impl", + "async-stream-impl 0.3.2", "futures-core", ] +[[package]] +name = "async-stream-impl" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25f9db3b38af870bf7e5cc649167533b493928e50744e2c30ae350230b414670" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "async-stream-impl" version = "0.3.2" @@ -387,6 +783,52 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "awc" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b381e490e7b0cfc37ebc54079b0413d8093ef43d14a4e4747083f7fa47a9e691" +dependencies = [ + "actix-codec", + "actix-http", + "actix-rt 1.1.1", + "actix-service", + "base64 0.13.0", + "bytes 0.5.6", + "cfg-if 1.0.0", + "derive_more", + "futures-core", + "log", + "mime", + "openssl", + "percent-encoding 2.1.0", + "rand 0.7.3", + "serde", + "serde_json", + "serde_urlencoded 0.7.0", +] + +[[package]] +name = "base-x" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" + +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +dependencies = [ + "byteorder", +] + +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" + [[package]] name = "base64" version = "0.12.3" @@ -460,6 +902,26 @@ dependencies = [ "once_cell", ] +[[package]] +name = "brotli-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "brotli2" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" +dependencies = [ + "brotli-sys", + "libc", +] + [[package]] name = "buf_redux" version = "0.8.4" @@ -498,12 +960,27 @@ dependencies = [ "iovec", ] +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + [[package]] name = "bytes" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +[[package]] +name = "bytestring" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d" +dependencies = [ + "bytes 1.0.1", +] + [[package]] name = "cache-padded" version = "1.1.1" @@ -538,10 +1015,25 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time", + "time 0.1.44", "winapi 0.3.9", ] +[[package]] +name = "clap" +version = "2.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim 0.8.0", + "textwrap", + "unicode-width", + "vec_map", +] + [[package]] name = "cloudabi" version = "0.0.3" @@ -560,23 +1052,29 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "const_fn" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" + [[package]] name = "controller" -version = "0.6.11" +version = "0.6.12" dependencies = [ - "akri-shared", + "akri-shared 0.6.12", "anyhow", "async-std", "async-trait", "chrono", - "env_logger", + "env_logger 0.9.0", "futures 0.3.16", - "k8s-openapi", - "kube", + "k8s-openapi 0.13.0", + "kube 0.59.0", "kube-runtime", "lazy_static", "log", - "mockall", + "mockall 0.10.2", "prometheus 0.12.0", "serde", "serde_derive", @@ -585,6 +1083,29 @@ dependencies = [ "tokio 1.9.0", ] +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cookie" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" +dependencies = [ + "percent-encoding 2.1.0", + "time 0.2.27", + "version_check", +] + +[[package]] +name = "copyless" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" + [[package]] name = "core-foundation" version = "0.9.1" @@ -619,6 +1140,16 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils 0.8.5", +] + [[package]] name = "crossbeam-deque" version = "0.7.4" @@ -717,7 +1248,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.10.0", "syn", ] @@ -744,11 +1275,11 @@ dependencies = [ [[package]] name = "debug-echo-discovery-handler" -version = "0.6.11" +version = "0.6.12" dependencies = [ "akri-debug-echo", "akri-discovery-utils", - "env_logger", + "env_logger 0.9.0", "log", "tokio 1.9.0", ] @@ -764,6 +1295,19 @@ dependencies = [ "syn", ] +[[package]] +name = "derive_more" +version = "0.99.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version 0.3.3", + "syn", +] + [[package]] name = "difference" version = "2.0.0" @@ -788,6 +1332,16 @@ dependencies = [ "generic-array 0.14.4", ] +[[package]] +name = "dirs" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +dependencies = [ + "cfg-if 0.1.10", + "dirs-sys", +] + [[package]] name = "dirs-next" version = "2.0.0" @@ -798,6 +1352,17 @@ dependencies = [ "dirs-sys-next", ] +[[package]] +name = "dirs-sys" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +dependencies = [ + "libc", + "redox_users", + "winapi 0.3.9", +] + [[package]] name = "dirs-sys-next" version = "0.1.2" @@ -809,6 +1374,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "doc-comment" version = "0.3.3" @@ -839,6 +1410,40 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "encoding_rs" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "enum-as-inner" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "env_logger" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "env_logger" version = "0.9.0" @@ -1018,7 +1623,7 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite", + "pin-project-lite 0.2.7", "waker-fn", ] @@ -1047,6 +1652,12 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2" +[[package]] +name = "futures-timer" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6" + [[package]] name = "futures-util" version = "0.3.16" @@ -1061,13 +1672,22 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite", + "pin-project-lite 0.2.7", "pin-utils", "proc-macro-hack", "proc-macro-nested", "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.12.4" @@ -1132,6 +1752,26 @@ dependencies = [ "web-sys", ] +[[package]] +name = "h2" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +dependencies = [ + "bytes 0.5.6", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.4", + "indexmap", + "slab", + "tokio 0.2.25", + "tokio-util 0.3.1", + "tracing", + "tracing-futures", +] + [[package]] name = "h2" version = "0.3.3" @@ -1142,11 +1782,11 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.4", "indexmap", "slab", "tokio 1.9.0", - "tokio-util", + "tokio-util 0.6.7", "tracing", ] @@ -1166,10 +1806,10 @@ dependencies = [ "bitflags", "bytes 1.0.1", "headers-core", - "http", + "http 0.2.4", "mime", "sha-1 0.9.7", - "time", + "time 0.1.44", ] [[package]] @@ -1178,7 +1818,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ - "http", + "http 0.2.4", ] [[package]] @@ -1191,19 +1831,41 @@ dependencies = [ ] [[package]] -name = "hermit-abi" -version = "0.1.19" +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hostname" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ "libc", + "match_cfg", + "winapi 0.3.9", ] [[package]] -name = "hex" -version = "0.4.3" +name = "http" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" +dependencies = [ + "bytes 0.4.12", + "fnv", + "itoa", +] [[package]] name = "http" @@ -1216,6 +1878,16 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes 0.5.6", + "http 0.2.4", +] + [[package]] name = "http-body" version = "0.4.2" @@ -1223,8 +1895,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" dependencies = [ "bytes 1.0.1", - "http", - "pin-project-lite", + "http 0.2.4", + "pin-project-lite 0.2.7", ] [[package]] @@ -1233,6 +1905,12 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" +[[package]] +name = "httpdate" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + [[package]] name = "httpdate" version = "1.0.1" @@ -1245,6 +1923,30 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "hyper" +version = "0.13.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" +dependencies = [ + "bytes 0.5.6", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.2.7", + "http 0.2.4", + "http-body 0.3.1", + "httparse", + "httpdate 0.3.2", + "itoa", + "pin-project 1.0.8", + "socket2 0.3.19", + "tokio 0.2.25", + "tower-service", + "tracing", + "want", +] + [[package]] name = "hyper" version = "0.14.11" @@ -1255,14 +1957,14 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.3", + "http 0.2.4", + "http-body 0.4.2", "httparse", - "httpdate", + "httpdate 1.0.1", "itoa", - "pin-project-lite", - "socket2", + "pin-project-lite 0.2.7", + "socket2 0.4.1", "tokio 1.9.0", "tower-service", "tracing", @@ -1275,12 +1977,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", - "pin-project-lite", + "hyper 0.14.11", + "pin-project-lite 0.2.7", "tokio 1.9.0", "tokio-io-timeout", ] +[[package]] +name = "hyper-tls" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" +dependencies = [ + "bytes 0.5.6", + "hyper 0.13.10", + "native-tls", + "tokio 0.2.25", + "tokio-tls", +] + [[package]] name = "hyper-tls" version = "0.5.0" @@ -1288,7 +2003,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes 1.0.1", - "hyper", + "hyper 0.14.11", "native-tls", "tokio 1.9.0", "tokio-native-tls", @@ -1332,6 +2047,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "input_buffer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a8a95243d5a0398cae618ec29477c6e3cb631152be5c19481f80bc71559754" +dependencies = [ + "bytes 0.5.6", +] + [[package]] name = "input_buffer" version = "0.4.0" @@ -1359,6 +2083,33 @@ dependencies = [ "libc", ] +[[package]] +name = "ipconfig" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" +dependencies = [ + "socket2 0.3.19", + "widestring", + "winapi 0.3.9", + "winreg 0.6.2", +] + +[[package]] +name = "ipnet" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" + +[[package]] +name = "itertools" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.10.1" @@ -1405,6 +2156,23 @@ dependencies = [ "serde_json", ] +[[package]] +name = "k8s-openapi" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8eb97e4ea14cef484aa56f44e93653cb6faa351b5f130d38584b3184b6ef5d1" +dependencies = [ + "base64 0.10.1", + "bytes 0.4.12", + "chrono", + "http 0.1.21", + "percent-encoding 2.1.0", + "serde", + "serde-value 0.6.0", + "serde_json", + "url 2.2.2", +] + [[package]] name = "k8s-openapi" version = "0.13.0" @@ -1416,7 +2184,7 @@ dependencies = [ "chrono", "schemars", "serde", - "serde-value", + "serde-value 0.7.0", "serde_json", ] @@ -1430,6 +2198,32 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "kube" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a8a53ca3e8cb9f6ebdf09cdd8943d08926da7ca8d5c1d89dee1ed0e8df0a2a" +dependencies = [ + "base64 0.11.0", + "chrono", + "dirs", + "either", + "futures 0.3.16", + "futures-timer", + "http 0.2.4", + "k8s-openapi 0.6.0", + "log", + "openssl", + "reqwest 0.10.10", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "thiserror", + "time 0.1.44", + "url 2.2.2", +] + [[package]] name = "kube" version = "0.59.0" @@ -1442,13 +2236,13 @@ dependencies = [ "dirs-next", "either", "futures 0.3.16", - "http", - "http-body", - "hyper", + "http 0.2.4", + "http-body 0.4.2", + "hyper 0.14.11", "hyper-timeout", - "hyper-tls", + "hyper-tls 0.5.0", "jsonpath_lib", - "k8s-openapi", + "k8s-openapi 0.13.0", "kube-core", "kube-derive", "openssl", @@ -1460,8 +2254,8 @@ dependencies = [ "thiserror", "tokio 1.9.0", "tokio-native-tls", - "tokio-util", - "tower", + "tokio-util 0.6.7", + "tower 0.4.8", "tower-http", "tracing", ] @@ -1473,9 +2267,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c33d2272d8e530938bafc6cf4ac76f2a6f6c9ca684defcfab6c357913a43bcc" dependencies = [ "form_urlencoded", - "http", + "http 0.2.4", "json-patch", - "k8s-openapi", + "k8s-openapi 0.13.0", "once_cell", "serde", "serde_json", @@ -1505,15 +2299,15 @@ dependencies = [ "derivative", "futures 0.3.16", "json-patch", - "k8s-openapi", - "kube", + "k8s-openapi 0.13.0", + "kube 0.59.0", "pin-project 1.0.8", "serde", "serde_json", "smallvec 1.6.1", "snafu", "tokio 1.9.0", - "tokio-util", + "tokio-util 0.6.7", "tracing", ] @@ -1526,6 +2320,12 @@ dependencies = [ "log", ] +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" + [[package]] name = "lazy_static" version = "1.4.0" @@ -1582,12 +2382,27 @@ dependencies = [ "value-bag", ] +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "maplit" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "matches" version = "0.1.8" @@ -1673,6 +2488,18 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "mio-named-pipes" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" +dependencies = [ + "log", + "mio 0.6.23", + "miow 0.3.7", + "winapi 0.3.9", +] + [[package]] name = "mio-uds" version = "0.6.8" @@ -1714,6 +2541,21 @@ dependencies = [ "once_cell", ] +[[package]] +name = "mockall" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d614ad23f9bb59119b8b5670a85c7ba92c5e9adf4385c81ea00c51c8be33d5" +dependencies = [ + "cfg-if 1.0.0", + "downcast", + "fragile", + "lazy_static", + "mockall_derive 0.9.1", + "predicates", + "predicates-tree", +] + [[package]] name = "mockall" version = "0.10.2" @@ -1724,11 +2566,23 @@ dependencies = [ "downcast", "fragile", "lazy_static", - "mockall_derive", + "mockall_derive 0.10.2", "predicates", "predicates-tree", ] +[[package]] +name = "mockall_derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd4234635bca06fc96c7368d038061e0aae1b00a764dc817e900dc974e3deea" +dependencies = [ + "cfg-if 1.0.0", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "mockall_derive" version = "0.10.2" @@ -1858,11 +2712,11 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "onvif-discovery-handler" -version = "0.6.11" +version = "0.6.12" dependencies = [ "akri-discovery-utils", "akri-onvif", - "env_logger", + "env_logger 0.9.0", "log", "tokio 1.9.0", ] @@ -1894,7 +2748,7 @@ dependencies = [ "opcua-types", "serde", "serde_derive", - "time", + "time 0.1.44", "tokio 0.1.22", "tokio-codec", "tokio-io", @@ -1942,11 +2796,11 @@ dependencies = [ [[package]] name = "opcua-discovery-handler" -version = "0.6.11" +version = "0.6.12" dependencies = [ "akri-discovery-utils", "akri-opcua", - "env_logger", + "env_logger 0.9.0", "log", "tokio 1.9.0", ] @@ -1969,6 +2823,18 @@ dependencies = [ "uuid", ] +[[package]] +name = "openapi" +version = "1.1.0" +source = "git+https://github.com/DazWilkin/openapi-admission-v1?tag=v1.1.0#60a9ba6bd64efda65cb136a21e0d6a53e962c415" +dependencies = [ + "reqwest 0.11.4", + "serde", + "serde_derive", + "serde_json", + "url 1.7.2", +] + [[package]] name = "openssl" version = "0.10.35" @@ -2002,6 +2868,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-float" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" +dependencies = [ + "num-traits", +] + [[package]] name = "ordered-float" version = "2.7.0" @@ -2025,7 +2900,7 @@ checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" dependencies = [ "lock_api 0.3.4", "parking_lot_core 0.6.2", - "rustc_version", + "rustc_version 0.2.3", ] [[package]] @@ -2049,7 +2924,7 @@ dependencies = [ "cloudabi", "libc", "redox_syscall 0.1.57", - "rustc_version", + "rustc_version 0.2.3", "smallvec 0.6.14", "winapi 0.3.9", ] @@ -2190,6 +3065,12 @@ dependencies = [ "syn", ] +[[package]] +name = "pin-project-lite" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" + [[package]] name = "pin-project-lite" version = "0.2.7" @@ -2325,6 +3206,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "prost" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" +dependencies = [ + "bytes 0.5.6", + "prost-derive 0.6.1", +] + [[package]] name = "prost" version = "0.8.0" @@ -2332,7 +3223,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" dependencies = [ "bytes 1.0.1", - "prost-derive", + "prost-derive 0.8.0", ] [[package]] @@ -2343,16 +3234,29 @@ checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" dependencies = [ "bytes 1.0.1", "heck", - "itertools", + "itertools 0.10.1", "log", "multimap", "petgraph", - "prost", + "prost 0.8.0", "prost-types", "tempfile", "which", ] +[[package]] +name = "prost-derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" +dependencies = [ + "anyhow", + "itertools 0.8.2", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "prost-derive" version = "0.8.0" @@ -2360,7 +3264,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" dependencies = [ "anyhow", - "itertools", + "itertools 0.10.1", "proc-macro2", "quote", "syn", @@ -2373,7 +3277,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" dependencies = [ "bytes 1.0.1", - "prost", + "prost 0.8.0", ] [[package]] @@ -2408,6 +3312,7 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", + "rand_pcg", ] [[package]] @@ -2478,6 +3383,15 @@ dependencies = [ "rand_core 0.6.3", ] +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + [[package]] name = "redox_syscall" version = "0.1.57" @@ -2521,12 +3435,92 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "reqwest" +version = "0.10.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" +dependencies = [ + "async-compression", + "base64 0.13.0", + "bytes 0.5.6", + "encoding_rs", + "futures-core", + "futures-util", + "http 0.2.4", + "http-body 0.3.1", + "hyper 0.13.10", + "hyper-tls 0.4.3", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "mime_guess", + "native-tls", + "percent-encoding 2.1.0", + "pin-project-lite 0.2.7", + "serde", + "serde_json", + "serde_urlencoded 0.7.0", + "tokio 0.2.25", + "tokio-tls", + "url 2.2.2", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.7.0", +] + +[[package]] +name = "reqwest" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" +dependencies = [ + "base64 0.13.0", + "bytes 1.0.1", + "encoding_rs", + "futures-core", + "futures-util", + "http 0.2.4", + "http-body 0.4.2", + "hyper 0.14.11", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "mime_guess", + "percent-encoding 2.1.0", + "pin-project-lite 0.2.7", + "serde", + "serde_json", + "serde_urlencoded 0.7.0", + "tokio 1.9.0", + "url 2.2.2", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.7.0", +] + +[[package]] +name = "resolv-conf" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ - "winapi 0.3.9", + "hostname", + "quick-error", ] [[package]] @@ -2559,7 +3553,16 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", ] [[package]] @@ -2621,6 +3624,12 @@ dependencies = [ "syn", ] +[[package]] +name = "scoped-tls" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" + [[package]] name = "scoped-tls" version = "1.0.0" @@ -2672,7 +3681,16 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser 0.10.2", ] [[package]] @@ -2681,6 +3699,15 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + [[package]] name = "serde" version = "1.0.127" @@ -2690,13 +3717,23 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-value" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a65a7291a8a568adcae4c10a677ebcedbc6c9cec91c054dee2ce40b0e3290eb" +dependencies = [ + "ordered-float 1.1.1", + "serde", +] + [[package]] name = "serde-value" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" dependencies = [ - "ordered-float", + "ordered-float 2.7.0", "serde", ] @@ -2734,6 +3771,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" +dependencies = [ + "dtoa", + "itoa", + "serde", + "url 2.2.2", +] + [[package]] name = "serde_urlencoded" version = "0.7.0" @@ -2783,6 +3832,12 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -2836,6 +3891,17 @@ dependencies = [ "syn", ] +[[package]] +name = "socket2" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "winapi 0.3.9", +] + [[package]] name = "socket2" version = "0.4.1" @@ -2852,6 +3918,70 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version 0.2.3", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + [[package]] name = "strsim" version = "0.10.0" @@ -2919,6 +4049,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.26" @@ -2939,6 +4078,15 @@ dependencies = [ "syn", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" version = "0.1.44" @@ -2950,6 +4098,44 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "time" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check", + "winapi 0.3.9", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn", +] + [[package]] name = "tinyvec" version = "1.3.1" @@ -2989,6 +4175,30 @@ dependencies = [ "tokio-uds", ] +[[package]] +name = "tokio" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" +dependencies = [ + "bytes 0.5.6", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio 0.6.23", + "mio-named-pipes", + "mio-uds", + "num_cpus", + "pin-project-lite 0.1.12", + "signal-hook-registry", + "slab", + "tokio-macros 0.2.6", + "winapi 0.3.9", +] + [[package]] name = "tokio" version = "1.9.0" @@ -3003,9 +4213,9 @@ dependencies = [ "num_cpus", "once_cell", "parking_lot 0.11.1", - "pin-project-lite", + "pin-project-lite 0.2.7", "signal-hook-registry", - "tokio-macros", + "tokio-macros 1.3.0", "winapi 0.3.9", ] @@ -3020,6 +4230,25 @@ dependencies = [ "tokio-io", ] +[[package]] +name = "tokio-core" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87b1395334443abca552f63d4f61d0486f12377c2ba8b368e523f89e828cffd4" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "iovec", + "log", + "mio 0.6.23", + "scoped-tls 0.1.2", + "tokio 0.1.22", + "tokio-executor", + "tokio-io", + "tokio-reactor", + "tokio-timer", +] + [[package]] name = "tokio-current-thread" version = "0.1.7" @@ -3068,10 +4297,21 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9" dependencies = [ - "pin-project-lite", + "pin-project-lite 0.2.7", "tokio 1.9.0", ] +[[package]] +name = "tokio-macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tokio-macros" version = "1.3.0" @@ -3093,6 +4333,16 @@ dependencies = [ "tokio 1.9.0", ] +[[package]] +name = "tokio-openssl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c4b08c5f4208e699ede3df2520aca2e82401b2de33f45e96696a074480be594" +dependencies = [ + "openssl", + "tokio 0.2.25", +] + [[package]] name = "tokio-reactor" version = "0.1.12" @@ -3123,6 +4373,23 @@ dependencies = [ "webpki", ] +[[package]] +name = "tokio-signal" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c34c6e548f101053321cba3da7cbb87a610b85555884c41b07da2eb91aff12" +dependencies = [ + "futures 0.1.31", + "libc", + "mio 0.6.23", + "mio-uds", + "signal-hook-registry", + "tokio-executor", + "tokio-io", + "tokio-reactor", + "winapi 0.3.9", +] + [[package]] name = "tokio-stream" version = "0.1.7" @@ -3130,7 +4397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" dependencies = [ "futures-core", - "pin-project-lite", + "pin-project-lite 0.2.7", "tokio 1.9.0", ] @@ -3187,6 +4454,29 @@ dependencies = [ "tokio-executor", ] +[[package]] +name = "tokio-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" +dependencies = [ + "native-tls", + "tokio 0.2.25", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d9e878ad426ca286e4dcae09cbd4e1973a7f8987d97570e2469703dd7f5720c" +dependencies = [ + "futures-util", + "log", + "pin-project 0.4.28", + "tokio 0.2.25", + "tungstenite 0.11.1", +] + [[package]] name = "tokio-tungstenite" version = "0.13.0" @@ -3197,7 +4487,7 @@ dependencies = [ "log", "pin-project 1.0.8", "tokio 1.9.0", - "tungstenite", + "tungstenite 0.12.0", ] [[package]] @@ -3216,21 +4506,49 @@ dependencies = [ ] [[package]] -name = "tokio-uds" -version = "0.2.7" +name = "tokio-uds" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "iovec", + "libc", + "log", + "mio 0.6.23", + "mio-uds", + "tokio-codec", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-util" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" +dependencies = [ + "bytes 0.5.6", + "futures-core", + "futures-sink", + "log", + "pin-project-lite 0.1.12", + "tokio 0.2.25", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "iovec", - "libc", + "bytes 0.5.6", + "futures-core", + "futures-sink", "log", - "mio 0.6.23", - "mio-uds", - "tokio-codec", - "tokio-io", - "tokio-reactor", + "pin-project-lite 0.1.12", + "tokio 0.2.25", ] [[package]] @@ -3243,37 +4561,67 @@ dependencies = [ "futures-core", "futures-sink", "log", - "pin-project-lite", + "pin-project-lite 0.2.7", "slab", "tokio 1.9.0", ] +[[package]] +name = "tonic" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08283643b1d483eb7f3fc77069e63b5cba3e4db93514b3d45470e67f123e4e48" +dependencies = [ + "async-stream 0.2.1", + "async-trait", + "base64 0.10.1", + "bytes 0.5.6", + "futures-core", + "futures-util", + "http 0.2.4", + "http-body 0.3.1", + "hyper 0.13.10", + "percent-encoding 1.0.1", + "pin-project 0.4.28", + "prost 0.6.1", + "prost-derive 0.6.1", + "tokio 0.2.25", + "tokio-util 0.2.0", + "tower 0.3.1", + "tower-balance", + "tower-load", + "tower-make", + "tower-service", + "tracing", + "tracing-futures", +] + [[package]] name = "tonic" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "796c5e1cd49905e65dd8e700d4cb1dffcbfdb4fc9d017de08c1a537afd83627c" dependencies = [ - "async-stream", + "async-stream 0.3.2", "async-trait", "base64 0.13.0", "bytes 1.0.1", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.3", + "http 0.2.4", + "http-body 0.4.2", + "hyper 0.14.11", "hyper-timeout", "percent-encoding 2.1.0", "pin-project 1.0.8", - "prost", - "prost-derive", + "prost 0.8.0", + "prost-derive 0.8.0", "tokio 1.9.0", "tokio-rustls", "tokio-stream", - "tokio-util", - "tower", + "tokio-util 0.6.7", + "tower 0.4.8", "tower-layer", "tower-service", "tracing", @@ -3292,6 +4640,24 @@ dependencies = [ "syn", ] +[[package]] +name = "tower" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3169017c090b7a28fce80abaad0ab4f5566423677c9331bb320af7e49cfe62" +dependencies = [ + "futures-core", + "tower-buffer", + "tower-discover", + "tower-layer", + "tower-limit", + "tower-load-shed", + "tower-retry", + "tower-service", + "tower-timeout", + "tower-util", +] + [[package]] name = "tower" version = "0.4.8" @@ -3306,12 +4672,59 @@ dependencies = [ "slab", "tokio 1.9.0", "tokio-stream", - "tokio-util", + "tokio-util 0.6.7", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-balance" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a792277613b7052448851efcf98a2c433e6f1d01460832dc60bef676bc275d4c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project 0.4.28", + "rand 0.7.3", + "slab", + "tokio 0.2.25", + "tower-discover", + "tower-layer", + "tower-load", + "tower-make", + "tower-ready-cache", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-buffer" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4887dc2a65d464c8b9b66e0e4d51c2fd6cf5b3373afc72805b0a60bce00446a" +dependencies = [ + "futures-core", + "pin-project 0.4.28", + "tokio 0.2.25", "tower-layer", "tower-service", "tracing", ] +[[package]] +name = "tower-discover" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f6b5000c3c54d269cc695dff28136bb33d08cbf1df2c48129e143ab65bf3c2a" +dependencies = [ + "futures-core", + "pin-project 0.4.28", + "tower-service", +] + [[package]] name = "tower-http" version = "0.1.1" @@ -3322,8 +4735,8 @@ dependencies = [ "bytes 1.0.1", "futures-core", "futures-util", - "http", - "http-body", + "http 0.2.4", + "http-body 0.4.2", "pin-project 1.0.8", "tower-layer", "tower-service", @@ -3336,12 +4749,113 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" +[[package]] +name = "tower-limit" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c3040c5dbed68abffaa0d4517ac1a454cd741044f33ab0eefab6b8d1361404" +dependencies = [ + "futures-core", + "pin-project 0.4.28", + "tokio 0.2.25", + "tower-layer", + "tower-load", + "tower-service", +] + +[[package]] +name = "tower-load" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cc79fc3afd07492b7966d7efa7c6c50f8ed58d768a6075dd7ae6591c5d2017b" +dependencies = [ + "futures-core", + "log", + "pin-project 0.4.28", + "tokio 0.2.25", + "tower-discover", + "tower-service", +] + +[[package]] +name = "tower-load-shed" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f021e23900173dc315feb4b6922510dae3e79c689b74c089112066c11f0ae4e" +dependencies = [ + "futures-core", + "pin-project 0.4.28", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-make" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce50370d644a0364bf4877ffd4f76404156a248d104e2cc234cd391ea5cdc965" +dependencies = [ + "tokio 0.2.25", + "tower-service", +] + +[[package]] +name = "tower-ready-cache" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eabb6620e5481267e2ec832c780b31cad0c15dcb14ed825df5076b26b591e1f" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "log", + "tokio 0.2.25", + "tower-service", +] + +[[package]] +name = "tower-retry" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6727956aaa2f8957d4d9232b308fe8e4e65d99db30f42b225646e86c9b6a952" +dependencies = [ + "futures-core", + "pin-project 0.4.28", + "tokio 0.2.25", + "tower-layer", + "tower-service", +] + [[package]] name = "tower-service" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +[[package]] +name = "tower-timeout" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "127b8924b357be938823eaaec0608c482d40add25609481027b96198b2e4b31e" +dependencies = [ + "pin-project 0.4.28", + "tokio 0.2.25", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1093c19826d33807c72511e68f73b4a0469a3f22c2bd5f7d5212178b4b89674" +dependencies = [ + "futures-core", + "futures-util", + "pin-project 0.4.28", + "tower-service", +] + [[package]] name = "tracing" version = "0.1.26" @@ -3350,7 +4864,7 @@ checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite", + "pin-project-lite 0.2.7", "tracing-attributes", "tracing-core", ] @@ -3400,12 +4914,70 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" +[[package]] +name = "trust-dns-proto" +version = "0.19.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cad71a0c0d68ab9941d2fb6e82f8fb2e86d9945b94e1661dd0aaea2b88215a9" +dependencies = [ + "async-trait", + "cfg-if 1.0.0", + "enum-as-inner", + "futures 0.3.16", + "idna 0.2.3", + "lazy_static", + "log", + "rand 0.7.3", + "smallvec 1.6.1", + "thiserror", + "tokio 0.2.25", + "url 2.2.2", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.19.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710f593b371175db53a26d0b38ed2978fafb9e9e8d3868b1acd753ea18df0ceb" +dependencies = [ + "cfg-if 0.1.10", + "futures 0.3.16", + "ipconfig", + "lazy_static", + "log", + "lru-cache", + "resolv-conf", + "smallvec 1.6.1", + "thiserror", + "tokio 0.2.25", + "trust-dns-proto", +] + [[package]] name = "try-lock" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "tungstenite" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0308d80d86700c5878b9ef6321f020f29b1bb9d5ff3cab25e75e23f3a492a23" +dependencies = [ + "base64 0.12.3", + "byteorder", + "bytes 0.5.6", + "http 0.2.4", + "httparse", + "input_buffer 0.3.1", + "log", + "rand 0.7.3", + "sha-1 0.9.7", + "url 2.2.2", + "utf-8", +] + [[package]] name = "tungstenite" version = "0.12.0" @@ -3415,9 +4987,9 @@ dependencies = [ "base64 0.13.0", "byteorder", "bytes 1.0.1", - "http", + "http 0.2.4", "httparse", - "input_buffer", + "input_buffer 0.4.0", "log", "rand 0.8.4", "sha-1 0.9.7", @@ -3464,28 +5036,28 @@ dependencies = [ [[package]] name = "udev-discovery-handler" -version = "0.6.11" +version = "0.6.12" dependencies = [ "akri-discovery-utils", "akri-udev", - "env_logger", + "env_logger 0.9.0", "log", "tokio 1.9.0", ] [[package]] name = "udev-video-broker" -version = "0.6.11" +version = "0.6.12" dependencies = [ - "akri-shared", - "env_logger", + "akri-shared 0.6.12", + "env_logger 0.9.0", "lazy_static", "log", "prometheus 0.12.0", - "prost", + "prost 0.8.0", "rscam", "tokio 1.9.0", - "tonic", + "tonic 0.5.2", "tonic-build", ] @@ -3522,6 +5094,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + [[package]] name = "unicode-xid" version = "0.2.2" @@ -3557,6 +5135,12 @@ dependencies = [ "percent-encoding 2.1.0", ] +[[package]] +name = "urlencoding" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a1f0175e03a0973cf4afd476bef05c26e228520400eb1fd473ad417b1c00ffb" + [[package]] name = "utf-8" version = "0.7.6" @@ -3588,6 +5172,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version_check" version = "0.9.3" @@ -3610,6 +5200,34 @@ dependencies = [ "try-lock", ] +[[package]] +name = "warp" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f41be6df54c97904af01aa23e613d4521eed7ab23537cede692d4058f6449407" +dependencies = [ + "bytes 0.5.6", + "futures 0.3.16", + "headers", + "http 0.2.4", + "hyper 0.13.10", + "log", + "mime", + "mime_guess", + "multipart", + "pin-project 0.4.28", + "scoped-tls 1.0.0", + "serde", + "serde_json", + "serde_urlencoded 0.6.1", + "tokio 0.2.25", + "tokio-tungstenite 0.11.0", + "tower-service", + "tracing", + "tracing-futures", + "urlencoding", +] + [[package]] name = "warp" version = "0.3.1" @@ -3619,22 +5237,22 @@ dependencies = [ "bytes 1.0.1", "futures 0.3.16", "headers", - "http", - "hyper", + "http 0.2.4", + "hyper 0.14.11", "log", "mime", "mime_guess", "multipart", "percent-encoding 2.1.0", "pin-project 1.0.8", - "scoped-tls", + "scoped-tls 1.0.0", "serde", "serde_json", - "serde_urlencoded", + "serde_urlencoded 0.7.0", "tokio 1.9.0", "tokio-stream", - "tokio-tungstenite", - "tokio-util", + "tokio-tungstenite 0.13.0", + "tokio-util 0.6.7", "tower-service", "tracing", ] @@ -3658,6 +5276,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b608ecc8f4198fe8680e2ed18eccab5f0cd4caaf3d83516fa5fb2e927fda2586" dependencies = [ "cfg-if 1.0.0", + "serde", + "serde_json", "wasm-bindgen-macro", ] @@ -3727,6 +5347,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webhook-configuration" +version = "0.6.12" +dependencies = [ + "actix", + "actix-rt 2.2.0", + "actix-web", + "akri-shared 0.6.5", + "clap", + "k8s-openapi 0.6.0", + "kube 0.23.0", + "openapi", + "openssl", + "rustls", + "serde", + "serde_json", +] + [[package]] name = "webpki" version = "0.21.4" @@ -3757,6 +5395,12 @@ dependencies = [ "libc", ] +[[package]] +name = "widestring" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" + [[package]] name = "winapi" version = "0.2.8" @@ -3800,6 +5444,24 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "winreg" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "ws2_32-sys" version = "0.2.1" diff --git a/Cargo.toml b/Cargo.toml index 7dc0f379f..2cf3bca67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [ "agent", "controller", "samples/brokers/udev-video-broker", - # "webhooks/validating/configuration", + "webhooks/validating/configuration", "discovery-utils", "discovery-handlers/debug-echo", "discovery-handlers/onvif", diff --git a/webhooks/validating/configuration/Cargo.toml b/webhooks/validating/configuration/Cargo.toml index 3a432148f..daf5e6de1 100644 --- a/webhooks/validating/configuration/Cargo.toml +++ b/webhooks/validating/configuration/Cargo.toml @@ -5,14 +5,13 @@ authors = ["DazWilkin "] edition = "2018" [dependencies] -actix = "0.11.1" +actix = "0.12.0" actix-web = { version = "3.3.2", features = ["openssl"] } actix-rt = "2.2.0" -akri-shared = { path = "../../../shared" } -clap = "3.0.0-beta.2" -kube = { version = "0.59.0", features = ["derive"] } -kube-runtime = "0.59.0" -k8s-openapi = { version = "0.13.0", default-features = false, features = ["schemars", "v1_16"] } +akri-shared = { git = "https://github.com/deislabs/akri", package = "akri-shared", tag = "v0.6.5" } +clap = "2.33.3" +k8s-openapi = { version = "0.6.0", features = ["v1_16"] } +kube = { version = "0.23.0", features = ["openapi"] } openapi = { git = "https://github.com/DazWilkin/openapi-admission-v1", tag = "v1.1.0" } openssl = "0.10" rustls = "0.19.0" diff --git a/webhooks/validating/configuration/src/main.rs b/webhooks/validating/configuration/src/main.rs index 077094f7b..13c50747a 100644 --- a/webhooks/validating/configuration/src/main.rs +++ b/webhooks/validating/configuration/src/main.rs @@ -1,5 +1,5 @@ use actix_web::{post, web, App, HttpResponse, HttpServer, Responder}; -use akri_shared::akri::configuration::Configuration; +use akri_shared::akri::configuration::KubeAkriConfig; use clap::Arg; use k8s_openapi::apimachinery::pkg::runtime::RawExtension; use openapi::models::{ @@ -115,7 +115,7 @@ fn validate_configuration(rqst: &AdmissionRequest) -> AdmissionResponse { let x: RawExtension = serde_json::from_value(raw.clone()) .expect("Could not parse as Kubernetes RawExtension"); let y = serde_json::to_string(&x).unwrap(); - let config: Configuration = + let config: KubeAkriConfig = serde_json::from_str(y.as_str()).expect("Could not parse as Akri Configuration"); let reserialized = serde_json::to_string(&config).unwrap(); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); @@ -179,7 +179,7 @@ async fn validate(rqst: web::Json) -> impl Responder { match &rqst.request { Some(rqst) => { println!("Handler received: AdmissionRequest"); - let resp = validate_configuration(rqst); + let resp = validate_configuration(&rqst); let resp: AdmissionReview = AdmissionReview { api_version: Some("admission.k8s.io/v1".to_owned()), kind: Some("AdmissionReview".to_owned()), @@ -187,11 +187,11 @@ async fn validate(rqst: web::Json) -> impl Responder { response: Some(resp), }; let body = serde_json::to_string(&resp).expect("Valid AdmissionReview"); - HttpResponse::Ok().body(body) + return HttpResponse::Ok().body(body); } None => { println!("Handler received: Nothing"); - HttpResponse::BadRequest().body("") + return HttpResponse::BadRequest().body(""); } } } @@ -200,25 +200,25 @@ async fn validate(rqst: web::Json) -> impl Responder { async fn main() -> std::io::Result<()> { let matches = clap::App::new("Akri Webhook") .arg( - Arg::new("crt_file") + Arg::with_name("crt_file") .long("tls-crt-file") .takes_value(true) .required(true) - .about("TLS certificate file"), + .help("TLS certificate file"), ) .arg( - Arg::new("key_file") + Arg::with_name("key_file") .long("tls-key-file") .takes_value(true) .required(true) - .about("TLS private key file"), + .help("TLS private key file"), ) .arg( - Arg::new("port") + Arg::with_name("port") .long("port") .takes_value(true) .required(true) - .about("port"), + .help("port"), ) .get_matches(); @@ -680,10 +680,10 @@ mod tests { } // Akri Configuration schema tests - use kube::api::{NotUsed, Object}; + use kube::api::{Object, Void}; #[test] fn test_creationtimestamp_is_filtered() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); @@ -692,7 +692,7 @@ mod tests { #[test] fn test_deletiontimestamp_is_filtered() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); @@ -701,7 +701,7 @@ mod tests { #[test] fn test_managedfields_is_filtered() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); @@ -710,7 +710,7 @@ mod tests { #[test] fn test_generation_becomes_f64() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); From 5365e22031cfa953d026d0c3b9936a4dd4a2d7dc Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 12 Aug 2021 11:57:37 -0700 Subject: [PATCH 07/22] update version.sh to not check/update version of dependencies with git sources --- version.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/version.sh b/version.sh index 96974793b..963ecb4f2 100755 --- a/version.sh +++ b/version.sh @@ -26,7 +26,12 @@ check_twoline_version() VERSION_STRING=$3 echo "Check $FILE ($LINE1_PATTERN :: $VERSION_STRING)" - + SKIP_SOURCE=$(grep "$LINE1_PATTERN" -A 2 $FILE | grep "source =") + if [ "$SKIP_SOURCE" != "" ]; then + echo " Skipping check: $LINE1_PATTERN" + return 0 + fi + CORRECT_VERSION=$(grep "$LINE1_PATTERN" -A 1 $FILE | grep "$VERSION_STRING") if [ "$CORRECT_VERSION" == "" ]; then echo " Needs upate: $FILE" @@ -59,6 +64,12 @@ update_twoline_version() NEW_LINE2=$5 echo "Update $FILE [$LINE1_PATTERN, $LINE2_PATTERN] => [$NEW_LINE1, $NEW_LINE2]" + SKIP_SOURCE=$(grep "$LINE1_PATTERN" -A 2 $FILE | grep "source =") + if [ "$SKIP_SOURCE" != "" ]; then + echo " Skipping Update: $LINE1_PATTERN" + return 0 + fi + sed -i "/$LINE1_PATTERN/ {n;/$LINE2_PATTERN/ {s/$LINE2_PATTERN/$NEW_LINE2/;p;d;}}" $FILE return $? } From 86cedb30b248ee43535b730a314314e9efaa42b5 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 12 Aug 2021 12:23:20 -0700 Subject: [PATCH 08/22] remove TODOs --- Cargo.lock | 1 - agent/Cargo.toml | 1 - shared/Cargo.toml | 2 -- shared/src/akri/configuration.rs | 2 -- shared/src/akri/instance.rs | 3 --- shared/src/k8s/service.rs | 1 - 6 files changed, 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa8e0d52e..dcada7de3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -537,7 +537,6 @@ dependencies = [ "serde_json", "serde_yaml", "tokio 1.9.0", - "tokio-stream", "tonic 0.5.2", "tower 0.4.8", "warp 0.3.1", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 6abe835b7..ac6b5fc80 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -42,7 +42,6 @@ serde_derive = "1.0.104" tokio = { version = "1.0", features = ["rt-multi-thread", "time", "fs", "macros", "net"] } tokio-stream = { version = "0.1", features = ["net"] } tonic = "0.5.2" -# TODO kagold maybe dont need tower tower = "0.4.8" url = "2.1.0" uuid = { version = "0.8.1", features = ["v4"] } diff --git a/shared/Cargo.toml b/shared/Cargo.toml index f1bd46bf5..b6c96ecf3 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -27,8 +27,6 @@ serde_derive = "1.0" serde_json = "1.0" serde_yaml = "0.8" tokio = { version = "1.0.1", features = ["full"] } -# TODO: is this needed? -tokio-stream = { version = "0.1", features = ["net"] } tonic = "0.5.2" tower = "0.4.8" warp = "0.3.1" diff --git a/shared/src/akri/configuration.rs b/shared/src/akri/configuration.rs index 8492e2188..71a507ad2 100644 --- a/shared/src/akri/configuration.rs +++ b/shared/src/akri/configuration.rs @@ -95,7 +95,6 @@ pub struct ConfigurationSpec { /// # } /// ``` pub async fn get_configurations(kube_client: &Client) -> Result { - // TODO kagold: pass in namespace and use Api::namespaced let configurations_client: Api = Api::all(kube_client.clone()); let lp = ListParams::default(); match configurations_client.list(&lp).await { @@ -141,7 +140,6 @@ pub async fn find_configuration( kube_client: &Client, ) -> Result { log::trace!("find_configuration enter"); - // TODO kagold: pass in namespace let configurations_client: Api = Api::namespaced(kube_client.clone(), namespace); log::trace!("find_configuration getting instance with name {}", name); diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs index 022b58be4..c325715d5 100644 --- a/shared/src/akri/instance.rs +++ b/shared/src/akri/instance.rs @@ -69,7 +69,6 @@ pub struct InstanceSpec { /// ``` pub async fn get_instances(kube_client: &Client) -> Result { log::trace!("get_instances enter"); - // TODO kagold: pass in namespace and use Api::namespaced let instances_client: Api = Api::all(kube_client.clone()); let lp = ListParams::default(); match instances_client.list(&lp).await { @@ -113,10 +112,8 @@ pub async fn find_instance( name: &str, namespace: &str, kube_client: &Client, - // TODO kagold: dont use boxed ) -> Result { log::trace!("find_instance enter"); - // TODO kagold: pass in namespace let instances_client: Api = Api::namespaced(kube_client.clone(), namespace); log::trace!("find_instance getting instance with name {}", name); diff --git a/shared/src/k8s/service.rs b/shared/src/k8s/service.rs index bf217d0a3..c6b5935a6 100644 --- a/shared/src/k8s/service.rs +++ b/shared/src/k8s/service.rs @@ -38,7 +38,6 @@ pub async fn find_services_with_selector( kube_client: Client, ) -> Result, anyhow::Error> { trace!("find_services_with_selector with selector={:?}", &selector); - // TODO kagold: make namespaced let svc_client: Api = Api::all(kube_client); let svc_list_params = ListParams { label_selector: Some(selector.to_string()), From 93c0053167e4a3dd1714f75a869f656da2266a11 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 12 Aug 2021 13:41:13 -0700 Subject: [PATCH 09/22] Increase Akri Rust version to support kube crate --- .github/actions/build-component-per-arch/main.js | 2 +- .github/workflows/build-rust-code.yml | 2 +- .github/workflows/check-rust.yml | 2 +- README.md | 2 +- build/setup.sh | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/build-component-per-arch/main.js b/.github/actions/build-component-per-arch/main.js index d3e4a7e5f..352debc22 100644 --- a/.github/actions/build-component-per-arch/main.js +++ b/.github/actions/build-component-per-arch/main.js @@ -67,7 +67,7 @@ async function shell_cmd(cmd) { if (core.getInput('build_rust') == '1') { console.log(`Install Rust`) - child_process.execSync(`curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.51.0`); + child_process.execSync(`curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.54.0`); const bindir = `${process.env.HOME}/.cargo/bin`; process.env.PATH = `${process.env.PATH}:${bindir}`; diff --git a/.github/workflows/build-rust-code.yml b/.github/workflows/build-rust-code.yml index 5fd394948..1437a36ee 100644 --- a/.github/workflows/build-rust-code.yml +++ b/.github/workflows/build-rust-code.yml @@ -74,7 +74,7 @@ jobs: - name: Rust install uses: actions-rs/toolchain@v1 with: - toolchain: 1.51.0 + toolchain: 1.54.0 override: true components: clippy, rustfmt diff --git a/.github/workflows/check-rust.yml b/.github/workflows/check-rust.yml index 8c06b7b26..a096bd290 100644 --- a/.github/workflows/check-rust.yml +++ b/.github/workflows/check-rust.yml @@ -33,7 +33,7 @@ jobs: - name: Rust install uses: actions-rs/toolchain@v1 with: - toolchain: 1.51.0 + toolchain: 1.54.0 override: true components: clippy, rustfmt - name: Install Linux requirements diff --git a/README.md b/README.md index 41d752960..c41f91c63 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Akri Logo

[![Slack channel #akri](https://img.shields.io/badge/slack-akri-blueviolet.svg?logo=slack)](https://kubernetes.slack.com/messages/akri) -[![Rust Version](https://img.shields.io/badge/rustc-1.51.0-blue.svg)](https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html) +[![Rust Version](https://img.shields.io/badge/rustc-1.54.0-blue.svg)](https://blog.rust-lang.org/2021/03/25/Rust-1.54.0.html) [![Kubernetes Version](https://img.shields.io/badge/kubernetes-≥%201.16-blue.svg)](https://kubernetes.io/) [![codecov](https://codecov.io/gh/deislabs/akri/branch/main/graph/badge.svg?token=V468HO7CDE)](https://codecov.io/gh/deislabs/akri) diff --git a/build/setup.sh b/build/setup.sh index 662633deb..ef1ab63bd 100755 --- a/build/setup.sh +++ b/build/setup.sh @@ -23,10 +23,10 @@ then if [ -x "$(command -v sudo)" ]; then echo "Install rustup" - sudo curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=1.51.0 + sudo curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=1.54.0 else echo "Install rustup" - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=1.51.0 + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=1.54.0 fi else echo "Found rustup" From 206c355690472327c1a4de1d0981531dbeb685bd Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 12 Aug 2021 15:40:12 -0700 Subject: [PATCH 10/22] PR updates: address naming and add and remove commenting --- agent/src/util/device_plugin_service.rs | 1 - agent/src/util/discovery_operator.rs | 2 ++ controller/src/util/node_watcher.rs | 5 ----- controller/src/util/shared_test_utils.rs | 6 +++--- shared/src/akri/configuration.rs | 6 +++--- shared/src/k8s/mod.rs | 11 ++++------- 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/agent/src/util/device_plugin_service.rs b/agent/src/util/device_plugin_service.rs index 978f5eed6..853a11518 100644 --- a/agent/src/util/device_plugin_service.rs +++ b/agent/src/util/device_plugin_service.rs @@ -118,7 +118,6 @@ impl DevicePlugin for DevicePluginService { type ListAndWatchStream = Pin> + Send + Sync + 'static>>; - // type ListAndWatchStream = mpsc::Receiver>; /// Called by Kubelet right after the DevicePluginService registers with Kubelet. /// Returns a stream of List of "virtual" Devices over a channel. diff --git a/agent/src/util/discovery_operator.rs b/agent/src/util/discovery_operator.rs index c4bba25fa..9a5154736 100644 --- a/agent/src/util/discovery_operator.rs +++ b/agent/src/util/discovery_operator.rs @@ -126,6 +126,8 @@ impl DiscoveryOperator { ); match discovery_handler.discover(discover_request).await { Ok(device_update_receiver) => Some(StreamType::Embedded( + // `discover` returns `Result, tonic::Status>` + // Get the `Receiver` from the `DiscoverStream` wrapper device_update_receiver.into_inner().into_inner(), )), Err(e) => { diff --git a/controller/src/util/node_watcher.rs b/controller/src/util/node_watcher.rs index f7201c992..93546c059 100644 --- a/controller/src/util/node_watcher.rs +++ b/controller/src/util/node_watcher.rs @@ -412,11 +412,6 @@ mod tests { let node_json = file::read_file_to_string("../test/json/node-b-not-ready.json"); let node: Node = serde_json::from_str(&node_json).unwrap(); let mut node_watcher = NodeWatcher::new(); - // Add Node to known_nodes with original Running state - node_watcher - .known_nodes - .insert("node-b".to_string(), NodeState::Running); - let instance_file = "../test/json/shared-instance-update.json"; let instance_json = file::read_file_to_string(instance_file); let kube_object_instance: Instance = serde_json::from_str(&instance_json).unwrap(); diff --git a/controller/src/util/shared_test_utils.rs b/controller/src/util/shared_test_utils.rs index a7b5a62b8..4dce38759 100644 --- a/controller/src/util/shared_test_utils.rs +++ b/controller/src/util/shared_test_utils.rs @@ -38,9 +38,9 @@ pub mod config_for_tests { } ))) } else { - let dci_json = file::read_file_to_string(result_file); - let dci: Instance = serde_json::from_str(&dci_json).unwrap(); - Ok(dci) + let instance_json = file::read_file_to_string(result_file); + let instance: Instance = serde_json::from_str(&instance_json).unwrap(); + Ok(instance) } }); } diff --git a/shared/src/akri/configuration.rs b/shared/src/akri/configuration.rs index 71a507ad2..1c9cb5ca2 100644 --- a/shared/src/akri/configuration.rs +++ b/shared/src/akri/configuration.rs @@ -15,7 +15,7 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::collections::HashMap; -pub type KubeAkriConfigList = ObjectList; +pub type ConfigurationList = ObjectList; /// This specifies which `DiscoveryHandler` should be used for discovery /// and any details that need to be sent to the `DiscoveryHandler`. @@ -91,10 +91,10 @@ pub struct ConfigurationSpec { /// # #[tokio::main] /// # async fn main() { /// let api_client = Client::try_default().await.unwrap(); -/// let dccs = configuration::get_configurations(&api_client).await.unwrap(); +/// let configs = configuration::get_configurations(&api_client).await.unwrap(); /// # } /// ``` -pub async fn get_configurations(kube_client: &Client) -> Result { +pub async fn get_configurations(kube_client: &Client) -> Result { let configurations_client: Api = Api::all(kube_client.clone()); let lp = ListParams::default(); match configurations_client.list(&lp).await { diff --git a/shared/src/k8s/mod.rs b/shared/src/k8s/mod.rs index 61b74caac..af58380f1 100644 --- a/shared/src/k8s/mod.rs +++ b/shared/src/k8s/mod.rs @@ -1,6 +1,6 @@ use super::akri::{ configuration, - configuration::{Configuration, KubeAkriConfigList}, + configuration::{Configuration, ConfigurationList}, instance, instance::{Instance, InstanceSpec, KubeAkriInstanceList}, retry::{random_delay, MAX_INSTANCE_UPDATE_TRIES}, @@ -120,7 +120,7 @@ pub trait KubeInterface: Send + Sync { name: &str, namespace: &str, ) -> Result; - async fn get_configurations(&self) -> Result; + async fn get_configurations(&self) -> Result; async fn find_instance(&self, name: &str, namespace: &str) -> Result; async fn get_instances(&self) -> Result; @@ -374,10 +374,10 @@ impl KubeInterface for KubeImpl { /// # #[tokio::main] /// # async fn main() { /// let kube = k8s::KubeImpl::new().await.unwrap(); - /// let dccs = kube.get_configurations().await.unwrap(); + /// let configs = kube.get_configurations().await.unwrap(); /// # } /// ``` - async fn get_configurations(&self) -> Result { + async fn get_configurations(&self) -> Result { configuration::get_configurations(&self.get_kube_client()).await } @@ -550,9 +550,6 @@ pub async fn try_delete_instance( log::error!("try_delete_instance - when looking up Instance {}, got kube API error: {:?}", instance_name, ae); } } - // Err(e) => { - // log::error!("try_delete_instance - when looking up Instance {}, got kube error: {:?}. {} retries left.", instance_name, e, MAX_INSTANCE_UPDATE_TRIES - x - 1); - // } Ok(_) => { log::error!( "try_delete_instance - tried to delete Instance {} but still exists. {} retries left.", From 51cd778d28bc717b630f0b0b91b9713af4af137a Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 12 Aug 2021 15:48:51 -0700 Subject: [PATCH 11/22] increase version --- Cargo.lock | 42 +++++++++---------- agent/Cargo.toml | 2 +- controller/Cargo.toml | 2 +- deployment/helm/Chart.yaml | 4 +- .../debug-echo-discovery-handler/Cargo.toml | 2 +- .../onvif-discovery-handler/Cargo.toml | 2 +- .../opcua-discovery-handler/Cargo.toml | 2 +- .../udev-discovery-handler/Cargo.toml | 2 +- discovery-handlers/debug-echo/Cargo.toml | 2 +- discovery-handlers/onvif/Cargo.toml | 2 +- discovery-handlers/opcua/Cargo.toml | 2 +- discovery-handlers/udev/Cargo.toml | 2 +- discovery-utils/Cargo.toml | 2 +- samples/brokers/udev-video-broker/Cargo.toml | 2 +- shared/Cargo.toml | 2 +- version.txt | 2 +- webhooks/validating/configuration/Cargo.toml | 2 +- 17 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dcada7de3..4379a3281 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,13 +333,13 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "agent" -version = "0.6.12" +version = "0.6.13" dependencies = [ "akri-debug-echo", "akri-discovery-utils", "akri-onvif", "akri-opcua", - "akri-shared 0.6.12", + "akri-shared 0.6.13", "akri-udev", "anyhow", "async-stream 0.3.2", @@ -390,10 +390,10 @@ dependencies = [ [[package]] name = "akri-debug-echo" -version = "0.6.12" +version = "0.6.13" dependencies = [ "akri-discovery-utils", - "akri-shared 0.6.12", + "akri-shared 0.6.13", "anyhow", "async-trait", "env_logger 0.9.0", @@ -410,9 +410,9 @@ dependencies = [ [[package]] name = "akri-discovery-utils" -version = "0.6.12" +version = "0.6.13" dependencies = [ - "akri-shared 0.6.12", + "akri-shared 0.6.13", "anyhow", "async-stream 0.3.2", "async-trait", @@ -432,10 +432,10 @@ dependencies = [ [[package]] name = "akri-onvif" -version = "0.6.12" +version = "0.6.13" dependencies = [ "akri-discovery-utils", - "akri-shared 0.6.12", + "akri-shared 0.6.13", "anyhow", "async-trait", "bytes 1.0.1", @@ -461,10 +461,10 @@ dependencies = [ [[package]] name = "akri-opcua" -version = "0.6.12" +version = "0.6.13" dependencies = [ "akri-discovery-utils", - "akri-shared 0.6.12", + "akri-shared 0.6.13", "anyhow", "async-trait", "env_logger 0.9.0", @@ -515,7 +515,7 @@ dependencies = [ [[package]] name = "akri-shared" -version = "0.6.12" +version = "0.6.13" dependencies = [ "anyhow", "async-trait", @@ -544,7 +544,7 @@ dependencies = [ [[package]] name = "akri-udev" -version = "0.6.12" +version = "0.6.13" dependencies = [ "akri-discovery-utils", "anyhow", @@ -1059,9 +1059,9 @@ checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" [[package]] name = "controller" -version = "0.6.12" +version = "0.6.13" dependencies = [ - "akri-shared 0.6.12", + "akri-shared 0.6.13", "anyhow", "async-std", "async-trait", @@ -1274,7 +1274,7 @@ dependencies = [ [[package]] name = "debug-echo-discovery-handler" -version = "0.6.12" +version = "0.6.13" dependencies = [ "akri-debug-echo", "akri-discovery-utils", @@ -2711,7 +2711,7 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "onvif-discovery-handler" -version = "0.6.12" +version = "0.6.13" dependencies = [ "akri-discovery-utils", "akri-onvif", @@ -2795,7 +2795,7 @@ dependencies = [ [[package]] name = "opcua-discovery-handler" -version = "0.6.12" +version = "0.6.13" dependencies = [ "akri-discovery-utils", "akri-opcua", @@ -5035,7 +5035,7 @@ dependencies = [ [[package]] name = "udev-discovery-handler" -version = "0.6.12" +version = "0.6.13" dependencies = [ "akri-discovery-utils", "akri-udev", @@ -5046,9 +5046,9 @@ dependencies = [ [[package]] name = "udev-video-broker" -version = "0.6.12" +version = "0.6.13" dependencies = [ - "akri-shared 0.6.12", + "akri-shared 0.6.13", "env_logger 0.9.0", "lazy_static", "log", @@ -5348,7 +5348,7 @@ dependencies = [ [[package]] name = "webhook-configuration" -version = "0.6.12" +version = "0.6.13" dependencies = [ "actix", "actix-rt 2.2.0", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index ac6b5fc80..b4d250bc5 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "agent" -version = "0.6.12" +version = "0.6.13" authors = ["Kate Goldenring ", ""] edition = "2018" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index d3058f98f..656393e39 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "controller" -version = "0.6.12" +version = "0.6.13" authors = [""] edition = "2018" diff --git a/deployment/helm/Chart.yaml b/deployment/helm/Chart.yaml index 0040ba1a1..c7bde958a 100644 --- a/deployment/helm/Chart.yaml +++ b/deployment/helm/Chart.yaml @@ -15,9 +15,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.6.12 +version: 0.6.13 # 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.6.12 +appVersion: 0.6.13 diff --git a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml index df3fc51e5..66a5c9955 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.6.12" +version = "0.6.13" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml index d1f76f1e7..fc231bccf 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.6.12" +version = "0.6.13" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml index 5ccfe6e95..21c9925d7 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.6.12" +version = "0.6.13" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handler-modules/udev-discovery-handler/Cargo.toml b/discovery-handler-modules/udev-discovery-handler/Cargo.toml index af71970b6..7a18fca40 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.6.12" +version = "0.6.13" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/debug-echo/Cargo.toml b/discovery-handlers/debug-echo/Cargo.toml index 1542109e4..5f2d13faf 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.6.12" +version = "0.6.13" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/onvif/Cargo.toml b/discovery-handlers/onvif/Cargo.toml index a34a24e50..2187ac160 100644 --- a/discovery-handlers/onvif/Cargo.toml +++ b/discovery-handlers/onvif/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-onvif" -version = "0.6.12" +version = "0.6.13" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/opcua/Cargo.toml b/discovery-handlers/opcua/Cargo.toml index 5b678c632..eaf1a92b1 100644 --- a/discovery-handlers/opcua/Cargo.toml +++ b/discovery-handlers/opcua/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-opcua" -version = "0.6.12" +version = "0.6.13" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/udev/Cargo.toml b/discovery-handlers/udev/Cargo.toml index a82dc6765..cb3c6e278 100644 --- a/discovery-handlers/udev/Cargo.toml +++ b/discovery-handlers/udev/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-udev" -version = "0.6.12" +version = "0.6.13" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-utils/Cargo.toml b/discovery-utils/Cargo.toml index f3d764e25..4201e19bb 100644 --- a/discovery-utils/Cargo.toml +++ b/discovery-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-discovery-utils" -version = "0.6.12" +version = "0.6.13" authors = ["Kate Goldenring "] edition = "2018" diff --git a/samples/brokers/udev-video-broker/Cargo.toml b/samples/brokers/udev-video-broker/Cargo.toml index e45b2cf47..87d73d6f5 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.6.12" +version = "0.6.13" authors = ["Kate Goldenring ", ""] edition = "2018" diff --git a/shared/Cargo.toml b/shared/Cargo.toml index b6c96ecf3..43c120b09 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-shared" -version = "0.6.12" +version = "0.6.13" authors = [""] edition = "2018" diff --git a/version.txt b/version.txt index 592e815ea..e196726d2 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.6.12 +0.6.13 diff --git a/webhooks/validating/configuration/Cargo.toml b/webhooks/validating/configuration/Cargo.toml index daf5e6de1..b63b9b645 100644 --- a/webhooks/validating/configuration/Cargo.toml +++ b/webhooks/validating/configuration/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "webhook-configuration" -version = "0.6.12" +version = "0.6.13" authors = ["DazWilkin "] edition = "2018" From d4bab9a2594337ad4afafc2495e39136c10e3537 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Tue, 17 Aug 2021 12:05:40 -0700 Subject: [PATCH 12/22] point to h2 patch specific version --- agent/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/Cargo.toml b/agent/Cargo.toml index b4d250bc5..115cf36f1 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -24,7 +24,7 @@ futures = { version = "0.3.1", package = "futures" } futures-core = "0.3" futures-util = "0.3" hyper = "0.14.2" -h2 = "0.3.0" +h2 = "=0.3.3" kube = { version = "0.59.0", features = ["derive"] } kube-runtime = "0.59.0" k8s-openapi = { version = "0.13.0", default-features = false, features = ["schemars", "v1_16"] } From 5dc53e223be4e6a29a6f4310625872d5cbc8215d Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Tue, 17 Aug 2021 12:06:07 -0700 Subject: [PATCH 13/22] use ReceiveStream --- agent/src/util/device_plugin_service.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/agent/src/util/device_plugin_service.rs b/agent/src/util/device_plugin_service.rs index 853a11518..f8db0d7b4 100644 --- a/agent/src/util/device_plugin_service.rs +++ b/agent/src/util/device_plugin_service.rs @@ -18,17 +18,17 @@ use akri_shared::{ k8s, k8s::KubeInterface, }; -use futures::Stream; use log::{error, info, trace}; #[cfg(test)] use mock_instant::Instant; #[cfg(not(test))] use std::time::Instant; -use std::{collections::HashMap, pin::Pin, sync::Arc, time::Duration}; +use std::{collections::HashMap, sync::Arc, time::Duration}; use tokio::{ sync::{broadcast, mpsc, Mutex}, time::timeout, }; +use tokio_stream::wrappers::ReceiverStream; use tonic::{Code, Request, Response, Status}; /// Message sent in channel to `list_and_watch`. @@ -116,8 +116,7 @@ impl DevicePlugin for DevicePluginService { Ok(Response::new(resp)) } - type ListAndWatchStream = - Pin> + Send + Sync + 'static>>; + type ListAndWatchStream = ReceiverStream>; /// Called by Kubelet right after the DevicePluginService registers with Kubelet. /// Returns a stream of List of "virtual" Devices over a channel. @@ -232,9 +231,7 @@ impl DevicePlugin for DevicePluginService { trace!("list_and_watch - for Instance {} ending", dps.instance_name); }); - Ok(Response::new(Box::pin( - tokio_stream::wrappers::ReceiverStream::new(kubelet_update_receiver), - ))) + Ok(Response::new(ReceiverStream::new(kubelet_update_receiver))) } /// Kubelet calls allocate during pod creation. From bc8456b1f8895066cb6ff3d8605a5bd1ed8992c3 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Tue, 17 Aug 2021 12:06:27 -0700 Subject: [PATCH 14/22] use recv instead of recv_from --- discovery-handlers/onvif/src/discovery_impl.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/discovery-handlers/onvif/src/discovery_impl.rs b/discovery-handlers/onvif/src/discovery_impl.rs index 1d850ab06..550ab50c4 100644 --- a/discovery-handlers/onvif/src/discovery_impl.rs +++ b/discovery-handlers/onvif/src/discovery_impl.rs @@ -359,8 +359,7 @@ pub mod util { async fn try_recv_string(s: &mut UdpSocket, timeout: Duration) -> std::io::Result { let mut buf = vec![0; 16 * 1024]; - // TODO: use `try_recv_from` when update tokio - let (len, _src) = time::timeout(timeout, s.recv_from(&mut buf)).await??; + let len = time::timeout(timeout, s.recv(&mut buf)).await??; Ok(String::from_utf8_lossy(&buf[..len]).to_string()) } From b333e97108681be021fda6c1e82b04fae3193df3 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Tue, 17 Aug 2021 12:06:42 -0700 Subject: [PATCH 15/22] do strategic patch --- shared/src/akri/instance.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs index c325715d5..d08f62ed5 100644 --- a/shared/src/akri/instance.rs +++ b/shared/src/akri/instance.rs @@ -297,7 +297,7 @@ pub async fn update_instance( log::trace!("update_instance enter"); let instances_client: Api = Api::namespaced(kube_client.clone(), namespace); let instance_json = serde_json::json!(instance_to_update); - let patch = Patch::Apply(&instance_json); + let patch = Patch::Strategic(&instance_json); let instance_patch_params = PatchParams::default(); log::trace!("update_instance instances_client.patch(name, &instance_patch_params, instance_to_update).await?"); match instances_client From a4fba1da3ff89eab6a90c843e7a7613c619dff42 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Tue, 17 Aug 2021 16:58:32 -0700 Subject: [PATCH 16/22] increase tarpaulin version --- .github/workflows/run-tarpaulin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tarpaulin.yml b/.github/workflows/run-tarpaulin.yml index 1a5e4bdb8..29a7a80ae 100644 --- a/.github/workflows/run-tarpaulin.yml +++ b/.github/workflows/run-tarpaulin.yml @@ -36,7 +36,7 @@ jobs: persist-credentials: false - name: Create tarpaulin instance - run: docker create --network host --security-opt seccomp=unconfined -v "${PWD}:/volume" xd009642/tarpaulin:0.16.0 bash -c "echo 'sleep 600m; echo bye' > /tmp/keep_alive.sh; chmod 777 /tmp/keep_alive.sh; /tmp/keep_alive.sh" > container_id.txt + run: docker create --network host --security-opt seccomp=unconfined -v "${PWD}:/volume" xd009642/tarpaulin:0.18.0 bash -c "echo 'sleep 600m; echo bye' > /tmp/keep_alive.sh; chmod 777 /tmp/keep_alive.sh; /tmp/keep_alive.sh" > container_id.txt - name: Start tarpaulin instance run: docker start $(cat container_id.txt) - name: Install linux requirement in tarpaulin instance From 2f34b71bed21006366e48464d0f8732abede3ad0 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 19 Aug 2021 19:33:04 +0000 Subject: [PATCH 17/22] specify group in test instances --- test/json/local-instance.json | 2 +- test/json/shared-instance-list-slots.json | 2 +- test/json/shared-instance-list.json | 2 +- test/json/shared-instance-update.json | 2 +- test/json/shared-instance.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/json/local-instance.json b/test/json/local-instance.json index 1dcb84c9d..34105187b 100644 --- a/test/json/local-instance.json +++ b/test/json/local-instance.json @@ -1,5 +1,5 @@ { - "apiVersion": "v0", + "apiVersion": "akri.sh/v0", "kind": "Instance", "metadata": { "name": "config-a-b494b6", diff --git a/test/json/shared-instance-list-slots.json b/test/json/shared-instance-list-slots.json index e2f988821..f3c571458 100644 --- a/test/json/shared-instance-list-slots.json +++ b/test/json/shared-instance-list-slots.json @@ -2,7 +2,7 @@ "apiVersion": "v1", "items": [ { - "apiVersion": "v0", + "apiVersion": "akri.sh/v0", "kind": "Instance", "metadata": { "name": "config-a-359973", diff --git a/test/json/shared-instance-list.json b/test/json/shared-instance-list.json index 6e698ca37..1b9914dd1 100644 --- a/test/json/shared-instance-list.json +++ b/test/json/shared-instance-list.json @@ -2,7 +2,7 @@ "apiVersion": "v1", "items": [ { - "apiVersion": "v0", + "apiVersion": "akri.sh/v0", "kind": "Instance", "metadata": { "name": "config-a-359973", diff --git a/test/json/shared-instance-update.json b/test/json/shared-instance-update.json index 2501aeef8..81d4b5168 100644 --- a/test/json/shared-instance-update.json +++ b/test/json/shared-instance-update.json @@ -1,5 +1,5 @@ { - "apiVersion": "v0", + "apiVersion": "akri.sh/v0", "kind": "Instance", "metadata": { "name": "config-a-359973", diff --git a/test/json/shared-instance.json b/test/json/shared-instance.json index d35d99794..120d0d169 100644 --- a/test/json/shared-instance.json +++ b/test/json/shared-instance.json @@ -1,5 +1,5 @@ { - "apiVersion": "v0", + "apiVersion": "akri.sh/v0", "kind": "Instance", "metadata": { "name": "config-a-359973", From 4e758c61ac42ddbfae34aa9ea007f6772145739c Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 19 Aug 2021 20:34:14 +0000 Subject: [PATCH 18/22] Rename instancelist --- agent/src/util/slot_reconciliation.rs | 5 ++--- controller/src/util/node_watcher.rs | 4 ++-- controller/src/util/shared_test_utils.rs | 4 ++-- shared/src/akri/instance.rs | 4 ++-- shared/src/k8s/mod.rs | 6 +++--- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/agent/src/util/slot_reconciliation.rs b/agent/src/util/slot_reconciliation.rs index 172f5ffce..22b009b5c 100644 --- a/agent/src/util/slot_reconciliation.rs +++ b/agent/src/util/slot_reconciliation.rs @@ -345,7 +345,7 @@ pub async fn periodic_slot_reconciliation( #[cfg(test)] mod reconcile_tests { use super::*; - use akri_shared::{akri::instance::KubeAkriInstanceList, k8s::MockKubeInterface, os::file}; + use akri_shared::{akri::instance::InstanceList, k8s::MockKubeInterface, os::file}; use k8s_openapi::api::core::v1::Pod; use kube::api::ObjectList; @@ -362,8 +362,7 @@ mod reconcile_tests { fn configure_get_instances(mock: &mut MockKubeInterface, result_file: &'static str) { mock.expect_get_instances().times(1).returning(move || { let instance_list_json = file::read_file_to_string(result_file); - let instance_list: KubeAkriInstanceList = - serde_json::from_str(&instance_list_json).unwrap(); + let instance_list: InstanceList = serde_json::from_str(&instance_list_json).unwrap(); Ok(instance_list) }); } diff --git a/controller/src/util/node_watcher.rs b/controller/src/util/node_watcher.rs index 93546c059..8ed6eac62 100644 --- a/controller/src/util/node_watcher.rs +++ b/controller/src/util/node_watcher.rs @@ -329,7 +329,7 @@ impl NodeWatcher { mod tests { use super::super::shared_test_utils::config_for_tests; use super::*; - use akri_shared::{akri::instance::KubeAkriInstanceList, k8s::MockKubeInterface, os::file}; + use akri_shared::{akri::instance::InstanceList, k8s::MockKubeInterface, os::file}; #[derive(Clone)] struct UpdateInstance { @@ -539,7 +539,7 @@ mod tests { let instance_file = "../test/json/shared-instance-update.json"; let instance_json = file::read_file_to_string(instance_file); let instance_list_json = listify_node(&instance_json); - let list: KubeAkriInstanceList = serde_json::from_str(&instance_list_json).unwrap(); + let list: InstanceList = serde_json::from_str(&instance_list_json).unwrap(); Ok(list) }); mock.expect_update_instance() diff --git a/controller/src/util/shared_test_utils.rs b/controller/src/util/shared_test_utils.rs index 4dce38759..b8425de09 100644 --- a/controller/src/util/shared_test_utils.rs +++ b/controller/src/util/shared_test_utils.rs @@ -3,7 +3,7 @@ pub mod config_for_tests { use akri_shared::{ akri::{ configuration::Configuration, - instance::{Instance, InstanceSpec, KubeAkriInstanceList}, + instance::{Instance, InstanceList, InstanceSpec}, }, k8s::MockKubeInterface, os::file, @@ -74,7 +74,7 @@ pub mod config_for_tests { } else { json }; - let list: KubeAkriInstanceList = serde_json::from_str(&instance_list_json).unwrap(); + let list: InstanceList = serde_json::from_str(&instance_list_json).unwrap(); Ok(list) }); } diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs index d08f62ed5..104b1097b 100644 --- a/shared/src/akri/instance.rs +++ b/shared/src/akri/instance.rs @@ -8,7 +8,7 @@ use k8s_openapi::apimachinery::pkg::apis::meta::v1::OwnerReference; use schemars::JsonSchema; use std::collections::HashMap; -pub type KubeAkriInstanceList = ObjectList; +pub type InstanceList = ObjectList; /// Defines the information in the Instance CRD /// @@ -67,7 +67,7 @@ pub struct InstanceSpec { /// let instances = instance::get_instances(&api_client).await.unwrap(); /// # } /// ``` -pub async fn get_instances(kube_client: &Client) -> Result { +pub async fn get_instances(kube_client: &Client) -> Result { log::trace!("get_instances enter"); let instances_client: Api = Api::all(kube_client.clone()); let lp = ListParams::default(); diff --git a/shared/src/k8s/mod.rs b/shared/src/k8s/mod.rs index af58380f1..e0a50efce 100644 --- a/shared/src/k8s/mod.rs +++ b/shared/src/k8s/mod.rs @@ -2,7 +2,7 @@ use super::akri::{ configuration, configuration::{Configuration, ConfigurationList}, instance, - instance::{Instance, InstanceSpec, KubeAkriInstanceList}, + instance::{Instance, InstanceList, InstanceSpec}, retry::{random_delay, MAX_INSTANCE_UPDATE_TRIES}, API_NAMESPACE, API_VERSION, }; @@ -123,7 +123,7 @@ pub trait KubeInterface: Send + Sync { async fn get_configurations(&self) -> Result; async fn find_instance(&self, name: &str, namespace: &str) -> Result; - async fn get_instances(&self) -> Result; + async fn get_instances(&self) -> Result; async fn create_instance( &self, instance_to_create: &InstanceSpec, @@ -412,7 +412,7 @@ impl KubeInterface for KubeImpl { /// let instances = kube.get_instances().await.unwrap(); /// # } /// ``` - async fn get_instances(&self) -> Result { + async fn get_instances(&self) -> Result { instance::get_instances(&self.get_kube_client()).await } /// Create Akri Instance From 70fbfede3aef8d5a2fb8db380f895e9e66d10fbe Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Mon, 23 Aug 2021 13:33:28 +0000 Subject: [PATCH 19/22] force Instance Apply patch --- shared/src/akri/instance.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs index 104b1097b..d9aadf748 100644 --- a/shared/src/akri/instance.rs +++ b/shared/src/akri/instance.rs @@ -296,12 +296,12 @@ pub async fn update_instance( ) -> Result<(), anyhow::Error> { log::trace!("update_instance enter"); let instances_client: Api = Api::namespaced(kube_client.clone(), namespace); - let instance_json = serde_json::json!(instance_to_update); - let patch = Patch::Strategic(&instance_json); - let instance_patch_params = PatchParams::default(); log::trace!("update_instance instances_client.patch(name, &instance_patch_params, instance_to_update).await?"); + let modified_instance = Instance::new(name, instance_to_update.clone()); + // Force the apply, ignoring conflicts and ensuring this updated Instance overwrites the previous + let patch_params = PatchParams::apply("akri").force(); match instances_client - .patch(name, &instance_patch_params, &patch) + .patch(name, &patch_params, &Patch::Apply(&modified_instance)) .await { Ok(_instance_modified) => { From 19ce1ea58e6dcd88a5e6b03a0bc5f24bf5f85a10 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Mon, 23 Aug 2021 14:26:33 +0000 Subject: [PATCH 20/22] Revert "update version.sh to not check/update version of dependencies with git sources" This reverts commit 5365e22031cfa953d026d0c3b9936a4dd4a2d7dc. --- version.sh | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/version.sh b/version.sh index 963ecb4f2..96974793b 100755 --- a/version.sh +++ b/version.sh @@ -26,12 +26,7 @@ check_twoline_version() VERSION_STRING=$3 echo "Check $FILE ($LINE1_PATTERN :: $VERSION_STRING)" - SKIP_SOURCE=$(grep "$LINE1_PATTERN" -A 2 $FILE | grep "source =") - if [ "$SKIP_SOURCE" != "" ]; then - echo " Skipping check: $LINE1_PATTERN" - return 0 - fi - + CORRECT_VERSION=$(grep "$LINE1_PATTERN" -A 1 $FILE | grep "$VERSION_STRING") if [ "$CORRECT_VERSION" == "" ]; then echo " Needs upate: $FILE" @@ -64,12 +59,6 @@ update_twoline_version() NEW_LINE2=$5 echo "Update $FILE [$LINE1_PATTERN, $LINE2_PATTERN] => [$NEW_LINE1, $NEW_LINE2]" - SKIP_SOURCE=$(grep "$LINE1_PATTERN" -A 2 $FILE | grep "source =") - if [ "$SKIP_SOURCE" != "" ]; then - echo " Skipping Update: $LINE1_PATTERN" - return 0 - fi - sed -i "/$LINE1_PATTERN/ {n;/$LINE2_PATTERN/ {s/$LINE2_PATTERN/$NEW_LINE2/;p;d;}}" $FILE return $? } From 5be85eb42e917efef2828b351d2e443b8d3a610c Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Mon, 23 Aug 2021 14:43:41 +0000 Subject: [PATCH 21/22] Update webhook to use integer instead of float --- Cargo.lock | 960 +++--------------- webhooks/validating/configuration/Cargo.toml | 7 +- webhooks/validating/configuration/src/main.rs | 26 +- 3 files changed, 134 insertions(+), 859 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4379a3281..e6eb52940 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,7 +55,7 @@ dependencies = [ "derive_more", "either", "futures-util", - "http 0.2.4", + "http", "log", "openssl", "tokio-openssl", @@ -91,7 +91,7 @@ dependencies = [ "futures-util", "fxhash", "h2 0.2.7", - "http 0.2.4", + "http", "httparse", "indexmap", "itoa", @@ -105,7 +105,7 @@ dependencies = [ "regex", "serde", "serde_json", - "serde_urlencoded 0.7.0", + "serde_urlencoded", "sha-1 0.9.7", "slab", "time 0.2.27", @@ -138,7 +138,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ad299af73649e1fc893e333ccf86f377751eb95ff875d095131574c6f43452c" dependencies = [ "bytestring", - "http 0.2.4", + "http", "log", "regex", "serde", @@ -296,7 +296,7 @@ dependencies = [ "regex", "serde", "serde_json", - "serde_urlencoded 0.7.0", + "serde_urlencoded", "socket2 0.3.19", "time 0.2.27", "tinyvec", @@ -339,30 +339,30 @@ dependencies = [ "akri-discovery-utils", "akri-onvif", "akri-opcua", - "akri-shared 0.6.13", + "akri-shared", "akri-udev", "anyhow", - "async-stream 0.3.2", + "async-stream", "async-trait", "blake2", "cfg-if 1.0.0", "chrono", - "env_logger 0.9.0", + "env_logger", "futures 0.3.16", "futures-core", "futures-util", "h2 0.3.3", - "hyper 0.14.11", - "k8s-openapi 0.13.0", - "kube 0.59.0", + "hyper", + "k8s-openapi", + "kube", "kube-runtime", "lazy_static", "log", "mock_instant", - "mockall 0.10.2", + "mockall", "mockall_double", "prometheus 0.12.0", - "prost 0.8.0", + "prost", "prost-types", "rand 0.8.4", "serde", @@ -372,9 +372,9 @@ dependencies = [ "tempfile", "tokio 1.9.0", "tokio-stream", - "tonic 0.5.2", + "tonic", "tonic-build", - "tower 0.4.8", + "tower", "url 2.2.2", "uuid", ] @@ -393,10 +393,10 @@ name = "akri-debug-echo" version = "0.6.13" dependencies = [ "akri-discovery-utils", - "akri-shared 0.6.13", + "akri-shared", "anyhow", "async-trait", - "env_logger 0.9.0", + "env_logger", "futures-util", "log", "serde", @@ -405,29 +405,29 @@ dependencies = [ "serde_yaml", "tokio 1.9.0", "tokio-stream", - "tonic 0.5.2", + "tonic", ] [[package]] name = "akri-discovery-utils" version = "0.6.13" dependencies = [ - "akri-shared 0.6.13", + "akri-shared", "anyhow", - "async-stream 0.3.2", + "async-stream", "async-trait", "futures 0.3.16", "log", - "prost 0.8.0", + "prost", "serde", "serde_derive", "serde_yaml", "tempfile", "tokio 1.9.0", "tokio-stream", - "tonic 0.5.2", + "tonic", "tonic-build", - "tower 0.4.8", + "tower", ] [[package]] @@ -435,15 +435,15 @@ name = "akri-onvif" version = "0.6.13" dependencies = [ "akri-discovery-utils", - "akri-shared 0.6.13", + "akri-shared", "anyhow", "async-trait", "bytes 1.0.1", - "env_logger 0.9.0", + "env_logger", "futures-util", - "hyper 0.14.11", + "hyper", "log", - "mockall 0.10.2", + "mockall", "serde", "serde_derive", "serde_json", @@ -452,7 +452,7 @@ dependencies = [ "sxd-xpath", "tokio 1.9.0", "tokio-stream", - "tonic 0.5.2", + "tonic", "uuid", "xml-rs", "yaserde", @@ -464,55 +464,25 @@ name = "akri-opcua" version = "0.6.13" dependencies = [ "akri-discovery-utils", - "akri-shared 0.6.13", + "akri-shared", "anyhow", "async-trait", - "env_logger 0.9.0", + "env_logger", "futures-util", "log", - "mockall 0.10.2", + "mockall", "opcua-client", - "prost 0.8.0", + "prost", "serde", "serde_derive", "serde_json", "serde_yaml", "tokio 1.9.0", "tokio-stream", - "tonic 0.5.2", + "tonic", "url 2.2.2", ] -[[package]] -name = "akri-shared" -version = "0.6.5" -source = "git+https://github.com/deislabs/akri?tag=v0.6.5#9a0d32faf0470c41dc1db381e8ce3469699ca808" -dependencies = [ - "anyhow", - "async-trait", - "either", - "env_logger 0.8.4", - "futures 0.1.31", - "futures 0.3.16", - "futures-util", - "k8s-openapi 0.6.0", - "kube 0.23.0", - "log", - "mockall 0.9.1", - "prometheus 0.11.0", - "rand 0.8.4", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "tokio 0.2.25", - "tokio-core", - "tokio-signal", - "tonic 0.1.1", - "tower 0.3.1", - "warp 0.2.5", -] - [[package]] name = "akri-shared" version = "0.6.13" @@ -520,15 +490,15 @@ dependencies = [ "anyhow", "async-trait", "either", - "env_logger 0.9.0", + "env_logger", "futures 0.3.16", "futures-util", - "hyper 0.14.11", - "k8s-openapi 0.13.0", - "kube 0.59.0", + "hyper", + "k8s-openapi", + "kube", "kube-runtime", "log", - "mockall 0.10.2", + "mockall", "prometheus 0.11.0", "rand 0.8.4", "schemars", @@ -537,9 +507,9 @@ dependencies = [ "serde_json", "serde_yaml", "tokio 1.9.0", - "tonic 0.5.2", - "tower 0.4.8", - "warp 0.3.1", + "tonic", + "tower", + "warp", ] [[package]] @@ -549,13 +519,13 @@ dependencies = [ "akri-discovery-utils", "anyhow", "async-trait", - "env_logger 0.9.0", + "env_logger", "futures-util", "log", - "mockall 0.10.2", + "mockall", "pest", "pest_derive", - "prost 0.8.0", + "prost", "regex", "serde", "serde_derive", @@ -563,7 +533,7 @@ dependencies = [ "serde_yaml", "tokio 1.9.0", "tokio-stream", - "tonic 0.5.2", + "tonic", "udev", ] @@ -593,19 +563,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "async-compression" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443ccbb270374a2b1055fc72da40e1f237809cd6bb0e97e66d264cd138473a6" -dependencies = [ - "bytes 0.5.6", - "flate2", - "futures-core", - "memchr", - "pin-project-lite 0.2.7", -] - [[package]] name = "async-executor" version = "1.4.1" @@ -700,37 +657,16 @@ dependencies = [ "wasm-bindgen-futures", ] -[[package]] -name = "async-stream" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22068c0c19514942eefcfd4daf8976ef1aad84e61539f95cd200c35202f80af5" -dependencies = [ - "async-stream-impl 0.2.1", - "futures-core", -] - [[package]] name = "async-stream" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" dependencies = [ - "async-stream-impl 0.3.2", + "async-stream-impl", "futures-core", ] -[[package]] -name = "async-stream-impl" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f9db3b38af870bf7e5cc649167533b493928e50744e2c30ae350230b414670" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "async-stream-impl" version = "0.3.2" @@ -804,7 +740,7 @@ dependencies = [ "rand 0.7.3", "serde", "serde_json", - "serde_urlencoded 0.7.0", + "serde_urlencoded", ] [[package]] @@ -813,21 +749,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" -[[package]] -name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder", -] - -[[package]] -name = "base64" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" - [[package]] name = "base64" version = "0.12.3" @@ -1061,19 +982,19 @@ checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" name = "controller" version = "0.6.13" dependencies = [ - "akri-shared 0.6.13", + "akri-shared", "anyhow", "async-std", "async-trait", "chrono", - "env_logger 0.9.0", + "env_logger", "futures 0.3.16", - "k8s-openapi 0.13.0", - "kube 0.59.0", + "k8s-openapi", + "kube", "kube-runtime", "lazy_static", "log", - "mockall 0.10.2", + "mockall", "prometheus 0.12.0", "serde", "serde_derive", @@ -1278,7 +1199,7 @@ version = "0.6.13" dependencies = [ "akri-debug-echo", "akri-discovery-utils", - "env_logger 0.9.0", + "env_logger", "log", "tokio 1.9.0", ] @@ -1331,16 +1252,6 @@ dependencies = [ "generic-array 0.14.4", ] -[[package]] -name = "dirs" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" -dependencies = [ - "cfg-if 0.1.10", - "dirs-sys", -] - [[package]] name = "dirs-next" version = "2.0.0" @@ -1351,17 +1262,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs-sys" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" -dependencies = [ - "libc", - "redox_users", - "winapi 0.3.9", -] - [[package]] name = "dirs-sys-next" version = "0.1.2" @@ -1430,19 +1330,6 @@ dependencies = [ "syn", ] -[[package]] -name = "env_logger" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.9.0" @@ -1651,12 +1538,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2" -[[package]] -name = "futures-timer" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6" - [[package]] name = "futures-util" version = "0.3.16" @@ -1762,7 +1643,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 0.2.4", + "http", "indexmap", "slab", "tokio 0.2.25", @@ -1781,7 +1662,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 0.2.4", + "http", "indexmap", "slab", "tokio 1.9.0", @@ -1805,7 +1686,7 @@ dependencies = [ "bitflags", "bytes 1.0.1", "headers-core", - "http 0.2.4", + "http", "mime", "sha-1 0.9.7", "time 0.1.44", @@ -1817,7 +1698,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ - "http 0.2.4", + "http", ] [[package]] @@ -1855,17 +1736,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "http" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" -dependencies = [ - "bytes 0.4.12", - "fnv", - "itoa", -] - [[package]] name = "http" version = "0.2.4" @@ -1877,16 +1747,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" -dependencies = [ - "bytes 0.5.6", - "http 0.2.4", -] - [[package]] name = "http-body" version = "0.4.2" @@ -1894,7 +1754,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" dependencies = [ "bytes 1.0.1", - "http 0.2.4", + "http", "pin-project-lite 0.2.7", ] @@ -1904,12 +1764,6 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" -[[package]] -name = "httpdate" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" - [[package]] name = "httpdate" version = "1.0.1" @@ -1922,30 +1776,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" -[[package]] -name = "hyper" -version = "0.13.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" -dependencies = [ - "bytes 0.5.6", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.2.7", - "http 0.2.4", - "http-body 0.3.1", - "httparse", - "httpdate 0.3.2", - "itoa", - "pin-project 1.0.8", - "socket2 0.3.19", - "tokio 0.2.25", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "0.14.11" @@ -1957,10 +1787,10 @@ dependencies = [ "futures-core", "futures-util", "h2 0.3.3", - "http 0.2.4", - "http-body 0.4.2", + "http", + "http-body", "httparse", - "httpdate 1.0.1", + "httpdate", "itoa", "pin-project-lite 0.2.7", "socket2 0.4.1", @@ -1976,25 +1806,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.11", + "hyper", "pin-project-lite 0.2.7", "tokio 1.9.0", "tokio-io-timeout", ] -[[package]] -name = "hyper-tls" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" -dependencies = [ - "bytes 0.5.6", - "hyper 0.13.10", - "native-tls", - "tokio 0.2.25", - "tokio-tls", -] - [[package]] name = "hyper-tls" version = "0.5.0" @@ -2002,7 +1819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes 1.0.1", - "hyper 0.14.11", + "hyper", "native-tls", "tokio 1.9.0", "tokio-native-tls", @@ -2046,15 +1863,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "input_buffer" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19a8a95243d5a0398cae618ec29477c6e3cb631152be5c19481f80bc71559754" -dependencies = [ - "bytes 0.5.6", -] - [[package]] name = "input_buffer" version = "0.4.0" @@ -2100,15 +1908,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" -[[package]] -name = "itertools" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.10.1" @@ -2155,23 +1954,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "k8s-openapi" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8eb97e4ea14cef484aa56f44e93653cb6faa351b5f130d38584b3184b6ef5d1" -dependencies = [ - "base64 0.10.1", - "bytes 0.4.12", - "chrono", - "http 0.1.21", - "percent-encoding 2.1.0", - "serde", - "serde-value 0.6.0", - "serde_json", - "url 2.2.2", -] - [[package]] name = "k8s-openapi" version = "0.13.0" @@ -2183,7 +1965,7 @@ dependencies = [ "chrono", "schemars", "serde", - "serde-value 0.7.0", + "serde-value", "serde_json", ] @@ -2197,32 +1979,6 @@ dependencies = [ "winapi-build", ] -[[package]] -name = "kube" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a8a53ca3e8cb9f6ebdf09cdd8943d08926da7ca8d5c1d89dee1ed0e8df0a2a" -dependencies = [ - "base64 0.11.0", - "chrono", - "dirs", - "either", - "futures 0.3.16", - "futures-timer", - "http 0.2.4", - "k8s-openapi 0.6.0", - "log", - "openssl", - "reqwest 0.10.10", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "thiserror", - "time 0.1.44", - "url 2.2.2", -] - [[package]] name = "kube" version = "0.59.0" @@ -2235,13 +1991,13 @@ dependencies = [ "dirs-next", "either", "futures 0.3.16", - "http 0.2.4", - "http-body 0.4.2", - "hyper 0.14.11", + "http", + "http-body", + "hyper", "hyper-timeout", - "hyper-tls 0.5.0", + "hyper-tls", "jsonpath_lib", - "k8s-openapi 0.13.0", + "k8s-openapi", "kube-core", "kube-derive", "openssl", @@ -2254,7 +2010,7 @@ dependencies = [ "tokio 1.9.0", "tokio-native-tls", "tokio-util 0.6.7", - "tower 0.4.8", + "tower", "tower-http", "tracing", ] @@ -2266,9 +2022,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c33d2272d8e530938bafc6cf4ac76f2a6f6c9ca684defcfab6c357913a43bcc" dependencies = [ "form_urlencoded", - "http 0.2.4", + "http", "json-patch", - "k8s-openapi 0.13.0", + "k8s-openapi", "once_cell", "serde", "serde_json", @@ -2298,8 +2054,8 @@ dependencies = [ "derivative", "futures 0.3.16", "json-patch", - "k8s-openapi 0.13.0", - "kube 0.59.0", + "k8s-openapi", + "kube", "pin-project 1.0.8", "serde", "serde_json", @@ -2487,18 +2243,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "mio-named-pipes" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" -dependencies = [ - "log", - "mio 0.6.23", - "miow 0.3.7", - "winapi 0.3.9", -] - [[package]] name = "mio-uds" version = "0.6.8" @@ -2540,21 +2284,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "mockall" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d614ad23f9bb59119b8b5670a85c7ba92c5e9adf4385c81ea00c51c8be33d5" -dependencies = [ - "cfg-if 1.0.0", - "downcast", - "fragile", - "lazy_static", - "mockall_derive 0.9.1", - "predicates", - "predicates-tree", -] - [[package]] name = "mockall" version = "0.10.2" @@ -2565,23 +2294,11 @@ dependencies = [ "downcast", "fragile", "lazy_static", - "mockall_derive 0.10.2", + "mockall_derive", "predicates", "predicates-tree", ] -[[package]] -name = "mockall_derive" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd4234635bca06fc96c7368d038061e0aae1b00a764dc817e900dc974e3deea" -dependencies = [ - "cfg-if 1.0.0", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "mockall_derive" version = "0.10.2" @@ -2715,7 +2432,7 @@ version = "0.6.13" dependencies = [ "akri-discovery-utils", "akri-onvif", - "env_logger 0.9.0", + "env_logger", "log", "tokio 1.9.0", ] @@ -2799,7 +2516,7 @@ version = "0.6.13" dependencies = [ "akri-discovery-utils", "akri-opcua", - "env_logger 0.9.0", + "env_logger", "log", "tokio 1.9.0", ] @@ -2827,7 +2544,7 @@ name = "openapi" version = "1.1.0" source = "git+https://github.com/DazWilkin/openapi-admission-v1?tag=v1.1.0#60a9ba6bd64efda65cb136a21e0d6a53e962c415" dependencies = [ - "reqwest 0.11.4", + "reqwest", "serde", "serde_derive", "serde_json", @@ -2867,15 +2584,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "ordered-float" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" -dependencies = [ - "num-traits", -] - [[package]] name = "ordered-float" version = "2.7.0" @@ -3205,16 +2913,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "prost" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" -dependencies = [ - "bytes 0.5.6", - "prost-derive 0.6.1", -] - [[package]] name = "prost" version = "0.8.0" @@ -3222,7 +2920,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" dependencies = [ "bytes 1.0.1", - "prost-derive 0.8.0", + "prost-derive", ] [[package]] @@ -3233,29 +2931,16 @@ checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" dependencies = [ "bytes 1.0.1", "heck", - "itertools 0.10.1", + "itertools", "log", "multimap", "petgraph", - "prost 0.8.0", + "prost", "prost-types", "tempfile", "which", ] -[[package]] -name = "prost-derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" -dependencies = [ - "anyhow", - "itertools 0.8.2", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "prost-derive" version = "0.8.0" @@ -3263,7 +2948,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" dependencies = [ "anyhow", - "itertools 0.10.1", + "itertools", "proc-macro2", "quote", "syn", @@ -3276,7 +2961,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" dependencies = [ "bytes 1.0.1", - "prost 0.8.0", + "prost", ] [[package]] @@ -3311,7 +2996,6 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", - "rand_pcg", ] [[package]] @@ -3383,17 +3067,8 @@ dependencies = [ ] [[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" +name = "redox_syscall" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" @@ -3442,43 +3117,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "reqwest" -version = "0.10.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" -dependencies = [ - "async-compression", - "base64 0.13.0", - "bytes 0.5.6", - "encoding_rs", - "futures-core", - "futures-util", - "http 0.2.4", - "http-body 0.3.1", - "hyper 0.13.10", - "hyper-tls 0.4.3", - "ipnet", - "js-sys", - "lazy_static", - "log", - "mime", - "mime_guess", - "native-tls", - "percent-encoding 2.1.0", - "pin-project-lite 0.2.7", - "serde", - "serde_json", - "serde_urlencoded 0.7.0", - "tokio 0.2.25", - "tokio-tls", - "url 2.2.2", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg 0.7.0", -] - [[package]] name = "reqwest" version = "0.11.4" @@ -3490,9 +3128,9 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "http 0.2.4", - "http-body 0.4.2", - "hyper 0.14.11", + "http", + "http-body", + "hyper", "ipnet", "js-sys", "lazy_static", @@ -3503,7 +3141,7 @@ dependencies = [ "pin-project-lite 0.2.7", "serde", "serde_json", - "serde_urlencoded 0.7.0", + "serde_urlencoded", "tokio 1.9.0", "url 2.2.2", "wasm-bindgen", @@ -3623,12 +3261,6 @@ dependencies = [ "syn", ] -[[package]] -name = "scoped-tls" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" - [[package]] name = "scoped-tls" version = "1.0.0" @@ -3716,23 +3348,13 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-value" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a65a7291a8a568adcae4c10a677ebcedbc6c9cec91c054dee2ce40b0e3290eb" -dependencies = [ - "ordered-float 1.1.1", - "serde", -] - [[package]] name = "serde-value" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" dependencies = [ - "ordered-float 2.7.0", + "ordered-float", "serde", ] @@ -3770,18 +3392,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" -dependencies = [ - "dtoa", - "itoa", - "serde", - "url 2.2.2", -] - [[package]] name = "serde_urlencoded" version = "0.7.0" @@ -4181,20 +3791,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" dependencies = [ "bytes 0.5.6", - "fnv", "futures-core", "iovec", "lazy_static", "libc", "memchr", "mio 0.6.23", - "mio-named-pipes", "mio-uds", - "num_cpus", "pin-project-lite 0.1.12", "signal-hook-registry", "slab", - "tokio-macros 0.2.6", "winapi 0.3.9", ] @@ -4214,7 +3820,7 @@ dependencies = [ "parking_lot 0.11.1", "pin-project-lite 0.2.7", "signal-hook-registry", - "tokio-macros 1.3.0", + "tokio-macros", "winapi 0.3.9", ] @@ -4229,25 +3835,6 @@ dependencies = [ "tokio-io", ] -[[package]] -name = "tokio-core" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87b1395334443abca552f63d4f61d0486f12377c2ba8b368e523f89e828cffd4" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "iovec", - "log", - "mio 0.6.23", - "scoped-tls 0.1.2", - "tokio 0.1.22", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "tokio-timer", -] - [[package]] name = "tokio-current-thread" version = "0.1.7" @@ -4300,17 +3887,6 @@ dependencies = [ "tokio 1.9.0", ] -[[package]] -name = "tokio-macros" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tokio-macros" version = "1.3.0" @@ -4372,23 +3948,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "tokio-signal" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c34c6e548f101053321cba3da7cbb87a610b85555884c41b07da2eb91aff12" -dependencies = [ - "futures 0.1.31", - "libc", - "mio 0.6.23", - "mio-uds", - "signal-hook-registry", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "winapi 0.3.9", -] - [[package]] name = "tokio-stream" version = "0.1.7" @@ -4453,29 +4012,6 @@ dependencies = [ "tokio-executor", ] -[[package]] -name = "tokio-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" -dependencies = [ - "native-tls", - "tokio 0.2.25", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9e878ad426ca286e4dcae09cbd4e1973a7f8987d97570e2469703dd7f5720c" -dependencies = [ - "futures-util", - "log", - "pin-project 0.4.28", - "tokio 0.2.25", - "tungstenite 0.11.1", -] - [[package]] name = "tokio-tungstenite" version = "0.13.0" @@ -4486,7 +4022,7 @@ dependencies = [ "log", "pin-project 1.0.8", "tokio 1.9.0", - "tungstenite 0.12.0", + "tungstenite", ] [[package]] @@ -4522,20 +4058,6 @@ dependencies = [ "tokio-reactor", ] -[[package]] -name = "tokio-util" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" -dependencies = [ - "bytes 0.5.6", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.1.12", - "tokio 0.2.25", -] - [[package]] name = "tokio-util" version = "0.3.1" @@ -4565,62 +4087,32 @@ dependencies = [ "tokio 1.9.0", ] -[[package]] -name = "tonic" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08283643b1d483eb7f3fc77069e63b5cba3e4db93514b3d45470e67f123e4e48" -dependencies = [ - "async-stream 0.2.1", - "async-trait", - "base64 0.10.1", - "bytes 0.5.6", - "futures-core", - "futures-util", - "http 0.2.4", - "http-body 0.3.1", - "hyper 0.13.10", - "percent-encoding 1.0.1", - "pin-project 0.4.28", - "prost 0.6.1", - "prost-derive 0.6.1", - "tokio 0.2.25", - "tokio-util 0.2.0", - "tower 0.3.1", - "tower-balance", - "tower-load", - "tower-make", - "tower-service", - "tracing", - "tracing-futures", -] - [[package]] name = "tonic" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "796c5e1cd49905e65dd8e700d4cb1dffcbfdb4fc9d017de08c1a537afd83627c" dependencies = [ - "async-stream 0.3.2", + "async-stream", "async-trait", "base64 0.13.0", "bytes 1.0.1", "futures-core", "futures-util", "h2 0.3.3", - "http 0.2.4", - "http-body 0.4.2", - "hyper 0.14.11", + "http", + "http-body", + "hyper", "hyper-timeout", "percent-encoding 2.1.0", "pin-project 1.0.8", - "prost 0.8.0", - "prost-derive 0.8.0", + "prost", + "prost-derive", "tokio 1.9.0", "tokio-rustls", "tokio-stream", "tokio-util 0.6.7", - "tower 0.4.8", + "tower", "tower-layer", "tower-service", "tracing", @@ -4639,24 +4131,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tower" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3169017c090b7a28fce80abaad0ab4f5566423677c9331bb320af7e49cfe62" -dependencies = [ - "futures-core", - "tower-buffer", - "tower-discover", - "tower-layer", - "tower-limit", - "tower-load-shed", - "tower-retry", - "tower-service", - "tower-timeout", - "tower-util", -] - [[package]] name = "tower" version = "0.4.8" @@ -4677,53 +4151,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "tower-balance" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a792277613b7052448851efcf98a2c433e6f1d01460832dc60bef676bc275d4c" -dependencies = [ - "futures-core", - "futures-util", - "indexmap", - "pin-project 0.4.28", - "rand 0.7.3", - "slab", - "tokio 0.2.25", - "tower-discover", - "tower-layer", - "tower-load", - "tower-make", - "tower-ready-cache", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-buffer" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4887dc2a65d464c8b9b66e0e4d51c2fd6cf5b3373afc72805b0a60bce00446a" -dependencies = [ - "futures-core", - "pin-project 0.4.28", - "tokio 0.2.25", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-discover" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6b5000c3c54d269cc695dff28136bb33d08cbf1df2c48129e143ab65bf3c2a" -dependencies = [ - "futures-core", - "pin-project 0.4.28", - "tower-service", -] - [[package]] name = "tower-http" version = "0.1.1" @@ -4734,8 +4161,8 @@ dependencies = [ "bytes 1.0.1", "futures-core", "futures-util", - "http 0.2.4", - "http-body 0.4.2", + "http", + "http-body", "pin-project 1.0.8", "tower-layer", "tower-service", @@ -4748,113 +4175,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" -[[package]] -name = "tower-limit" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c3040c5dbed68abffaa0d4517ac1a454cd741044f33ab0eefab6b8d1361404" -dependencies = [ - "futures-core", - "pin-project 0.4.28", - "tokio 0.2.25", - "tower-layer", - "tower-load", - "tower-service", -] - -[[package]] -name = "tower-load" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc79fc3afd07492b7966d7efa7c6c50f8ed58d768a6075dd7ae6591c5d2017b" -dependencies = [ - "futures-core", - "log", - "pin-project 0.4.28", - "tokio 0.2.25", - "tower-discover", - "tower-service", -] - -[[package]] -name = "tower-load-shed" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f021e23900173dc315feb4b6922510dae3e79c689b74c089112066c11f0ae4e" -dependencies = [ - "futures-core", - "pin-project 0.4.28", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-make" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce50370d644a0364bf4877ffd4f76404156a248d104e2cc234cd391ea5cdc965" -dependencies = [ - "tokio 0.2.25", - "tower-service", -] - -[[package]] -name = "tower-ready-cache" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eabb6620e5481267e2ec832c780b31cad0c15dcb14ed825df5076b26b591e1f" -dependencies = [ - "futures-core", - "futures-util", - "indexmap", - "log", - "tokio 0.2.25", - "tower-service", -] - -[[package]] -name = "tower-retry" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6727956aaa2f8957d4d9232b308fe8e4e65d99db30f42b225646e86c9b6a952" -dependencies = [ - "futures-core", - "pin-project 0.4.28", - "tokio 0.2.25", - "tower-layer", - "tower-service", -] - [[package]] name = "tower-service" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" -[[package]] -name = "tower-timeout" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "127b8924b357be938823eaaec0608c482d40add25609481027b96198b2e4b31e" -dependencies = [ - "pin-project 0.4.28", - "tokio 0.2.25", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1093c19826d33807c72511e68f73b4a0469a3f22c2bd5f7d5212178b4b89674" -dependencies = [ - "futures-core", - "futures-util", - "pin-project 0.4.28", - "tower-service", -] - [[package]] name = "tracing" version = "0.1.26" @@ -4958,25 +4284,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "tungstenite" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0308d80d86700c5878b9ef6321f020f29b1bb9d5ff3cab25e75e23f3a492a23" -dependencies = [ - "base64 0.12.3", - "byteorder", - "bytes 0.5.6", - "http 0.2.4", - "httparse", - "input_buffer 0.3.1", - "log", - "rand 0.7.3", - "sha-1 0.9.7", - "url 2.2.2", - "utf-8", -] - [[package]] name = "tungstenite" version = "0.12.0" @@ -4986,9 +4293,9 @@ dependencies = [ "base64 0.13.0", "byteorder", "bytes 1.0.1", - "http 0.2.4", + "http", "httparse", - "input_buffer 0.4.0", + "input_buffer", "log", "rand 0.8.4", "sha-1 0.9.7", @@ -5039,7 +4346,7 @@ version = "0.6.13" dependencies = [ "akri-discovery-utils", "akri-udev", - "env_logger 0.9.0", + "env_logger", "log", "tokio 1.9.0", ] @@ -5048,15 +4355,15 @@ dependencies = [ name = "udev-video-broker" version = "0.6.13" dependencies = [ - "akri-shared 0.6.13", - "env_logger 0.9.0", + "akri-shared", + "env_logger", "lazy_static", "log", "prometheus 0.12.0", - "prost 0.8.0", + "prost", "rscam", "tokio 1.9.0", - "tonic 0.5.2", + "tonic", "tonic-build", ] @@ -5134,12 +4441,6 @@ dependencies = [ "percent-encoding 2.1.0", ] -[[package]] -name = "urlencoding" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a1f0175e03a0973cf4afd476bef05c26e228520400eb1fd473ad417b1c00ffb" - [[package]] name = "utf-8" version = "0.7.6" @@ -5199,34 +4500,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "warp" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41be6df54c97904af01aa23e613d4521eed7ab23537cede692d4058f6449407" -dependencies = [ - "bytes 0.5.6", - "futures 0.3.16", - "headers", - "http 0.2.4", - "hyper 0.13.10", - "log", - "mime", - "mime_guess", - "multipart", - "pin-project 0.4.28", - "scoped-tls 1.0.0", - "serde", - "serde_json", - "serde_urlencoded 0.6.1", - "tokio 0.2.25", - "tokio-tungstenite 0.11.0", - "tower-service", - "tracing", - "tracing-futures", - "urlencoding", -] - [[package]] name = "warp" version = "0.3.1" @@ -5236,21 +4509,21 @@ dependencies = [ "bytes 1.0.1", "futures 0.3.16", "headers", - "http 0.2.4", - "hyper 0.14.11", + "http", + "hyper", "log", "mime", "mime_guess", "multipart", "percent-encoding 2.1.0", "pin-project 1.0.8", - "scoped-tls 1.0.0", + "scoped-tls", "serde", "serde_json", - "serde_urlencoded 0.7.0", + "serde_urlencoded", "tokio 1.9.0", "tokio-stream", - "tokio-tungstenite 0.13.0", + "tokio-tungstenite", "tokio-util 0.6.7", "tower-service", "tracing", @@ -5353,10 +4626,11 @@ dependencies = [ "actix", "actix-rt 2.2.0", "actix-web", - "akri-shared 0.6.5", + "akri-shared", "clap", - "k8s-openapi 0.6.0", - "kube 0.23.0", + "k8s-openapi", + "kube", + "kube-runtime", "openapi", "openssl", "rustls", diff --git a/webhooks/validating/configuration/Cargo.toml b/webhooks/validating/configuration/Cargo.toml index b63b9b645..82a34ac3e 100644 --- a/webhooks/validating/configuration/Cargo.toml +++ b/webhooks/validating/configuration/Cargo.toml @@ -8,10 +8,11 @@ edition = "2018" actix = "0.12.0" actix-web = { version = "3.3.2", features = ["openssl"] } actix-rt = "2.2.0" -akri-shared = { git = "https://github.com/deislabs/akri", package = "akri-shared", tag = "v0.6.5" } +akri-shared = { path = "../../../shared" } clap = "2.33.3" -k8s-openapi = { version = "0.6.0", features = ["v1_16"] } -kube = { version = "0.23.0", features = ["openapi"] } +kube = { version = "0.59.0", features = ["derive"] } +kube-runtime = "0.59.0" +k8s-openapi = { version = "0.13.0", default-features = false, features = ["schemars", "v1_16"] } openapi = { git = "https://github.com/DazWilkin/openapi-admission-v1", tag = "v1.1.0" } openssl = "0.10" rustls = "0.19.0" diff --git a/webhooks/validating/configuration/src/main.rs b/webhooks/validating/configuration/src/main.rs index 13c50747a..51b7c7c02 100644 --- a/webhooks/validating/configuration/src/main.rs +++ b/webhooks/validating/configuration/src/main.rs @@ -1,5 +1,5 @@ use actix_web::{post, web, App, HttpResponse, HttpServer, Responder}; -use akri_shared::akri::configuration::KubeAkriConfig; +use akri_shared::akri::configuration::Configuration; use clap::Arg; use k8s_openapi::apimachinery::pkg::runtime::RawExtension; use openapi::models::{ @@ -103,7 +103,7 @@ fn filter_configuration(mut v: Value) -> Value { metadata.remove("managedFields"); let generation = metadata.get_mut("generation").unwrap(); - *generation = json!(generation.as_f64().unwrap()); + *generation = json!(generation.as_u64().unwrap()); v } @@ -115,7 +115,7 @@ fn validate_configuration(rqst: &AdmissionRequest) -> AdmissionResponse { let x: RawExtension = serde_json::from_value(raw.clone()) .expect("Could not parse as Kubernetes RawExtension"); let y = serde_json::to_string(&x).unwrap(); - let config: KubeAkriConfig = + let config: Configuration = serde_json::from_str(y.as_str()).expect("Could not parse as Akri Configuration"); let reserialized = serde_json::to_string(&config).unwrap(); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); @@ -179,7 +179,7 @@ async fn validate(rqst: web::Json) -> impl Responder { match &rqst.request { Some(rqst) => { println!("Handler received: AdmissionRequest"); - let resp = validate_configuration(&rqst); + let resp = validate_configuration(rqst); let resp: AdmissionReview = AdmissionReview { api_version: Some("admission.k8s.io/v1".to_owned()), kind: Some("AdmissionReview".to_owned()), @@ -187,11 +187,11 @@ async fn validate(rqst: web::Json) -> impl Responder { response: Some(resp), }; let body = serde_json::to_string(&resp).expect("Valid AdmissionReview"); - return HttpResponse::Ok().body(body); + HttpResponse::Ok().body(body) } None => { println!("Handler received: Nothing"); - return HttpResponse::BadRequest().body(""); + HttpResponse::BadRequest().body("") } } } @@ -680,10 +680,10 @@ mod tests { } // Akri Configuration schema tests - use kube::api::{Object, Void}; + use kube::api::{NotUsed, Object}; #[test] fn test_creationtimestamp_is_filtered() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); @@ -692,7 +692,7 @@ mod tests { #[test] fn test_deletiontimestamp_is_filtered() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); @@ -701,7 +701,7 @@ mod tests { #[test] fn test_managedfields_is_filtered() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); @@ -709,12 +709,12 @@ mod tests { } #[test] - fn test_generation_becomes_f64() { - let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); + fn test_generation_becomes_u64() { + let t: Object = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); - assert!(v["metadata"].get("generation").unwrap().is_f64()); + assert!(v["metadata"].get("generation").unwrap().is_u64()); } #[test] From f36251d2321ecfaeba13a94c3e85f66546469669 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Mon, 23 Aug 2021 21:24:33 +0000 Subject: [PATCH 22/22] Do merge patches and set kube::api::watch version constant --- agent/src/util/config_action.rs | 5 +---- controller/src/util/instance_action.rs | 5 +---- controller/src/util/node_watcher.rs | 5 +---- controller/src/util/pod_watcher.rs | 2 +- shared/src/akri/instance.rs | 12 +++++------- shared/src/akri/mod.rs | 7 +++---- shared/src/k8s/service.rs | 3 +-- 7 files changed, 13 insertions(+), 26 deletions(-) diff --git a/agent/src/util/config_action.rs b/agent/src/util/config_action.rs index c10dd7d5b..d125a6674 100644 --- a/agent/src/util/config_action.rs +++ b/agent/src/util/config_action.rs @@ -92,10 +92,7 @@ async fn watch_for_config_changes( trace!("watch_for_config_changes - start"); let resource = Api::::all(kube_interface.get_kube_client()); let mut stream = resource - .watch( - &ListParams::default(), - akri_shared::akri::API_VERSION_NUMBER, - ) + .watch(&ListParams::default(), akri_shared::akri::WATCH_VERSION) .await? .boxed(); // Currently, this does not handle None except to break the diff --git a/controller/src/util/instance_action.rs b/controller/src/util/instance_action.rs index 5593c7d82..0d6252d59 100644 --- a/controller/src/util/instance_action.rs +++ b/controller/src/util/instance_action.rs @@ -79,10 +79,7 @@ async fn internal_do_instance_watch( trace!("internal_do_instance_watch - enter"); let resource = Api::::all(kube_interface.get_kube_client()); let mut stream = resource - .watch( - &ListParams::default(), - akri_shared::akri::API_VERSION_NUMBER, - ) + .watch(&ListParams::default(), akri_shared::akri::WATCH_VERSION) .await? .boxed(); // Currently, this does not handle None except to break the diff --git a/controller/src/util/node_watcher.rs b/controller/src/util/node_watcher.rs index 8ed6eac62..5bd100734 100644 --- a/controller/src/util/node_watcher.rs +++ b/controller/src/util/node_watcher.rs @@ -55,10 +55,7 @@ impl NodeWatcher { let kube_interface = k8s::KubeImpl::new().await?; let resource = Api::::all(kube_interface.get_kube_client()); let mut stream = resource - .watch( - &ListParams::default(), - akri_shared::akri::API_VERSION_NUMBER, - ) + .watch(&ListParams::default(), akri_shared::akri::WATCH_VERSION) .await? .boxed(); // Currently, this does not handle None except to break the diff --git a/controller/src/util/pod_watcher.rs b/controller/src/util/pod_watcher.rs index be3553eef..2f46769b4 100644 --- a/controller/src/util/pod_watcher.rs +++ b/controller/src/util/pod_watcher.rs @@ -84,7 +84,7 @@ impl BrokerPodWatcher { let mut stream = resource .watch( &ListParams::default().labels(AKRI_TARGET_NODE_LABEL_NAME), - akri_shared::akri::POD_VERSION_NUMBER, + akri_shared::akri::WATCH_VERSION, ) .await? .boxed(); diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs index d9aadf748..3e7caefd1 100644 --- a/shared/src/akri/instance.rs +++ b/shared/src/akri/instance.rs @@ -191,9 +191,6 @@ pub async fn create_instance( }]), ..Default::default() }; - log::trace!( - "create_instance instances_client.create(&PostParams::default(), &instance).await?" - ); match instances_client .create(&PostParams::default(), &instance) .await @@ -296,12 +293,13 @@ pub async fn update_instance( ) -> Result<(), anyhow::Error> { log::trace!("update_instance enter"); let instances_client: Api = Api::namespaced(kube_client.clone(), namespace); - log::trace!("update_instance instances_client.patch(name, &instance_patch_params, instance_to_update).await?"); let modified_instance = Instance::new(name, instance_to_update.clone()); - // Force the apply, ignoring conflicts and ensuring this updated Instance overwrites the previous - let patch_params = PatchParams::apply("akri").force(); match instances_client - .patch(name, &patch_params, &Patch::Apply(&modified_instance)) + .patch( + name, + &PatchParams::default(), + &Patch::Merge(&modified_instance), + ) .await { Ok(_instance_modified) => { diff --git a/shared/src/akri/mod.rs b/shared/src/akri/mod.rs index 65e1ccd1b..7a8ba22a3 100644 --- a/shared/src/akri/mod.rs +++ b/shared/src/akri/mod.rs @@ -1,9 +1,8 @@ /// Akri API Version pub const API_VERSION: &str = "v0"; -/// Akri API Version Number -pub const API_VERSION_NUMBER: &str = "0"; -/// Version of Pods that the Controller watches for -pub const POD_VERSION_NUMBER: &str = "1"; +/// Version for kube:Api::watch +/// TODO: use kube_runtime::watcher::watcher to avoid managing version +pub const WATCH_VERSION: &str = "0"; /// Akri CRD Namespace pub const API_NAMESPACE: &str = "akri.sh"; /// Akri Configuration CRD name diff --git a/shared/src/k8s/service.rs b/shared/src/k8s/service.rs index c6b5935a6..f9cafc9bc 100644 --- a/shared/src/k8s/service.rs +++ b/shared/src/k8s/service.rs @@ -784,11 +784,10 @@ pub async fn update_service( &namespace ); let svcs: Api = Api::namespaced(kube_client, namespace); - let svc_as_u8 = serde_json::to_vec(svc_to_update)?; info!("remove_service svcs.patch(...).await?:"); match svcs - .patch(name, &PatchParams::default(), &Patch::Apply(&svc_as_u8)) + .patch(name, &PatchParams::default(), &Patch::Merge(&svc_to_update)) .await { Ok(_service_modified) => {