From 05192af2890c803f88112821e6308d292f3616fc Mon Sep 17 00:00:00 2001 From: Garry O'Donnell Date: Fri, 5 Jul 2024 14:07:31 +0000 Subject: [PATCH] Specify field manager when patching resources in sessionspaces --- sessionspaces/src/resources/config_maps.rs | 5 ++++- sessionspaces/src/resources/namespace.rs | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sessionspaces/src/resources/config_maps.rs b/sessionspaces/src/resources/config_maps.rs index e374c583..1e0fb703 100644 --- a/sessionspaces/src/resources/config_maps.rs +++ b/sessionspaces/src/resources/config_maps.rs @@ -65,7 +65,10 @@ pub async fn create_configmap( configmaps .patch( NAME, - &PatchParams::default(), + &PatchParams { + field_manager: Some("sessionspaces".to_string()), + ..Default::default() + }, &Patch::Apply(&ConfigMap { metadata: ObjectMeta { name: Some(NAME.to_string()), diff --git a/sessionspaces/src/resources/namespace.rs b/sessionspaces/src/resources/namespace.rs index 5a7a2a79..92a95786 100644 --- a/sessionspaces/src/resources/namespace.rs +++ b/sessionspaces/src/resources/namespace.rs @@ -38,7 +38,10 @@ pub async fn create_namespace( let api = Api::::all(k8s_client.clone()); api.patch( &namespace, - &PatchParams::default(), + &PatchParams { + field_manager: Some("sessionspaces".to_string()), + ..Default::default() + }, &Patch::Apply(&Namespace { metadata: ObjectMeta { name: Some(namespace.clone()), @@ -67,7 +70,10 @@ mod tests { async fn create_new_namespace() { let mut server = Server::new_async().await; let mock_patch_test_namespace = server - .mock("PATCH", "/api/v1/namespaces/test?") + .mock( + "PATCH", + "/api/v1/namespaces/test?&fieldManager=sessionspaces", + ) .with_status(201) .with_header("content-type", "application/json") .with_body(