Skip to content

Commit

Permalink
feat: trim optional trailing dot of cluster domain to always get the …
Browse files Browse the repository at this point in the history
…non-FQDN variant
  • Loading branch information
dervoeti committed Feb 14, 2025
1 parent 85f141a commit fb36ae9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rust/operator-binary/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ impl SecretVolumeSelector {
scope: &scope::SecretScope,
) -> Result<Vec<Address>, ScopeAddressesError> {
use scope_addresses_error::*;
let cluster_domain = &pod_info.kubernetes_cluster_domain;
// Turn FQDNs into bare domain names by removing the trailing dot
let cluster_domain = pod_info.kubernetes_cluster_domain.trim_end_matches(".");
let namespace = &self.namespace;
Ok(match scope {
scope::SecretScope::Node => {
Expand Down Expand Up @@ -208,7 +209,13 @@ impl SecretVolumeSelector {
.listener_addresses
.get(name)
.context(NoListenerAddressesSnafu { listener: name })?
.to_vec(),
.iter()
.map(|addr| match addr {
// Turn FQDNs into bare domain names by removing the trailing dot
Address::Dns(dns) => Address::Dns(dns.trim_end_matches(".").to_string()),
_ => addr.clone(),
})
.collect(),
})
}

Expand Down

0 comments on commit fb36ae9

Please sign in to comment.