You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/08/03 17:54:52 UTC

[GitHub] [airflow] dimon222 commented on a change in pull request #16980: Change pod id notation back to hyphen

dimon222 commented on a change in pull request #16980:
URL: https://github.com/apache/airflow/pull/16980#discussion_r681979565



##########
File path: airflow/kubernetes/pod_generator.py
##########
@@ -453,7 +453,7 @@ def make_unique_pod_id(pod_id: str) -> str:
         # Strip trailing '-' and '.' as they can't be followed by '.'
         trimmed_pod_id = pod_id[:MAX_LABEL_LEN].rstrip('-.')
 
-        safe_pod_id = f"{trimmed_pod_id}.{safe_uuid}"
+        safe_pod_id = f"{trimmed_pod_id}-{safe_uuid}"

Review comment:
       Valid point, but we also can't trim construction, since it might cause collisions. Since we ensure that trimmed_pod_id is limited, all we need to ensure is that uuid is limited too. Now, knowing that safe_uuid is static length, we can calculate the exact leftover space for trimmed_pod_id.
   
   In other words, if length is the initial problem of nearby ticket, I would go with something like:
   ```
   trimmed_pod_id = pod_id[:MAX_LABEL_LEN-len(safe_uuid)].rstrip('-.')
   ```




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org