DnsNameGenerator { public String serviceDnsNameWithoutClusterDomain() { return String.format("%s.%s.svc", serviceName, namespace); } private  DnsNameGenerator(String namespace, String serviceName); static DnsNameGenerator of(String namespace, String serviceName); String podDnsName(String podName); static String podDnsName(String namespace, String serviceName, String podName); String podDnsNameWithoutClusterDomain(String podName); static String podDnsNameWithoutClusterDomain(String namespace, String serviceName, String podName); static String podDnsNameWithClusterDomain(String namespace, String serviceName, String podName); String serviceDnsName(); String wildcardServiceDnsNameWithoutClusterDomain(); String wildcardServiceDnsName(); String serviceDnsNameWithoutClusterDomain(); static String serviceDnsNameWithoutClusterDomain(String namespace, String serviceName); static String serviceDnsNameWithClusterDomain(String namespace, String serviceName); static final String KUBERNETES_SERVICE_DNS_DOMAIN; }
@Test public void testServiceDnsNameWithoutClusterDomain() { assertThat(DnsNameGenerator.of(NAMESPACE, SERVICE_NAME).serviceDnsNameWithoutClusterDomain(), is("my-service.my-ns.svc")); }