amoghrajesh commented on code in PR #62129:
URL: https://github.com/apache/airflow/pull/62129#discussion_r2826438993


##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/cli/kubernetes_command.py:
##########
@@ -199,3 +199,16 @@
     print(f'Deleting POD "{name}" from "{namespace}" namespace')
     api_response = kube_client.delete_namespaced_pod(name=name, 
namespace=namespace, body=delete_options)
     print(api_response)
+    _delete_workload_secret(name, namespace)
+
+
+def _delete_workload_secret(pod_name, namespace):
+    """Delete the workload secret associated with a pod if it exists."""
+    kube_client = get_kube_client()
+    secret_name = f"airflow-workload-{pod_name}"
+    try:
+        kube_client.delete_namespaced_secret(name=secret_name, 
namespace=namespace)
+        print(f'Deleted workload secret "{secret_name}" from "{namespace}" 
namespace')

Review Comment:
   Not sensitive, just plain text name of a K8S SECRET



##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/cli/kubernetes_command.py:
##########
@@ -199,3 +199,16 @@
     print(f'Deleting POD "{name}" from "{namespace}" namespace')
     api_response = kube_client.delete_namespaced_pod(name=name, 
namespace=namespace, body=delete_options)
     print(api_response)
+    _delete_workload_secret(name, namespace)
+
+
+def _delete_workload_secret(pod_name, namespace):
+    """Delete the workload secret associated with a pod if it exists."""
+    kube_client = get_kube_client()
+    secret_name = f"airflow-workload-{pod_name}"
+    try:
+        kube_client.delete_namespaced_secret(name=secret_name, 
namespace=namespace)
+        print(f'Deleted workload secret "{secret_name}" from "{namespace}" 
namespace')
+    except ApiException as e:
+        if str(e.status) != "404":
+            print(f'Failed to delete workload secret "{secret_name}": {e}')

Review Comment:
   Not sensitive, just plain text name of a K8S SECRET



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to