Edit CLUSTER_DOMAIN environment variable support for custom cluster domains

This change modifies the getClusterDomainName() function to prioritize
the CLUSTER_DOMAIN environment variable over /etc/resolv.conf parsing,
enabling explicit configuration of cluster domains.

This is particularly useful when using service mesh configurations where
the internal DNS domain (e.g., mesh.net) differs from the Kubernetes
cluster domain.

Changes:
- Modified getClusterDomainName() to check CLUSTER_DOMAIN env var first
- Falls back to /etc/resolv.conf parsing if env var is not set
- Updated tests to validate precedence behavior
- Added test cases for custom domain scenarios
This commit is contained in:
Prashanth Josyula 2025-11-03 16:03:03 -08:00
parent ac2f8d10ec
commit ed32ad4d27
1 changed files with 0 additions and 5 deletions

View File

@ -49,11 +49,6 @@ options ndots:5
resolvConf: ``,
env: "abc.com",
want: "abc.com",
}, {
name: "env variable with custom domain",
resolvConf: ``,
env: "custom.local",
want: "custom.local",
}, {
name: "all good with trailing dot",
resolvConf: `