kaxil commented on a change in pull request #10996:
URL: https://github.com/apache/airflow/pull/10996#discussion_r493793630
##########
File path: airflow/executors/kubernetes_executor.py
##########
@@ -470,6 +475,37 @@ def terminate(self) -> None:
self._manager.shutdown()
+def _strip_unsafe_kubernetes_special_chars(string: str) -> str:
+ """
+ Kubernetes only supports lowercase alphanumeric characters and "-" and "."
in
+ the pod name
+ However, there are special rules about how "-" and "." can be used so let's
+ only keep
+ alphanumeric chars see here for detail:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/
+
+ :param string: The requested Pod name
+ :return: ``str`` Pod name stripped of any unsafe characters
+ """
+ return ''.join(ch.lower() for ind, ch in enumerate(string) if ch.isalnum())
+
+
+def create_pod_id(dag_id: str, task_id: str) -> str:
+ """
+ Generates the kubernetes safe pod_id. Note that this is
+ NOT the full ID that will be launched to k8s. We will add a uuid
+ to ensure uniqueness.
+ @param dag_id:
+ @param task_id:
+ @return:
Review comment:
same here, can you add docstrings please with the following syntax:
```
:param dag_id: DAG ID
:param task_id: Task ID
```
----------------------------------------------------------------
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]