From 53a980008c0828fb6295df7363d921bc38b124ff Mon Sep 17 00:00:00 2001 From: Rizwana777 Date: Mon, 12 Feb 2024 18:41:04 +0530 Subject: [PATCH] Add check to return hostname if it is in size limit Signed-off-by: Rizwana777 --- controllers/argocd/route.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllers/argocd/route.go b/controllers/argocd/route.go index 71de0e35a..d53b318c1 100644 --- a/controllers/argocd/route.go +++ b/controllers/argocd/route.go @@ -428,6 +428,11 @@ func shortenHostname(hostname string) (string, error) { // Split the hostname into labels labels := strings.Split(hostname, ".") + // Return the hostname as it is if hostname is already within the size limit + if len(hostname) <= maxHostnameLength { + return hostname, nil + } + // Check and truncate the FIRST label if longer than 63 characters if len(labels[0]) > maxLabelLength { labels[0] = labels[0][:maxLabelLength]