code: func truncatePodHostnameIfNeeded(podName, hostname string) (string, error) {
  	// Cap hostname at 63 chars (specification is 64bytes which is 63 chars and the null terminating char).
  	const hostnameMaxLen = 63
  	if len(hostname) <= hostnameMaxLen {
  		return hostname, nil
  	}
  	truncated := hostname[:hostnameMaxLen]
  	klog.Errorf("hostname for pod:%q was longer than %d. Truncated hostname to :%q", podName, hostnameMaxLen, truncated)
  	// hostname should not end with '-' or '.'
  	truncated = strings.TrimRight(truncated, "-.")
  	if len(truncated) == 0 {
  		// This should never happen.
  		return "", fmt.Errorf("hostname for pod %q was invalid: %q", podName, hostname)
  	}
  	return truncated, nil
  }
docs: // truncatePodHostnameIfNeeded truncates the pod hostname if it's longer than 63 chars.