diff --git a/Cargo.toml b/Cargo.toml index ecb28891d..62b4d41be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,8 +57,8 @@ hyper-openssl = "0.10.2" hyper-rustls = { version = "0.27.1", default-features = false } hyper-socks2 = { version = "0.9.0", default-features = false } hyper-timeout = "0.5.1" -json-patch = "2.0.0" -jsonptr = "0.4.7" +json-patch = "3" +jsonptr = "0.6" jsonpath-rust = "0.5.0" k8s-openapi = { version = "0.23.0", default-features = false } openssl = "0.10.36" diff --git a/examples/admission_controller.rs b/examples/admission_controller.rs index 801c64028..6aac09a67 100644 --- a/examples/admission_controller.rs +++ b/examples/admission_controller.rs @@ -1,4 +1,4 @@ -use jsonptr::Pointer; +use jsonptr::PointerBuf; use kube::core::{ admission::{AdmissionRequest, AdmissionResponse, AdmissionReview}, DynamicObject, Resource, ResourceExt, @@ -76,13 +76,13 @@ fn mutate(res: AdmissionResponse, obj: &DynamicObject) -> Result = AdmissionResponse::from(&req) /// .with_patch(Patch(vec![PatchOperation::Add(AddOperation { -/// path: Pointer::new(["metadata","labels","my-label"]), +/// path: PointerBuf::from_tokens(["metadata","labels","my-label"]), /// value: serde_json::Value::String("my-value".to_owned()), /// })])) /// .unwrap() diff --git a/kube-runtime/src/finalizer.rs b/kube-runtime/src/finalizer.rs index 32cbaa70d..70497e190 100644 --- a/kube-runtime/src/finalizer.rs +++ b/kube-runtime/src/finalizer.rs @@ -2,7 +2,7 @@ use crate::controller::Action; use futures::{TryFuture, TryFutureExt}; use json_patch::{AddOperation, PatchOperation, RemoveOperation, TestOperation}; -use jsonptr::Pointer; +use jsonptr::PointerBuf; use kube_client::{ api::{Patch, PatchParams}, Api, Resource, ResourceExt, @@ -142,12 +142,12 @@ where // `Test` ensures that we fail instead of deleting someone else's finalizer // (in which case a new `Cleanup` event will be sent) PatchOperation::Test(TestOperation { - path: Pointer::from_str(finalizer_path.as_str()) + path: PointerBuf::from_str(finalizer_path.as_str()) .map_err(|_err| Error::InvalidFinalizer)?, value: finalizer_name.into(), }), PatchOperation::Remove(RemoveOperation { - path: Pointer::from_str(finalizer_path.as_str()) + path: PointerBuf::from_str(finalizer_path.as_str()) .map_err(|_err| Error::InvalidFinalizer)?, }), ])), @@ -164,12 +164,12 @@ where let patch = json_patch::Patch(if obj.finalizers().is_empty() { vec![ PatchOperation::Test(TestOperation { - path: Pointer::from_str("/metadata/finalizers") + path: PointerBuf::from_str("/metadata/finalizers") .map_err(|_err| Error::InvalidFinalizer)?, value: serde_json::Value::Null, }), PatchOperation::Add(AddOperation { - path: Pointer::from_str("/metadata/finalizers") + path: PointerBuf::from_str("/metadata/finalizers") .map_err(|_err| Error::InvalidFinalizer)?, value: vec![finalizer_name].into(), }), @@ -180,12 +180,12 @@ where // https://github.com/kube-rs/kube/issues/964#issuecomment-1197311254), // so we need to fail and retry if anyone else has added the finalizer in the meantime PatchOperation::Test(TestOperation { - path: Pointer::from_str("/metadata/finalizers") + path: PointerBuf::from_str("/metadata/finalizers") .map_err(|_err| Error::InvalidFinalizer)?, value: obj.finalizers().into(), }), PatchOperation::Add(AddOperation { - path: Pointer::from_str("/metadata/finalizers/-") + path: PointerBuf::from_str("/metadata/finalizers/-") .map_err(|_err| Error::InvalidFinalizer)?, value: finalizer_name.into(), }),