From 0f308e1ff5001f6117c1b3233040b65922715077 Mon Sep 17 00:00:00 2001 From: Mohit Gupta Date: Tue, 8 Oct 2024 19:02:23 +0100 Subject: [PATCH] removes data from last-applied-configuration closes #27 --- icekube/models/secret.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/icekube/models/secret.py b/icekube/models/secret.py index 2bfd571..1c0d849 100644 --- a/icekube/models/secret.py +++ b/icekube/models/secret.py @@ -21,6 +21,19 @@ def remove_secret_data(cls, v: Optional[str]) -> Optional[str]: if "data" in data: del data["data"] + last_applied_configuration = ( + data.get("metadata", {}) + .get("annotations", {}) + .get("kubectl.kubernetes.io/last-applied-configuration") + ) + if last_applied_configuration: + last_applied_configuration = json.loads(last_applied_configuration) + if "data" in last_applied_configuration: + del last_applied_configuration["data"] + data["metadata"]["annotations"][ + "kubectl.kubernetes.io/last-applied-configuration" + ] = json.dumps(last_applied_configuration) + return json.dumps(data) return v