Skip to content

Commit 229cc99

Browse files
committed
feat: improve DNS lookup performance
1 parent a2ea04b commit 229cc99

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/stackable-operator/src/commons/networking.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ impl FromStr for DomainName {
1717
type Err = validation::Errors;
1818

1919
fn from_str(value: &str) -> Result<Self, Self::Err> {
20+
// Remove optional trailing dot before validation, logic taken from https://github.com/kubernetes/kubernetes/blob/30de989fb57fb5921a7ae3e3203cf7ecac9cf3f0/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go#L100
21+
let value = value.strip_suffix('.').unwrap_or(value);
2022
validation::is_rfc_1123_subdomain(value)?;
21-
Ok(DomainName(value.to_owned()))
23+
// Append trailing dot to make the domain name a FQDN to improve DNS lookup performance, see https://github.com/stackabletech/issues/issues/656
24+
Ok(DomainName(format!("{}.", value)))
2225
}
2326
}
2427

0 commit comments

Comments
 (0)