diff --git a/Cargo.toml b/Cargo.toml index 62b4d41be..1aa434508 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ async-broadcast = "0.7.0" async-stream = "0.3.5" async-trait = "0.1.64" backoff = "0.4.0" -base64 = "0.22.0" +base64 = "0.22.1" bytes = "1.1.0" chrono = { version = "0.4.34", default-features = false } darling = "0.20.3" @@ -49,7 +49,7 @@ futures = { version = "0.3.17", default-features = false } hashbrown = "0.15.0" home = "0.5.4" http = "1.1.0" -http-body = "1.0.0" +http-body = "1.0.1" http-body-util = "0.1.2" hyper = "1.2.0" hyper-util = "0.1.9" @@ -59,7 +59,7 @@ hyper-socks2 = { version = "0.9.0", default-features = false } hyper-timeout = "0.5.1" json-patch = "3" jsonptr = "0.6" -jsonpath-rust = "0.5.0" +jsonpath-rust = "0.7.3" k8s-openapi = { version = "0.23.0", default-features = false } openssl = "0.10.36" parking_lot = "0.12.0" @@ -68,7 +68,7 @@ pin-project = "1.0.4" proc-macro2 = "1.0.29" quote = "1.0.10" rand = "0.8.3" -rustls = { version = "0.23.0", default-features = false } +rustls = { version = "0.23.16", default-features = false } rustls-pemfile = "2.0.0" schemars = "0.8.6" secrecy = "0.10.2" diff --git a/examples/dynamic_jsonpath.rs b/examples/dynamic_jsonpath.rs index 3fb670b84..bc4b02d48 100644 --- a/examples/dynamic_jsonpath.rs +++ b/examples/dynamic_jsonpath.rs @@ -1,5 +1,5 @@ use anyhow::{Context, Error}; -use jsonpath_rust::JsonPathInst; +use jsonpath_rust::JsonPath; use k8s_openapi::api::core::v1::Pod; use kube::{ api::{Api, ListParams}, @@ -18,7 +18,7 @@ async fn main() -> anyhow::Result<()> { let jsonpath = { let path = std::env::var("JSONPATH").unwrap_or_else(|_| ".items[*].spec.containers[*].image".into()); format!("${path}") - .parse::() + .parse::() .map_err(Error::msg) .with_context(|| { format!( @@ -34,8 +34,8 @@ async fn main() -> anyhow::Result<()> { // Use the given JSONPATH to filter the ObjectList let list_json = serde_json::to_value(&list)?; - for res in jsonpath.find_slice(&list_json, Default::default()) { - info!("\t\t {}", *res); + for res in jsonpath.find_slice(&list_json) { + info!("\t\t {}", res.to_data()); } Ok(()) } diff --git a/kube-client/src/api/entry.rs b/kube-client/src/api/entry.rs index 70d7d61cd..14e408fbd 100644 --- a/kube-client/src/api/entry.rs +++ b/kube-client/src/api/entry.rs @@ -134,7 +134,7 @@ enum Dirtiness { New, } -impl<'a, K> OccupiedEntry<'a, K> { +impl OccupiedEntry<'_, K> { /// Borrow the object pub fn get(&self) -> &K { &self.object diff --git a/kube-client/src/client/auth/mod.rs b/kube-client/src/client/auth/mod.rs index 406ca26ca..f051bba45 100644 --- a/kube-client/src/client/auth/mod.rs +++ b/kube-client/src/client/auth/mod.rs @@ -10,7 +10,7 @@ use http::{ header::{InvalidHeaderValue, AUTHORIZATION}, HeaderValue, Request, }; -use jsonpath_rust::{path::config::JsonPathConfig, JsonPathInst}; +use jsonpath_rust::JsonPath; use secrecy::{ExposeSecret, SecretString}; use serde::{Deserialize, Serialize}; use thiserror::Error; @@ -498,10 +498,9 @@ fn token_from_gcp_provider(provider: &AuthProviderConfig) -> Result Result { - let cfg = JsonPathConfig::default(); // no need for regex caching here let parsed_path = path .trim_matches(|c| c == '"' || c == '{' || c == '}') - .parse::() + .parse::() .map_err(|err| { Error::AuthExec(format!( "Failed to parse {context:?} as a JsonPath: {path}\n @@ -509,7 +508,7 @@ fn extract_value(json: &serde_json::Value, context: &str, path: &str) -> Result< )) })?; - let res = parsed_path.find_slice(json, cfg); + let res = parsed_path.find_slice(json); let Some(res) = res.into_iter().next() else { return Err(Error::AuthExec(format!( @@ -517,14 +516,12 @@ fn extract_value(json: &serde_json::Value, context: &str, path: &str) -> Result< ))); }; - if let Some(val) = res.as_str() { - Ok(val.to_owned()) - } else { - Err(Error::AuthExec(format!( - "Target {:?} value {:?} is not a string: {:?}", - context, path, *res - ))) - } + let jval = res.to_data(); + let val = jval.as_str().ok_or(Error::AuthExec(format!( + "Target {context:?} value {path:?} is not a string" + )))?; + + Ok(val.to_string()) } /// ExecCredentials is used by exec-based plugins to communicate credentials to