ashb commented on a change in pull request #11815:
URL: https://github.com/apache/airflow/pull/11815#discussion_r518375530



##########
File path: airflow/www/views.py
##########
@@ -924,6 +926,56 @@ def rendered(self):
             title=title,
         )
 
+    @expose('/rendered-k8s')
+    @auth.has_access(
+        [
+            (permissions.ACTION_CAN_READ, permissions.RESOURCE_DAG),
+            (permissions.ACTION_CAN_READ, permissions.RESOURCE_TASK_INSTANCE),
+        ]
+    )
+    @action_logging
+    def rendered_k8s(self):
+        """Get rendered k8s yaml."""
+        k8s = is_k8s_or_k8scelery_executor()
+        if not k8s:
+            abort(404)
+        dag_id = request.args.get('dag_id')
+        task_id = request.args.get('task_id')
+        execution_date = request.args.get('execution_date')
+        dttm = timezone.parse(execution_date)
+        form = DateTimeForm(data={'execution_date': dttm})
+        root = request.args.get('root', '')
+        logging.info("Retrieving rendered templates.")
+        dag = current_app.dag_bag.get_dag(dag_id)
+        task = copy.copy(dag.get_task(task_id))
+        ti = models.TaskInstance(task=task, execution_date=dttm)
+        try:
+            pod_spec = ti.render_k8s_pod_yaml()

Review comment:
       Shouldn't this be using `RenceredTIFIelds.get_k8s_pod_yaml`?
   
   Or if not, we should delete that function.




----------------------------------------------------------------
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.

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


Reply via email to