dstandish commented on code in PR #27736:
URL: https://github.com/apache/airflow/pull/27736#discussion_r1027038571


##########
airflow/kubernetes/pod_generator.py:
##########
@@ -445,29 +455,27 @@ def make_unique_pod_id(pod_id: str) -> str | None:
         r"""
         Kubernetes pod names must consist of one or more lowercase
         rfc1035/rfc1123 labels separated by '.' with a maximum length of 253
-        characters. Each label has a maximum length of 63 characters.
+        characters.
 
         Name must pass the following regex for validation
         ``^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$``
 
+        (But note that this method actually doesn't guarantee that!)
+
         For more details, see:
         
https://github.com/kubernetes/kubernetes/blob/release-1.1/docs/design/identifiers.md
 
-        :param pod_id: a dag_id with only alphanumeric characters
+        :param pod_id: requested pod name
         :return: ``str`` valid Pod name of appropriate length
         """
         if not pod_id:
             return None
 
-        safe_uuid = uuid.uuid4().hex  # safe uuid will always be less than 63 
chars
-
-        # 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
-        return f"{trimmed_pod_id}-{safe_uuid}"
+        max_pod_id_len = 100  # arbitrarily chosen

Review Comment:
   haha
   
   yeah it's completely arbitrary.  Previously it was 63.
   
   250 is just, quite long. Here's an example of what it looks like with a pod 
name of length 101
   
   ```
   local ❯ k delete pod 
static-podstatic-podstatic-podstatic-podstatic-podstatic-podstatic-podstatic-podstatic-podstatic-pod
   pod 
"static-podstatic-podstatic-podstatic-podstatic-podstatic-podstatic-podstatic-podstatic-podstatic-pod"
 deleted
   ```
   
   
   I actually have some second thoughts about allowing it to go to 100.  Now 
that we aren't using up 32 of the characters with a UUID, we would get a lot 
more out of those 63 characters.... 



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