Keep pod name for k8s executor under 63 characters #28237
Merged
+23
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because of the way that the task log handler reads from running k8s executor pods, we must keep pod name <= 63 characters. The handler gets pod name from ti.hostname. TI hostname is derived from the container hostname, which is truncated to 63 characters. We could lift this limit by using label selectors instead of pod name to find the pod. But for now, easy enough to keep limited to 63.
Since we limit to 63 in the code, we can remove the logic to find the matching pod when length is >= 63.
Note:
Recently I made changes that allowed for longer pod name, and take up less space on the random part, and allow hyphens. At the time it wasn't clear why the pod id length had to be limited. But I think the reason is this task log issue. So we restore the length limit here, while still retaining the other improvements. And we make clear in the place where we limit what is the reason for the limit. And we remove the code to handle longer limit since it's not needed. For KPO, we can keep the longer name since hostname is not used for pod id. (there we use labels)