Skip to content

Commit

Permalink
Add check to return hostname if it is in size limit
Browse files Browse the repository at this point in the history
Signed-off-by: Rizwana777 <rizwananaaz177@gmail.com>
  • Loading branch information
Rizwana777 committed Feb 12, 2024
1 parent 117a866 commit 53a9800
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/argocd/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 53a9800

Please sign in to comment.