func GetNodenameForKernel(hostname string, hostDomainName string, setHostnameAsFQDN *bool) (string, error) {
	kernelHostname := hostname
	// FQDN has to be 64 chars to fit in the Linux nodename kernel field (specification 64 chars and the null terminating char).
	const fqdnMaxLen = 64
	if len(hostDomainName) > 0 && setHostnameAsFQDN != nil && *setHostnameAsFQDN == true {
		fqdn := fmt.Sprintf("%s.%s", hostname, hostDomainName)
		// FQDN has to be shorter than hostnameMaxLen characters.
		if len(fqdn) > fqdnMaxLen {
			return "", fmt.Errorf("Failed to construct FQDN from pod hostname and cluster domain, FQDN %s is too long (%d characters is the max, %d characters requested)", fqdn, fqdnMaxLen, len(fqdn))
		}
		kernelHostname = fqdn
	}
	return kernelHostname, nil
}
// GetNodenameForKernel gets hostname value to set in the hostname field (the nodename field of struct utsname) of the pod.
GetNodenameForKernel gets hostname value to set in the hostname field (the nodename field of struct utsname) of the pod.
// GetNodenameForKernel gets hostname value to set in the hostname field ( the nodename field of struct utsname ) of the pod .
func GetNodenameForKernel(hostname string, hostDomainName string, setHostnameAsFQDN *bool) (string, error) {
	kernelHostname := hostname
	const fqdnMaxLen = 64
	if len(hostDomainName) > 0 && setHostnameAsFQDN != nil && *setHostnameAsFQDN == true {
		fqdn := fmt.Sprintf("%s.%s", hostname, hostDomainName)
		if len(fqdn) > fqdnMaxLen {
			return "", fmt.Errorf("Failed to construct FQDN from pod hostname and cluster domain, FQDN %s is too long (%d characters is the max, %d characters requested)", fqdn, fqdnMaxLen, len(fqdn))
		}
		kernelHostname = fqdn
	}
	return kernelHostname, nil
}
func GetNodenameForKernel ( hostname string , hostDomainName string , setHostnameAsFQDN * bool ) ( string , error ) { kernelHostname := hostname const fqdnMaxLen = 64 if len ( hostDomainName ) > 0 && setHostnameAsFQDN != nil && * setHostnameAsFQDN == true { fqdn := fmt . Sprintf ( " " , hostname , hostDomainName ) if len ( fqdn ) > fqdnMaxLen { return " " , fmt . Errorf ( " " , fqdn , fqdnMaxLen , len ( fqdn ) ) } kernelHostname = fqdn } return kernelHostname , nil }
GetNodenameForKernel gets hostname value to set in the hostname field (the nodename field of struct utsname) of the pod.
GetNodenameForKernel gets hostname value to set in the hostname field ( the nodename field of struct utsname ) of the pod .
// FQDN has to be 64 chars to fit in the Linux nodename kernel field (specification 64 chars and the null terminating char). // FQDN has to be shorter than hostnameMaxLen characters.