Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pod name can exceed Kubernetes 63-character limit #115

Open
anaslbrg opened this issue Dec 17, 2024 · 0 comments
Open

Pod name can exceed Kubernetes 63-character limit #115

anaslbrg opened this issue Dec 17, 2024 · 0 comments

Comments

@anaslbrg
Copy link

Pod name can exceed Kubernetes 63-character limit when adding suffixes

The current implementation of _parse_app_name_and_id doesn't account for suffixes that are added after the initial name generation (like "-driver" for pod names). This can lead to pod names exceeding Kubernetes' 63-character limit.

Current Behavior

  • _parse_app_name_and_id truncates names to fit within 63 characters
  • However, suffixes like "-driver" are added later when creating pod specs
  • This can result in final pod names exceeding the 63-character limit

Example

If we have:

  • app_name = "my-very-long-application-name-that-needs-to-be-truncated"
  • timestamp suffix = "-20240101123456"

The method will truncate considering these, but when "-driver" or othere suffixes e.g "-exec-0" is added later for the pod name, it can exceed 63 characters.

Proposed Solution

Modify _parse_app_name_and_id to reserve space for known suffixes:

RESERVED_LENGTH = 7  # Length for "-driver" or other suffixes
MAX_LENGTH = 63 - RESERVED_LENGTH

# Calculate maximum length considering both suffix and reserved length
max_base_length = MAX_LENGTH - len(app_id_suffix_str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant