Skip to content

Commit fb36ae9

Browse files
committed
feat: trim optional trailing dot of cluster domain to always get the non-FQDN variant
1 parent 85f141a commit fb36ae9

File tree

1 file changed

+9
-2
lines changed
  • rust/operator-binary/src/backend

1 file changed

+9
-2
lines changed

rust/operator-binary/src/backend/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ impl SecretVolumeSelector {
179179
scope: &scope::SecretScope,
180180
) -> Result<Vec<Address>, ScopeAddressesError> {
181181
use scope_addresses_error::*;
182-
let cluster_domain = &pod_info.kubernetes_cluster_domain;
182+
// Turn FQDNs into bare domain names by removing the trailing dot
183+
let cluster_domain = pod_info.kubernetes_cluster_domain.trim_end_matches(".");
183184
let namespace = &self.namespace;
184185
Ok(match scope {
185186
scope::SecretScope::Node => {
@@ -208,7 +209,13 @@ impl SecretVolumeSelector {
208209
.listener_addresses
209210
.get(name)
210211
.context(NoListenerAddressesSnafu { listener: name })?
211-
.to_vec(),
212+
.iter()
213+
.map(|addr| match addr {
214+
// Turn FQDNs into bare domain names by removing the trailing dot
215+
Address::Dns(dns) => Address::Dns(dns.trim_end_matches(".").to_string()),
216+
_ => addr.clone(),
217+
})
218+
.collect(),
212219
})
213220
}
214221

0 commit comments

Comments
 (0)