Skip to content

Commit 21eb550

Browse files
committed
Add trailing dot to KubernetesClusterInfo::cluster_domain
1 parent 873db01 commit 21eb550

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

crates/stackable-operator/src/utils/cluster_info.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,22 @@ use std::str::FromStr;
22

33
use crate::commons::networking::DomainName;
44

5-
const KUBERNETES_CLUSTER_DOMAIN_DEFAULT: &str = "cluster.local";
5+
const KUBERNETES_CLUSTER_DOMAIN_DEFAULT: &str = "cluster.local.";
66

77
/// Some information that we know about the Kubernetes cluster.
88
#[derive(Debug, Clone)]
99
pub struct KubernetesClusterInfo {
10-
/// The Kubernetes cluster domain, typically `cluster.local`.
10+
/// The Kubernetes cluster domain, typically `cluster.local.`.
1111
pub cluster_domain: DomainName,
1212
}
1313

1414
#[derive(clap::Parser, Debug, Default, PartialEq, Eq)]
1515
pub struct KubernetesClusterInfoOpts {
16-
/// Kubernetes cluster domain, usually this is `cluster.local`.
16+
/// Kubernetes cluster domain, usually this is `cluster.local.`.
17+
///
18+
/// Please note that we recommend adding a trailing dot (".") for performance reasons, see
19+
/// <https://github.com/stackabletech/issues/issues/656> for details.
20+
//
1721
// We are not using a default value here, as operators will probably do an more advanced
1822
// auto-detection of the cluster domain in case it is not specified in the future.
1923
#[arg(long, env)]
@@ -25,6 +29,9 @@ impl KubernetesClusterInfo {
2529
let cluster_domain = match &cluster_info_opts.kubernetes_cluster_domain {
2630
Some(cluster_domain) => {
2731
tracing::info!(%cluster_domain, "Using configured Kubernetes cluster domain");
32+
if !cluster_domain.ends_with('.') {
33+
tracing::warn!(%cluster_domain, "Your configured Kubernetes cluster domain does not end with a dot (\".\"). We recommend to add a trailing dot for performance reasons, see https://github.com/stackabletech/issues/issues/656 for details");
34+
}
2835

2936
cluster_domain.clone()
3037
}

0 commit comments

Comments
 (0)