jedcunningham commented on a change in pull request #19036:
URL: https://github.com/apache/airflow/pull/19036#discussion_r753331876



##########
File path: airflow/kubernetes/pod_generator.py
##########
@@ -459,10 +459,14 @@ def make_unique_pod_id(pod_id: str) -> str:
             return None
 
         safe_uuid = uuid.uuid4().hex  # safe uuid will always be less than 63 
chars
-        # 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}"
+        # Get prefix length after subtracting the uuid length. Clean up '.' 
and '-' from
+        # end of podID ('.' can't be followed by '-').
+        label_prefix_length = MAX_LABEL_LEN - len(safe_uuid) - 1  # -1 for 
separator
+        trimmed_pod_id = pod_id[:label_prefix_length].rstrip('-.')
+
+        # previously used a '.' as the separator, but this could create errors 
in some situations
+        safe_pod_id = f"{trimmed_pod_id}-{safe_uuid}"
         return safe_pod_id

Review comment:
       ```suggestion
           return f"{trimmed_pod_id}-{safe_uuid}"
   ```
   
   nit




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