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