diff --git a/.github/workflows/check-rust.yml b/.github/workflows/check-rust.yml
index c50cc91ea..0c4138f07 100644
--- a/.github/workflows/check-rust.yml
+++ b/.github/workflows/check-rust.yml
@@ -33,7 +33,7 @@ jobs:
- name: Rust install
uses: dtolnay/rust-toolchain@master
with:
- toolchain: 1.82.0
+ toolchain: 1.88.0
components: clippy, rustfmt
- name: Install Linux requirements
# TODO: When ubuntu-latest gets updated to >= 23.04 replace the wget+unzip with just protobuf-compiler in apt
@@ -49,7 +49,11 @@ jobs:
- name: Check clippy
run: cargo clippy --all
- name: Check clippy for tests
- run: cargo clippy --all-targets --all-features -- -D warnings -A clippy::derive_partial_eq_without_eq
+ run: |
+ cargo clippy --all-targets --all-features -- -D warnings \
+ -A clippy::derive_partial_eq_without_eq \
+ -A clippy::doc_overindented_list_items \
+ -A clippy::result_large_err # TODO: @gauravgahlot - revisit large error
- name: Run check
run: cargo check
- name: Run tests
diff --git a/.github/workflows/run-tarpaulin.yml b/.github/workflows/run-tarpaulin.yml
index d59b74387..ef29f367b 100644
--- a/.github/workflows/run-tarpaulin.yml
+++ b/.github/workflows/run-tarpaulin.yml
@@ -16,7 +16,7 @@ on:
env:
CARGO_TERM_COLOR: always
- CARGO_VERSION: 1.82.0
+ CARGO_VERSION: 1.88.0
jobs:
build:
diff --git a/Cargo.lock b/Cargo.lock
index 5906f72b8..3e88be4a0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 3
+version = 4
[[package]]
name = "actix-codec"
@@ -66,7 +66,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb"
dependencies = [
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -153,9 +153,9 @@ dependencies = [
[[package]]
name = "actix-web"
-version = "4.12.0"
+version = "4.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2233f53f6cb18ae038ce1f0713ca0c72ca0c4b71fe9aaeb59924ce2c89c6dd85"
+checksum = "1654a77ba142e37f049637a3e5685f864514af11fcbc51cb51eb6596afe5b8d6"
dependencies = [
"actix-codec",
"actix-http",
@@ -204,7 +204,7 @@ dependencies = [
"actix-router",
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -215,7 +215,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "agent"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-debug-echo",
"akri-discovery-utils",
@@ -229,22 +229,22 @@ dependencies = [
"blake2",
"env_logger",
"futures",
- "hyper",
+ "hyper 0.14.32",
"itertools",
- "k8s-openapi 0.20.0",
- "kube 0.87.2",
+ "k8s-openapi",
+ "kube",
"kube-runtime",
"lazy_static",
"log",
"mock_instant",
"mockall",
"mockall_double",
- "prometheus",
+ "prometheus 0.13.4",
"prost",
"serde",
"serde_derive",
"serde_json",
- "serde_yaml 0.9.34+deprecated",
+ "serde_yaml",
"simple-mermaid",
"tempfile",
"thiserror",
@@ -279,7 +279,7 @@ dependencies = [
[[package]]
name = "akri-debug-echo"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-discovery-utils",
"akri-shared",
@@ -289,7 +289,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
- "serde_yaml 0.9.34+deprecated",
+ "serde_yaml",
"tokio",
"tokio-stream",
"tonic",
@@ -297,7 +297,7 @@ dependencies = [
[[package]]
name = "akri-discovery-utils"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-shared",
"anyhow",
@@ -308,7 +308,7 @@ dependencies = [
"prost",
"serde",
"serde_derive",
- "serde_yaml 0.9.34+deprecated",
+ "serde_yaml",
"tempfile",
"tokio",
"tokio-stream",
@@ -319,7 +319,7 @@ dependencies = [
[[package]]
name = "akri-onvif"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-discovery-utils",
"anyhow",
@@ -329,7 +329,7 @@ dependencies = [
"chrono",
"env_logger",
"futures-util",
- "hyper",
+ "hyper 0.14.32",
"log",
"mockall",
"serde",
@@ -348,7 +348,7 @@ dependencies = [
[[package]]
name = "akri-opcua"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-discovery-utils",
"anyhow",
@@ -359,7 +359,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
- "serde_yaml 0.9.34+deprecated",
+ "serde_yaml",
"tokio",
"tokio-stream",
"tonic",
@@ -368,23 +368,23 @@ dependencies = [
[[package]]
name = "akri-shared"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"anyhow",
"async-trait",
"either",
"env_logger",
- "k8s-openapi 0.20.0",
- "kube 0.87.2",
+ "k8s-openapi",
+ "kube",
"log",
"mockall",
- "prometheus",
+ "prometheus 0.13.4",
"rand 0.8.5",
"schemars",
"serde",
"serde_derive",
"serde_json",
- "serde_yaml 0.9.34+deprecated",
+ "serde_yaml",
"tokio",
"tonic",
"tower",
@@ -393,7 +393,7 @@ dependencies = [
[[package]]
name = "akri-udev"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-discovery-utils",
"anyhow",
@@ -499,6 +499,18 @@ version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
+[[package]]
+name = "async-broadcast"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"
+dependencies = [
+ "event-listener 5.4.1",
+ "event-listener-strategy",
+ "futures-core",
+ "pin-project-lite",
+]
+
[[package]]
name = "async-channel"
version = "1.9.0"
@@ -564,7 +576,7 @@ dependencies = [
"futures-lite",
"parking",
"polling",
- "rustix",
+ "rustix 1.1.2",
"slab",
"windows-sys 0.61.2",
]
@@ -625,7 +637,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -642,7 +654,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -669,8 +681,8 @@ dependencies = [
"bytes",
"futures-util",
"http 0.2.12",
- "http-body",
- "hyper",
+ "http-body 0.4.6",
+ "hyper 0.14.32",
"itoa",
"matchit",
"memchr",
@@ -695,7 +707,7 @@ dependencies = [
"bytes",
"futures-util",
"http 0.2.12",
- "http-body",
+ "http-body 0.4.6",
"mime",
"rustversion",
"tower-layer",
@@ -719,12 +731,6 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
-[[package]]
-name = "base64"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5"
-
[[package]]
name = "base64"
version = "0.21.7"
@@ -832,9 +838,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.2.46"
+version = "1.2.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36"
+checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215"
dependencies = [
"find-msvc-tools",
"jobserver",
@@ -880,7 +886,7 @@ dependencies = [
"anstream",
"anstyle",
"clap_lex",
- "strsim 0.11.1",
+ "strsim",
]
[[package]]
@@ -906,7 +912,7 @@ dependencies = [
[[package]]
name = "controller"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-shared",
"anyhow",
@@ -914,17 +920,25 @@ dependencies = [
"chrono",
"env_logger",
"futures",
- "k8s-openapi 0.20.0",
- "kube 0.87.2",
- "kube-runtime",
+ "k8s-openapi",
+ "kube",
"lazy_static",
"log",
"mockall",
- "prometheus",
+ "prometheus 0.13.4",
"serde_json",
"tokio",
]
+[[package]]
+name = "convert_case"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9"
+dependencies = [
+ "unicode-segmentation",
+]
+
[[package]]
name = "cookie"
version = "0.16.2"
@@ -946,6 +960,16 @@ dependencies = [
"libc",
]
+[[package]]
+name = "core-foundation"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
@@ -996,38 +1020,14 @@ dependencies = [
"subtle",
]
-[[package]]
-name = "darling"
-version = "0.14.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
-dependencies = [
- "darling_core 0.14.4",
- "darling_macro 0.14.4",
-]
-
[[package]]
name = "darling"
version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
dependencies = [
- "darling_core 0.20.11",
- "darling_macro 0.20.11",
-]
-
-[[package]]
-name = "darling_core"
-version = "0.14.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
-dependencies = [
- "fnv",
- "ident_case",
- "proc-macro2",
- "quote",
- "strsim 0.10.0",
- "syn 1.0.109",
+ "darling_core",
+ "darling_macro",
]
[[package]]
@@ -1040,19 +1040,8 @@ dependencies = [
"ident_case",
"proc-macro2",
"quote",
- "strsim 0.11.1",
- "syn 2.0.110",
-]
-
-[[package]]
-name = "darling_macro"
-version = "0.14.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
-dependencies = [
- "darling_core 0.14.4",
- "quote",
- "syn 1.0.109",
+ "strsim",
+ "syn 2.0.111",
]
[[package]]
@@ -1061,9 +1050,9 @@ version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
dependencies = [
- "darling_core 0.20.11",
+ "darling_core",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -1074,7 +1063,7 @@ checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476"
[[package]]
name = "debug-echo-discovery-handler"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-debug-echo",
"akri-discovery-utils",
@@ -1105,22 +1094,24 @@ dependencies = [
[[package]]
name = "derive_more"
-version = "2.0.1"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
+checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618"
dependencies = [
"derive_more-impl",
]
[[package]]
name = "derive_more-impl"
-version = "2.0.1"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
+checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b"
dependencies = [
+ "convert_case",
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "rustc_version",
+ "syn 2.0.111",
"unicode-xid",
]
@@ -1143,27 +1134,6 @@ dependencies = [
"crypto-common",
]
-[[package]]
-name = "dirs-next"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
-dependencies = [
- "cfg-if",
- "dirs-sys-next",
-]
-
-[[package]]
-name = "dirs-sys-next"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
-dependencies = [
- "libc",
- "redox_users",
- "winapi",
-]
-
[[package]]
name = "displaydoc"
version = "0.2.5"
@@ -1172,7 +1142,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -1407,7 +1377,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -1507,7 +1477,7 @@ dependencies = [
"futures-sink",
"futures-util",
"http 0.2.12",
- "indexmap 2.12.0",
+ "indexmap 2.12.1",
"slab",
"tokio",
"tokio-util",
@@ -1532,9 +1502,9 @@ dependencies = [
[[package]]
name = "hashbrown"
-version = "0.16.0"
+version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
+checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
[[package]]
name = "headers"
@@ -1560,15 +1530,6 @@ dependencies = [
"http 0.2.12",
]
-[[package]]
-name = "heck"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
-dependencies = [
- "unicode-segmentation",
-]
-
[[package]]
name = "heck"
version = "0.5.0"
@@ -1609,12 +1570,11 @@ dependencies = [
[[package]]
name = "http"
-version = "1.3.1"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
+checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
dependencies = [
"bytes",
- "fnv",
"itoa",
]
@@ -1630,10 +1590,27 @@ dependencies = [
]
[[package]]
-name = "http-range-header"
-version = "0.3.1"
+name = "http-body"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f"
+checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
+dependencies = [
+ "bytes",
+ "http 1.4.0",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "http 1.4.0",
+ "http-body 1.0.1",
+ "pin-project-lite",
+]
[[package]]
name = "httparse"
@@ -1659,7 +1636,7 @@ dependencies = [
"futures-util",
"h2",
"http 0.2.12",
- "http-body",
+ "http-body 0.4.6",
"httparse",
"httpdate",
"itoa",
@@ -1672,37 +1649,42 @@ dependencies = [
]
[[package]]
-name = "hyper-openssl"
-version = "0.9.2"
+name = "hyper"
+version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6ee5d7a8f718585d1c3c61dfde28ef5b0bb14734b4db13f5ada856cdc6c612b"
+checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11"
dependencies = [
- "http 0.2.12",
- "hyper",
- "linked_hash_set",
- "once_cell",
- "openssl",
- "openssl-sys",
- "parking_lot 0.12.5",
+ "atomic-waker",
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "http 1.4.0",
+ "http-body 1.0.1",
+ "httparse",
+ "itoa",
+ "pin-project-lite",
+ "pin-utils",
+ "smallvec",
"tokio",
- "tokio-openssl",
- "tower-layer",
+ "want",
]
[[package]]
name = "hyper-rustls"
-version = "0.24.2"
+version = "0.27.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590"
+checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58"
dependencies = [
- "futures-util",
- "http 0.2.12",
- "hyper",
+ "http 1.4.0",
+ "hyper 1.8.1",
+ "hyper-util",
"log",
- "rustls",
+ "rustls 0.23.35",
"rustls-native-certs",
+ "rustls-pki-types",
"tokio",
- "tokio-rustls",
+ "tokio-rustls 0.26.4",
+ "tower-service",
]
[[package]]
@@ -1711,12 +1693,46 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
dependencies = [
- "hyper",
+ "hyper 0.14.32",
"pin-project-lite",
"tokio",
"tokio-io-timeout",
]
+[[package]]
+name = "hyper-timeout"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0"
+dependencies = [
+ "hyper 1.8.1",
+ "hyper-util",
+ "pin-project-lite",
+ "tokio",
+ "tower-service",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f"
+dependencies = [
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "futures-util",
+ "http 1.4.0",
+ "http-body 1.0.1",
+ "hyper 1.8.1",
+ "libc",
+ "pin-project-lite",
+ "socket2 0.6.1",
+ "tokio",
+ "tower-service",
+ "tracing",
+]
+
[[package]]
name = "iana-time-zone"
version = "0.1.64"
@@ -1789,9 +1805,9 @@ checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"
[[package]]
name = "icu_properties"
-version = "2.1.1"
+version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99"
+checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec"
dependencies = [
"icu_collections",
"icu_locale_core",
@@ -1803,9 +1819,9 @@ dependencies = [
[[package]]
name = "icu_properties_data"
-version = "2.1.1"
+version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899"
+checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af"
[[package]]
name = "icu_provider"
@@ -1878,12 +1894,12 @@ dependencies = [
[[package]]
name = "indexmap"
-version = "2.12.0"
+version = "2.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
+checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2"
dependencies = [
"equivalent",
- "hashbrown 0.16.0",
+ "hashbrown 0.16.1",
]
[[package]]
@@ -1943,7 +1959,7 @@ checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -1958,9 +1974,9 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.82"
+version = "0.3.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65"
+checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8"
dependencies = [
"once_cell",
"wasm-bindgen",
@@ -1979,10 +1995,12 @@ dependencies = [
[[package]]
name = "jsonpath-rust"
-version = "0.3.5"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06cc127b7c3d270be504572364f9569761a180b981919dd0d87693a7f5fb7829"
+checksum = "19d8fe85bd70ff715f31ce8c739194b423d79811a19602115d611a3ec85d6200"
dependencies = [
+ "lazy_static",
+ "once_cell",
"pest",
"pest_derive",
"regex",
@@ -1990,40 +2008,13 @@ dependencies = [
"thiserror",
]
-[[package]]
-name = "jsonpath_lib"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eaa63191d68230cccb81c5aa23abd53ed64d83337cacbb25a7b8c7979523774f"
-dependencies = [
- "log",
- "serde",
- "serde_json",
-]
-
-[[package]]
-name = "k8s-openapi"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d1985030683a2bac402cbda61222195de80d3f66b4c87ab56e5fea379bd98c3"
-dependencies = [
- "base64 0.20.0",
- "bytes",
- "chrono",
- "schemars",
- "serde",
- "serde-value",
- "serde_json",
-]
-
[[package]]
name = "k8s-openapi"
-version = "0.20.0"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "edc3606fd16aca7989db2f84bb25684d0270c6d6fa1dbcd0025af7b4130523a6"
+checksum = "19501afb943ae5806548bc3ebd7f3374153ca057a38f480ef30adfde5ef09755"
dependencies = [
- "base64 0.21.7",
- "bytes",
+ "base64 0.22.1",
"chrono",
"schemars",
"serde",
@@ -2033,128 +2024,65 @@ dependencies = [
[[package]]
name = "kube"
-version = "0.80.0"
+version = "0.91.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "414d80c69906a91e8ecf4ae16d0fb504e19aa6b099135d35d85298b4e4be3ed3"
+checksum = "264461a7ebf4fb0fcf23e4c7e4f9387c5696ee61d003de207d9b5a895ff37bfa"
dependencies = [
- "k8s-openapi 0.17.0",
- "kube-client 0.80.0",
- "kube-core 0.80.0",
- "kube-derive 0.80.0",
-]
-
-[[package]]
-name = "kube"
-version = "0.87.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3499c8d60c763246c7a213f51caac1e9033f46026904cb89bc8951ae8601f26e"
-dependencies = [
- "k8s-openapi 0.20.0",
- "kube-client 0.87.2",
- "kube-core 0.87.2",
- "kube-derive 0.87.2",
-]
-
-[[package]]
-name = "kube-client"
-version = "0.80.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6dc5ae0b9148b4e2ebb0dabda06a0cd65b1eed2f41d792d49787841a68050283"
-dependencies = [
- "base64 0.20.0",
- "bytes",
- "chrono",
- "dirs-next",
- "either",
- "futures",
- "http 0.2.12",
- "http-body",
- "hyper",
- "hyper-openssl",
- "hyper-timeout",
- "jsonpath_lib",
- "k8s-openapi 0.17.0",
- "kube-core 0.80.0",
- "openssl",
- "pem 1.1.1",
- "pin-project",
- "secrecy",
- "serde",
- "serde_json",
- "serde_yaml 0.8.26",
- "thiserror",
- "tokio",
- "tokio-util",
- "tower",
- "tower-http 0.3.5",
- "tracing",
+ "k8s-openapi",
+ "kube-client",
+ "kube-core",
+ "kube-derive",
+ "kube-runtime",
]
[[package]]
name = "kube-client"
-version = "0.87.2"
+version = "0.91.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "033450dfa0762130565890dadf2f8835faedf749376ca13345bcd8ecd6b5f29f"
+checksum = "47164ad6c47398ee4bdf90509c7b44026229721cb1377eb4623a1ec2a00a85e9"
dependencies = [
- "base64 0.21.7",
+ "base64 0.22.1",
"bytes",
"chrono",
"either",
"futures",
"home",
- "http 0.2.12",
- "http-body",
- "hyper",
+ "http 1.4.0",
+ "http-body 1.0.1",
+ "http-body-util",
+ "hyper 1.8.1",
"hyper-rustls",
- "hyper-timeout",
+ "hyper-timeout 0.5.2",
+ "hyper-util",
"jsonpath-rust",
- "k8s-openapi 0.20.0",
- "kube-core 0.87.2",
- "pem 3.0.6",
- "pin-project",
- "rustls",
- "rustls-pemfile",
+ "k8s-openapi",
+ "kube-core",
+ "pem",
+ "rustls 0.23.35",
+ "rustls-pemfile 2.2.0",
"secrecy",
"serde",
"serde_json",
- "serde_yaml 0.9.34+deprecated",
+ "serde_yaml",
"thiserror",
"tokio",
"tokio-util",
"tower",
- "tower-http 0.4.4",
+ "tower-http",
"tracing",
]
[[package]]
name = "kube-core"
-version = "0.80.0"
+version = "0.91.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "98331c6f1354893f7c50da069e43a3fd1c84e55bbedc7765d9db22ec3291d07d"
+checksum = "2797d3044a238825432129cd9537e12c2a6dacbbb5352381af5ea55e1505ed4f"
dependencies = [
"chrono",
"form_urlencoded",
- "http 0.2.12",
- "k8s-openapi 0.17.0",
- "once_cell",
- "schemars",
- "serde",
- "serde_json",
- "thiserror",
-]
-
-[[package]]
-name = "kube-core"
-version = "0.87.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5bba93d054786eba7994d03ce522f368ef7d48c88a1826faa28478d85fb63ae"
-dependencies = [
- "chrono",
- "form_urlencoded",
- "http 0.2.12",
+ "http 1.4.0",
"json-patch",
- "k8s-openapi 0.20.0",
- "once_cell",
+ "k8s-openapi",
"schemars",
"serde",
"serde_json",
@@ -2163,45 +2091,34 @@ dependencies = [
[[package]]
name = "kube-derive"
-version = "0.80.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4be6ff26b9a34ce831d341e8b33bc78986a33c1be88f5bf9ca84e92e98b1dfb"
-dependencies = [
- "darling 0.14.4",
- "proc-macro2",
- "quote",
- "serde_json",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "kube-derive"
-version = "0.87.2"
+version = "0.91.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91e98dd5e5767c7b894c1f0e41fd628b145f808e981feb8b08ed66455d47f1a4"
+checksum = "fcf837edaa0c478f85e9a3cddb17fa80d58a57c1afa722b3a9e55753ea162f41"
dependencies = [
- "darling 0.20.11",
+ "darling",
"proc-macro2",
"quote",
"serde_json",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
name = "kube-runtime"
-version = "0.87.2"
+version = "0.91.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d8893eb18fbf6bb6c80ef6ee7dd11ec32b1dc3c034c988ac1b3a84d46a230ae"
+checksum = "e463e89a1fb222c65a5469b568803153d1bf13d084a8dd42b659e6cca66edc6e"
dependencies = [
"ahash",
+ "async-broadcast",
+ "async-stream",
"async-trait",
"backoff",
"derivative",
"futures",
"hashbrown 0.14.5",
"json-patch",
- "k8s-openapi 0.20.0",
- "kube-client 0.87.2",
+ "k8s-openapi",
+ "kube-client",
"parking_lot 0.12.5",
"pin-project",
"serde",
@@ -2236,19 +2153,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
-version = "0.2.177"
+version = "0.2.178"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
-
-[[package]]
-name = "libredox"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
-dependencies = [
- "bitflags 2.10.0",
- "libc",
-]
+checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091"
[[package]]
name = "libudev-sys"
@@ -2261,19 +2168,10 @@ dependencies = [
]
[[package]]
-name = "linked-hash-map"
-version = "0.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
-
-[[package]]
-name = "linked_hash_set"
-version = "0.1.6"
+name = "linux-raw-sys"
+version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "984fb35d06508d1e69fc91050cceba9c0b748f983e6739fa2c7a9237154c52c8"
-dependencies = [
- "linked-hash-map",
-]
+checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
[[package]]
name = "linux-raw-sys"
@@ -2315,9 +2213,9 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.28"
+version = "0.4.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
+checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
dependencies = [
"value-bag",
]
@@ -2368,9 +2266,9 @@ dependencies = [
[[package]]
name = "mio"
-version = "1.1.0"
+version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873"
+checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc"
dependencies = [
"libc",
"log",
@@ -2411,7 +2309,7 @@ dependencies = [
"cfg-if",
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -2423,7 +2321,7 @@ dependencies = [
"cfg-if",
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -2479,7 +2377,7 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
name = "onvif-discovery-handler"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-discovery-utils",
"akri-onvif",
@@ -2519,16 +2417,16 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
- "serde_yaml 0.9.34+deprecated",
+ "serde_yaml",
"tokio",
"tokio-util",
"url 1.7.2",
- "uuid 1.18.1",
+ "uuid 1.19.0",
]
[[package]]
name = "opcua-discovery-handler"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-discovery-utils",
"akri-opcua",
@@ -2572,7 +2470,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -2656,15 +2554,6 @@ dependencies = [
"windows-link",
]
-[[package]]
-name = "pem"
-version = "1.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8"
-dependencies = [
- "base64 0.13.1",
-]
-
[[package]]
name = "pem"
version = "3.0.6"
@@ -2695,9 +2584,9 @@ checksum = "f658886ed52e196e850cfbbfddab9eaa7f6d90dd0929e264c31e5cec07e09e57"
[[package]]
name = "pest"
-version = "2.8.3"
+version = "2.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "989e7521a040efde50c3ab6bbadafbe15ab6dc042686926be59ac35d74607df4"
+checksum = "cbcfd20a6d4eeba40179f05735784ad32bdaef05ce8e8af05f180d45bb3e7e22"
dependencies = [
"memchr",
"ucd-trie",
@@ -2705,9 +2594,9 @@ dependencies = [
[[package]]
name = "pest_derive"
-version = "2.8.3"
+version = "2.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "187da9a3030dbafabbbfb20cb323b976dc7b7ce91fcd84f2f74d6e31d378e2de"
+checksum = "51f72981ade67b1ca6adc26ec221be9f463f2b5839c7508998daa17c23d94d7f"
dependencies = [
"pest",
"pest_generator",
@@ -2715,22 +2604,22 @@ dependencies = [
[[package]]
name = "pest_generator"
-version = "2.8.3"
+version = "2.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49b401d98f5757ebe97a26085998d6c0eecec4995cad6ab7fc30ffdf4b052843"
+checksum = "dee9efd8cdb50d719a80088b76f81aec7c41ed6d522ee750178f83883d271625"
dependencies = [
"pest",
"pest_meta",
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
name = "pest_meta"
-version = "2.8.3"
+version = "2.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72f27a2cfee9f9039c4d86faa5af122a0ac3851441a34865b8a043b46be0065a"
+checksum = "bf1d70880e76bdc13ba52eafa6239ce793d85c8e43896507e43dd8984ff05b82"
dependencies = [
"pest",
"sha2",
@@ -2743,7 +2632,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
dependencies = [
"fixedbitset",
- "indexmap 2.12.0",
+ "indexmap 2.12.1",
]
[[package]]
@@ -2763,7 +2652,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -2805,7 +2694,7 @@ dependencies = [
"concurrent-queue",
"hermit-abi",
"pin-project-lite",
- "rustix",
+ "rustix 1.1.2",
"windows-sys 0.61.2",
]
@@ -2881,7 +2770,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
dependencies = [
"proc-macro2",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -2907,6 +2796,29 @@ dependencies = [
"libc",
]
+[[package]]
+name = "procfs"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "731e0d9356b0c25f16f33b5be79b1c57b562f141ebfcdb0ad8ac2c13a24293b4"
+dependencies = [
+ "bitflags 2.10.0",
+ "hex",
+ "lazy_static",
+ "procfs-core",
+ "rustix 0.38.44",
+]
+
+[[package]]
+name = "procfs-core"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2d3554923a69f4ce04c4a754260c338f505ce22642d3830e049a399fc2059a29"
+dependencies = [
+ "bitflags 2.10.0",
+ "hex",
+]
+
[[package]]
name = "prometheus"
version = "0.12.0"
@@ -2919,7 +2831,24 @@ dependencies = [
"libc",
"memchr",
"parking_lot 0.11.2",
- "procfs",
+ "procfs 0.9.1",
+ "protobuf",
+ "thiserror",
+]
+
+[[package]]
+name = "prometheus"
+version = "0.13.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d33c28a30771f7f96db69893f78b857f7450d7e0237e9c8fc6427a81bae7ed1"
+dependencies = [
+ "cfg-if",
+ "fnv",
+ "lazy_static",
+ "libc",
+ "memchr",
+ "parking_lot 0.12.5",
+ "procfs 0.16.0",
"protobuf",
"thiserror",
]
@@ -2941,7 +2870,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4"
dependencies = [
"bytes",
- "heck 0.5.0",
+ "heck",
"itertools",
"log",
"multimap",
@@ -2951,7 +2880,7 @@ dependencies = [
"prost",
"prost-types",
"regex",
- "syn 2.0.110",
+ "syn 2.0.111",
"tempfile",
]
@@ -2965,7 +2894,7 @@ dependencies = [
"itertools",
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -3081,17 +3010,6 @@ dependencies = [
"bitflags 2.10.0",
]
-[[package]]
-name = "redox_users"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
-dependencies = [
- "getrandom 0.2.16",
- "libredox",
- "thiserror",
-]
-
[[package]]
name = "regex"
version = "1.12.2"
@@ -3140,8 +3058,8 @@ dependencies = [
"futures-util",
"h2",
"http 0.2.12",
- "http-body",
- "hyper",
+ "http-body 0.4.6",
+ "hyper 0.14.32",
"ipnet",
"js-sys",
"log",
@@ -3187,6 +3105,28 @@ dependencies = [
"libc",
]
+[[package]]
+name = "rustc_version"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
+dependencies = [
+ "semver",
+]
+
+[[package]]
+name = "rustix"
+version = "0.38.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
+dependencies = [
+ "bitflags 2.10.0",
+ "errno",
+ "libc",
+ "linux-raw-sys 0.4.15",
+ "windows-sys 0.59.0",
+]
+
[[package]]
name = "rustix"
version = "1.1.2"
@@ -3196,7 +3136,7 @@ dependencies = [
"bitflags 2.10.0",
"errno",
"libc",
- "linux-raw-sys",
+ "linux-raw-sys 0.11.0",
"windows-sys 0.61.2",
]
@@ -3208,18 +3148,33 @@ checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [
"log",
"ring",
- "rustls-webpki",
+ "rustls-webpki 0.101.7",
"sct",
]
+[[package]]
+name = "rustls"
+version = "0.23.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f"
+dependencies = [
+ "log",
+ "once_cell",
+ "ring",
+ "rustls-pki-types",
+ "rustls-webpki 0.103.8",
+ "subtle",
+ "zeroize",
+]
+
[[package]]
name = "rustls-native-certs"
-version = "0.6.3"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
+checksum = "9980d917ebb0c0536119ba501e90834767bffc3d60641457fd84a1f3fd337923"
dependencies = [
"openssl-probe",
- "rustls-pemfile",
+ "rustls-pki-types",
"schannel",
"security-framework",
]
@@ -3233,6 +3188,24 @@ dependencies = [
"base64 0.21.7",
]
+[[package]]
+name = "rustls-pemfile"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50"
+dependencies = [
+ "rustls-pki-types",
+]
+
+[[package]]
+name = "rustls-pki-types"
+version = "1.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c"
+dependencies = [
+ "zeroize",
+]
+
[[package]]
name = "rustls-webpki"
version = "0.101.7"
@@ -3243,6 +3216,17 @@ dependencies = [
"untrusted",
]
+[[package]]
+name = "rustls-webpki"
+version = "0.103.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
[[package]]
name = "rustversion"
version = "1.0.22"
@@ -3285,7 +3269,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde_derive_internals",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -3322,12 +3306,12 @@ dependencies = [
[[package]]
name = "security-framework"
-version = "2.11.1"
+version = "3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
+checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef"
dependencies = [
"bitflags 2.10.0",
- "core-foundation",
+ "core-foundation 0.10.1",
"core-foundation-sys",
"libc",
"security-framework-sys",
@@ -3343,6 +3327,12 @@ dependencies = [
"libc",
]
+[[package]]
+name = "semver"
+version = "1.0.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
+
[[package]]
name = "serde"
version = "1.0.228"
@@ -3380,7 +3370,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -3391,7 +3381,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -3400,7 +3390,6 @@ version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
dependencies = [
- "indexmap 2.12.0",
"itoa",
"memchr",
"ryu",
@@ -3420,25 +3409,13 @@ dependencies = [
"serde",
]
-[[package]]
-name = "serde_yaml"
-version = "0.8.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b"
-dependencies = [
- "indexmap 1.9.3",
- "ryu",
- "serde",
- "yaml-rust",
-]
-
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
- "indexmap 2.12.0",
+ "indexmap 2.12.1",
"itoa",
"ryu",
"serde",
@@ -3490,18 +3467,18 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "signal-hook-registry"
-version = "1.4.6"
+version = "1.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b"
+checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad"
dependencies = [
"libc",
]
[[package]]
name = "simd-adler32"
-version = "0.3.7"
+version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
+checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2"
[[package]]
name = "simple-mermaid"
@@ -3553,12 +3530,6 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
-[[package]]
-name = "strsim"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
-
[[package]]
name = "strsim"
version = "0.11.1"
@@ -3605,9 +3576,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.110"
+version = "2.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
+checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
dependencies = [
"proc-macro2",
"quote",
@@ -3628,7 +3599,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -3638,7 +3609,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [
"bitflags 1.3.2",
- "core-foundation",
+ "core-foundation 0.9.4",
"system-configuration-sys",
]
@@ -3661,7 +3632,7 @@ dependencies = [
"fastrand",
"getrandom 0.3.4",
"once_cell",
- "rustix",
+ "rustix 1.1.2",
"windows-sys 0.61.2",
]
@@ -3688,7 +3659,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -3782,7 +3753,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -3802,7 +3773,17 @@ version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
dependencies = [
- "rustls",
+ "rustls 0.21.12",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-rustls"
+version = "0.26.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"
+dependencies = [
+ "rustls 0.23.35",
"tokio",
]
@@ -3857,16 +3838,16 @@ dependencies = [
"bytes",
"h2",
"http 0.2.12",
- "http-body",
- "hyper",
- "hyper-timeout",
+ "http-body 0.4.6",
+ "hyper 0.14.32",
+ "hyper-timeout 0.4.1",
"percent-encoding 2.3.2",
"pin-project",
"prost",
- "rustls",
- "rustls-pemfile",
+ "rustls 0.21.12",
+ "rustls-pemfile 1.0.4",
"tokio",
- "tokio-rustls",
+ "tokio-rustls 0.24.1",
"tokio-stream",
"tower",
"tower-layer",
@@ -3884,7 +3865,7 @@ dependencies = [
"proc-macro2",
"prost-build",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -3909,38 +3890,16 @@ dependencies = [
[[package]]
name = "tower-http"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858"
-dependencies = [
- "base64 0.13.1",
- "bitflags 1.3.2",
- "bytes",
- "futures-core",
- "futures-util",
- "http 0.2.12",
- "http-body",
- "http-range-header",
- "pin-project-lite",
- "tower-layer",
- "tower-service",
- "tracing",
-]
-
-[[package]]
-name = "tower-http"
-version = "0.4.4"
+version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140"
+checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5"
dependencies = [
"base64 0.21.7",
"bitflags 2.10.0",
"bytes",
- "futures-core",
- "futures-util",
- "http 0.2.12",
- "http-body",
- "http-range-header",
+ "http 1.4.0",
+ "http-body 1.0.1",
+ "http-body-util",
"mime",
"pin-project-lite",
"tower-layer",
@@ -3962,9 +3921,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]]
name = "tracing"
-version = "0.1.41"
+version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
+checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647"
dependencies = [
"log",
"pin-project-lite",
@@ -3974,20 +3933,20 @@ dependencies = [
[[package]]
name = "tracing-attributes"
-version = "0.1.30"
+version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
name = "tracing-core"
-version = "0.1.34"
+version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
+checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
dependencies = [
"once_cell",
]
@@ -4007,7 +3966,7 @@ dependencies = [
"byteorder",
"bytes",
"data-encoding",
- "http 1.3.1",
+ "http 1.4.0",
"httparse",
"log",
"rand 0.8.5",
@@ -4047,7 +4006,7 @@ dependencies = [
[[package]]
name = "udev-discovery-handler"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-discovery-utils",
"akri-udev",
@@ -4058,13 +4017,13 @@ dependencies = [
[[package]]
name = "udev-video-broker"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"akri-shared",
"env_logger",
"lazy_static",
"log",
- "prometheus",
+ "prometheus 0.12.0",
"prost",
"regex",
"rscam",
@@ -4176,9 +4135,9 @@ dependencies = [
[[package]]
name = "uuid"
-version = "1.18.1"
+version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2"
+checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a"
dependencies = [
"getrandom 0.3.4",
"js-sys",
@@ -4187,9 +4146,9 @@ dependencies = [
[[package]]
name = "value-bag"
-version = "1.11.1"
+version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5"
+checksum = "7ba6f5989077681266825251a52748b8c1d8a4ad098cc37e440103d0ea717fc0"
[[package]]
name = "vcpkg"
@@ -4223,7 +4182,7 @@ dependencies = [
"futures-util",
"headers",
"http 0.2.12",
- "hyper",
+ "hyper 0.14.32",
"log",
"mime",
"mime_guess",
@@ -4258,9 +4217,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen"
-version = "0.2.105"
+version = "0.2.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60"
+checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd"
dependencies = [
"cfg-if",
"once_cell",
@@ -4271,9 +4230,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.55"
+version = "0.4.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0"
+checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c"
dependencies = [
"cfg-if",
"js-sys",
@@ -4284,9 +4243,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.105"
+version = "0.2.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2"
+checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -4294,31 +4253,31 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.105"
+version = "0.2.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc"
+checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40"
dependencies = [
"bumpalo",
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.105"
+version = "0.2.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76"
+checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4"
dependencies = [
"unicode-ident",
]
[[package]]
name = "web-sys"
-version = "0.3.82"
+version = "0.3.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1"
+checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -4326,14 +4285,14 @@ dependencies = [
[[package]]
name = "webhook-configuration"
-version = "0.13.18"
+version = "0.13.19"
dependencies = [
"actix-rt",
"actix-web",
"akri-shared",
"clap",
- "k8s-openapi 0.17.0",
- "kube 0.80.0",
+ "k8s-openapi",
+ "kube",
"openapi",
"openssl",
"serde_json",
@@ -4382,7 +4341,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -4393,7 +4352,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -4438,6 +4397,15 @@ dependencies = [
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows-sys"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows-sys"
version = "0.60.2"
@@ -4670,20 +4638,11 @@ version = "0.8.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f"
-[[package]]
-name = "yaml-rust"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
-dependencies = [
- "linked-hash-map",
-]
-
[[package]]
name = "yaserde"
-version = "0.7.1"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2776ec5bb20e76d89268e87e1ea66c078b94f55e9771e4d648adda3019f87fc"
+checksum = "3837963ac213fd0babf6be78811f1d9e673e5c9240ee0d00020fa69c0acb5b35"
dependencies = [
"log",
"xml-rs",
@@ -4691,11 +4650,11 @@ dependencies = [
[[package]]
name = "yaserde_derive"
-version = "0.7.1"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c0b0a4701f203ebaecce4971a6bb8575aa07b617bdc39ddfc6ffeff3a38530d"
+checksum = "5b14b171e65b944cd8018ea60ac5cc6601bb0a07ce4b2979962e22c9f6fb6496"
dependencies = [
- "heck 0.3.3",
+ "heck",
"log",
"proc-macro2",
"quote",
@@ -4722,28 +4681,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
"synstructure",
]
[[package]]
name = "zerocopy"
-version = "0.8.27"
+version = "0.8.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
+checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
-version = "0.8.27"
+version = "0.8.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
+checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
@@ -4763,7 +4722,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
"synstructure",
]
@@ -4803,7 +4762,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.110",
+ "syn 2.0.111",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index f162fcb01..bf8bbd0c8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,10 +23,10 @@ members = [
resolver = "2"
[workspace.package]
-version = "0.13.18"
-edition = "2021"
+version = "0.13.19"
+edition = "2024"
license = "Apache-2.0"
homepage = "https://docs.akri.sh/"
repository = "https://github.com/project-akri/akri"
-rust-version = "1.82"
+rust-version = "1.88"
authors = ["The Akri Team"]
diff --git a/README.md b/README.md
index f360dd07e..15bc5cc8c 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@

[](https://kubernetes.slack.com/messages/akri)
-[](https://blog.rust-lang.org/2024/10/17/Rust-1.82.0/)
+[](https://blog.rust-lang.org/2025/06/26/Rust-1.88.0/)
[](https://kubernetes.io/)
[](https://codecov.io/gh/project-akri/akri)
[](https://bestpractices.coreinfrastructure.org/projects/5339)
diff --git a/agent/Cargo.toml b/agent/Cargo.toml
index eb9d61d63..123e054ae 100644
--- a/agent/Cargo.toml
+++ b/agent/Cargo.toml
@@ -25,13 +25,13 @@ env_logger = "0.11.8"
futures = { version = "0.3.1", package = "futures" }
hyper = "0.14.2"
itertools = "0.12.0"
-k8s-openapi = { version = "0.20.0", default-features = false, features = ["schemars", "v1_23"] }
-kube = { version = "0.87.1", features = ["derive"] }
-kube-runtime = { version = "0.87.1", features = ["unstable-runtime-reconcile-on"] }
+k8s-openapi = { version = "0.22.0", default-features = false, features = ["schemars", "v1_25"] }
+kube = { version = "0.91.0", features = ["derive", "runtime"] }
+kube-runtime = { version = "0.91.0", features = ["unstable-runtime-reconcile-on"] }
lazy_static = "1.4"
log = "0.4"
mockall_double = "0.3.1"
-prometheus = { version = "0.12.0", features = ["process"] }
+prometheus = { version = "0.13.4", features = ["process"] }
prost = "0.12"
serde = "1.0.104"
serde_derive = "1.0.104"
diff --git a/agent/src/device_manager/in_memory.rs b/agent/src/device_manager/in_memory.rs
index 54611c4e3..e2cedfbc1 100644
--- a/agent/src/device_manager/in_memory.rs
+++ b/agent/src/device_manager/in_memory.rs
@@ -1,6 +1,6 @@
use std::collections::HashMap;
-use super::{cdi, DeviceManager};
+use super::{DeviceManager, cdi};
use tokio::sync::watch;
pub struct InMemoryManager {
@@ -24,7 +24,7 @@ impl DeviceManager for InMemoryManager {
let state = self.state.borrow();
let cdi_kind = state.get(kind)?;
let mut device = cdi_kind.devices.iter().find(|dev| dev.name == id)?.clone();
- device.name = format!("{}-{}", kind, id);
+ device.name = format!("{kind}-{id}");
device.annotations.extend(
cdi_kind
.annotations
diff --git a/agent/src/discovery_handler_manager/discovery_handler_registry.rs b/agent/src/discovery_handler_manager/discovery_handler_registry.rs
index 49be7ee18..0a401584d 100644
--- a/agent/src/discovery_handler_manager/discovery_handler_registry.rs
+++ b/agent/src/discovery_handler_manager/discovery_handler_registry.rs
@@ -24,22 +24,22 @@ use akri_discovery_utils::discovery::v0::{ByteData, Device, DiscoverRequest};
use akri_shared::akri::configuration::{Configuration, DiscoveryProperty};
use akri_shared::akri::instance::Instance;
-use akri_shared::akri::instance::InstanceSpec;
use akri_shared::akri::AKRI_PREFIX;
+use akri_shared::akri::instance::InstanceSpec;
use async_trait::async_trait;
-use blake2::digest::{Update, VariableOutput};
use blake2::VarBlake2b;
+use blake2::digest::{Update, VariableOutput};
+use futures::FutureExt;
use futures::future::select_all;
use futures::future::try_join_all;
-use futures::FutureExt;
use itertools::Itertools;
use kube::core::ObjectMeta;
use kube_runtime::reflector::ObjectRef;
use tokio::select;
+use tokio::sync::RwLock;
use tokio::sync::mpsc;
use tokio::sync::watch;
-use tokio::sync::RwLock;
-use tokio::sync::{broadcast, Mutex, Notify};
+use tokio::sync::{Mutex, Notify, broadcast};
use super::discovery_property_solver::PropertySolver;
use super::{DiscoveryError, DiscoveryManagerKubeInterface};
@@ -68,7 +68,7 @@ impl DiscoveredDevice {
let mut id_to_digest = id_to_digest.to_string();
// For local devices, include node hostname in id_to_digest so instances have unique names
if !shared {
- id_to_digest = format!("{}{}", id_to_digest, node_name);
+ id_to_digest = format!("{id_to_digest}{node_name}");
}
let mut digest = String::new();
let mut hasher = VarBlake2b::new(3).unwrap();
@@ -76,7 +76,7 @@ impl DiscoveredDevice {
hasher.finalize_variable(|var| {
digest = var
.iter()
- .map(|num| format!("{:02x}", num))
+ .map(|num| format!("{num:02x}"))
.collect::>()
.join("")
});
@@ -102,7 +102,7 @@ impl From for crate::device_manager::cdi::Device {
env: dev
.properties
.into_iter()
- .map(|(k, v)| format!("{}={}", k, v))
+ .map(|(k, v)| format!("{k}={v}"))
.collect(),
device_nodes: dev.device_specs.into_iter().map_into().collect(),
mounts: dev.mounts.into_iter().map_into().collect(),
@@ -200,7 +200,7 @@ impl DiscoveryHandlerRequest for DHRequestImpl {
if extra_device_properties != *current {
let edit = extra_device_properties
.iter()
- .map(|(k, v)| format!("{}={}", k, v))
+ .map(|(k, v)| format!("{k}={v}"))
.collect();
*current = extra_device_properties;
self.notifier
@@ -298,7 +298,7 @@ impl DHRequestImpl {
.read()
.await
.iter()
- .map(|(k, v)| format!("{}={}", k, v))
+ .map(|(k, v)| format!("{k}={v}"))
.collect(),
..Default::default()
}],
@@ -371,7 +371,7 @@ async fn handle_request(
cdi_sender: Arc>>>,
local_config_sender: mpsc::Sender>,
) {
- let cdi_kind = format!("{}/{}", AKRI_PREFIX, key);
+ let cdi_kind = format!("{AKRI_PREFIX}/{key}");
loop {
match req_notifier.changed().await {
Ok(_) => {
@@ -379,7 +379,7 @@ async fn handle_request(
cdi_sender.lock().await.send_modify(|kinds| {
kinds.insert(cdi_kind.clone(), kind);
});
- trace!("Ask for reconciliation of {}::{}", namespace, key);
+ trace!("Ask for reconciliation of {namespace}::{key}");
let res = local_config_sender
.send(ObjectRef::::new(key).within(namespace))
.await;
@@ -391,7 +391,7 @@ async fn handle_request(
}
}
Err(_) => {
- trace!("Ask for reconciliation of {}::{}", namespace, key);
+ trace!("Ask for reconciliation of {namespace}::{key}");
let _ = local_config_sender
.send(ObjectRef::::new(key).within(namespace))
.await;
@@ -431,8 +431,8 @@ impl DiscoveryHandlerRegistry for DHRegistryImpl {
termination_notifier: terminated.clone(),
};
let dh_futures = handlers
- .iter()
- .map(|(_, handler)| dh_req.query(handler.clone()));
+ .values()
+ .map(|handler| dh_req.query(handler.clone()));
let dh_streams: Vec>>> =
try_join_all(dh_futures).await?;
dh_req.endpoints = RwLock::new(dh_streams);
@@ -781,14 +781,16 @@ mod tests {
});
endpoint.expect_is_closed().return_const(true);
dh_reg.register_endpoint(Arc::new(endpoint)).await;
- assert!(dh_reg
- .handlers
- .read()
- .await
- .get("mock_handler")
- .unwrap()
- .get("mock_handler_local")
- .is_some());
+ assert!(
+ dh_reg
+ .handlers
+ .read()
+ .await
+ .get("mock_handler")
+ .unwrap()
+ .get("mock_handler_local")
+ .is_some()
+ );
let mut endpoint = MockDiscoveryHandlerEndpoint::new();
let (close_2, closed) = tokio::sync::oneshot::channel::<()>();
@@ -804,33 +806,39 @@ mod tests {
endpoint.expect_is_closed().once().return_const(false);
endpoint.expect_is_closed().once().return_const(true);
dh_reg.register_endpoint(Arc::new(endpoint)).await;
- assert!(dh_reg
- .handlers
- .read()
- .await
- .get("mock_handler")
- .unwrap()
- .get("mock_handler_local_2")
- .is_some());
+ assert!(
+ dh_reg
+ .handlers
+ .read()
+ .await
+ .get("mock_handler")
+ .unwrap()
+ .get("mock_handler_local_2")
+ .is_some()
+ );
close_1.send(()).unwrap();
tokio::time::sleep(Duration::from_millis(500)).await;
- assert!(dh_reg
- .handlers
- .read()
- .await
- .get("mock_handler")
- .unwrap()
- .get("mock_handler_local")
- .is_none());
- assert!(dh_reg
- .handlers
- .read()
- .await
- .get("mock_handler")
- .unwrap()
- .get("mock_handler_local_2")
- .is_some());
+ assert!(
+ dh_reg
+ .handlers
+ .read()
+ .await
+ .get("mock_handler")
+ .unwrap()
+ .get("mock_handler_local")
+ .is_none()
+ );
+ assert!(
+ dh_reg
+ .handlers
+ .read()
+ .await
+ .get("mock_handler")
+ .unwrap()
+ .get("mock_handler_local_2")
+ .is_some()
+ );
close_2.send(()).unwrap();
tokio::time::sleep(Duration::from_millis(500)).await;
@@ -864,18 +872,22 @@ mod tests {
assert!(dh_reg.get_request("my-config").await.is_some());
assert!(dh_reg.get_request("my-other-config").await.is_none());
- assert!(tokio::time::timeout(
- Duration::from_millis(500),
- request.termination_notifier.notified()
- )
- .await
- .is_err());
+ assert!(
+ tokio::time::timeout(
+ Duration::from_millis(500),
+ request.termination_notifier.notified()
+ )
+ .await
+ .is_err()
+ );
let notif = request.termination_notifier.notified();
dh_reg.terminate_request("my-config").await;
- assert!(tokio::time::timeout(Duration::from_millis(500), notif)
- .await
- .is_ok());
+ assert!(
+ tokio::time::timeout(Duration::from_millis(500), notif)
+ .await
+ .is_ok()
+ );
}
#[tokio::test]
@@ -885,21 +897,23 @@ mod tests {
let kube_client = Arc::new(MockDiscoveryManagerKubeInterface::new());
let dh_reg = DHRegistryImpl::new(kube_client.clone(), cdi_notifier, configuration_notifier);
- assert!(dh_reg
- .new_request(
- "my-config",
- "mock_handler",
- "discovery details",
- &[],
- HashMap::from([]),
- "namespace"
- )
- .await
- .is_err_and(|e| {
- matches!(e,
- DiscoveryError::NoHandler(s) if s == *"mock_handler"
+ assert!(
+ dh_reg
+ .new_request(
+ "my-config",
+ "mock_handler",
+ "discovery details",
+ &[],
+ HashMap::from([]),
+ "namespace"
)
- }));
+ .await
+ .is_err_and(|e| {
+ matches!(e,
+ DiscoveryError::NoHandler(s) if s == *"mock_handler"
+ )
+ })
+ );
let dev_senders = Arc::new(std::sync::Mutex::new(vec![]));
@@ -938,17 +952,19 @@ mod tests {
});
dh_reg.register_endpoint(Arc::new(endpoint)).await;
- assert!(dh_reg
- .new_request(
- "my-config",
- "mock_handler",
- "discovery details",
- &[],
- HashMap::from([]),
- "namespace"
- )
- .await
- .is_ok());
+ assert!(
+ dh_reg
+ .new_request(
+ "my-config",
+ "mock_handler",
+ "discovery details",
+ &[],
+ HashMap::from([]),
+ "namespace"
+ )
+ .await
+ .is_ok()
+ );
assert!(cdi_rec.borrow_and_update().is_empty());
assert_eq!(config_rec.try_recv(), Err(mpsc::error::TryRecvError::Empty));
diff --git a/agent/src/discovery_handler_manager/discovery_property_solver.rs b/agent/src/discovery_handler_manager/discovery_property_solver.rs
index 6c06dd7cb..d6f5c6b56 100644
--- a/agent/src/discovery_handler_manager/discovery_property_solver.rs
+++ b/agent/src/discovery_handler_manager/discovery_property_solver.rs
@@ -223,9 +223,11 @@ mod tests {
.return_once(|_| Box::new(mock_secret_api));
// solve_value_from_secret should return error if key in secret not found
- assert!(solve_value_from_secret(&selector, &mock_kube_client)
- .await
- .is_err());
+ assert!(
+ solve_value_from_secret(&selector, &mock_kube_client)
+ .await
+ .is_err()
+ );
}
#[tokio::test]
diff --git a/agent/src/discovery_handler_manager/embedded_handler.rs b/agent/src/discovery_handler_manager/embedded_handler.rs
index 6d0320892..dc29ba0e1 100644
--- a/agent/src/discovery_handler_manager/embedded_handler.rs
+++ b/agent/src/discovery_handler_manager/embedded_handler.rs
@@ -1,13 +1,13 @@
use std::sync::Arc;
use akri_discovery_utils::discovery::{
- v0::{discovery_handler_server::DiscoveryHandler, DiscoverRequest, DiscoverResponse},
DiscoverStream,
+ v0::{DiscoverRequest, DiscoverResponse, discovery_handler_server::DiscoveryHandler},
};
use akri_shared::os::env_var::{ActualEnvVarQuery, EnvVarQuery};
use async_trait::async_trait;
use tokio::{select, sync::watch};
-use tokio_stream::{wrappers::ReceiverStream, StreamExt};
+use tokio_stream::{StreamExt, wrappers::ReceiverStream};
use tonic::IntoRequest;
/// Label of environment variable that, when set, enables the embedded debug echo discovery handler
@@ -15,10 +15,10 @@ use tonic::IntoRequest;
pub const ENABLE_DEBUG_ECHO_LABEL: &str = "ENABLE_DEBUG_ECHO";
use super::{
+ DiscoveryError,
discovery_handler_registry::{
DiscoveredDevice, DiscoveryHandlerEndpoint, DiscoveryHandlerRegistry,
},
- DiscoveryError,
};
struct EmbeddedHandlerEndpoint {
@@ -42,11 +42,11 @@ impl EmbeddedHandlerEndpoint {
msg = stream.try_next() => match msg {
Ok(Some(msg)) => msg,
Ok(None) => {
- error!("Discovery Handler {} closed the stream unexpectedly", uid);
+ error!("Discovery Handler {uid} closed the stream unexpectedly");
return
},
Err(e) => {
- error!("Received error on gRPC stream for {}: {}", uid, e);
+ error!("Received error on gRPC stream for {uid}: {e}");
return
},
},
@@ -78,11 +78,17 @@ impl DiscoveryHandlerEndpoint for EmbeddedHandlerEndpoint {
Err(e) => {
match e.code() {
tonic::Code::InvalidArgument => {
- warn!("NetworkEndpoint::query - invalid arguments provided to DiscoveryHandler");
+ warn!(
+ "NetworkEndpoint::query - invalid arguments provided to DiscoveryHandler"
+ );
return Err(DiscoveryError::InvalidDiscoveryDetails);
}
_ => {
- error!("NetworkEndpoint::query - could not connect to DiscoveryHandler at endpoint {} with error {}", self.get_uid(), e);
+ error!(
+ "NetworkEndpoint::query - could not connect to DiscoveryHandler at endpoint {} with error {}",
+ self.get_uid(),
+ e
+ );
// We do not consider the DH as unavailable here, as this can be a temporary error
return Err(DiscoveryError::UnavailableDiscoveryHandler(self.get_uid()));
}
diff --git a/agent/src/discovery_handler_manager/registration_socket.rs b/agent/src/discovery_handler_manager/registration_socket.rs
index 1bc67aadd..05305412b 100644
--- a/agent/src/discovery_handler_manager/registration_socket.rs
+++ b/agent/src/discovery_handler_manager/registration_socket.rs
@@ -1,24 +1,24 @@
use std::{convert::TryFrom, pin::Pin, sync::Arc};
use akri_discovery_utils::discovery::v0::{
+ DiscoverRequest, DiscoverResponse, Empty, RegisterDiscoveryHandlerRequest,
discovery_handler_client::DiscoveryHandlerClient,
register_discovery_handler_request::EndpointType, registration_server::Registration,
- DiscoverRequest, DiscoverResponse, Empty, RegisterDiscoveryHandlerRequest,
};
use akri_shared::uds::unix_stream;
use async_trait::async_trait;
use futures::{Stream, StreamExt, TryFutureExt};
use tokio::{select, sync::watch};
use tokio_stream::StreamExt as _;
-use tonic::{transport::Channel, Request, Response, Status};
+use tonic::{Request, Response, Status, transport::Channel};
use crate::util::stopper::Stopper;
use super::{
+ DiscoveryError,
discovery_handler_registry::{
DiscoveredDevice, DiscoveryHandlerEndpoint, DiscoveryHandlerRegistry,
},
- DiscoveryError,
};
struct NetworkEndpoint {
@@ -76,16 +76,16 @@ impl NetworkEndpoint {
msg = stream.try_next() => match msg {
Ok(Some(msg)) => msg,
Ok(None) => {
- error!("Discovery Handler {} closed the stream unexpectedly", uid);
+ error!("Discovery Handler {uid} closed the stream unexpectedly");
return
},
Err(e) => {
- error!("Received error on gRPC stream for {}: {}", uid, e);
+ error!("Received error on gRPC stream for {uid}: {e}");
return
},
},
};
- trace!("Received new message from discovery handler: {:?}", msg);
+ trace!("Received new message from discovery handler: {msg:?}");
let devices = msg
.devices
.into_iter()
@@ -122,11 +122,17 @@ impl DiscoveryHandlerEndpoint for NetworkEndpoint {
Err(e) => {
match e.code() {
tonic::Code::InvalidArgument => {
- warn!("NetworkEndpoint::query - invalid arguments provided to DiscoveryHandler");
+ warn!(
+ "NetworkEndpoint::query - invalid arguments provided to DiscoveryHandler"
+ );
return Err(DiscoveryError::InvalidDiscoveryDetails);
}
_ => {
- error!("NetworkEndpoint::query - could not connect to DiscoveryHandler at endpoint {} with error {}", self.get_uid(), e);
+ error!(
+ "NetworkEndpoint::query - could not connect to DiscoveryHandler at endpoint {} with error {}",
+ self.get_uid(),
+ e
+ );
// We do not consider the DH as unavailable here, as this can be a temporary error
return Err(DiscoveryError::UnavailableDiscoveryHandler(
self.get_uid(),
@@ -137,7 +143,10 @@ impl DiscoveryHandlerEndpoint for NetworkEndpoint {
}
}
Err(e) => {
- error!("NetworkEndpoint::query - failed to connect to {} discovery handler over network with error {}", self.name, e);
+ error!(
+ "NetworkEndpoint::query - failed to connect to {} discovery handler over network with error {}",
+ self.name, e
+ );
// We failed to connect to Discovery Handler, consider it offline now
self.stopped.stop();
return Err(DiscoveryError::UnavailableDiscoveryHandler(self.get_uid()));
@@ -194,8 +203,7 @@ pub async fn run_registration_server(
) -> Result<(), Box> {
info!("internal_run_registration_server - entered");
trace!(
- "internal_run_registration_server - registration server listening on socket {}",
- socket_path
+ "internal_run_registration_server - registration server listening on socket {socket_path}"
);
#[cfg(any(test, feature = "agent-full"))]
@@ -225,8 +233,7 @@ pub async fn run_registration_server(
.serve_with_incoming(incoming)
.await?;
trace!(
- "internal_run_registration_server - gracefully shutdown ... deleting socket {}",
- socket_path
+ "internal_run_registration_server - gracefully shutdown ... deleting socket {socket_path}"
);
std::fs::remove_file(socket_path).unwrap_or(());
Ok(())
@@ -259,15 +266,17 @@ mod tests {
sender,
stream.boxed(),
));
- assert!(st_sender
- .send(Ok(DiscoverResponse {
- devices: vec![Device {
- id: "bar".to_string(),
- ..Default::default()
- }]
- }))
- .await
- .is_ok());
+ assert!(
+ st_sender
+ .send(Ok(DiscoverResponse {
+ devices: vec![Device {
+ id: "bar".to_string(),
+ ..Default::default()
+ }]
+ }))
+ .await
+ .is_ok()
+ );
assert!(
tokio::time::timeout(Duration::from_millis(500), receiver.changed())
.await
@@ -286,9 +295,11 @@ mod tests {
);
drop(receiver);
- assert!(tokio::time::timeout(Duration::from_millis(500), task)
- .await
- .is_ok());
+ assert!(
+ tokio::time::timeout(Duration::from_millis(500), task)
+ .await
+ .is_ok()
+ );
}
#[tokio::test]
@@ -309,15 +320,17 @@ mod tests {
sender,
stream.boxed(),
));
- assert!(st_sender
- .send(Ok(DiscoverResponse {
- devices: vec![Device {
- id: "bar".to_string(),
- ..Default::default()
- }]
- }))
- .await
- .is_ok());
+ assert!(
+ st_sender
+ .send(Ok(DiscoverResponse {
+ devices: vec![Device {
+ id: "bar".to_string(),
+ ..Default::default()
+ }]
+ }))
+ .await
+ .is_ok()
+ );
assert!(
tokio::time::timeout(Duration::from_millis(500), receiver.changed())
.await
@@ -333,8 +346,10 @@ mod tests {
);
stopper.stop();
- assert!(tokio::time::timeout(Duration::from_millis(500), task)
- .await
- .is_ok());
+ assert!(
+ tokio::time::timeout(Duration::from_millis(500), task)
+ .await
+ .is_ok()
+ );
}
}
diff --git a/agent/src/main.rs b/agent/src/main.rs
index 3416d0af6..8f1ad6846 100644
--- a/agent/src/main.rs
+++ b/agent/src/main.rs
@@ -8,7 +8,7 @@ mod discovery_handler_manager;
mod plugin_manager;
mod util;
-use akri_shared::akri::{metrics::run_metrics_server, API_NAMESPACE};
+use akri_shared::akri::{API_NAMESPACE, metrics::run_metrics_server};
use log::{info, trace};
use std::{
collections::HashMap,
@@ -21,17 +21,11 @@ use std::{
#[cfg(unix)]
#[tokio::main]
async fn main() -> Result<(), Box> {
- println!("{} Agent start", API_NAMESPACE);
+ println!("{API_NAMESPACE} Agent start");
- println!(
- "{} KUBERNETES_PORT found ... env_logger::init",
- API_NAMESPACE
- );
+ println!("{API_NAMESPACE} KUBERNETES_PORT found ... env_logger::init");
env_logger::try_init()?;
- trace!(
- "{} KUBERNETES_PORT found ... env_logger::init finished",
- API_NAMESPACE
- );
+ trace!("{API_NAMESPACE} KUBERNETES_PORT found ... env_logger::init finished");
let mut tasks = Vec::new();
let node_name = env::var("AGENT_NODE_NAME")?;
@@ -101,6 +95,6 @@ async fn main() -> Result<(), Box
}
futures::future::try_join_all(tasks).await?;
- info!("{} Agent end", API_NAMESPACE);
+ info!("{API_NAMESPACE} Agent end");
Ok(())
}
diff --git a/agent/src/plugin_manager/device_plugin_instance_controller.rs b/agent/src/plugin_manager/device_plugin_instance_controller.rs
index 4b220eb8d..702dad2c8 100644
--- a/agent/src/plugin_manager/device_plugin_instance_controller.rs
+++ b/agent/src/plugin_manager/device_plugin_instance_controller.rs
@@ -11,20 +11,20 @@ use itertools::Itertools;
use kube::api::{Patch, PatchParams};
use kube::core::{NotUsed, Object, ObjectMeta, TypeMeta};
use kube::{Resource, ResourceExt};
+use kube_runtime::Controller;
use kube_runtime::controller::Action;
use kube_runtime::reflector::Store;
-use kube_runtime::Controller;
use thiserror::Error;
-use tokio::sync::{watch, Mutex, RwLock};
+use tokio::sync::{Mutex, RwLock, watch};
use tokio::task::JoinHandle;
use tonic::Request;
-use crate::device_manager::{cdi, DeviceManager};
+use crate::device_manager::{DeviceManager, cdi};
use crate::plugin_manager::v1beta1::ContainerAllocateResponse;
use crate::util::stopper::Stopper;
use super::device_plugin_runner::{
- serve_and_register_plugin, DeviceUsageStream, InternalDevicePlugin,
+ DeviceUsageStream, InternalDevicePlugin, serve_and_register_plugin,
};
use super::v1beta1::{AllocateRequest, AllocateResponse, ListAndWatchResponse};
@@ -72,8 +72,8 @@ impl Display for DeviceUsage {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
DeviceUsage::Unused => write!(f, ""),
- DeviceUsage::Node(node) => write!(f, "{}", node),
- DeviceUsage::Configuration { vdev, node } => write!(f, "C:{}:{}", vdev, node),
+ DeviceUsage::Node(node) => write!(f, "{node}"),
+ DeviceUsage::Configuration { vdev, node } => write!(f, "C:{vdev}:{node}"),
}
}
}
@@ -247,7 +247,7 @@ impl InstanceDevicePlugin {
.map_err(|e| match e {
kube::Error::Api(ae) => match ae.code {
409 => {
- trace!("Conflict on apply {:?}", ae);
+ trace!("Conflict on apply {ae:?}");
DevicePluginError::SlotInUse
}
_ => DevicePluginError::Other(ae.into()),
@@ -321,7 +321,7 @@ fn instance_device_usage_to_device(
.into_iter()
.enumerate()
.map(|(id, dev)| super::v1beta1::Device {
- id: format!("{}-{}", device_name, id),
+ id: format!("{device_name}-{id}"),
health: match dev {
DeviceUsage::Unused => "Healthy",
DeviceUsage::Configuration { .. } => "Unhealthy",
@@ -334,7 +334,7 @@ fn instance_device_usage_to_device(
topology: None,
})
.collect();
- trace!("Sending devices to kubelet: {:?}", devices);
+ trace!("Sending devices to kubelet: {devices:?}");
Ok(ListAndWatchResponse { devices })
}
@@ -401,7 +401,7 @@ impl InternalDevicePlugin for InstanceDevicePlugin {
self.claim_slot(Some(id), DeviceUsage::Node(self.node_name.to_owned()))
.await
.map_err(|e| {
- error!("Unable to claim slot: {:?}", e);
+ error!("Unable to claim slot: {e:?}");
tonic::Status::unknown("Unable to claim slot")
})?;
}
@@ -419,7 +419,7 @@ fn cdi_device_to_car(device: &cdi::Device) -> ContainerAllocateResponse {
let instance_hash = device
.name
.split('-')
- .last()
+ .next_back()
.unwrap_or_default()
.to_uppercase();
@@ -440,7 +440,7 @@ fn cdi_device_to_car(device: &cdi::Device) -> ContainerAllocateResponse {
let suffixed_envs = envs
.clone()
- .map(|(k, v)| (format!("{}_{}", k, instance_hash), v));
+ .map(|(k, v)| (format!("{k}_{instance_hash}"), v));
ContainerAllocateResponse {
envs: envs.chain(suffixed_envs).collect(),
@@ -570,7 +570,7 @@ impl ConfigurationDevicePlugin {
possible_slot += 1;
}
slots.insert(
- format!("{}-{}", config_name, possible_slot),
+ format!("{config_name}-{possible_slot}"),
ConfigurationSlot::DeviceFree(instance_name.clone()),
);
}
@@ -724,8 +724,8 @@ fn config_device_usage_to_device(
})
}
-/// This module implements a controller for Instance resources that will ensure device plugins are correctly created with the correct health status
-
+/// This module implements a controller for Instance resources that will ensure
+/// device plugins are correctly created with the correct health status
pub struct DevicePluginManager {
instance_plugins: Mutex>>,
configuration_plugins: Mutex>>,
@@ -793,7 +793,7 @@ impl DevicePluginManager {
.enumerate()
.filter_map(|(i, u)| match u {
DeviceUsage::Node(n) if *n == self.node_name => {
- Some(format!("{}{}-{}", DP_SLOT_PREFIX, instance, i))
+ Some(format!("{DP_SLOT_PREFIX}{instance}-{i}"))
}
DeviceUsage::Configuration { vdev, node } if *node == self.node_name => {
Some(vdev.to_string())
@@ -1033,10 +1033,12 @@ mod tests {
)
.unwrap();
- assert!(plugin
- .update_slots(&HashMap::from([("slot-1".to_owned(), "node-a".to_owned())]))
- .await
- .is_ok(),);
+ assert!(
+ plugin
+ .update_slots(&HashMap::from([("slot-1".to_owned(), "node-a".to_owned())]))
+ .await
+ .is_ok(),
+ );
assert_eq!(
plugin.slots_status.lock().await.borrow()[1],
@@ -1413,22 +1415,26 @@ mod tests {
stopper: stopper.clone(),
});
- assert!(instance_plugin
- .allocate(Request::new(AllocateRequest {
- container_requests: vec![ContainerAllocateRequest {
- devices_i_ds: vec!["instance-a-0".to_owned()],
- }]
- }))
- .await
- .is_err());
- assert!(instance_plugin
- .allocate(Request::new(AllocateRequest {
- container_requests: vec![ContainerAllocateRequest {
- devices_i_ds: vec!["instance-a-3".to_owned()],
- }]
- }))
- .await
- .is_ok());
+ assert!(
+ instance_plugin
+ .allocate(Request::new(AllocateRequest {
+ container_requests: vec![ContainerAllocateRequest {
+ devices_i_ds: vec!["instance-a-0".to_owned()],
+ }]
+ }))
+ .await
+ .is_err()
+ );
+ assert!(
+ instance_plugin
+ .allocate(Request::new(AllocateRequest {
+ container_requests: vec![ContainerAllocateRequest {
+ devices_i_ds: vec!["instance-a-3".to_owned()],
+ }]
+ }))
+ .await
+ .is_ok()
+ );
}
#[tokio::test]
diff --git a/agent/src/plugin_manager/device_plugin_runner.rs b/agent/src/plugin_manager/device_plugin_runner.rs
index f374447e8..c2dbf2526 100644
--- a/agent/src/plugin_manager/device_plugin_runner.rs
+++ b/agent/src/plugin_manager/device_plugin_runner.rs
@@ -7,8 +7,8 @@ use thiserror::Error;
use tokio::net::{UnixListener, UnixStream};
use tokio_stream::wrappers::WatchStream;
use tonic::{
- transport::{Endpoint, Server, Uri},
Request,
+ transport::{Endpoint, Server, Uri},
};
use tower::service_fn;
@@ -22,9 +22,10 @@ pub const DEVICE_PLUGIN_PATH: &str = "/var/lib/kubelet/device-plugins";
pub const KUBELET_SOCKET: &str = "/var/lib/kubelet/device-plugins/kubelet.sock";
use super::v1beta1::{
+ AllocateRequest, AllocateResponse, DevicePluginOptions, Empty, ListAndWatchResponse,
+ RegisterRequest,
device_plugin_server::{DevicePlugin, DevicePluginServer},
- registration_client, AllocateRequest, AllocateResponse, DevicePluginOptions, Empty,
- ListAndWatchResponse, RegisterRequest,
+ registration_client,
};
#[async_trait]
@@ -103,7 +104,7 @@ impl DevicePlugin for DevicePluginImpl {
&self,
requests: Request,
) -> Result, tonic::Status> {
- trace!("kubelet called allocate {:?}", requests);
+ trace!("kubelet called allocate {requests:?}");
self.inner.allocate(requests).await
}
@@ -155,10 +156,7 @@ pub(super) async fn serve_and_register_plugin(
.unwrap()
.to_string();
- info!(
- "serve - creating a device plugin server that will listen at: {}",
- socket_path
- );
+ info!("serve - creating a device plugin server that will listen at: {socket_path}");
tokio::fs::create_dir_all(Path::new(&socket_path[..]).parent().unwrap())
.await
.expect("Failed to create dir at socket path");
@@ -182,10 +180,7 @@ pub(super) async fn serve_and_register_plugin(
.serve_with_incoming_shutdown(incoming, task_plugin.stopped())
.await
.unwrap();
- trace!(
- "serve - gracefully shutdown ... deleting socket {}",
- socket_to_delete
- );
+ trace!("serve - gracefully shutdown ... deleting socket {socket_to_delete}");
// Socket may already be deleted in the case of the kubelet restart
std::fs::remove_file(socket_to_delete).unwrap_or(());
});
@@ -204,16 +199,13 @@ async fn register_plugin(
) -> anyhow::Result<()> {
use anyhow::Context;
- let capability_id: String = format!("akri.sh/{}", device_plugin_name);
+ let capability_id: String = format!("akri.sh/{device_plugin_name}");
akri_shared::uds::unix_stream::try_connect(&socket_path)
.await
.with_context(|| format!("while trying to connect to {socket_path}"))?;
- info!(
- "register - entered for Instance {} and socket_name: {}",
- capability_id, device_endpoint
- );
+ info!("register - entered for Instance {capability_id} and socket_name: {device_endpoint}");
let op = DevicePluginOptions {
pre_start_required: false,
get_preferred_allocation_available: false,
@@ -239,10 +231,7 @@ async fn register_plugin(
resource_name: capability_id.to_string(),
options: Some(op),
});
- trace!(
- "register - before call to register with the kubelet at socket {}",
- KUBELET_SOCKET
- );
+ trace!("register - before call to register with the kubelet at socket {KUBELET_SOCKET}");
// If fail to register with the kubelet, terminate device plugin
registration_client.register(register_request).await?;
diff --git a/agent/src/plugin_manager/device_plugin_slot_reclaimer.rs b/agent/src/plugin_manager/device_plugin_slot_reclaimer.rs
index 6d5ed39f6..2dcce8190 100644
--- a/agent/src/plugin_manager/device_plugin_slot_reclaimer.rs
+++ b/agent/src/plugin_manager/device_plugin_slot_reclaimer.rs
@@ -42,10 +42,7 @@ async fn get_used_slots() -> Result, anyhow::Error> {
let mut podresources_client = podresources::PodResourcesListerClient::new(channel);
let list_request = tonic::Request::new(ListPodResourcesRequest {});
- trace!(
- "register - before call to register with the kubelet at socket {}",
- KUBELET_SOCKET
- );
+ trace!("register - before call to register with the kubelet at socket {KUBELET_SOCKET}");
// Get the list of allocated device ids from kubelet
let resources = podresources_client
@@ -83,7 +80,7 @@ pub async fn start_reclaimer(dp_manager: Arc) {
if let Some(at) = stalled_slots.get(slot_to_reclaim) {
if reclaim_iteration_start.saturating_duration_since(*at) >= SLOT_GRACE_PERIOD {
// Slot is stalled for more than grace period, free it
- trace!("freeing slot: {}", slot_to_reclaim);
+ trace!("freeing slot: {slot_to_reclaim}");
if dp_manager
.free_slot(slot_to_reclaim.to_string())
.await
diff --git a/agent/src/plugin_manager/v1.rs b/agent/src/plugin_manager/v1.rs
index f4cfc2df8..c93bf05dc 100644
--- a/agent/src/plugin_manager/v1.rs
+++ b/agent/src/plugin_manager/v1.rs
@@ -129,11 +129,11 @@ pub mod pod_resources_lister_client {
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
- http::Request,
- Response = http::Response<
- >::ResponseBody,
+ http::Request,
+ Response = http::Response<
+ >::ResponseBody,
+ >,
>,
- >,
>>::Error:
Into + Send + Sync,
{
diff --git a/agent/src/plugin_manager/v1beta1.rs b/agent/src/plugin_manager/v1beta1.rs
index 083007abe..e728044e6 100644
--- a/agent/src/plugin_manager/v1beta1.rs
+++ b/agent/src/plugin_manager/v1beta1.rs
@@ -256,11 +256,11 @@ pub mod registration_client {
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
- http::Request,
- Response = http::Response<
- >::ResponseBody,
+ http::Request,
+ Response = http::Response<
+ >::ResponseBody,
+ >,
>,
- >,
>>::Error:
Into + Send + Sync,
{
@@ -360,11 +360,11 @@ pub mod device_plugin_client {
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
- http::Request,
- Response = http::Response<
- >::ResponseBody,
+ http::Request,
+ Response = http::Response<
+ >::ResponseBody,
+ >,
>,
- >,
>>::Error:
Into + Send + Sync,
{
diff --git a/agent/src/util/discovery_configuration_controller.rs b/agent/src/util/discovery_configuration_controller.rs
index 780fdb80b..1232a1c99 100644
--- a/agent/src/util/discovery_configuration_controller.rs
+++ b/agent/src/util/discovery_configuration_controller.rs
@@ -15,15 +15,15 @@ use futures::StreamExt;
use tokio::sync::mpsc;
use crate::discovery_handler_manager::{
- discovery_handler_registry::DiscoveryHandlerRegistry, DiscoveryError,
+ DiscoveryError, discovery_handler_registry::DiscoveryHandlerRegistry,
};
use kube::api::ObjectMeta;
use kube::{Resource, ResourceExt};
use kube_runtime::{
+ Controller,
controller::Action,
reflector::{ObjectRef, Store},
- Controller,
};
use thiserror::Error;
diff --git a/agent/src/util/metrics.rs b/agent/src/util/metrics.rs
index 4f43a22d9..a112da562 100644
--- a/agent/src/util/metrics.rs
+++ b/agent/src/util/metrics.rs
@@ -1,5 +1,5 @@
use lazy_static::lazy_static;
-use prometheus::{opts, register_int_counter_vec, HistogramVec, IntCounterVec, IntGaugeVec};
+use prometheus::{HistogramVec, IntCounterVec, IntGaugeVec, opts, register_int_counter_vec};
// Discovery request response time bucket (in seconds)
const DISCOVERY_RESPONSE_TIME_BUCKETS: &[f64; 9] =
diff --git a/build/containers/Dockerfile.rust b/build/containers/Dockerfile.rust
index b80908684..a4fc42854 100644
--- a/build/containers/Dockerfile.rust
+++ b/build/containers/Dockerfile.rust
@@ -1,6 +1,6 @@
FROM --platform=$BUILDPLATFORM tonistiigi/xx:master AS xx
-FROM --platform=$BUILDPLATFORM rust:1.82-slim-bookworm AS build
+FROM --platform=$BUILDPLATFORM rust:1.88-slim-bookworm AS build
RUN rustup component add rustfmt
RUN apt-get update && apt-get install -y clang lld protobuf-compiler pkg-config mmdebstrap wget
COPY --from=xx / /
diff --git a/build/setup.sh b/build/setup.sh
index 0aa29ff80..5cae11157 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.82.0
+ sudo curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=1.88.0
else
echo "Install rustup"
- curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=1.82.0
+ curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=1.88.0
fi
else
echo "Found rustup"
@@ -35,4 +35,4 @@ fi
echo "Install rustfmt"
rustup component add rustfmt
-exit 0
\ No newline at end of file
+exit 0
diff --git a/controller/Cargo.toml b/controller/Cargo.toml
index b1c4bff56..d17d553ba 100644
--- a/controller/Cargo.toml
+++ b/controller/Cargo.toml
@@ -15,12 +15,11 @@ async-std = "1.5.0"
chrono = "0.4.10"
env_logger = "0.11.8"
futures = "0.3.1"
-k8s-openapi = { version = "0.20.0", default-features = false, features = ["schemars", "v1_23"] }
-kube = { version = "0.87.1", features = ["derive"] }
-kube-runtime = "0.87.1"
+k8s-openapi = { version = "0.22.0", default-features = false, features = ["schemars", "v1_25"] }
+kube = { version = "0.91.0", features = ["client", "derive", "runtime"] }
lazy_static = "1.4"
log = "0.4"
-prometheus = { version = "0.12.0", features = ["process"] }
+prometheus = { version = "0.13.4", features = ["process"] }
tokio = { version = "1.0.2", features = ["full"] }
[dev-dependencies]
diff --git a/controller/src/main.rs b/controller/src/main.rs
index 82d6d0c35..998e8998d 100644
--- a/controller/src/main.rs
+++ b/controller/src/main.rs
@@ -2,7 +2,7 @@
extern crate lazy_static;
mod util;
-use akri_shared::akri::{metrics::run_metrics_server, API_NAMESPACE};
+use akri_shared::akri::{API_NAMESPACE, metrics::run_metrics_server};
use async_std::sync::Mutex;
use prometheus::IntGaugeVec;
use std::sync::Arc;
@@ -19,19 +19,13 @@ lazy_static! {
/// This is the entry point for the controller.
#[tokio::main]
async fn main() -> Result<(), Box> {
- println!("{} Controller start", API_NAMESPACE);
+ println!("{API_NAMESPACE} Controller start");
- println!(
- "{} KUBERNETES_PORT found ... env_logger::init",
- API_NAMESPACE
- );
+ println!("{API_NAMESPACE} KUBERNETES_PORT found ... env_logger::init");
env_logger::try_init()?;
- println!(
- "{} KUBERNETES_PORT found ... env_logger::init finished",
- API_NAMESPACE
- );
+ println!("{API_NAMESPACE} KUBERNETES_PORT found ... env_logger::init finished");
- log::info!("{} Controller logging started", API_NAMESPACE);
+ log::info!("{API_NAMESPACE} Controller logging started");
let synchronization = Arc::new(Mutex::new(()));
let instance_watch_synchronization = synchronization.clone();
@@ -73,6 +67,6 @@ async fn main() -> Result<(), Box
futures::future::try_join_all(tasks).await?;
- log::info!("{} Controller end", API_NAMESPACE);
+ log::info!("{API_NAMESPACE} Controller end");
Ok(())
}
diff --git a/controller/src/util/instance_action.rs b/controller/src/util/instance_action.rs
index 0824b02cb..c2b5d7c95 100644
--- a/controller/src/util/instance_action.rs
+++ b/controller/src/util/instance_action.rs
@@ -1,11 +1,10 @@
use super::super::BROKER_POD_COUNT_METRIC;
use super::{pod_action::PodAction, pod_action::PodActionInfo};
use akri_shared::{
- akri::{configuration::BrokerSpec, instance::Instance, AKRI_PREFIX},
+ akri::{AKRI_PREFIX, configuration::BrokerSpec, instance::Instance},
k8s::{
- self, job, pod,
+ self, KubeInterface, OwnershipInfo, OwnershipType, job, pod,
pod::{AKRI_INSTANCE_LABEL_NAME, AKRI_TARGET_NODE_LABEL_NAME},
- KubeInterface, OwnershipInfo, OwnershipType,
},
};
use async_std::sync::Mutex;
@@ -13,8 +12,8 @@ use futures::{StreamExt, TryStreamExt};
use k8s_openapi::api::batch::v1::JobSpec;
use k8s_openapi::api::core::v1::{Pod, PodSpec};
use kube::api::Api;
-use kube_runtime::watcher::{watcher, Config, Event};
-use kube_runtime::WatchStreamExt;
+use kube::runtime::WatchStreamExt;
+use kube::runtime::watcher::{Config, Event, watcher};
use log::{error, info, trace};
use std::collections::HashMap;
use std::sync::Arc;
@@ -54,8 +53,8 @@ pub enum InstanceAction {
}
/// This invokes an internal method that watches for Instance events
-pub async fn handle_existing_instances(
-) -> Result<(), Box> {
+pub async fn handle_existing_instances()
+-> Result<(), Box> {
internal_handle_existing_instances(&k8s::KubeImpl::new().await?).await
}
@@ -100,7 +99,7 @@ async fn internal_do_instance_watch(
loop {
let event = match informer.try_next().await {
Err(e) => {
- error!("Error during watch: {}", e);
+ error!("Error during watch: {e}");
continue;
}
Ok(None) => break,
@@ -180,14 +179,10 @@ pub(crate) fn create_pod_context(k8s_pod: &Pod, action: PodAction) -> anyhow::Re
.metadata
.labels
.as_ref()
- .ok_or_else(|| anyhow::anyhow!("no labels found for Pod {:?}", pod_name))?;
+ .ok_or_else(|| anyhow::anyhow!("no labels found for Pod {pod_name:?}"))?;
// Early exits above ensure unwrap will not panic
let node_to_run_pod_on = labels.get(AKRI_TARGET_NODE_LABEL_NAME).ok_or_else(|| {
- anyhow::anyhow!(
- "no {} label found for {:?}",
- AKRI_TARGET_NODE_LABEL_NAME,
- pod_name
- )
+ anyhow::anyhow!("no {AKRI_TARGET_NODE_LABEL_NAME} label found for {pod_name:?}")
})?;
Ok(PodContext {
@@ -209,10 +204,10 @@ fn determine_action_for_pod(
let pod_phase = k8s_pod
.status
.as_ref()
- .ok_or_else(|| anyhow::anyhow!("No pod status found for Pod {:?}", pod_name))?
+ .ok_or_else(|| anyhow::anyhow!("No pod status found for Pod {pod_name:?}"))?
.phase
.as_ref()
- .ok_or_else(|| anyhow::anyhow!("No pod phase found for Pod {:?}", pod_name))?;
+ .ok_or_else(|| anyhow::anyhow!("No pod phase found for Pod {pod_name:?}"))?;
let mut update_pod_context = create_pod_context(k8s_pod, PodAction::NoAction)?;
let node_to_run_pod_on = update_pod_context.node_name.as_ref().unwrap();
@@ -247,25 +242,18 @@ async fn handle_deletion_work(
) -> anyhow::Result<()> {
let context_node_name = context.node_name.as_ref().ok_or_else(|| {
anyhow::anyhow!(
- "handle_deletion_work - Context node_name is missing for {}: {:?}",
- node_to_delete_pod,
- context
+ "handle_deletion_work - Context node_name is missing for {node_to_delete_pod}: {context:?}"
)
})?;
let context_namespace = context.namespace.as_ref().ok_or_else(|| {
anyhow::anyhow!(
- "handle_deletion_work - Context namespace is missing for {}: {:?}",
- node_to_delete_pod,
- context
+ "handle_deletion_work - Context namespace is missing for {node_to_delete_pod}: {context:?}"
)
})?;
trace!(
"handle_deletion_work - pod::create_broker_app_name({:?}, {:?}, {:?}, {:?})",
- &instance_name,
- context_node_name,
- instance_shared,
- "pod"
+ &instance_name, context_node_name, instance_shared, "pod"
);
let pod_app_name = pod::create_broker_app_name(
instance_name,
@@ -275,8 +263,7 @@ async fn handle_deletion_work(
);
trace!(
"handle_deletion_work - pod::remove_pod name={:?}, namespace={:?}",
- &pod_app_name,
- &context_namespace
+ &pod_app_name, &context_namespace
);
kube_interface
.remove_pod(&pod_app_name, context_namespace)
@@ -303,16 +290,18 @@ mod handle_deletion_work_tests {
action: PodAction::NoAction,
};
- assert!(handle_deletion_work(
- "instance_name",
- "configuration_name",
- true,
- "node_to_delete_pod",
- &context,
- &MockKubeInterface::new(),
- )
- .await
- .is_err());
+ assert!(
+ handle_deletion_work(
+ "instance_name",
+ "configuration_name",
+ true,
+ "node_to_delete_pod",
+ &context,
+ &MockKubeInterface::new(),
+ )
+ .await
+ .is_err()
+ );
}
#[tokio::test]
@@ -325,16 +314,18 @@ mod handle_deletion_work_tests {
action: PodAction::NoAction,
};
- assert!(handle_deletion_work(
- "instance_name",
- "configuration_name",
- true,
- "node_to_delete_pod",
- &context,
- &MockKubeInterface::new(),
- )
- .await
- .is_err());
+ assert!(
+ handle_deletion_work(
+ "instance_name",
+ "configuration_name",
+ true,
+ "node_to_delete_pod",
+ &context,
+ &MockKubeInterface::new(),
+ )
+ .await
+ .is_err()
+ );
}
}
@@ -353,11 +344,8 @@ async fn handle_addition_work(
podspec: &PodSpec,
kube_interface: &impl KubeInterface,
) -> anyhow::Result<()> {
- trace!(
- "handle_addition_work - Create new Pod for Node={:?}",
- new_node
- );
- let capability_id = format!("{}/{}", AKRI_PREFIX, instance_name);
+ trace!("handle_addition_work - Create new Pod for Node={new_node:?}");
+ let capability_id = format!("{AKRI_PREFIX}/{instance_name}");
let new_pod = pod::create_new_pod_from_spec(
instance_namespace,
instance_name,
@@ -373,7 +361,7 @@ async fn handle_addition_work(
podspec,
)?;
- trace!("handle_addition_work - New pod spec={:?}", new_pod);
+ trace!("handle_addition_work - New pod spec={new_pod:?}");
kube_interface
.create_pod(&new_pod, instance_namespace)
@@ -394,7 +382,7 @@ pub async fn handle_instance_change(
action: &InstanceAction,
kube_interface: &impl KubeInterface,
) -> anyhow::Result<()> {
- trace!("handle_instance_change - enter {:?}", action);
+ trace!("handle_instance_change - enter {action:?}");
let instance_name = instance.metadata.name.clone().unwrap();
let instance_namespace =
instance.metadata.namespace.as_ref().ok_or_else(|| {
@@ -411,9 +399,9 @@ pub async fn handle_instance_change(
// Furthermore, Akri Agent is still modifying the Instances. This should not happen because 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 properly",
- &instance.spec.configuration_name, &instance.metadata.name
- );
+ "handle_instance_change - no configuration found for {:?} yet instance {:?} exists - check that device plugin is running properly",
+ &instance.spec.configuration_name, &instance.metadata.name
+ );
}
return Ok(());
}
@@ -435,7 +423,7 @@ pub async fn handle_instance_change(
}
};
if let Err(e) = instance_change_result {
- error!("Unable to handle Broker action: {:?}", e);
+ error!("Unable to handle Broker action: {e:?}");
}
}
Ok(())
@@ -452,14 +440,14 @@ pub async fn handle_instance_change_job(
action: &InstanceAction,
kube_interface: &impl KubeInterface,
) -> anyhow::Result<()> {
- trace!("handle_instance_change_job - enter {:?}", action);
+ trace!("handle_instance_change_job - enter {action:?}");
// Create name for Job. Includes Configuration generation in the suffix
// to track what version of the Configuration the Job is associated with.
let job_name = pod::create_broker_app_name(
instance.metadata.name.as_ref().unwrap(),
None,
instance.spec.shared,
- &format!("{}-job", config_generation),
+ &format!("{config_generation}-job"),
);
let instance_name = instance.metadata.name.as_ref().unwrap();
@@ -472,7 +460,7 @@ pub async fn handle_instance_change_job(
match action {
InstanceAction::Add => {
trace!("handle_instance_change_job - instance added");
- let capability_id = format!("{}/{}", AKRI_PREFIX, instance_name);
+ let capability_id = format!("{AKRI_PREFIX}/{instance_name}");
let new_job = job::create_new_job_from_spec(
instance,
OwnershipInfo::new(
@@ -492,7 +480,7 @@ pub async fn handle_instance_change_job(
trace!("handle_instance_change_job - instance removed");
// Find all jobs with the label
let instance_jobs = kube_interface
- .find_jobs_with_label(&format!("{}={}", AKRI_INSTANCE_LABEL_NAME, instance_name))
+ .find_jobs_with_label(&format!("{AKRI_INSTANCE_LABEL_NAME}={instance_name}"))
.await?;
let delete_tasks = instance_jobs.into_iter().map(|j| async move {
kube_interface
@@ -525,7 +513,7 @@ pub async fn handle_instance_change_pod(
action: &InstanceAction,
kube_interface: &impl KubeInterface,
) -> anyhow::Result<()> {
- trace!("handle_instance_change_pod - enter {:?}", action);
+ trace!("handle_instance_change_pod - enter {action:?}");
let instance_name = instance.metadata.name.clone().unwrap();
@@ -550,18 +538,13 @@ pub async fn handle_instance_change_pod(
)
})
.collect();
- trace!(
- "handle_instance_change - nodes tracked from instance={:?}",
- nodes_to_act_on
- );
+ trace!("handle_instance_change - nodes tracked from instance={nodes_to_act_on:?}");
trace!(
- "handle_instance_change - find all pods that have {}={}",
- AKRI_INSTANCE_LABEL_NAME,
- instance_name
+ "handle_instance_change - find all pods that have {AKRI_INSTANCE_LABEL_NAME}={instance_name}"
);
let instance_pods = kube_interface
- .find_pods_with_label(&format!("{}={}", AKRI_INSTANCE_LABEL_NAME, instance_name))
+ .find_pods_with_label(&format!("{AKRI_INSTANCE_LABEL_NAME}={instance_name}"))
.await?;
trace!(
"handle_instance_change - found {} pods",
@@ -578,8 +561,7 @@ pub async fn handle_instance_change_pod(
.try_for_each(|x| determine_action_for_pod(x, action, &mut nodes_to_act_on))?;
trace!(
- "handle_instance_change - nodes tracked after querying existing pods={:?}",
- nodes_to_act_on
+ "handle_instance_change - nodes tracked after querying existing pods={nodes_to_act_on:?}"
);
do_pod_action_for_nodes(nodes_to_act_on, instance, podspec, kube_interface).await?;
trace!("handle_instance_change - exit");
@@ -645,11 +627,11 @@ mod handle_instance_tests {
use super::*;
use akri_shared::{
akri::instance::Instance,
- k8s::{pod::AKRI_INSTANCE_LABEL_NAME, MockKubeInterface},
+ k8s::{MockKubeInterface, pod::AKRI_INSTANCE_LABEL_NAME},
os::file,
};
- use chrono::prelude::*;
use chrono::Utc;
+ use chrono::prelude::*;
use mockall::predicate::*;
fn configure_find_pods_with_phase(
@@ -658,10 +640,7 @@ mod handle_instance_tests {
result_file: &'static str,
specified_phase: &'static str,
) {
- trace!(
- "mock.expect_find_pods_with_label pod_selector:{}",
- pod_selector
- );
+ trace!("mock.expect_find_pods_with_label pod_selector:{pod_selector}");
mock.expect_find_pods_with_label()
.times(1)
.withf(move |selector| selector == pod_selector)
@@ -669,7 +648,7 @@ mod handle_instance_tests {
let pods_json = file::read_file_to_string(result_file);
let phase_adjusted_json = pods_json.replace(
"\"phase\": \"Running\"",
- &format!("\"phase\": \"{}\"", specified_phase),
+ &format!("\"phase\": \"{specified_phase}\""),
);
let pods: PodList = serde_json::from_str(&phase_adjusted_json).unwrap();
Ok(pods)
@@ -683,10 +662,7 @@ mod handle_instance_tests {
specified_phase: &'static str,
start_time: DateTime,
) {
- trace!(
- "mock.expect_find_pods_with_label pod_selector:{}",
- pod_selector
- );
+ trace!("mock.expect_find_pods_with_label pod_selector:{pod_selector}");
mock.expect_find_pods_with_label()
.times(1)
.withf(move |selector| selector == pod_selector)
@@ -694,7 +670,7 @@ mod handle_instance_tests {
let pods_json = file::read_file_to_string(result_file);
let phase_adjusted_json = pods_json.replace(
"\"phase\": \"Running\"",
- &format!("\"phase\": \"{}\"", specified_phase),
+ &format!("\"phase\": \"{specified_phase}\""),
);
let start_time_adjusted_json = phase_adjusted_json.replace(
"\"startTime\": \"2020-02-25T20:48:03Z\"",
@@ -714,10 +690,7 @@ mod handle_instance_tests {
result_file: &'static str,
specified_phase: &'static str,
) {
- trace!(
- "mock.expect_find_pods_with_label pod_selector:{}",
- pod_selector
- );
+ trace!("mock.expect_find_pods_with_label pod_selector:{pod_selector}");
mock.expect_find_pods_with_label()
.times(1)
.withf(move |selector| selector == pod_selector)
@@ -725,7 +698,7 @@ mod handle_instance_tests {
let pods_json = file::read_file_to_string(result_file);
let phase_adjusted_json = pods_json.replace(
"\"phase\": \"Running\"",
- &format!("\"phase\": \"{}\"", specified_phase),
+ &format!("\"phase\": \"{specified_phase}\""),
);
let start_time_adjusted_json =
phase_adjusted_json.replace("\"startTime\": \"2020-02-25T20:48:03Z\",", "");
@@ -909,21 +882,25 @@ mod handle_instance_tests {
async fn test_handle_watcher_restart() {
let _ = env_logger::builder().is_test(true).try_init();
let mut first_event = true;
- assert!(handle_instance(
- Event::Restarted(Vec::new()),
- &MockKubeInterface::new(),
- &mut first_event
- )
- .await
- .is_ok());
+ assert!(
+ handle_instance(
+ Event::Restarted(Vec::new()),
+ &MockKubeInterface::new(),
+ &mut first_event
+ )
+ .await
+ .is_ok()
+ );
first_event = false;
- assert!(handle_instance(
- Event::Restarted(Vec::new()),
- &MockKubeInterface::new(),
- &mut first_event
- )
- .await
- .is_err());
+ assert!(
+ handle_instance(
+ Event::Restarted(Vec::new()),
+ &MockKubeInterface::new(),
+ &mut first_event
+ )
+ .await
+ .is_err()
+ );
}
#[tokio::test]
diff --git a/controller/src/util/node_watcher.rs b/controller/src/util/node_watcher.rs
index 30eaa1e82..47767bcd1 100644
--- a/controller/src/util/node_watcher.rs
+++ b/controller/src/util/node_watcher.rs
@@ -2,7 +2,7 @@ use akri_shared::{
akri::{
instance::device_usage::NodeUsage,
instance::{Instance, InstanceSpec},
- retry::{random_delay, MAX_INSTANCE_UPDATE_TRIES},
+ retry::{MAX_INSTANCE_UPDATE_TRIES, random_delay},
},
k8s,
k8s::KubeInterface,
@@ -10,8 +10,8 @@ use akri_shared::{
use futures::{StreamExt, TryStreamExt};
use k8s_openapi::api::core::v1::{Node, NodeStatus};
use kube::api::Api;
-use kube_runtime::watcher::{watcher, Config, Event};
-use kube_runtime::WatchStreamExt;
+use kube::runtime::WatchStreamExt;
+use kube::runtime::watcher::{Config, Event, watcher};
use log::{error, info, trace};
use std::collections::HashMap;
use std::str::FromStr;
@@ -66,7 +66,7 @@ impl NodeWatcher {
loop {
let event = match informer.try_next().await {
Err(e) => {
- error!("Error during watch: {}", e);
+ error!("Error during watch: {e}");
continue;
}
Ok(None) => break,
@@ -107,7 +107,7 @@ impl NodeWatcher {
match event {
Event::Applied(node) => {
let node_name = node.metadata.name.clone().unwrap();
- info!("handle_node - Added or modified: {}", node_name);
+ info!("handle_node - Added or modified: {node_name}");
if self.is_node_ready(&node) {
self.known_nodes.insert(node_name, NodeState::Running);
} else if let std::collections::hash_map::Entry::Vacant(e) =
@@ -210,10 +210,7 @@ impl NodeWatcher {
vanished_node_name: &str,
kube_interface: &impl KubeInterface,
) -> anyhow::Result<()> {
- trace!(
- "handle_node_disappearance - enter vanished_node_name={:?}",
- vanished_node_name,
- );
+ trace!("handle_node_disappearance - enter vanished_node_name={vanished_node_name:?}",);
let instances = kube_interface.get_instances().await?;
trace!(
@@ -223,7 +220,7 @@ 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_else(|| {
- anyhow::anyhow!("Namespace not found for instance: {}", instance_name)
+ anyhow::anyhow!("Namespace not found for instance: {instance_name}")
})?;
trace!(
@@ -327,9 +324,7 @@ impl NodeWatcher {
trace!(
"handle_node_disappearance - kube_interface.update_instance name: {}, namespace: {}, {:?}",
- &instance_name,
- &instance_namespace,
- &modified_instance
+ &instance_name, &instance_namespace, &modified_instance
);
kube_interface
@@ -385,23 +380,27 @@ mod tests {
let _ = env_logger::builder().is_test(true).try_init();
let mut pod_watcher = NodeWatcher::new();
let mut first_event = true;
- assert!(pod_watcher
- .handle_node(
- Event::Restarted(Vec::new()),
- &MockKubeInterface::new(),
- &mut first_event
- )
- .await
- .is_ok());
+ assert!(
+ pod_watcher
+ .handle_node(
+ Event::Restarted(Vec::new()),
+ &MockKubeInterface::new(),
+ &mut first_event
+ )
+ .await
+ .is_ok()
+ );
first_event = false;
- assert!(pod_watcher
- .handle_node(
- Event::Restarted(Vec::new()),
- &MockKubeInterface::new(),
- &mut first_event
- )
- .await
- .is_err());
+ assert!(
+ pod_watcher
+ .handle_node(
+ Event::Restarted(Vec::new()),
+ &MockKubeInterface::new(),
+ &mut first_event
+ )
+ .await
+ .is_err()
+ );
}
#[tokio::test]
@@ -568,7 +567,7 @@ mod tests {
}
}"#;
fn listify_node(node_json: &str) -> String {
- format!("{}\n{}\n{}", LIST_PREFIX, node_json, LIST_SUFFIX)
+ format!("{LIST_PREFIX}\n{node_json}\n{LIST_SUFFIX}")
}
#[tokio::test]
@@ -598,10 +597,12 @@ mod tests {
});
let node_watcher = NodeWatcher::new();
- assert!(node_watcher
- .handle_node_disappearance("foo-a", &mock)
- .await
- .is_err());
+ assert!(
+ node_watcher
+ .handle_node_disappearance("foo-a", &mock)
+ .await
+ .is_err()
+ );
}
#[tokio::test]
@@ -630,22 +631,23 @@ mod tests {
}
})
.collect::>()
- .first()
- .is_none()
+ .is_empty()
})
.returning(move |_, _, _| Ok(()));
let node_watcher = NodeWatcher::new();
- assert!(node_watcher
- .try_remove_nodes_from_instance(
- "node-b",
- "config-a",
- "config-a-namespace",
- &kube_object_instance,
- &mock,
- )
- .await
- .is_ok());
+ assert!(
+ node_watcher
+ .try_remove_nodes_from_instance(
+ "node-b",
+ "config-a",
+ "config-a-namespace",
+ &kube_object_instance,
+ &mock,
+ )
+ .await
+ .is_ok()
+ );
}
#[test]
@@ -660,11 +662,7 @@ mod tests {
];
for (node_file, result) in tests.iter() {
- trace!(
- "Testing {} should reflect node is ready={}",
- node_file,
- result
- );
+ trace!("Testing {node_file} should reflect node is ready={result}");
let node_json = file::read_file_to_string(node_file);
let kube_object_node: Node = serde_json::from_str(&node_json).unwrap();
diff --git a/controller/src/util/pod_action.rs b/controller/src/util/pod_action.rs
index d105990fe..70496b7a0 100644
--- a/controller/src/util/pod_action.rs
+++ b/controller/src/util/pod_action.rs
@@ -79,8 +79,7 @@ impl PodActionInfo {
if let Some(start_time) = &self.status_start_time {
// If this pod has a start_time in its status, calculate when the grace period would end
log::trace!(
- "time_choice_for_non_running_pods - checking for time after start_time ({:?})",
- start_time
+ "time_choice_for_non_running_pods - checking for time after start_time ({start_time:?})"
);
let time_limit = &start_time
.0
@@ -95,8 +94,7 @@ impl PodActionInfo {
// If "now" is less than the grace period, the pod deserves more time
give_it_more_time = now < *time_limit;
log::trace!(
- "time_choice_for_non_running_pods - give_it_more_time: ({:?})",
- give_it_more_time
+ "time_choice_for_non_running_pods - give_it_more_time: ({give_it_more_time:?})"
);
} else {
// If the pod has no start_time, give it more time
@@ -106,8 +104,7 @@ impl PodActionInfo {
);
give_it_more_time = true;
log::trace!(
- "time_choice_for_non_running_pods - give_it_more_time: ({:?})",
- give_it_more_time
+ "time_choice_for_non_running_pods - give_it_more_time: ({give_it_more_time:?})"
);
}
diff --git a/controller/src/util/pod_watcher.rs b/controller/src/util/pod_watcher.rs
index 35f61a975..e9fbb596d 100644
--- a/controller/src/util/pod_watcher.rs
+++ b/controller/src/util/pod_watcher.rs
@@ -1,20 +1,21 @@
use akri_shared::{
akri::{
configuration::Configuration,
- retry::{random_delay, MAX_INSTANCE_UPDATE_TRIES},
+ retry::{MAX_INSTANCE_UPDATE_TRIES, random_delay},
},
k8s,
k8s::{
+ KubeInterface, OwnershipInfo, OwnershipType,
pod::{AKRI_CONFIGURATION_LABEL_NAME, AKRI_INSTANCE_LABEL_NAME},
- service, KubeInterface, OwnershipInfo, OwnershipType,
+ service,
},
};
use async_std::sync::Mutex;
use futures::{StreamExt, TryStreamExt};
use k8s_openapi::api::core::v1::{Pod, ServiceSpec};
use kube::api::Api;
-use kube_runtime::watcher::{watcher, Config, Event};
-use kube_runtime::WatchStreamExt;
+use kube::runtime::WatchStreamExt;
+use kube::runtime::watcher::{Config, Event, watcher};
use log::{error, info, trace};
use std::{collections::HashMap, sync::Arc};
@@ -139,7 +140,7 @@ impl BrokerPodWatcher {
loop {
let event = match informer.try_next().await {
Err(e) => {
- error!("Error during watch: {}", e);
+ error!("Error during watch: {e}");
continue;
}
Ok(None) => return Err(anyhow::anyhow!("Watch stream ended")),
@@ -175,7 +176,7 @@ impl BrokerPodWatcher {
kube_interface: &impl KubeInterface,
first_event: &mut bool,
) -> anyhow::Result<()> {
- trace!("handle_pod - enter [event: {:?}]", event);
+ trace!("handle_pod - enter [event: {event:?}]");
match event {
Event::Applied(pod) => {
info!(
@@ -188,7 +189,7 @@ impl BrokerPodWatcher {
"Unknown" | "Pending" => {
self.known_pods.insert(
pod.metadata.name.clone().ok_or_else(|| {
- anyhow::format_err!("Pod {:?} does not have name", pod)
+ anyhow::format_err!("Pod {pod:?} does not have name")
})?,
PodState::Pending,
);
@@ -213,10 +214,7 @@ impl BrokerPodWatcher {
}
Event::Restarted(pods) => {
if *first_event {
- info!(
- "handle_pod - pod watcher [re]started. Pods are : {:?}",
- pods
- );
+ info!("handle_pod - pod watcher [re]started. Pods are : {pods:?}");
} else {
return Err(anyhow::anyhow!(
"Pod watcher restarted - throwing error to restart controller"
@@ -240,7 +238,7 @@ impl BrokerPodWatcher {
.metadata
.name
.clone()
- .ok_or_else(|| anyhow::format_err!("Pod {:?} does not have name", pod))?;
+ .ok_or_else(|| anyhow::format_err!("Pod {pod:?} does not have name"))?;
let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending);
trace!(
"handle_running_pod_if_needed - last_known_state: {:?}",
@@ -270,7 +268,7 @@ impl BrokerPodWatcher {
.metadata
.name
.clone()
- .ok_or_else(|| anyhow::format_err!("Pod {:?} does not have name", pod))?;
+ .ok_or_else(|| anyhow::format_err!("Pod {pod:?} does not have name"))?;
let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending);
trace!(
"handle_ended_pod_if_needed - last_known_state: {:?}",
@@ -300,7 +298,7 @@ impl BrokerPodWatcher {
.metadata
.name
.clone()
- .ok_or_else(|| anyhow::format_err!("Pod {:?} does not have name", pod))?;
+ .ok_or_else(|| anyhow::format_err!("Pod {pod:?} does not have name"))?;
let last_known_state = self.known_pods.get(&pod_name).unwrap_or(&PodState::Pending);
trace!(
"handle_deleted_pod_if_needed - last_known_state: {:?}",
@@ -401,11 +399,8 @@ impl BrokerPodWatcher {
};
// Clean up instance service if there are no pods anymore
- let selector = format!("{}={}", label, value);
- trace!(
- "find_pods_and_cleanup_svc_if_unsupported - find_pods_with_label({})",
- selector
- );
+ let selector = format!("{label}={value}");
+ trace!("find_pods_and_cleanup_svc_if_unsupported - find_pods_with_label({selector})");
let pods = kube_interface.find_pods_with_label(&selector).await?;
trace!(
"find_pods_and_cleanup_svc_if_unsupported - found {} pods",
@@ -446,10 +441,7 @@ impl BrokerPodWatcher {
},
_ => true,
}).count();
- trace!(
- "cleanup_svc_if_unsupported - num_non_terminating_pods: {}",
- num_non_terminating_pods
- );
+ trace!("cleanup_svc_if_unsupported - num_non_terminating_pods: {num_non_terminating_pods}");
if num_non_terminating_pods == 0 {
trace!(
@@ -512,7 +504,7 @@ impl BrokerPodWatcher {
.metadata
.uid
.as_ref()
- .ok_or_else(|| anyhow::anyhow!("UID not found for instance: {}", instance_name))?;
+ .ok_or_else(|| anyhow::anyhow!("UID not found for instance: {instance_name}"))?;
self.add_instance_and_configuration_services(
&instance_name,
instance_uid,
@@ -542,19 +534,18 @@ impl BrokerPodWatcher {
) -> anyhow::Result<()> {
trace!(
"create_or_update_service - instance={:?} with ownership:{:?}",
- instance_name,
- &ownership
+ instance_name, &ownership
);
let mut create_new_service = true;
if let Ok(existing_svcs) = kube_interface
- .find_services(&format!("{}={}", label_name, label_value))
+ .find_services(&format!("{label_name}={label_value}"))
.await
{
for existing_svc in existing_svcs {
let mut existing_svc = existing_svc.clone();
let svc_name = existing_svc.metadata.name.clone().ok_or_else(|| {
- anyhow::format_err!("Service {:?} does not have name", existing_svc)
+ anyhow::format_err!("Service {existing_svc:?} does not have name")
})?;
let svc_namespace = existing_svc.metadata.namespace.as_ref().unwrap().clone();
trace!(
@@ -562,7 +553,10 @@ impl BrokerPodWatcher {
&svc_name
);
service::update_ownership(&mut existing_svc, ownership.clone(), true)?;
- trace!("create_or_update_service - calling service::update_service name:{} namespace: {}", &svc_name, &svc_namespace);
+ trace!(
+ "create_or_update_service - calling service::update_service name:{} namespace: {}",
+ &svc_name, &svc_namespace
+ );
kube_interface
.update_service(&existing_svc, &svc_name, &svc_namespace)
.await?;
@@ -580,10 +574,7 @@ impl BrokerPodWatcher {
service_spec,
is_instance_service,
)?;
- trace!(
- "create_or_update_service - New instance svc spec={:?}",
- new_instance_svc
- );
+ trace!("create_or_update_service - New instance svc spec={new_instance_svc:?}");
kube_interface
.create_service(&new_instance_svc, namespace)
@@ -603,10 +594,7 @@ impl BrokerPodWatcher {
configuration: &Configuration,
kube_interface: &impl KubeInterface,
) -> anyhow::Result<()> {
- trace!(
- "add_instance_and_configuration_services - instance={:?}",
- instance_name
- );
+ trace!("add_instance_and_configuration_services - instance={instance_name:?}");
if let Some(instance_service_spec) = &configuration.spec.instance_service_spec {
let ownership = OwnershipInfo::new(
OwnershipType::Instance,
@@ -642,7 +630,7 @@ impl BrokerPodWatcher {
if let Some(configuration_service_spec) = &configuration.spec.configuration_service_spec {
let configuration_uid = configuration.metadata.uid.as_ref().ok_or_else(|| {
- anyhow::anyhow!("UID not found for configuration: {}", configuration_name)
+ anyhow::anyhow!("UID not found for configuration: {configuration_name}")
})?;
let ownership = OwnershipInfo::new(
OwnershipType::Configuration,
@@ -692,7 +680,7 @@ mod tests {
let pods_json = file::read_file_to_string(result_file);
let phase_adjusted_json = pods_json.replace(
"\"phase\": \"Running\"",
- &format!("\"phase\": \"{}\"", specified_phase),
+ &format!("\"phase\": \"{specified_phase}\""),
);
let pods: PodList = serde_json::from_str(&phase_adjusted_json).unwrap();
pods
@@ -789,23 +777,27 @@ mod tests {
let _ = env_logger::builder().is_test(true).try_init();
let mut pod_watcher = BrokerPodWatcher::new();
let mut first_event = true;
- assert!(pod_watcher
- .handle_pod(
- Event::Restarted(Vec::new()),
- &MockKubeInterface::new(),
- &mut first_event
- )
- .await
- .is_ok());
+ assert!(
+ pod_watcher
+ .handle_pod(
+ Event::Restarted(Vec::new()),
+ &MockKubeInterface::new(),
+ &mut first_event
+ )
+ .await
+ .is_ok()
+ );
first_event = false;
- assert!(pod_watcher
- .handle_pod(
- Event::Restarted(Vec::new()),
- &MockKubeInterface::new(),
- &mut first_event
- )
- .await
- .is_err());
+ assert!(
+ pod_watcher
+ .handle_pod(
+ Event::Restarted(Vec::new()),
+ &MockKubeInterface::new(),
+ &mut first_event
+ )
+ .await
+ .is_err()
+ );
}
#[tokio::test]
@@ -1348,9 +1340,11 @@ mod tests {
let orig_pod = pod_list.items.first().unwrap();
let pod_watcher = BrokerPodWatcher::new();
- assert!(pod_watcher
- .get_instance_and_configuration_from_pod(orig_pod)
- .is_ok());
+ assert!(
+ pod_watcher
+ .get_instance_and_configuration_from_pod(orig_pod)
+ .is_ok()
+ );
let mut instanceless_pod = orig_pod.clone();
instanceless_pod
@@ -1359,9 +1353,11 @@ mod tests {
.as_mut()
.unwrap()
.remove(AKRI_INSTANCE_LABEL_NAME);
- assert!(pod_watcher
- .get_instance_and_configuration_from_pod(&instanceless_pod)
- .is_err());
+ assert!(
+ pod_watcher
+ .get_instance_and_configuration_from_pod(&instanceless_pod)
+ .is_err()
+ );
let mut configurationless_pod = orig_pod.clone();
configurationless_pod
@@ -1370,9 +1366,11 @@ mod tests {
.as_mut()
.unwrap()
.remove(AKRI_CONFIGURATION_LABEL_NAME);
- assert!(pod_watcher
- .get_instance_and_configuration_from_pod(&configurationless_pod)
- .is_err());
+ assert!(
+ pod_watcher
+ .get_instance_and_configuration_from_pod(&configurationless_pod)
+ .is_err()
+ );
}
#[tokio::test]
@@ -1444,20 +1442,22 @@ mod tests {
"object_uid".to_string(),
);
- assert!(pod_watcher
- .create_or_update_service(
- "config-a-b494b6",
- "config-a",
- "config-a-namespace",
- AKRI_INSTANCE_LABEL_NAME,
- "config-a-b494b6",
- ownership,
- &config.spec.instance_service_spec.unwrap().clone(),
- true,
- &mock
- )
- .await
- .is_err());
+ assert!(
+ pod_watcher
+ .create_or_update_service(
+ "config-a-b494b6",
+ "config-a",
+ "config-a-namespace",
+ AKRI_INSTANCE_LABEL_NAME,
+ "config-a-b494b6",
+ ownership,
+ &config.spec.instance_service_spec.unwrap().clone(),
+ true,
+ &mock
+ )
+ .await
+ .is_err()
+ );
}
#[tokio::test]
@@ -1528,20 +1528,22 @@ mod tests {
"object_uid".to_string(),
);
- assert!(pod_watcher
- .create_or_update_service(
- "config-a-b494b6",
- "config-a",
- "config-a-namespace",
- AKRI_INSTANCE_LABEL_NAME,
- "config-a-b494b6",
- ownership,
- &config.spec.instance_service_spec.unwrap().clone(),
- true,
- &mock
- )
- .await
- .is_err());
+ assert!(
+ pod_watcher
+ .create_or_update_service(
+ "config-a-b494b6",
+ "config-a",
+ "config-a-namespace",
+ AKRI_INSTANCE_LABEL_NAME,
+ "config-a-b494b6",
+ ownership,
+ &config.spec.instance_service_spec.unwrap().clone(),
+ true,
+ &mock
+ )
+ .await
+ .is_err()
+ );
}
#[derive(Clone)]
diff --git a/controller/src/util/shared_test_utils.rs b/controller/src/util/shared_test_utils.rs
index 09ac39735..8bea2e262 100644
--- a/controller/src/util/shared_test_utils.rs
+++ b/controller/src/util/shared_test_utils.rs
@@ -22,7 +22,7 @@ pub mod config_for_tests {
result_file: &'static str,
result_error: bool,
) {
- trace!("mock.expect_find_instance instance_name:{}", instance_name);
+ trace!("mock.expect_find_instance instance_name:{instance_name}");
mock.expect_find_instance()
.times(1)
.withf(move |name, namespace| name == instance_name && namespace == instance_namespace)
@@ -58,7 +58,7 @@ pub mod config_for_tests {
}
}"#;
fn listify_kube_object(node_json: &str) -> String {
- format!("{}\n{}\n{}", LIST_PREFIX, node_json, LIST_SUFFIX)
+ format!("{LIST_PREFIX}\n{node_json}\n{LIST_SUFFIX}")
}
pub fn configure_get_instances(
@@ -87,10 +87,7 @@ pub mod config_for_tests {
result_error: bool,
) {
trace!(
- "mock.expect_update_instance name:{} namespace:{} error:{}",
- instance_name,
- instance_namespace,
- result_error
+ "mock.expect_update_instance name:{instance_name} namespace:{instance_namespace} error:{result_error}"
);
mock.expect_update_instance()
.times(1)
@@ -116,7 +113,7 @@ pub mod config_for_tests {
result_file: &'static str,
result_error: bool,
) {
- trace!("mock.expect_find_configuration config_name:{}", config_name);
+ trace!("mock.expect_find_configuration config_name:{config_name}");
mock.expect_find_configuration()
.times(1)
.withf(move |name, namespace| name == config_name && namespace == config_namespace)
@@ -137,7 +134,7 @@ pub mod config_for_tests {
result_file: &'static str,
result_error: bool,
) {
- trace!("mock.expect_find_services svc_selector:{}", svc_selector);
+ trace!("mock.expect_find_services svc_selector:{svc_selector}");
mock.expect_find_services()
.times(1)
.withf(move |selector| selector == svc_selector)
@@ -160,10 +157,7 @@ pub mod config_for_tests {
) {
trace!(
"mock.expect_create_service name:{}, namespace:{}, [{}={}]",
- &svc_name,
- &namespace,
- &label_id,
- &label_value
+ &svc_name, &namespace, &label_id, &label_value
);
mock.expect_create_service()
.withf(move |svc_to_create, ns| {
@@ -186,11 +180,7 @@ pub mod config_for_tests {
svc_name: &'static str,
svc_namespace: &'static str,
) {
- trace!(
- "mock.expect_remove_service svc_name:{}, svc_namespace={}",
- svc_name,
- svc_namespace
- );
+ trace!("mock.expect_remove_service svc_name:{svc_name}, svc_namespace={svc_namespace}");
mock.expect_remove_service()
.times(1)
.withf(move |svc_to_remove, namespace| {
@@ -206,10 +196,7 @@ pub mod config_for_tests {
result_error: bool,
) {
trace!(
- "mock.expect_update_service name:{} namespace:{} error:{}",
- svc_name,
- svc_namespace,
- result_error,
+ "mock.expect_update_service name:{svc_name} namespace:{svc_namespace} error:{result_error}",
);
mock.expect_update_service()
.times(1)
@@ -229,10 +216,7 @@ pub mod config_for_tests {
result_file: &'static str,
result_error: bool,
) {
- trace!(
- "mock.expect_find_pods_with_label pod_selector:{}",
- pod_selector
- );
+ trace!("mock.expect_find_pods_with_label pod_selector:{pod_selector}");
mock.expect_find_pods_with_label()
.times(1)
.withf(move |selector| selector == pod_selector)
@@ -255,7 +239,7 @@ pub mod config_for_tests {
label_value: &'static str,
error: bool,
) {
- trace!("mock.expect_create_pod pod_name:{}", pod_name);
+ trace!("mock.expect_create_pod pod_name:{pod_name}");
mock.expect_create_pod()
.times(1)
.withf(move |pod_to_create, namespace| {
@@ -281,11 +265,7 @@ pub mod config_for_tests {
pod_name: &'static str,
pod_namespace: &'static str,
) {
- trace!(
- "mock.expect_remove_pod pod_name:{} pod_namespace:{}",
- pod_name,
- pod_namespace
- );
+ trace!("mock.expect_remove_pod pod_name:{pod_name} pod_namespace:{pod_namespace}");
mock.expect_remove_pod()
.times(1)
.withf(move |pod_to_remove, namespace| {
diff --git a/deployment/helm/Chart.yaml b/deployment/helm/Chart.yaml
index 1fdc3512f..e4aacabb8 100644
--- a/deployment/helm/Chart.yaml
+++ b/deployment/helm/Chart.yaml
@@ -16,9 +16,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.13.18
+version: 0.13.19
# 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.13.18
+appVersion: 0.13.19
diff --git a/discovery-handler-modules/debug-echo-discovery-handler/src/main.rs b/discovery-handler-modules/debug-echo-discovery-handler/src/main.rs
index 1a58ef943..b4ecc40c6 100644
--- a/discovery-handler-modules/debug-echo-discovery-handler/src/main.rs
+++ b/discovery-handler-modules/debug-echo-discovery-handler/src/main.rs
@@ -1,9 +1,9 @@
use akri_debug_echo::{
- discovery_handler::DiscoveryHandlerImpl, DEBUG_ECHO_INSTANCES_SHARED_LABEL,
- DISCOVERY_HANDLER_NAME,
+ DEBUG_ECHO_INSTANCES_SHARED_LABEL, DISCOVERY_HANDLER_NAME,
+ discovery_handler::DiscoveryHandlerImpl,
};
use akri_discovery_utils::discovery::discovery_handler::{
- run_discovery_handler, REGISTER_AGAIN_CHANNEL_CAPACITY,
+ REGISTER_AGAIN_CHANNEL_CAPACITY, run_discovery_handler,
};
use log::info;
#[tokio::main]
diff --git a/discovery-handler-modules/onvif-discovery-handler/src/main.rs b/discovery-handler-modules/onvif-discovery-handler/src/main.rs
index 2def2feba..475588fbf 100644
--- a/discovery-handler-modules/onvif-discovery-handler/src/main.rs
+++ b/discovery-handler-modules/onvif-discovery-handler/src/main.rs
@@ -1,7 +1,7 @@
use akri_discovery_utils::discovery::discovery_handler::{
- run_discovery_handler, REGISTER_AGAIN_CHANNEL_CAPACITY,
+ REGISTER_AGAIN_CHANNEL_CAPACITY, run_discovery_handler,
};
-use akri_onvif::{discovery_handler::DiscoveryHandlerImpl, DISCOVERY_HANDLER_NAME, SHARED};
+use akri_onvif::{DISCOVERY_HANDLER_NAME, SHARED, discovery_handler::DiscoveryHandlerImpl};
use log::info;
#[tokio::main]
async fn main() -> Result<(), Box> {
diff --git a/discovery-handler-modules/opcua-discovery-handler/src/main.rs b/discovery-handler-modules/opcua-discovery-handler/src/main.rs
index 25360df6f..110515610 100644
--- a/discovery-handler-modules/opcua-discovery-handler/src/main.rs
+++ b/discovery-handler-modules/opcua-discovery-handler/src/main.rs
@@ -1,7 +1,7 @@
use akri_discovery_utils::discovery::discovery_handler::{
- run_discovery_handler, REGISTER_AGAIN_CHANNEL_CAPACITY,
+ REGISTER_AGAIN_CHANNEL_CAPACITY, run_discovery_handler,
};
-use akri_opcua::{discovery_handler::DiscoveryHandlerImpl, DISCOVERY_HANDLER_NAME, SHARED};
+use akri_opcua::{DISCOVERY_HANDLER_NAME, SHARED, discovery_handler::DiscoveryHandlerImpl};
use log::info;
#[tokio::main]
async fn main() -> Result<(), Box> {
diff --git a/discovery-handler-modules/udev-discovery-handler/src/main.rs b/discovery-handler-modules/udev-discovery-handler/src/main.rs
index ccd4b9a76..51600cfd0 100644
--- a/discovery-handler-modules/udev-discovery-handler/src/main.rs
+++ b/discovery-handler-modules/udev-discovery-handler/src/main.rs
@@ -1,7 +1,7 @@
use akri_discovery_utils::discovery::discovery_handler::{
- run_discovery_handler, REGISTER_AGAIN_CHANNEL_CAPACITY,
+ REGISTER_AGAIN_CHANNEL_CAPACITY, run_discovery_handler,
};
-use akri_udev::{discovery_handler::DiscoveryHandlerImpl, DISCOVERY_HANDLER_NAME, SHARED};
+use akri_udev::{DISCOVERY_HANDLER_NAME, SHARED, discovery_handler::DiscoveryHandlerImpl};
use log::info;
#[tokio::main]
async fn main() -> Result<(), Box> {
diff --git a/discovery-handlers/debug-echo/src/discovery_handler.rs b/discovery-handlers/debug-echo/src/discovery_handler.rs
index 4e016054b..63fa7cec7 100644
--- a/discovery-handlers/debug-echo/src/discovery_handler.rs
+++ b/discovery-handlers/debug-echo/src/discovery_handler.rs
@@ -1,7 +1,7 @@
use akri_discovery_utils::discovery::{
- discovery_handler::{deserialize_discovery_details, DISCOVERED_DEVICES_CHANNEL_CAPACITY},
- v0::{discovery_handler_server::DiscoveryHandler, Device, DiscoverRequest, DiscoverResponse},
DiscoverStream,
+ discovery_handler::{DISCOVERED_DEVICES_CHANNEL_CAPACITY, deserialize_discovery_details},
+ v0::{Device, DiscoverRequest, DiscoverResponse, discovery_handler_server::DiscoveryHandler},
};
use async_trait::async_trait;
use log::{error, info, trace};
@@ -59,7 +59,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
mpsc::channel(DISCOVERED_DEVICES_CHANNEL_CAPACITY);
let discovery_handler_config: DebugEchoDiscoveryDetails =
deserialize_discovery_details(&discover_request.discovery_details)
- .map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!("{}", e)))?;
+ .map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!("{e}")))?;
let descriptions = discovery_handler_config.descriptions;
let mut offline = fs::read_to_string(DEBUG_ECHO_AVAILABILITY_CHECK_PATH)
.unwrap_or_default()
@@ -94,7 +94,9 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
}))
.await
{
- error!("discover - for debugEcho failed to send discovery response with error {}", e);
+ error!(
+ "discover - for debugEcho failed to send discovery response with error {e}"
+ );
if let Some(sender) = register_sender {
sender.send(()).await.unwrap();
}
@@ -126,7 +128,9 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
.await
{
// TODO: consider re-registering here
- error!("discover - for debugEcho failed to send discovery response with error {}", e);
+ error!(
+ "discover - for debugEcho failed to send discovery response with error {e}"
+ );
if let Some(sender) = register_sender {
sender.send(()).await.unwrap();
}
diff --git a/discovery-handlers/onvif/Cargo.toml b/discovery-handlers/onvif/Cargo.toml
index 98dce407e..8fbbc1d23 100644
--- a/discovery-handlers/onvif/Cargo.toml
+++ b/discovery-handlers/onvif/Cargo.toml
@@ -28,8 +28,8 @@ tokio = { version = "1.0", features = ["time", "net", "sync"] }
tokio-stream = { version = "0.1", features = ["net"] }
tonic = { version = "0.10", features = ["tls"] }
uuid = { version = "0.8.1", features = ["v4"] }
-yaserde = "0.7.1"
-yaserde_derive = "0.7.1"
+yaserde = "0.11.2"
+yaserde_derive = "0.11.2"
[dev-dependencies]
env_logger = "0.11.8"
diff --git a/discovery-handlers/onvif/src/credential_store.rs b/discovery-handlers/onvif/src/credential_store.rs
index 5f44d95c4..923c7b0ce 100644
--- a/discovery-handlers/onvif/src/credential_store.rs
+++ b/discovery-handlers/onvif/src/credential_store.rs
@@ -251,7 +251,7 @@ mod tests {
"[{}]",
entries
.iter()
- .map(|(k, _v)| format!(r#""{}""#, k))
+ .map(|(k, _v)| format!(r#""{k}""#))
.collect::>()
.join(", ")
);
diff --git a/discovery-handlers/onvif/src/discovery_handler.rs b/discovery-handlers/onvif/src/discovery_handler.rs
index 468422c9b..ef464d222 100644
--- a/discovery-handlers/onvif/src/discovery_handler.rs
+++ b/discovery-handlers/onvif/src/discovery_handler.rs
@@ -1,17 +1,16 @@
use super::credential_store::CredentialStore;
use super::discovery_impl::util;
use super::discovery_utils::{
- OnvifQuery, OnvifQueryImpl, ONVIF_DEVICE_IP_ADDRESS_LABEL_ID,
- ONVIF_DEVICE_MAC_ADDRESS_LABEL_ID, ONVIF_DEVICE_SERVICE_URL_LABEL_ID,
- ONVIF_DEVICE_UUID_LABEL_ID,
+ ONVIF_DEVICE_IP_ADDRESS_LABEL_ID, ONVIF_DEVICE_MAC_ADDRESS_LABEL_ID,
+ ONVIF_DEVICE_SERVICE_URL_LABEL_ID, ONVIF_DEVICE_UUID_LABEL_ID, OnvifQuery, OnvifQueryImpl,
};
use akri_discovery_utils::{
discovery::{
- discovery_handler::{deserialize_discovery_details, DISCOVERED_DEVICES_CHANNEL_CAPACITY},
+ DiscoverStream,
+ discovery_handler::{DISCOVERED_DEVICES_CHANNEL_CAPACITY, deserialize_discovery_details},
v0::{
- discovery_handler_server::DiscoveryHandler, Device, DiscoverRequest, DiscoverResponse,
+ Device, DiscoverRequest, DiscoverResponse, discovery_handler_server::DiscoveryHandler,
},
- DiscoverStream,
},
filtering::FilterList,
};
@@ -75,7 +74,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
mpsc::channel(DISCOVERED_DEVICES_CHANNEL_CAPACITY);
let discovery_handler_config: OnvifDiscoveryDetails =
deserialize_discovery_details(&discover_request.discovery_details)
- .map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!("{}", e)))?;
+ .map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!("{e}")))?;
let credential_store = CredentialStore::new(&discover_request.discovery_properties);
let onvif_query = OnvifQueryImpl::new(credential_store);
tokio::spawn(async move {
@@ -136,8 +135,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
.await
{
error!(
- "discover - for ONVIF failed to send discovery response with error {}",
- e
+ "discover - for ONVIF failed to send discovery response with error {e}"
);
if let Some(sender) = register_sender {
sender.send(()).await.unwrap();
@@ -160,10 +158,7 @@ async fn apply_filters(
device_uuid: &str,
onvif_query: &impl OnvifQuery,
) -> Option<(String, Device)> {
- info!(
- "apply_filters - device service url {}, uuid {}",
- device_service_uri, device_uuid
- );
+ info!("apply_filters - device service url {device_service_uri}, uuid {device_uuid}");
// Evaluate device uuid against uuids filter if provided
if util::execute_filter(
discovery_handler_config.uuids.as_ref(),
@@ -177,7 +172,7 @@ async fn apply_filters(
.get_device_ip_and_mac_address(device_service_uri, device_uuid)
.await
.map_err(|e| {
- error!("apply_filters - error getting ip and mac address: {}", e);
+ error!("apply_filters - error getting ip and mac address: {e}");
e
})
.ok();
@@ -202,7 +197,7 @@ async fn apply_filters(
return None;
}
- let service_uri_and_uuid_joined = format!("{}-{}", device_service_uri, device_uuid);
+ let service_uri_and_uuid_joined = format!("{device_service_uri}-{device_uuid}");
let mut properties = HashMap::new();
properties.insert(
ONVIF_DEVICE_SERVICE_URL_LABEL_ID.to_string(),
@@ -281,7 +276,7 @@ mod tests {
(
uri.to_string(),
Device {
- id: format!("{}-{}", uri, uuid),
+ id: format!("{uri}-{uuid}"),
properties,
mounts: Vec::default(),
device_specs: Vec::default(),
@@ -383,9 +378,11 @@ mod tests {
uuids: None,
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -447,9 +444,11 @@ mod tests {
uuids: None,
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -476,9 +475,11 @@ mod tests {
uuids: None,
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -540,9 +541,11 @@ mod tests {
uuids: None,
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -604,9 +607,11 @@ mod tests {
uuids: None,
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -668,9 +673,11 @@ mod tests {
uuids: None,
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -732,9 +739,11 @@ mod tests {
uuids: None,
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -797,9 +806,11 @@ mod tests {
uuids: None,
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -854,9 +865,11 @@ mod tests {
}),
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -877,9 +890,11 @@ mod tests {
}),
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -900,9 +915,11 @@ mod tests {
}),
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
#[tokio::test]
@@ -1025,8 +1042,10 @@ mod tests {
}),
discovery_timeout_seconds: 1,
};
- assert!(apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
- .await
- .is_none());
+ assert!(
+ apply_filters(&onvif_config, mock_uri, mock_uuid, &mock)
+ .await
+ .is_none()
+ );
}
}
diff --git a/discovery-handlers/onvif/src/discovery_impl.rs b/discovery-handlers/onvif/src/discovery_impl.rs
index 3b6666cd2..be3902f01 100644
--- a/discovery-handlers/onvif/src/discovery_impl.rs
+++ b/discovery-handlers/onvif/src/discovery_impl.rs
@@ -179,8 +179,9 @@ pub mod util {
/// Get SOAP probe message with a specific message id
fn get_expected_probe_message(message_id: &str) -> String {
format!(
- "{}urn:schemas-xmlsoap-org:ws:2005:04:discoveryhttp://schemas.xmlsoap.org/ws/2005/04/discovery/Probenetwsdl:NetworkVideoTransmitter",
- &message_id)
+ "{}urn:schemas-xmlsoap-org:ws:2005:04:discoveryhttp://schemas.xmlsoap.org/ws/2005/04/discovery/Probenetwsdl:NetworkVideoTransmitter",
+ &message_id
+ )
}
#[test]
@@ -246,10 +247,7 @@ pub mod util {
.filter_map(|r| match r {
Ok(uri) => Some(uri),
Err(e) => {
- trace!(
- "device not responding to date/time request with error {}",
- e
- );
+ trace!("device not responding to date/time request with error {e}");
None
}
})
@@ -428,11 +426,13 @@ pub mod util {
let uris = vec!["uri_one".to_string(), "uri_two".to_string()];
let device_uuid = "device_uuid";
let response = get_expected_probe_match_message(device_uuid, &uris);
- assert!(get_scope_filtered_uris_from_discovery_response(
- &response,
- Some(filter_list).as_ref()
- )
- .is_empty());
+ assert!(
+ get_scope_filtered_uris_from_discovery_response(
+ &response,
+ Some(filter_list).as_ref()
+ )
+ .is_empty()
+ );
}
#[test]
@@ -446,11 +446,13 @@ pub mod util {
let uris = vec!["uri_one".to_string(), "uri_two".to_string()];
let device_uuid = "device_uuid";
let response = get_expected_probe_match_message(device_uuid, &uris);
- assert!(get_scope_filtered_uris_from_discovery_response(
- &response,
- Some(filter_list).as_ref()
- )
- .is_empty());
+ assert!(
+ get_scope_filtered_uris_from_discovery_response(
+ &response,
+ Some(filter_list).as_ref()
+ )
+ .is_empty()
+ );
}
#[test]
@@ -488,11 +490,13 @@ pub mod util {
let uris = vec!["uri_one".to_string(), "uri_two".to_string()];
let device_uuid = "device_uuid";
let response = get_expected_probe_match_message(device_uuid, &uris);
- assert!(get_scope_filtered_uris_from_discovery_response(
- &response,
- Some(filter_list).as_ref()
- )
- .is_empty());
+ assert!(
+ get_scope_filtered_uris_from_discovery_response(
+ &response,
+ Some(filter_list).as_ref()
+ )
+ .is_empty()
+ );
}
#[test]
@@ -691,15 +695,11 @@ pub mod util {
const MULTI_PORT: u16 = 3702;
let multi_socket_addr = SocketAddr::new(IpAddr::V4(MULTI_IPV4_ADDR), MULTI_PORT);
- trace!(
- "get_discovery_response_socket - binding to: {:?}",
- local_socket_addr
- );
+ trace!("get_discovery_response_socket - binding to: {local_socket_addr:?}");
let socket = UdpSocket::bind(local_socket_addr).await?;
trace!(
"get_discovery_response_socket - joining multicast: {:?} {:?}",
- &MULTI_IPV4_ADDR,
- &LOCAL_IPV4_ADDR
+ &MULTI_IPV4_ADDR, &LOCAL_IPV4_ADDR
);
socket
.join_multicast_v4(MULTI_IPV4_ADDR, LOCAL_IPV4_ADDR)
@@ -734,30 +734,26 @@ pub mod util {
}
Err(e) => match e.kind() {
ErrorKind::WouldBlock | ErrorKind::TimedOut => {
- trace!("simple_onvif_discover - recv_from error ... continue collecting responses {:?}", e);
+ trace!(
+ "simple_onvif_discover - recv_from error ... continue collecting responses {e:?}"
+ );
}
_ => {
- error!("simple_onvif_discover - recv_from error: {:?}", e);
+ error!("simple_onvif_discover - recv_from error: {e:?}");
return Err(anyhow::anyhow!(e));
}
},
}
}
- trace!(
- "simple_onvif_discover - uris discovered by udp broadcast {:?}",
- broadcast_responses
- );
+ trace!("simple_onvif_discover - uris discovered by udp broadcast {broadcast_responses:?}");
let filtered_uris = broadcast_responses
.into_iter()
.flat_map(|r| get_scope_filtered_uris_from_discovery_response(&r, scopes_filters))
.collect::>();
- trace!(
- "simple_onvif_discover - uris after filtering by scopes {:?}",
- filtered_uris
- );
+ trace!("simple_onvif_discover - uris after filtering by scopes {filtered_uris:?}");
let devices = get_responsive_uris(filtered_uris, &OnvifQueryImpl::default()).await;
- info!("simple_onvif_discover - devices: {:?}", devices);
+ info!("simple_onvif_discover - devices: {devices:?}");
Ok(devices)
}
@@ -802,7 +798,7 @@ pub mod util {
});
let wait_for_call_millis = timeout.as_secs() * 1000 + 200;
- trace!("wait for {} milliseconds", wait_for_call_millis);
+ trace!("wait for {wait_for_call_millis} milliseconds");
std::thread::sleep(Duration::from_millis(wait_for_call_millis));
// validate that this ends in 2 seconds or less
trace!("duration to test: {}", duration.lock().unwrap().as_millis());
diff --git a/discovery-handlers/onvif/src/discovery_utils.rs b/discovery-handlers/onvif/src/discovery_utils.rs
index 513ac707a..0f95a91ab 100644
--- a/discovery-handlers/onvif/src/discovery_utils.rs
+++ b/discovery-handlers/onvif/src/discovery_utils.rs
@@ -7,7 +7,7 @@ use log::trace;
#[cfg(test)]
use mockall::{automock, predicate::*};
use std::io::{Error, ErrorKind};
-use sxd_document::{parser, Package};
+use sxd_document::{Package, parser};
use sxd_xpath::Value;
pub const ONVIF_DEVICE_SERVICE_URL_LABEL_ID: &str = "ONVIF_DEVICE_SERVICE_URL";
@@ -110,7 +110,7 @@ impl OnvifQuery for OnvifQueryImpl {
#[async_trait]
trait Http {
async fn post(&self, url: &str, mime_action: &str, msg: &str)
- -> Result;
+ -> Result;
}
struct HttpRequest {}
@@ -122,10 +122,7 @@ impl HttpRequest {
Ok(xml_as_tree) => xml_as_tree,
Err(e) => return Err(Error::new(ErrorKind::InvalidData, e).into()),
};
- trace!(
- "handle_request_body - response as xmltree: {:?}",
- xml_as_tree
- );
+ trace!("handle_request_body - response as xmltree: {xml_as_tree:?}");
Ok(xml_as_tree)
}
}
@@ -141,9 +138,7 @@ impl Http for HttpRequest {
) -> Result {
trace!(
"post - url:{}, mime_action:{}, msg:{}",
- &url,
- &mime_action,
- &msg
+ &url, &mime_action, &msg
);
let full_mime = format!(
@@ -184,7 +179,7 @@ impl Http for HttpRequest {
/// Creates a SOAP mime action
fn get_action(wsdl: &str, function: &str) -> String {
- format!("action=\"{}/{}\"", wsdl, function)
+ format!("action=\"{wsdl}/{function}\"")
}
/// Gets the ip and mac address for a given ONVIF camera
@@ -208,45 +203,66 @@ async fn inner_get_device_ip_and_mac_address(
Ok(xml) => xml,
Err(e) => {
return Err(anyhow::format_err!(
- "failed to get network interfaces from device: {:?}",
- e
- ))
+ "failed to get network interfaces from device: {e:?}"
+ ));
}
};
let network_interfaces_doc = network_interfaces_xml.as_document();
let ip_address = match sxd_xpath::evaluate_xpath(
- &network_interfaces_doc,
- "//*[local-name()='GetNetworkInterfacesResponse']/*[local-name()='NetworkInterfaces']/*[local-name()='IPv4']/*[local-name()='Config']/*/*[local-name()='Address']/text()"
- ) {
- Ok(Value::String(ip)) => ip,
- Ok(Value::Nodeset(ns)) => match ns.into_iter().map(|x| x.string_value()).collect::>().first() {
- Some(first) => first.to_string(),
- None => return Err(anyhow::format_err!("Failed to get ONVIF ip address: none specified in response"))
- },
- Ok(Value::Boolean(_)) |
- Ok(Value::Number(_)) => return Err(anyhow::format_err!("Failed to get ONVIF ip address: unexpected type")),
- Err(e) => return Err(anyhow::format_err!("Failed to get ONVIF ip address: {}", e))
- };
- trace!(
- "inner_get_device_ip_and_mac_address - network interfaces (ip address): {:?}",
- ip_address
- );
+ &network_interfaces_doc,
+ "//*[local-name()='GetNetworkInterfacesResponse']/*[local-name()='NetworkInterfaces']/*[local-name()='IPv4']/*[local-name()='Config']/*/*[local-name()='Address']/text()",
+ ) {
+ Ok(Value::String(ip)) => ip,
+ Ok(Value::Nodeset(ns)) => match ns
+ .into_iter()
+ .map(|x| x.string_value())
+ .collect::>()
+ .first()
+ {
+ Some(first) => first.to_string(),
+ None => {
+ return Err(anyhow::format_err!(
+ "Failed to get ONVIF ip address: none specified in response"
+ ));
+ }
+ },
+ Ok(Value::Boolean(_)) | Ok(Value::Number(_)) => {
+ return Err(anyhow::format_err!(
+ "Failed to get ONVIF ip address: unexpected type"
+ ));
+ }
+ Err(e) => return Err(anyhow::format_err!("Failed to get ONVIF ip address: {e}")),
+ };
+ trace!("inner_get_device_ip_and_mac_address - network interfaces (ip address): {ip_address:?}");
let mac_address = match sxd_xpath::evaluate_xpath(
- &network_interfaces_doc,
- "//*[local-name()='GetNetworkInterfacesResponse']/*[local-name()='NetworkInterfaces']/*[local-name()='Info']/*[local-name()='HwAddress']/text()"
- ) {
- Ok(Value::String(mac)) => mac,
- Ok(Value::Nodeset(ns)) => match ns.iter().map(|x| x.string_value()).collect::>().first() {
- Some(first) => first.to_string(),
- None => return Err(anyhow::format_err!("Failed to get ONVIF mac address: none specified in response"))
- },
- Ok(Value::Boolean(_)) |
- Ok(Value::Number(_)) => return Err(anyhow::format_err!("Failed to get ONVIF mac address: unexpected type")),
- Err(e) => return Err(anyhow::format_err!("Failed to get ONVIF mac address: {}", e))
- };
+ &network_interfaces_doc,
+ "//*[local-name()='GetNetworkInterfacesResponse']/*[local-name()='NetworkInterfaces']/*[local-name()='Info']/*[local-name()='HwAddress']/text()",
+ ) {
+ Ok(Value::String(mac)) => mac,
+ Ok(Value::Nodeset(ns)) => match ns
+ .iter()
+ .map(|x| x.string_value())
+ .collect::>()
+ .first()
+ {
+ Some(first) => first.to_string(),
+ None => {
+ return Err(anyhow::format_err!(
+ "Failed to get ONVIF mac address: none specified in response"
+ ));
+ }
+ },
+ Ok(Value::Boolean(_)) | Ok(Value::Number(_)) => {
+ return Err(anyhow::format_err!(
+ "Failed to get ONVIF mac address: unexpected type"
+ ));
+ }
+ Err(e) => {
+ return Err(anyhow::format_err!("Failed to get ONVIF mac address: {e}"));
+ }
+ };
trace!(
- "inner_get_device_ip_and_mac_address - network interfaces (mac address): {:?}",
- mac_address
+ "inner_get_device_ip_and_mac_address - network interfaces (mac address): {mac_address:?}"
);
Ok((ip_address, mac_address))
}
@@ -285,13 +301,12 @@ fn get_network_interfaces_message(username_token: &Option) -> Str
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsdl="http://www.onvif.org/ver10/device/wsdl">
- {}
+ {security_header}
-"#,
- security_header
+"#
)
}
@@ -312,30 +327,25 @@ async fn inner_get_device_service_uri(
Ok(xml) => xml,
Err(e) => {
return Err(anyhow::format_err!(
- "failed to get services from device: {:?}",
- e
- ))
+ "failed to get services from device: {e:?}"
+ ));
}
};
let services_doc = services_xml.as_document();
let service_xpath_query = format!(
- "//*[local-name()='GetServicesResponse']/*[local-name()='Service' and *[local-name()='Namespace']/text() ='{}']/*[local-name()='XAddr']/text()",
- service
+ "//*[local-name()='GetServicesResponse']/*[local-name()='Service' and *[local-name()='Namespace']/text() ='{service}']/*[local-name()='XAddr']/text()"
);
let requested_device_service_uri =
match sxd_xpath::evaluate_xpath(&services_doc, service_xpath_query.as_str()) {
Ok(uri) => uri.string(),
Err(e) => {
return Err(anyhow::format_err!(
- "failed to get servuce uri from resoinse: {:?}",
- e
- ))
+ "failed to get servuce uri from resoinse: {e:?}"
+ ));
}
};
trace!(
- "inner_get_device_service_uri - service ({}) uris: {:?}",
- service,
- requested_device_service_uri
+ "inner_get_device_service_uri - service ({service}) uris: {requested_device_service_uri:?}"
);
Ok(requested_device_service_uri)
}
@@ -359,9 +369,8 @@ async fn inner_get_device_profiles(
Ok(xml) => xml,
Err(e) => {
return Err(anyhow::format_err!(
- "failed to get profiles from device: {:?}",
- e
- ))
+ "failed to get profiles from device: {e:?}"
+ ));
}
};
let profiles_doc = profiles_xml.as_document();
@@ -377,11 +386,11 @@ async fn inner_get_device_profiles(
Ok(Value::Boolean(_)) | Ok(Value::Number(_)) | Ok(Value::String(_)) => {
return Err(anyhow::format_err!(
"Failed to get ONVIF profiles: unexpected type"
- ))
+ ));
}
- Err(e) => return Err(anyhow::format_err!("Failed to get ONVIF profiles: {}", e)),
+ Err(e) => return Err(anyhow::format_err!("Failed to get ONVIF profiles: {e}")),
};
- trace!("inner_get_device_profiles - profiles: {:?}", profiles);
+ trace!("inner_get_device_profiles - profiles: {profiles:?}");
Ok(profiles)
}
@@ -399,24 +408,22 @@ async fn inner_get_device_profile_streaming_uri(
Ok(xml) => xml,
Err(e) => {
return Err(anyhow::format_err!(
- "failed to get streaming uri from device: {:?}",
- e
- ))
+ "failed to get streaming uri from device: {e:?}"
+ ));
}
};
let stream_uri_doc = stream_uri_xml.as_document();
let stream_uri = match sxd_xpath::evaluate_xpath(
&stream_uri_doc,
- "//*[local-name()='GetStreamUriResponse']/*[local-name()='MediaUri']/*[local-name()='Uri']/text()"
- ) {
- Ok(stream) => stream.string(),
- Err(e) => {
- return Err(anyhow::format_err!(
- "failed to get service uri from response: {:?}",
- e
- ))
- }
- };
+ "//*[local-name()='GetStreamUriResponse']/*[local-name()='MediaUri']/*[local-name()='Uri']/text()",
+ ) {
+ Ok(stream) => stream.string(),
+ Err(e) => {
+ return Err(anyhow::format_err!(
+ "failed to get service uri from response: {e:?}"
+ ));
+ }
+ };
Ok(stream_uri)
}
@@ -444,11 +451,10 @@ fn get_stream_uri_message(profile: &str) -> String {
RTSP
- {}
+ {profile}
-;"#,
- profile
+;"#
)
}
@@ -483,7 +489,7 @@ mod tests {
let inner_mime = mime.to_string();
let inner_msg = msg.to_string();
let inner_output_xml = output_xml.to_string();
- trace!("mock.expect_post url:{}, mime:{}, msg:{}", url, mime, msg);
+ trace!("mock.expect_post url:{url}, mime:{mime}, msg:{msg}");
mock.expect_post()
.times(1)
.withf(move |actual_url, actual_mime, actual_msg| {
@@ -614,11 +620,10 @@ mod tests {
for (i, expected_uri) in expected_result.iter().enumerate().take(3) {
let mut mock = MockHttp::new();
- let profile = format!("00{}", i).to_string();
+ let profile = format!("00{i}").to_string();
let message = get_stream_uri_message(&profile);
let response = format!(
- "\nrtsp://192.168.{}.36:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_streamfalsefalsePT10S",
- i
+ "\nrtsp://192.168.{i}.36:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_streamfalsefalsePT10S"
);
configure_post(
&mut mock,
@@ -648,7 +653,8 @@ mod tests {
// empty response since do not check contents only successful response
let empty_response = "";
let response = format!(
- "\n{}", empty_response);
+ "\n{empty_response}"
+ );
let url = "test_inner_is_device_responding-url".to_string();
configure_post(
&mut mock,
diff --git a/discovery-handlers/onvif/src/username_token.rs b/discovery-handlers/onvif/src/username_token.rs
index 3cbea0538..7ffd2ed13 100644
--- a/discovery-handlers/onvif/src/username_token.rs
+++ b/discovery-handlers/onvif/src/username_token.rs
@@ -16,7 +16,7 @@ impl UsernameToken {
}
fn generate_token(username: &str, password: &str, nonce: &str, created: &str) -> UsernameToken {
- let concat = format!("{}{}{}", nonce, created, password);
+ let concat = format!("{nonce}{created}{password}");
let digest = {
let mut hasher = sha1::Sha1::new();
hasher.update(concat.as_bytes());
diff --git a/discovery-handlers/opcua/src/discovery_handler.rs b/discovery-handlers/opcua/src/discovery_handler.rs
index c9b9ddd27..0b9cb9bf0 100644
--- a/discovery-handlers/opcua/src/discovery_handler.rs
+++ b/discovery-handlers/opcua/src/discovery_handler.rs
@@ -1,11 +1,11 @@
-use super::{discovery_impl::do_standard_discovery, OPCUA_DISCOVERY_URL_LABEL};
+use super::{OPCUA_DISCOVERY_URL_LABEL, discovery_impl::do_standard_discovery};
use akri_discovery_utils::{
discovery::{
- discovery_handler::{deserialize_discovery_details, DISCOVERED_DEVICES_CHANNEL_CAPACITY},
+ DiscoverStream,
+ discovery_handler::{DISCOVERED_DEVICES_CHANNEL_CAPACITY, deserialize_discovery_details},
v0::{
- discovery_handler_server::DiscoveryHandler, Device, DiscoverRequest, DiscoverResponse,
+ Device, DiscoverRequest, DiscoverResponse, discovery_handler_server::DiscoveryHandler,
},
- DiscoverStream,
},
filtering::FilterList,
};
@@ -84,7 +84,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
mpsc::channel(DISCOVERED_DEVICES_CHANNEL_CAPACITY);
let discovery_handler_config: OpcuaDiscoveryDetails =
deserialize_discovery_details(&discover_request.discovery_details)
- .map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!("{}", e)))?;
+ .map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!("{e}")))?;
let mut previously_discovered_devices: Vec = Vec::new();
tokio::spawn(async move {
let discovery_method = discovery_handler_config.opcua_discovery_method.clone();
@@ -116,10 +116,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
.into_iter()
.map(|discovery_url| {
let mut properties = std::collections::HashMap::new();
- trace!(
- "discover - found OPC UA server at DiscoveryURL {}",
- discovery_url
- );
+ trace!("discover - found OPC UA server at DiscoveryURL {discovery_url}");
properties
.insert(OPCUA_DISCOVERY_URL_LABEL.to_string(), discovery_url.clone());
Device {
@@ -151,8 +148,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
.await
{
error!(
- "discover - for OPC UA failed to send discovery response with error {}",
- e
+ "discover - for OPC UA failed to send discovery response with error {e}"
);
if let Some(sender) = register_sender {
sender.send(()).await.unwrap();
diff --git a/discovery-handlers/opcua/src/discovery_impl.rs b/discovery-handlers/opcua/src/discovery_impl.rs
index a8d7e808c..d4561151d 100644
--- a/discovery-handlers/opcua/src/discovery_impl.rs
+++ b/discovery-handlers/opcua/src/discovery_impl.rs
@@ -1,9 +1,9 @@
use super::wrappers::{
- opcua_client_wrapper::{create_opcua_discovery_client, OpcuaClient},
+ opcua_client_wrapper::{OpcuaClient, create_opcua_discovery_client},
tcp_stream_wrapper::{TcpStream, TcpStreamImpl},
};
use ::url::Url;
-use akri_discovery_utils::filtering::{should_include, FilterList};
+use akri_discovery_utils::filtering::{FilterList, should_include};
use anyhow::Context;
use log::{error, info, trace};
use opcua::client::prelude::*;
@@ -31,10 +31,7 @@ pub fn do_standard_discovery(
discovery_urls: Vec,
filter_list: Option,
) -> Vec {
- info!(
- "do_standard_discovery - for DiscoveryUrls {:?}",
- discovery_urls
- );
+ info!("do_standard_discovery - for DiscoveryUrls {discovery_urls:?}");
let mut discovery_handler_client = create_opcua_discovery_client();
let tcp_stream = TcpStreamImpl {};
get_discovery_urls(
@@ -56,41 +53,42 @@ fn get_discovery_urls(
tcp_stream: impl TcpStream,
) -> Vec {
let mut discovery_urls: Vec = Vec::new();
- lds_urls.iter().for_each(|url| {
- if let Err(e) = test_tcp_connection(url, &tcp_stream) {
- error!(
- "get_discovery_urls - failed to make tcp connection with url {} with error {:?}",
- url, e
+ lds_urls
+ .iter()
+ .for_each(|url| match test_tcp_connection(url, &tcp_stream) {
+ Err(e) => {
+ error!(
+ "get_discovery_urls - failed to make tcp connection with url {url} with error {e:?}"
);
- } else {
- match discovery_handler_client.find_servers(url) {
- Ok(applications) => {
- trace!(
- "get_discovery_urls - Server at {} responded with {} Applications",
- url,
- applications.len()
- );
- let mut servers_discovery_urls: Vec = applications
- .iter()
- .filter_map(|application| {
- get_discovery_url_from_application_description(
- application,
- filter_list.as_ref(),
- url,
- )
- })
- .collect::>();
- discovery_urls.append(&mut servers_discovery_urls);
- }
- Err(err) => {
- trace!(
- "get_discovery_urls - cannot find servers on discovery server. Error {:?}",
- err
+ }
+ _ => {
+ match discovery_handler_client.find_servers(url) {
+ Ok(applications) => {
+ trace!(
+ "get_discovery_urls - Server at {} responded with {} Applications",
+ url,
+ applications.len()
+ );
+ let mut servers_discovery_urls: Vec = applications
+ .iter()
+ .filter_map(|application| {
+ get_discovery_url_from_application_description(
+ application,
+ filter_list.as_ref(),
+ url,
+ )
+ })
+ .collect::>();
+ discovery_urls.append(&mut servers_discovery_urls);
+ }
+ Err(err) => {
+ trace!(
+ "get_discovery_urls - cannot find servers on discovery server. Error {err:?}"
);
- }
- };
- }
- });
+ }
+ };
+ }
+ });
// Remove duplicates in the case that a server was registered with more than one LDS
discovery_urls.dedup();
discovery_urls
@@ -106,7 +104,7 @@ fn test_tcp_connection(url: &str, tcp_stream: &impl TcpStream) -> Result<(), any
Duration::from_secs(TCP_CONNECTION_TEST_TIMEOUT_SECS),
) {
Ok(_stream) => Ok(()),
- Err(e) => Err(anyhow::format_err!("{:?}", e)),
+ Err(e) => Err(anyhow::format_err!("{e:?}")),
}
}
@@ -134,14 +132,13 @@ fn get_discovery_url_from_application_description(
} else if !should_include(filter_list, server.application_name.text.as_ref()) {
trace!(
"get_discovery_url_from_application - Application {} has been filtered out by application name",
- server.application_name.text.to_string()
+ server.application_name.text
);
None
} else if let Some(ref server_discovery_urls) = server.discovery_urls {
// TODO: could two different DiscoveryUrls be registered as localhost: on different lds's?
trace!(
- "get_discovery_url_from_application - server has {:?} DiscoveryUrls",
- server_discovery_urls
+ "get_discovery_url_from_application - server has {server_discovery_urls:?} DiscoveryUrls"
);
// Pass the tcp DiscoveryURL by default, since it supports application authentication and
// is more frequently utilized in OPC UA else pass first one
@@ -157,8 +154,7 @@ fn get_discovery_url_from_application_description(
Ok(discovery_url) => Some(discovery_url),
Err(e) => {
trace!(
- "get_discovery_url_from_application - failed to resolve discovery url with error {:?}",
- e
+ "get_discovery_url_from_application - failed to resolve discovery url with error {e:?}"
);
None
}
@@ -177,8 +173,7 @@ fn get_socket_addr(url: &str) -> Result {
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",
- url
+ "format of OPC UA url {url} is not valid"
));
}
let host = url.host_str().unwrap();
@@ -187,7 +182,7 @@ fn get_socket_addr(url: &str) -> Result {
.ok_or_else(|| anyhow::format_err!("provided discoveryURL is missing port"))?;
// Convert host and port to socket address
- let addr_str = format!("{}:{}", host, port);
+ let addr_str = format!("{host}:{port}");
let addrs = addr_str.to_socket_addrs();
let addr = addrs.unwrap().next().unwrap();
Ok(addr)
@@ -203,15 +198,14 @@ fn get_discovery_url_ip(
.with_context(|| "could not parse url {discovery_url_str}")?;
if discovery_url.scheme() != OPC_TCP_SCHEME {
return Err(anyhow::format_err!(
- "format of OPC UA url {} is not valid",
- discovery_url
+ "format of OPC UA url {discovery_url} is not valid"
));
}
let mut path = discovery_url.path().to_string();
let host = discovery_url.host_str().unwrap();
let port = discovery_url.port().unwrap_or(DEFAULT_OPC_UA_SERVER_PORT);
- let addr_str = format!("{}:{}", host, port);
+ let addr_str = format!("{host}:{port}");
// check if the hostname can be resolved to socket address
match addr_str.to_socket_addrs() {
@@ -221,13 +215,12 @@ fn get_discovery_url_ip(
path.remove(0);
}
let url = if ip_url.path() == "" || ip_url.path() == "/" {
- format!("{}{}", ip_url, path)
+ format!("{ip_url}{path}")
} else {
ip_url_str.to_string()
};
trace!(
- "get_discovery_url_ip - cannot resolve the application url from server, using ip address instead of hostname: {}",
- url
+ "get_discovery_url_ip - cannot resolve the application url from server, using ip address instead of hostname: {url}"
);
Ok(url)
}
@@ -426,13 +419,15 @@ mod tests {
fn test_get_server_endpoints_invalid_url() {
let mut mock_client = MockOpcuaClient::new();
let mock_tcp_stream = MockTcpStream::new();
- assert!(get_discovery_urls(
- &mut mock_client,
- vec!["tcp://127.0.0.1:4855/".to_string()],
- None,
- mock_tcp_stream
+ assert!(
+ get_discovery_urls(
+ &mut mock_client,
+ vec!["tcp://127.0.0.1:4855/".to_string()],
+ None,
+ mock_tcp_stream
+ )
+ .is_empty()
)
- .is_empty())
}
#[test]
diff --git a/discovery-handlers/udev/src/discovery_handler.rs b/discovery-handlers/udev/src/discovery_handler.rs
index 21e49bd8e..be630a204 100644
--- a/discovery-handlers/udev/src/discovery_handler.rs
+++ b/discovery-handlers/udev/src/discovery_handler.rs
@@ -1,18 +1,18 @@
use super::{
- discovery_impl::{do_parse_and_find, insert_device_with_relatives, DeviceProperties},
+ discovery_impl::{DeviceProperties, do_parse_and_find, insert_device_with_relatives},
wrappers::udev_enumerator,
};
use akri_discovery_utils::discovery::{
- discovery_handler::{deserialize_discovery_details, DISCOVERED_DEVICES_CHANNEL_CAPACITY},
+ DiscoverStream,
+ discovery_handler::{DISCOVERED_DEVICES_CHANNEL_CAPACITY, deserialize_discovery_details},
v0::{
- discovery_handler_server::DiscoveryHandler, Device, DeviceSpec, DiscoverRequest,
- DiscoverResponse,
+ Device, DeviceSpec, DiscoverRequest, DiscoverResponse,
+ discovery_handler_server::DiscoveryHandler,
},
- DiscoverStream,
};
use async_trait::async_trait;
use log::{error, info, trace};
-use serde::{de, Deserialize, Deserializer};
+use serde::{Deserialize, Deserializer, de};
use std::collections::{HashMap, HashSet};
use std::time::Duration;
use tokio::sync::mpsc;
@@ -86,12 +86,12 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
mpsc::channel(DISCOVERED_DEVICES_CHANNEL_CAPACITY);
let discovery_handler_config: UdevDiscoveryDetails =
deserialize_discovery_details(&discover_request.discovery_details)
- .map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!("{}", e)))?;
+ .map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!("{e}")))?;
let mut previously_discovered_devices: Vec = Vec::new();
tokio::spawn(async move {
let udev_rules = discovery_handler_config.udev_rules.clone();
loop {
- trace!("discover - for udev rules {:?}", udev_rules);
+ trace!("discover - for udev rules {udev_rules:?}");
// Before each iteration, check if receiver has dropped
if discovered_devices_sender.is_closed() {
error!("discover - channel closed ... attempting to re-register with Agent");
@@ -112,20 +112,19 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
}
}
});
- trace!(
- "discover - mapping and returning devices at devpaths {:?}",
- devpaths
- );
+ trace!("discover - mapping and returning devices at devpaths {devpaths:?}");
let discovered_devices = devpaths
.into_iter()
.map(|(id, paths)| {
let mut properties = HashMap::new();
let mut device_specs = Vec::new();
for (i, (_, node)) in paths.into_iter().enumerate() {
- let property_suffix = discovery_handler_config
- .group_recursive
- .then(|| format!("_{}", i))
- .unwrap_or_default();
+ let property_suffix = if discovery_handler_config.group_recursive {
+ format!("_{i}")
+ } else {
+ Default::default()
+ };
+
if let Some(devnode) = node {
properties.insert(
super::UDEV_DEVNODE_LABEL_ID.to_string() + &property_suffix,
@@ -172,8 +171,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
.await
{
error!(
- "discover - for udev failed to send discovery response with error {}",
- e
+ "discover - for udev failed to send discovery response with error {e}"
);
if let Some(sender) = register_sender {
sender.send(()).await.unwrap();
diff --git a/discovery-handlers/udev/src/discovery_impl.rs b/discovery-handlers/udev/src/discovery_impl.rs
index e50d2f559..e991fa87f 100644
--- a/discovery-handlers/udev/src/discovery_impl.rs
+++ b/discovery-handlers/udev/src/discovery_impl.rs
@@ -2,14 +2,14 @@ use std::collections::HashSet;
use super::wrappers::{
udev_device::{
- get_attribute_value, get_devnode, get_devpath, get_driver, get_parent, get_property_value,
- get_subsystem, get_sysname, DeviceExt,
+ DeviceExt, get_attribute_value, get_devnode, get_devpath, get_driver, get_parent,
+ get_property_value, get_subsystem, get_sysname,
},
udev_enumerator::Enumerator,
};
use log::{error, info, trace};
-use pest::iterators::Pair;
use pest::Parser;
+use pest::iterators::Pair;
use regex::Regex;
const TAGS: &str = "TAGS";
@@ -35,10 +35,7 @@ pub fn do_parse_and_find(
) -> Result, anyhow::Error> {
let udev_filters = parse_udev_rule(udev_rule_string)?;
let devices = find_devices(enumerator, udev_filters)?;
- trace!(
- "do_parse_and_find - returning discovered devices with devpaths: {:?}",
- devices
- );
+ trace!("do_parse_and_find - returning discovered devices with devpaths: {devices:?}");
Ok(devices)
}
@@ -51,10 +48,7 @@ pub fn do_parse_and_find(
/// will be ignored.
/// Udev discovery is only interested in match fields, so all action fields, such as TEST, are ignored
fn parse_udev_rule(udev_rule_string: &str) -> Result, anyhow::Error> {
- info!(
- "parse_udev_rule - enter for udev rule string {}",
- udev_rule_string
- );
+ info!("parse_udev_rule - enter for udev rule string {udev_rule_string}");
let mut udev_filters: Vec = Vec::new();
// So long as parse succeeds, subsequent unwraps will not fails, since they are following the
@@ -97,8 +91,12 @@ fn parse_udev_rule(udev_rule_string: &str) -> Result, anyhow::Er
value: value.to_string(),
});
} else {
- return Err(anyhow::format_err!("parse_udev_rule - unsupported action operation for rule with field [{}], operation [{:?}], and value[{}]",
- inner_field.into_inner().as_str(), operation_rule, value));
+ return Err(anyhow::format_err!(
+ "parse_udev_rule - unsupported action operation for rule with field [{}], operation [{:?}], and value[{}]",
+ inner_field.into_inner().as_str(),
+ operation_rule,
+ value
+ ));
}
}
Ok(udev_filters)
@@ -110,7 +108,7 @@ fn find_devices(
udev_filters: Vec,
) -> std::io::Result> {
let mut enumerator = enumerator;
- trace!("find_devices - enter with udev_filters {:?}", udev_filters);
+ trace!("find_devices - enter with udev_filters {udev_filters:?}");
// Enumerator scans sys devices for its filters. Only certain filters can be applied to it.
// Divide device fields by type of filter than can be applied to Enumerator, if any
@@ -167,10 +165,7 @@ fn find_devices(
/// This adds equality filters to the Enumerator
fn filter_by_match_udev_filters(enumerator: &mut impl Enumerator, udev_filters: Vec<&UdevFilter>) {
- trace!(
- "enumerator_match_udev_filters - enter with udev_filters {:?}",
- udev_filters
- );
+ trace!("enumerator_match_udev_filters - enter with udev_filters {udev_filters:?}");
for udev_filter in udev_filters {
match udev_filter.field.as_rule() {
Rule::devpath => {
@@ -225,10 +220,7 @@ fn filter_by_nomatch_udev_filters(
enumerator: &mut impl Enumerator,
udev_filters: Vec<&UdevFilter>,
) {
- trace!(
- "enumerator_nomatch_udev_filters - enter with udev_filters {:?}",
- udev_filters
- );
+ trace!("enumerator_nomatch_udev_filters - enter with udev_filters {udev_filters:?}");
for udev_filter in udev_filters {
match udev_filter.field.as_rule() {
Rule::attribute => {
@@ -262,10 +254,7 @@ fn filter_by_remaining_udev_filters(
devices: Vec,
udev_filters: Vec<&UdevFilter>,
) -> Vec {
- trace!(
- "filter_by_remaining_udev_filters - enter with udev_filters {:?}",
- udev_filters
- );
+ trace!("filter_by_remaining_udev_filters - enter with udev_filters {udev_filters:?}");
let mut mutable_devices = devices;
for udev_filter in udev_filters {
let value_regex = Regex::new(&udev_filter.value).unwrap();
@@ -524,7 +513,7 @@ fn get_device_relatives<'a>(
for relative in possible_relatives {
match relative {
parent if device_path.starts_with(relative.as_str()) => {
- return (Some(parent.clone()), vec![])
+ return (Some(parent.clone()), vec![]);
}
child if relative.starts_with(device_path) => childrens.push(child.clone()),
_ => (),
@@ -555,13 +544,13 @@ pub fn insert_device_with_relatives(
#[cfg(test)]
mod discovery_tests {
- use super::super::wrappers::udev_enumerator::{create_enumerator, MockEnumerator};
+ use super::super::wrappers::udev_enumerator::{MockEnumerator, create_enumerator};
use super::*;
use std::{
collections::HashMap,
ffi::OsStr,
fs::File,
- io::{prelude::*, BufReader},
+ io::{BufReader, prelude::*},
path::Path,
};
#[derive(Clone)]
diff --git a/discovery-utils/src/discovery/mod.rs b/discovery-utils/src/discovery/mod.rs
index 3243188ff..ef6c4ab24 100644
--- a/discovery-utils/src/discovery/mod.rs
+++ b/discovery-utils/src/discovery/mod.rs
@@ -12,8 +12,8 @@ pub mod discovery_handler {
use super::{
server::run_discovery_server,
v0::{
- discovery_handler_server::DiscoveryHandler,
- register_discovery_handler_request::EndpointType, RegisterDiscoveryHandlerRequest,
+ RegisterDiscoveryHandlerRequest, discovery_handler_server::DiscoveryHandler,
+ register_discovery_handler_request::EndpointType,
},
};
use log::trace;
@@ -41,7 +41,7 @@ pub mod discovery_handler {
Ok(pod_ip) => {
trace!("run_discovery_handler - registering with Agent with IP endpoint");
use_uds = false;
- format!("{}:{}", pod_ip, DISCOVERY_PORT)
+ format!("{pod_ip}:{DISCOVERY_PORT}")
}
Err(_) => {
trace!("run_discovery_handler - registering with Agent with uds endpoint");
@@ -86,8 +86,7 @@ pub mod discovery_handler {
{
let discovery_handler_config: T = serde_yaml::from_str(discovery_details).map_err(|e| {
anyhow::format_err!(
- "Configuration discovery details improperly configured with error {:?}",
- e
+ "Configuration discovery details improperly configured with error {e:?}"
)
})?;
Ok(discovery_handler_config)
@@ -97,7 +96,7 @@ pub mod discovery_handler {
#[cfg(any(feature = "mock-discovery-handler", test))]
pub mod mock_discovery_handler {
use super::v0::{
- discovery_handler_server::DiscoveryHandler, Device, DiscoverRequest, DiscoverResponse,
+ Device, DiscoverRequest, DiscoverResponse, discovery_handler_server::DiscoveryHandler,
};
use akri_shared::uds::unix_stream;
use async_trait::async_trait;
@@ -257,10 +256,10 @@ pub mod server {
pub mod tests {
use super::super::{
mock_discovery_handler::{
- get_mock_discovery_handler_dir_and_endpoint, run_mock_discovery_handler,
- MockDiscoveryHandler,
+ MockDiscoveryHandler, get_mock_discovery_handler_dir_and_endpoint,
+ run_mock_discovery_handler,
},
- v0::{discovery_handler_client::DiscoveryHandlerClient, DiscoverRequest},
+ v0::{DiscoverRequest, discovery_handler_client::DiscoveryHandlerClient},
};
use super::*;
use std::collections::HashMap;
@@ -268,8 +267,8 @@ pub mod server {
use tempfile::Builder;
use tokio::net::UnixStream;
use tonic::{
- transport::{Endpoint, Uri},
Request,
+ transport::{Endpoint, Uri},
};
#[tokio::test]
@@ -313,16 +312,19 @@ pub mod server {
.prefix("discovery-handlers")
.tempdir()
.unwrap();
- if let Err(e) = internal_run_discovery_server(
+ match internal_run_discovery_server(
discovery_handler,
"random",
discovery_handler_temp_dir.path().to_str().unwrap(),
)
.await
{
- assert!((*e).to_string().contains("invalid socket address syntax"))
- } else {
- panic!("should be invalid address error")
+ Err(e) => {
+ assert!((*e).to_string().contains("invalid socket address syntax"))
+ }
+ _ => {
+ panic!("should be invalid address error")
+ }
}
}
}
diff --git a/discovery-utils/src/discovery/v0.rs b/discovery-utils/src/discovery/v0.rs
index 08781a68e..e691f1458 100644
--- a/discovery-utils/src/discovery/v0.rs
+++ b/discovery-utils/src/discovery/v0.rs
@@ -175,11 +175,11 @@ pub mod registration_client {
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
- http::Request,
- Response = http::Response<
- >::ResponseBody,
+ http::Request,
+ Response = http::Response<
+ >::ResponseBody,
+ >,
>,
- >,
>>::Error:
Into + Send + Sync,
{
@@ -281,11 +281,11 @@ pub mod discovery_handler_client {
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
- http::Request,
- Response = http::Response<
- >::ResponseBody,
+ http::Request,
+ Response = http::Response<
+ >::ResponseBody,
+ >,
>,
- >,
>>::Error:
Into + Send + Sync,
{
diff --git a/discovery-utils/src/registration_client.rs b/discovery-utils/src/registration_client.rs
index 32da1384a..d89d38fa3 100644
--- a/discovery-utils/src/registration_client.rs
+++ b/discovery-utils/src/registration_client.rs
@@ -1,11 +1,11 @@
use super::discovery::v0::{
- registration_client::RegistrationClient, RegisterDiscoveryHandlerRequest,
+ RegisterDiscoveryHandlerRequest, registration_client::RegistrationClient,
};
use log::{info, trace};
use std::convert::TryFrom;
use tonic::{
- transport::{Endpoint, Uri},
Request,
+ transport::{Endpoint, Uri},
};
pub async fn register_discovery_handler(
diff --git a/samples/brokers/udev-video-broker/src/main.rs b/samples/brokers/udev-video-broker/src/main.rs
index 9a8dcc3cc..8dedcfe2d 100644
--- a/samples/brokers/udev-video-broker/src/main.rs
+++ b/samples/brokers/udev-video-broker/src/main.rs
@@ -2,7 +2,7 @@ mod util;
#[macro_use]
extern crate lazy_static;
use akri_shared::{
- akri::{metrics::run_metrics_server, API_NAMESPACE},
+ akri::{API_NAMESPACE, metrics::run_metrics_server},
os::env_var::{ActualEnvVarQuery, EnvVarQuery},
};
use log::{info, trace};
@@ -22,13 +22,10 @@ pub const UDEV_DEVNODE_LABEL_ID_PATTERN: &str = "UDEV_DEVNODE_[A-F0-9]{6,6}$";
#[tokio::main]
async fn main() -> Result<(), Box> {
- println!("{} udev_broker ... env_logger::init", API_NAMESPACE);
+ println!("{API_NAMESPACE} udev_broker ... env_logger::init");
env_logger::try_init().unwrap();
- println!(
- "{} udev_broker ... env_logger::init finished",
- API_NAMESPACE
- );
- info!("{} Udev Broker logging started", API_NAMESPACE);
+ println!("{API_NAMESPACE} udev_broker ... env_logger::init finished");
+ info!("{API_NAMESPACE} Udev Broker logging started");
tokio::spawn(async move {
run_metrics_server().await.unwrap();
@@ -73,7 +70,7 @@ fn get_video_devnode(env_var_query: &impl EnvVarQuery) -> String {
.first()
.expect("devnode not set in environment variable");
- trace!("get_video_devnode - found devnode {}", device_devnode);
+ trace!("get_video_devnode - found devnode {device_devnode}");
device_devnode.to_string()
}
diff --git a/samples/brokers/udev-video-broker/src/util/camera.rs b/samples/brokers/udev-video-broker/src/util/camera.rs
index 437b09cd8..a1ee7fe5d 100644
--- a/samples/brokers/udev-video-broker/src/util/camera.rs
+++ b/samples/brokers/udev-video-broker/src/util/camera.rs
@@ -53,11 +53,11 @@ pub mod camera_client {
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
- http::Request,
- Response = http::Response<
- >::ResponseBody,
+ http::Request,
+ Response = http::Response<
+ >::ResponseBody,
+ >,
>,
- >,
>>::Error:
Into + Send + Sync,
{
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 c9e66871e..43a7469bd 100644
--- a/samples/brokers/udev-video-broker/src/util/camera_capturer.rs
+++ b/samples/brokers/udev-video-broker/src/util/camera_capturer.rs
@@ -40,7 +40,7 @@ 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 format = &format_string.as_bytes();
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();
@@ -63,10 +63,7 @@ fn get_format(env_var_query: &impl EnvVarQuery, format_options: Vec) ->
let format_to_find = match env_var_query.get_env_var(FORMAT) {
Ok(format) => format,
Err(_) => {
- trace!(
- "get_format - format not set ... trying to use {:?}",
- DEFAULT_FORMAT
- );
+ trace!("get_format - format not set ... trying to use {DEFAULT_FORMAT:?}");
DEFAULT_FORMAT.to_string()
}
};
@@ -75,16 +72,15 @@ fn get_format(env_var_query: &impl EnvVarQuery, format_options: Vec) ->
if !format_options.contains(&DEFAULT_FORMAT.to_string()) {
trace!(
"get_format - camera does not support {:?} format, using {:?} format",
- DEFAULT_FORMAT,
- format_options[0]
+ DEFAULT_FORMAT, format_options[0]
);
format_options[0].clone()
} else {
- trace!("get_format - using default {:?} format", DEFAULT_FORMAT);
+ trace!("get_format - using default {DEFAULT_FORMAT:?} format");
DEFAULT_FORMAT.to_string()
}
} else {
- trace!("get_format - using {:?} format", format_to_find);
+ trace!("get_format - using {format_to_find:?} format");
format_to_find
}
}
@@ -106,12 +102,11 @@ fn get_interval(env_var_query: &impl EnvVarQuery, interval_info: rscam::Interval
if !interval_options.contains(&interval_to_validate) {
trace!(
"get_interval - camera does not support {:?} interval, using {:?} interval",
- interval_to_validate,
- interval_options[0]
+ interval_to_validate, interval_options[0]
);
interval_options[0]
} else {
- trace!("get_interval - using {:?} interval", interval_to_validate);
+ trace!("get_interval - using {interval_to_validate:?} interval");
interval_to_validate
}
}
@@ -156,15 +151,11 @@ fn get_resolution(
if !resolution_options.contains(&resolution_to_validate) {
trace!(
"get_resolution - camera does not support {:?} resolution, using {:?} resolution",
- resolution_to_validate,
- resolution_options[0]
+ resolution_to_validate, resolution_options[0]
);
resolution_options[0]
} else {
- trace!(
- "get_resolution - using resolution {:?}",
- resolution_to_validate
- );
+ trace!("get_resolution - using resolution {resolution_to_validate:?}");
resolution_to_validate
}
}
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 b5ddc3c7d..0bb059a6c 100644
--- a/samples/brokers/udev-video-broker/src/util/camera_service.rs
+++ b/samples/brokers/udev-video-broker/src/util/camera_service.rs
@@ -1,8 +1,8 @@
use super::super::FRAME_COUNT_METRIC;
use super::camera::{
+ NotifyRequest, NotifyResponse,
camera_client::CameraClient,
camera_server::{Camera, CameraServer},
- NotifyRequest, NotifyResponse,
};
use log::{info, trace};
use rscam::Camera as RsCamera;
@@ -51,11 +51,11 @@ pub async fn serve(devnode: &str, camera_capturer: RsCamera) -> Result<(), Strin
};
let service = CameraServer::new(camera_service);
- let addr_str = format!("{}:{}", CAMERA_SERVICE_SERVER_ADDRESS, CAMERA_SERVICE_PORT);
+ let addr_str = format!("{CAMERA_SERVICE_SERVER_ADDRESS}:{CAMERA_SERVICE_PORT}");
let addr: SocketAddr = match addr_str.parse() {
Ok(sock) => sock,
Err(e) => {
- return Err(format!("Unable to parse socket: {:?}", e));
+ return Err(format!("Unable to parse socket: {e:?}"));
}
};
@@ -87,17 +87,15 @@ pub async fn serve(devnode: &str, camera_capturer: RsCamera) -> Result<(), Strin
< start_plus_10)
&& !connected
{
- let client_addr_str = format!(
- "http://{}:{}",
- CAMERA_SERVICE_TEST_LOCALHOST, CAMERA_SERVICE_PORT
- );
+ let client_addr_str =
+ format!("http://{CAMERA_SERVICE_TEST_LOCALHOST}:{CAMERA_SERVICE_PORT}");
connected = match CameraClient::connect(client_addr_str).await {
Ok(_) => {
trace!("Connected to server, stop polling");
true
}
Err(e) => {
- trace!("Unable to connect to server, continue polling: {:?}", e);
+ trace!("Unable to connect to server, continue polling: {e:?}");
tokio::time::sleep(Duration::from_secs(1)).await;
false
}
diff --git a/shared/Cargo.toml b/shared/Cargo.toml
index 0651529cf..3457ff0a6 100644
--- a/shared/Cargo.toml
+++ b/shared/Cargo.toml
@@ -11,12 +11,12 @@ rust-version.workspace = true
[dependencies]
anyhow = "1.0.38"
async-trait = "0.1.0"
-either = '*'
-k8s-openapi = { version = "0.20.0", default-features = false, features = ["schemars", "v1_23"] }
-kube = { version = "0.87.1", features = ["derive"] }
+either = "1.13"
+k8s-openapi = { version = "0.22.0", default-features = false, features = ["schemars", "v1_25"] }
+kube = { version = "0.91.0", features = ["derive" ] }
log = "0.4"
mockall = "0.12"
-prometheus = { version = "0.12.0", features = ["process"] }
+prometheus = { version = "0.13.4", features = ["process"] }
rand = "0.8.3"
schemars = "0.8.0"
serde = "1.0"
diff --git a/shared/src/akri/configuration.rs b/shared/src/akri/configuration.rs
index d2dd59532..92f0d0879 100644
--- a/shared/src/akri/configuration.rs
+++ b/shared/src/akri/configuration.rs
@@ -151,9 +151,9 @@ pub struct ConfigurationSpec {
pub broker_properties: HashMap,
}
-fn immutable_dh_info(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
+fn immutable_dh_info(r#gen: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
let mut schema: schemars::schema::SchemaObject =
- ::json_schema(gen).into();
+ ::json_schema(r#gen).into();
schema.extensions.insert(
"x-kubernetes-validations".to_owned(),
serde_json::from_str(r#"[{"message": "Value is immutable", "rule": "self == oldSelf"}]"#)
@@ -186,14 +186,11 @@ pub async fn get_configurations(kube_client: &Client) -> Result {
- log::trace!(
- "get_configurations kube_client.request returned kube error: {:?}",
- ae
- );
+ log::trace!("get_configurations kube_client.request returned kube error: {ae:?}");
Err(ae.into())
}
Err(e) => {
- log::trace!("get_configurations kube_client.request error: {:?}", e);
+ log::trace!("get_configurations kube_client.request error: {e:?}");
Err(e.into())
}
}
@@ -225,7 +222,7 @@ pub async fn find_configuration(
log::trace!("find_configuration enter");
let configurations_client: Api = Api::namespaced(kube_client.clone(), namespace);
- log::trace!("find_configuration getting instance with name {}", name);
+ log::trace!("find_configuration getting instance with name {name}");
match configurations_client.get(name).await {
Ok(configuration_retrieved) => {
@@ -234,14 +231,11 @@ pub async fn find_configuration(
}
Err(e) => match e {
kube::Error::Api(ae) => {
- log::trace!(
- "find_configuration kube_client.request returned kube error: {:?}",
- 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);
+ log::trace!("find_configuration kube_client.request error: {e:?}");
Err(anyhow::anyhow!(e))
}
},
diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs
index 22a1eb485..e2762a755 100644
--- a/shared/src/akri/instance.rs
+++ b/shared/src/akri/instance.rs
@@ -1,7 +1,7 @@
use super::{API_NAMESPACE, API_VERSION};
use kube::{
- api::{Api, DeleteParams, ListParams, ObjectList, ObjectMeta, Patch, PatchParams, PostParams},
Client, CustomResource,
+ api::{Api, DeleteParams, ListParams, ObjectList, ObjectMeta, Patch, PatchParams, PostParams},
};
use k8s_openapi::apimachinery::pkg::apis::meta::v1::OwnerReference;
@@ -89,8 +89,8 @@ pub struct InstanceSpec {
pub device_usage: HashMap,
}
-fn ssa_nodes_set(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
- let mut schema: schemars::schema::SchemaObject = >::json_schema(gen).into();
+fn ssa_nodes_set(r#gen: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
+ let mut schema: schemars::schema::SchemaObject = >::json_schema(r#gen).into();
schema.extensions.insert(
"x-kubernetes-list-type".to_owned(),
serde_json::Value::String("set".to_owned()),
@@ -98,9 +98,9 @@ fn ssa_nodes_set(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::
schema.into()
}
-fn ssa_usage_granular(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
+fn ssa_usage_granular(r#gen: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
let mut schema: schemars::schema::SchemaObject =
- >::json_schema(gen).into();
+ >::json_schema(r#gen).into();
schema.extensions.insert(
"x-kubernetes-map-type".to_owned(),
serde_json::Value::String("granular".to_owned()),
@@ -133,14 +133,11 @@ pub async fn get_instances(kube_client: &Client) -> Result {
- log::trace!(
- "get_instances kube_client.request returned kube error: {:?}",
- ae
- );
+ log::trace!("get_instances kube_client.request returned kube error: {ae:?}");
Err(ae.into())
}
Err(e) => {
- log::trace!("get_instances kube_client.request error: {:?}", e);
+ log::trace!("get_instances kube_client.request error: {e:?}");
Err(e.into())
}
}
@@ -172,7 +169,7 @@ pub async fn find_instance(
log::trace!("find_instance enter");
let instances_client: Api = Api::namespaced(kube_client.clone(), namespace);
- log::trace!("find_instance getting instance with name {}", name);
+ log::trace!("find_instance getting instance with name {name}");
match instances_client.get(name).await {
Ok(instance_retrieved) => {
@@ -181,14 +178,11 @@ pub async fn find_instance(
}
Err(e) => match e {
kube::Error::Api(ae) => {
- log::trace!(
- "find_instance kube_client.request returned kube error: {:?}",
- ae
- );
+ log::trace!("find_instance kube_client.request returned kube error: {ae:?}");
Err(anyhow::anyhow!(ae))
}
_ => {
- log::trace!("find_instance kube_client.request error: {:?}", e);
+ log::trace!("find_instance kube_client.request error: {e:?}");
Err(anyhow::anyhow!(e))
}
},
@@ -240,7 +234,7 @@ pub async fn create_instance(
instance.metadata = ObjectMeta {
name: Some(name.to_string()),
owner_references: Some(vec![OwnerReference {
- api_version: format!("{}/{}", API_NAMESPACE, API_VERSION),
+ api_version: format!("{API_NAMESPACE}/{API_VERSION}"),
kind: "Configuration".to_string(),
controller: Some(true),
block_owner_deletion: Some(true),
@@ -258,14 +252,11 @@ pub async fn create_instance(
Ok(())
}
Err(kube::Error::Api(ae)) => {
- log::trace!(
- "create_instance kube_client.request returned kube error: {:?}",
- ae
- );
+ log::trace!("create_instance kube_client.request returned kube error: {ae:?}");
Err(ae.into())
}
Err(e) => {
- log::trace!("create_instance kube_client.request error: {:?}", e);
+ log::trace!("create_instance kube_client.request error: {e:?}");
Err(e.into())
}
}
@@ -304,14 +295,11 @@ pub async fn delete_instance(
Ok(())
}
Err(kube::Error::Api(ae)) => {
- log::trace!(
- "delete_instance kube_client.request returned kube error: {:?}",
- ae
- );
+ log::trace!("delete_instance kube_client.request returned kube error: {ae:?}");
Err(ae.into())
}
Err(e) => {
- log::trace!("delete_instance kube_client.request error: {:?}", e);
+ log::trace!("delete_instance kube_client.request error: {e:?}");
Err(e.into())
}
}
@@ -367,14 +355,11 @@ pub async fn update_instance(
Ok(())
}
Err(kube::Error::Api(ae)) => {
- log::trace!(
- "update_instance kube_client.request returned kube error: {:?}",
- ae
- );
+ log::trace!("update_instance kube_client.request returned kube error: {ae:?}");
Err(ae.into())
}
Err(e) => {
- log::trace!("update_instance kube_client.request error: {:?}", e);
+ log::trace!("update_instance kube_client.request error: {e:?}");
Err(e.into())
}
}
@@ -451,8 +436,7 @@ pub mod device_usage {
DeviceUsageKind::Free => {
if !node_name.is_empty() {
return Err(anyhow::anyhow!(
- "Invalid input parameter, node name: {} provided for free node usage",
- node_name
+ "Invalid input parameter, node name: {node_name} provided for free node usage"
));
};
}
diff --git a/shared/src/akri/metrics.rs b/shared/src/akri/metrics.rs
index 5d15472a4..4ce9a1578 100644
--- a/shared/src/akri/metrics.rs
+++ b/shared/src/akri/metrics.rs
@@ -28,7 +28,7 @@ pub async fn run_metrics_server() -> Result<(), Box p.parse::()?,
Err(_) => 8080,
};
- info!("starting metrics server on port {} at /metrics", port);
+ info!("starting metrics server on port {port} at /metrics");
let metrics_route = warp::path!("metrics").and_then(metrics_handler);
warp::serve(metrics_route).run(([0, 0, 0, 0], port)).await;
Ok(())
diff --git a/shared/src/k8s/api.rs b/shared/src/k8s/api.rs
index 88ec79a0f..94613fdc8 100644
--- a/shared/src/k8s/api.rs
+++ b/shared/src/k8s/api.rs
@@ -3,9 +3,9 @@ use std::fmt::Debug;
use async_trait::async_trait;
use either::Either;
use kube::{
+ Error, Resource, ResourceExt,
api::{Patch, PatchParams},
core::{ObjectList, ObjectMeta, PartialObjectMetaExt, Status},
- Error, Resource, ResourceExt,
};
use mockall::automock;
use serde::de::DeserializeOwned;
@@ -31,12 +31,12 @@ pub trait Api: Send + Sync {
self.set_finalizers(
&obj.name_any(),
Some(vec![finalizer.to_string()]),
- &format!("{}-fin", finalizer),
+ &format!("{finalizer}-fin"),
)
.await
}
async fn remove_finalizer(&self, obj: &T, finalizer: &str) -> Result<(), Error> {
- self.set_finalizers(&obj.name_any(), None, &format!("{}-fin", finalizer))
+ self.set_finalizers(&obj.name_any(), None, &format!("{finalizer}-fin"))
.await
}
async fn set_finalizers(
diff --git a/shared/src/k8s/job.rs b/shared/src/k8s/job.rs
index bcf5c238a..ddff6e91d 100644
--- a/shared/src/k8s/job.rs
+++ b/shared/src/k8s/job.rs
@@ -1,10 +1,10 @@
-use super::super::akri::{instance::Instance, API_NAMESPACE};
+use super::super::akri::{API_NAMESPACE, instance::Instance};
use super::{
+ ERROR_CONFLICT, ERROR_NOT_FOUND, OwnershipInfo,
pod::modify_pod_spec,
pod::{
AKRI_CONFIGURATION_LABEL_NAME, AKRI_INSTANCE_LABEL_NAME, APP_LABEL_ID, CONTROLLER_LABEL_ID,
},
- OwnershipInfo, ERROR_CONFLICT, ERROR_NOT_FOUND,
};
use either::Either;
use k8s_openapi::api::batch::v1::{Job, JobSpec};
@@ -56,8 +56,7 @@ pub async fn find_jobs_with_selector(
) -> Result, anyhow::Error> {
trace!(
"find_jobs_with_selector with label_selector={:?} field_selector={:?}",
- &label_selector,
- &field_selector
+ &label_selector, &field_selector
);
let jobs: Api = Api::all(kube_client);
let job_list_params = ListParams {
@@ -480,7 +479,7 @@ mod broker_jobspec_tests {
.kind
);
assert_eq!(
- format!("{}/{}", API_NAMESPACE, API_VERSION),
+ format!("{API_NAMESPACE}/{API_VERSION}"),
job.metadata
.owner_references
.as_ref()
@@ -489,23 +488,25 @@ mod broker_jobspec_tests {
.unwrap()
.api_version
);
- assert!(job
- .metadata
- .owner_references
- .as_ref()
- .unwrap()
- .first()
- .unwrap()
- .controller
- .unwrap());
- assert!(job
- .metadata
- .owner_references
- .as_ref()
- .unwrap()
- .first()
- .unwrap()
- .block_owner_deletion
- .unwrap());
+ assert!(
+ job.metadata
+ .owner_references
+ .as_ref()
+ .unwrap()
+ .first()
+ .unwrap()
+ .controller
+ .unwrap()
+ );
+ assert!(
+ job.metadata
+ .owner_references
+ .as_ref()
+ .unwrap()
+ .first()
+ .unwrap()
+ .block_owner_deletion
+ .unwrap()
+ );
}
}
diff --git a/shared/src/k8s/mod.rs b/shared/src/k8s/mod.rs
index 9f607be3d..7d64b8bc4 100644
--- a/shared/src/k8s/mod.rs
+++ b/shared/src/k8s/mod.rs
@@ -1,10 +1,9 @@
use super::akri::{
- configuration,
+ API_NAMESPACE, API_VERSION, configuration,
configuration::{Configuration, ConfigurationList},
instance,
instance::{Instance, InstanceList, InstanceSpec},
- retry::{random_delay, MAX_INSTANCE_UPDATE_TRIES},
- API_NAMESPACE, API_VERSION,
+ retry::{MAX_INSTANCE_UPDATE_TRIES, random_delay},
};
use async_trait::async_trait;
use k8s_openapi::api::batch::v1::Job;
@@ -55,7 +54,7 @@ impl OwnershipInfo {
pub fn get_api_version(&self) -> String {
match self.object_type {
OwnershipType::Instance | OwnershipType::Configuration => {
- format!("{}/{}", API_NAMESPACE, API_VERSION)
+ format!("{API_NAMESPACE}/{API_VERSION}")
}
OwnershipType::Pod | OwnershipType::Service => "core/v1".to_string(),
}
@@ -613,22 +612,22 @@ pub async fn try_delete_instance(
.await
{
Ok(()) => {
- log::trace!("try_delete_instance - deleted Instance {}", instance_name);
+ log::trace!("try_delete_instance - deleted Instance {instance_name}");
break;
}
Err(e) => {
if let Some(ae) = e.downcast_ref::() {
if ae.code == ERROR_NOT_FOUND {
log::trace!(
- "try_delete_instance - discovered Instance {} already deleted",
- instance_name
+ "try_delete_instance - discovered Instance {instance_name} already deleted"
);
break;
}
}
log::error!(
"try_delete_instance - tried to delete Instance {} but still exists. {} retries left.",
- instance_name, MAX_INSTANCE_UPDATE_TRIES - x - 1
+ instance_name,
+ MAX_INSTANCE_UPDATE_TRIES - x - 1
);
if x == MAX_INSTANCE_UPDATE_TRIES - 1 {
return Err(e);
@@ -702,7 +701,7 @@ pub mod test_ownership {
uid.to_string(),
);
assert_eq!(
- format!("{}/{}", API_NAMESPACE, API_VERSION),
+ format!("{API_NAMESPACE}/{API_VERSION}"),
ownership.get_api_version()
);
assert_eq!("Configuration", &ownership.get_kind());
@@ -718,7 +717,7 @@ pub mod test_ownership {
let ownership =
OwnershipInfo::new(OwnershipType::Instance, name.to_string(), uid.to_string());
assert_eq!(
- format!("{}/{}", API_NAMESPACE, API_VERSION),
+ format!("{API_NAMESPACE}/{API_VERSION}"),
ownership.get_api_version()
);
assert_eq!("Instance", &ownership.get_kind());
diff --git a/shared/src/k8s/node.rs b/shared/src/k8s/node.rs
index 4f7f518fb..75f0acb67 100644
--- a/shared/src/k8s/node.rs
+++ b/shared/src/k8s/node.rs
@@ -19,7 +19,7 @@ use log::trace;
/// # }
/// ```
pub async fn find_node(name: &str, kube_client: Client) -> Result {
- trace!("find_node with name={}", name);
+ 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;
diff --git a/shared/src/k8s/pod.rs b/shared/src/k8s/pod.rs
index a5b109dfc..5a672a6e6 100644
--- a/shared/src/k8s/pod.rs
+++ b/shared/src/k8s/pod.rs
@@ -1,6 +1,6 @@
use super::{
- super::akri::API_NAMESPACE, OwnershipInfo, ERROR_CONFLICT, ERROR_NOT_FOUND,
- NODE_SELECTOR_OP_IN, OBJECT_NAME_FIELD, RESOURCE_REQUIREMENTS_KEY,
+ super::akri::API_NAMESPACE, ERROR_CONFLICT, ERROR_NOT_FOUND, NODE_SELECTOR_OP_IN,
+ OBJECT_NAME_FIELD, OwnershipInfo, RESOURCE_REQUIREMENTS_KEY,
};
use either::Either;
use k8s_openapi::api::core::v1::{
@@ -62,8 +62,7 @@ pub async fn find_pods_with_selector(
) -> Result, anyhow::Error> {
trace!(
"find_pods_with_selector with label_selector={:?} field_selector={:?}",
- &label_selector,
- &field_selector
+ &label_selector, &field_selector
);
let pods: Api = Api::all(kube_client);
let pod_list_params = ListParams {
@@ -102,13 +101,13 @@ pub fn create_broker_app_name(
// node-specific content. To ensure uniqueness of the Pod/Job we are creating,
// prepend the node name here.
match node_to_run_broker_on {
- Some(n) => format!("{}-{}-{}", n, normalized_instance_name, app_name_suffix),
- None => format!("{}-{}", normalized_instance_name, app_name_suffix),
+ Some(n) => format!("{n}-{normalized_instance_name}-{app_name_suffix}"),
+ None => format!("{normalized_instance_name}-{app_name_suffix}"),
}
} else {
// If the device capability is NOT shared, the instance name will contain
// node-specific content, which guarantees uniqueness.
- format!("{}-{}", normalized_instance_name, app_name_suffix)
+ format!("{normalized_instance_name}-{app_name_suffix}")
}
}
@@ -685,7 +684,7 @@ mod broker_podspec_tests {
.kind
);
assert_eq!(
- &format!("{}/{}", API_NAMESPACE, API_VERSION),
+ &format!("{API_NAMESPACE}/{API_VERSION}"),
&pod.metadata
.clone()
.owner_references
@@ -694,24 +693,26 @@ mod broker_podspec_tests {
.unwrap()
.api_version
);
- assert!(pod
- .metadata
- .clone()
- .owner_references
- .unwrap()
- .first()
- .unwrap()
- .controller
- .unwrap());
- assert!(pod
- .metadata
- .clone()
- .owner_references
- .unwrap()
- .first()
- .unwrap()
- .block_owner_deletion
- .unwrap());
+ assert!(
+ pod.metadata
+ .clone()
+ .owner_references
+ .unwrap()
+ .first()
+ .unwrap()
+ .controller
+ .unwrap()
+ );
+ assert!(
+ pod.metadata
+ .clone()
+ .owner_references
+ .unwrap()
+ .first()
+ .unwrap()
+ .block_owner_deletion
+ .unwrap()
+ );
// Validate existing and new affinity exist
assert_eq!(
diff --git a/shared/src/k8s/service.rs b/shared/src/k8s/service.rs
index 90f9849a2..7a56fc3a8 100644
--- a/shared/src/k8s/service.rs
+++ b/shared/src/k8s/service.rs
@@ -1,9 +1,9 @@
use super::{
super::akri::API_NAMESPACE,
+ ERROR_NOT_FOUND, OwnershipInfo,
pod::{
AKRI_CONFIGURATION_LABEL_NAME, AKRI_INSTANCE_LABEL_NAME, APP_LABEL_ID, CONTROLLER_LABEL_ID,
},
- OwnershipInfo, ERROR_NOT_FOUND,
};
use either::Either;
use k8s_openapi::api::core::v1::{Service, ServiceSpec};
@@ -72,10 +72,10 @@ pub fn create_service_app_name(
if node_specific_svc {
// If this is the node specific service, use the insrtance name which
// contains node-specific content.
- format!("{}-{}", normalized_instance_name, svc_suffix)
+ format!("{normalized_instance_name}-{svc_suffix}")
} else {
// If this is NOT the node specific service, use the capability name.
- format!("{}-{}", configuration_name, svc_suffix)
+ format!("{configuration_name}-{svc_suffix}")
}
}
@@ -385,8 +385,7 @@ pub async fn update_service(
) -> Result<(), anyhow::Error> {
trace!(
"update_service enter name:{} namespace: {}",
- &name,
- &namespace
+ &name, &namespace
);
let svcs: Api = Api::namespaced(kube_client, namespace);
@@ -400,14 +399,11 @@ pub async fn update_service(
Ok(())
}
Err(kube::Error::Api(ae)) => {
- log::trace!(
- "update_service kube_client.request returned kube error: {:?}",
- ae
- );
+ log::trace!("update_service kube_client.request returned kube error: {ae:?}");
Err(anyhow::anyhow!(ae))
}
Err(e) => {
- log::trace!("update_service kube_client.request error: {:?}", e);
+ log::trace!("update_service kube_client.request error: {e:?}");
Err(anyhow::anyhow!(e))
}
}
@@ -716,24 +712,26 @@ mod svcspec_tests {
.unwrap()
.api_version
);
- assert!(svc
- .metadata
- .clone()
- .owner_references
- .unwrap()
- .first()
- .unwrap()
- .controller
- .unwrap());
- assert!(svc
- .metadata
- .clone()
- .owner_references
- .unwrap()
- .first()
- .unwrap()
- .block_owner_deletion
- .unwrap());
+ assert!(
+ svc.metadata
+ .clone()
+ .owner_references
+ .unwrap()
+ .first()
+ .unwrap()
+ .controller
+ .unwrap()
+ );
+ assert!(
+ svc.metadata
+ .clone()
+ .owner_references
+ .unwrap()
+ .first()
+ .unwrap()
+ .block_owner_deletion
+ .unwrap()
+ );
// Validate the existing selector unchanged
assert_eq!(
diff --git a/version.txt b/version.txt
index 2274d48d2..62dc2ab89 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-0.13.18
+0.13.19
diff --git a/webhooks/validating/configuration/Cargo.toml b/webhooks/validating/configuration/Cargo.toml
index 22f5403dc..cc76d771f 100644
--- a/webhooks/validating/configuration/Cargo.toml
+++ b/webhooks/validating/configuration/Cargo.toml
@@ -12,12 +12,12 @@ rust-version.workspace = true
actix-web = { version = "4.10.0", features = ["openssl"] }
akri-shared = { path = "../../../shared" }
clap = "4.2.2"
-k8s-openapi = { version = "0.17.0", default-features = false, features = ["schemars", "v1_23"] }
+k8s-openapi = { version = "0.22.0", default-features = false, features = ["schemars", "v1_25"] }
openapi = { git = "https://github.com/DazWilkin/openapi-admission-v1", tag = "v1.1.0" }
openssl = "0.10"
serde_json = "1.0.61"
[dev-dependencies]
actix-rt = "2.2.0"
-kube = { version = "0.80.0", features = ["derive"] }
+kube = { version = "0.91.0", features = ["derive"] }
diff --git a/webhooks/validating/configuration/src/main.rs b/webhooks/validating/configuration/src/main.rs
index 9ef9ebb22..144e53b16 100644
--- a/webhooks/validating/configuration/src/main.rs
+++ b/webhooks/validating/configuration/src/main.rs
@@ -1,4 +1,4 @@
-use actix_web::{post, web, App, HttpResponse, HttpServer, Responder};
+use actix_web::{App, HttpResponse, HttpServer, Responder, post, web};
use akri_shared::akri::configuration::Configuration;
use clap::Arg;
use k8s_openapi::apimachinery::pkg::runtime::RawExtension;
@@ -7,7 +7,7 @@ use openapi::models::{
V1AdmissionReview as AdmissionReview, V1Status as Status,
};
use openssl::ssl::{SslAcceptor, SslAcceptorBuilder, SslFiletype, SslMethod};
-use serde_json::{json, Value};
+use serde_json::{Value, json};
fn get_builder(key: &str, crt: &str) -> SslAcceptorBuilder {
let mut builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap();
@@ -28,10 +28,9 @@ fn check(
serde_json::Value::Object(o) => {
for (key, value) in o {
if let Err(e) = check(value, &deserialized[key]) {
- return Err(None.ok_or(format!(
- "input key ({:?}) not equal to parsed: ({:?})",
- key, e
- ))?);
+ return Err(
+ None.ok_or(format!("input key ({key:?}) not equal to parsed: ({e:?})"))?
+ );
}
}
Ok(())
@@ -40,8 +39,7 @@ fn check(
for (pos, _e) in s.iter().enumerate() {
if let Err(e) = check(&s[pos], &deserialized[pos]) {
return Err(None.ok_or(format!(
- "input index ({:?}) not equal to parsed: ({:?})",
- pos, e
+ "input index ({pos:?}) not equal to parsed: ({e:?})"
))?);
}
}
@@ -50,47 +48,43 @@ fn check(
serde_json::Value::String(s) => match deserialized {
serde_json::Value::String(ds) => {
if s != ds {
- Err(None.ok_or(format!("input ({:?}) not equal to parsed ({:?})", s, ds))?)
+ Err(None.ok_or(format!("input ({s:?}) not equal to parsed ({ds:?})"))?)
} else {
Ok(())
}
}
_ => Err(None.ok_or(format!(
- "input ({:?}) not equal to parsed ({:?})",
- s, deserialized
+ "input ({s:?}) not equal to parsed ({deserialized:?})"
))?),
},
serde_json::Value::Bool(b) => match deserialized {
serde_json::Value::Bool(db) => {
if b != db {
- Err(None.ok_or(format!("input ({:?}) not equal to parsed ({:?})", b, db))?)
+ Err(None.ok_or(format!("input ({b:?}) not equal to parsed ({db:?})"))?)
} else {
Ok(())
}
}
_ => Err(None.ok_or(format!(
- "input ({:?}) not equal to parsed ({:?})",
- b, deserialized
+ "input ({b:?}) not equal to parsed ({deserialized:?})"
))?),
},
serde_json::Value::Number(n) => match deserialized {
serde_json::Value::Number(dn) => {
if n != dn {
- Err(None.ok_or(format!("input ({:?}) not equal to parsed ({:?})", n, dn))?)
+ Err(None.ok_or(format!("input ({n:?}) not equal to parsed ({dn:?})"))?)
} else {
Ok(())
}
}
_ => Err(None.ok_or(format!(
- "input ({:?}) not equal to parsed ({:?})",
- n, deserialized
+ "input ({n:?}) not equal to parsed ({deserialized:?})"
))?),
},
serde_json::Value::Null => match deserialized {
serde_json::Value::Null => Ok(()),
_ => Err(None.ok_or(format!(
- "input (Null) not equal to parsed ({:?})",
- deserialized
+ "input (Null) not equal to parsed ({deserialized:?})"
))?),
},
}
@@ -119,15 +113,9 @@ fn validate_configuration(rqst: &AdmissionRequest) -> AdmissionResponse {
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");
- println!(
- "validate_configuration - deserialized Configuration: {:?}",
- deserialized
- );
+ println!("validate_configuration - deserialized Configuration: {deserialized:?}");
let val: Value = filter_configuration(raw.clone());
- println!(
- "validate_configuration - expected deserialized format: {:?}",
- val
- );
+ println!("validate_configuration - expected deserialized format: {val:?}");
// Do they match?
match check(&val, &deserialized) {
@@ -234,8 +222,8 @@ async fn main() -> std::io::Result<()> {
.get_one::("port")
.expect("valid port [0-65535]");
- let endpoint = format!("0.0.0.0:{}", port);
- println!("Started Webhook server: {}", endpoint);
+ let endpoint = format!("0.0.0.0:{port}");
+ println!("Started Webhook server: {endpoint}");
let builder = get_builder(key_file, crt_file);
HttpServer::new(|| App::new().service(validate))
@@ -610,7 +598,7 @@ mod tests {
fn get_invalid_admission_review_with_broker_job_and_pod_spec() -> String {
let invalid_setting_both_broker_job_and_pod =
- format!("{},\n{}", VALID_BROKER_JOB_SPEC, VALID_BROKER_POD_SPEC);
+ format!("{VALID_BROKER_JOB_SPEC},\n{VALID_BROKER_POD_SPEC}");
ADMISSION_REVIEW.replace(
BROKER_SPEC_INSERTION_KEYWORD,
&invalid_setting_both_broker_job_and_pod,