YARN-8069. Clean up example hostnames for RegistryDNS.
Contributed by Billie Rinaldi
(cherry picked from commit 3d185d62fc
)
This commit is contained in:
parent
d54e19a913
commit
570d7f3072
|
@ -156,7 +156,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
|
|
||||||
protected Configuration createConfiguration() {
|
protected Configuration createConfiguration() {
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
conf.set(RegistryConstants.KEY_DNS_DOMAIN, "hwx.test");
|
conf.set(RegistryConstants.KEY_DNS_DOMAIN, "dev.test");
|
||||||
conf.set(RegistryConstants.KEY_DNS_ZONE_SUBNET, "172.17.0");
|
conf.set(RegistryConstants.KEY_DNS_ZONE_SUBNET, "172.17.0");
|
||||||
conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
|
conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
|
||||||
return conf;
|
return conf;
|
||||||
|
@ -179,39 +179,39 @@ public class TestRegistryDNS extends Assert {
|
||||||
"/registry/users/root/services/org-apache-slider/test1/", record);
|
"/registry/users/root/services/org-apache-slider/test1/", record);
|
||||||
|
|
||||||
// start assessing whether correct records are available
|
// start assessing whether correct records are available
|
||||||
Record[] recs = assertDNSQuery("test1.root.hwx.test.");
|
Record[] recs = assertDNSQuery("test1.root.dev.test.");
|
||||||
assertEquals("wrong result", "192.168.1.5",
|
assertEquals("wrong result", "192.168.1.5",
|
||||||
((ARecord) recs[0]).getAddress().getHostAddress());
|
((ARecord) recs[0]).getAddress().getHostAddress());
|
||||||
|
|
||||||
recs = assertDNSQuery("management-api.test1.root.hwx.test.", 2);
|
recs = assertDNSQuery("management-api.test1.root.dev.test.", 2);
|
||||||
assertEquals("wrong target name", "test1.root.hwx.test.",
|
assertEquals("wrong target name", "test1.root.dev.test.",
|
||||||
((CNAMERecord) recs[0]).getTarget().toString());
|
((CNAMERecord) recs[0]).getTarget().toString());
|
||||||
assertTrue("not an ARecord", recs[isSecure() ? 2 : 1] instanceof ARecord);
|
assertTrue("not an ARecord", recs[isSecure() ? 2 : 1] instanceof ARecord);
|
||||||
|
|
||||||
recs = assertDNSQuery("appmaster-ipc-api.test1.root.hwx.test.",
|
recs = assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.",
|
||||||
Type.SRV, 1);
|
Type.SRV, 1);
|
||||||
assertTrue("not an SRV record", recs[0] instanceof SRVRecord);
|
assertTrue("not an SRV record", recs[0] instanceof SRVRecord);
|
||||||
assertEquals("wrong port", 1026, ((SRVRecord) recs[0]).getPort());
|
assertEquals("wrong port", 1026, ((SRVRecord) recs[0]).getPort());
|
||||||
|
|
||||||
recs = assertDNSQuery("appmaster-ipc-api.test1.root.hwx.test.", 2);
|
recs = assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.", 2);
|
||||||
assertEquals("wrong target name", "test1.root.hwx.test.",
|
assertEquals("wrong target name", "test1.root.dev.test.",
|
||||||
((CNAMERecord) recs[0]).getTarget().toString());
|
((CNAMERecord) recs[0]).getTarget().toString());
|
||||||
assertTrue("not an ARecord", recs[isSecure() ? 2 : 1] instanceof ARecord);
|
assertTrue("not an ARecord", recs[isSecure() ? 2 : 1] instanceof ARecord);
|
||||||
|
|
||||||
recs = assertDNSQuery("http-api.test1.root.hwx.test.", 2);
|
recs = assertDNSQuery("http-api.test1.root.dev.test.", 2);
|
||||||
assertEquals("wrong target name", "test1.root.hwx.test.",
|
assertEquals("wrong target name", "test1.root.dev.test.",
|
||||||
((CNAMERecord) recs[0]).getTarget().toString());
|
((CNAMERecord) recs[0]).getTarget().toString());
|
||||||
assertTrue("not an ARecord", recs[isSecure() ? 2 : 1] instanceof ARecord);
|
assertTrue("not an ARecord", recs[isSecure() ? 2 : 1] instanceof ARecord);
|
||||||
|
|
||||||
recs = assertDNSQuery("http-api.test1.root.hwx.test.", Type.SRV,
|
recs = assertDNSQuery("http-api.test1.root.dev.test.", Type.SRV,
|
||||||
1);
|
1);
|
||||||
assertTrue("not an SRV record", recs[0] instanceof SRVRecord);
|
assertTrue("not an SRV record", recs[0] instanceof SRVRecord);
|
||||||
assertEquals("wrong port", 1027, ((SRVRecord) recs[0]).getPort());
|
assertEquals("wrong port", 1027, ((SRVRecord) recs[0]).getPort());
|
||||||
|
|
||||||
assertDNSQuery("test1.root.hwx.test.", Type.TXT, 3);
|
assertDNSQuery("test1.root.dev.test.", Type.TXT, 3);
|
||||||
assertDNSQuery("appmaster-ipc-api.test1.root.hwx.test.", Type.TXT, 1);
|
assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.", Type.TXT, 1);
|
||||||
assertDNSQuery("http-api.test1.root.hwx.test.", Type.TXT, 1);
|
assertDNSQuery("http-api.test1.root.dev.test.", Type.TXT, 1);
|
||||||
assertDNSQuery("management-api.test1.root.hwx.test.", Type.TXT, 1);
|
assertDNSQuery("management-api.test1.root.dev.test.", Type.TXT, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -225,11 +225,11 @@ public class TestRegistryDNS extends Assert {
|
||||||
|
|
||||||
// start assessing whether correct records are available
|
// start assessing whether correct records are available
|
||||||
Record[] recs =
|
Record[] recs =
|
||||||
assertDNSQuery("ctr-e50-1451931954322-0016-01-000002.hwx.test.");
|
assertDNSQuery("ctr-e50-1451931954322-0016-01-000002.dev.test.");
|
||||||
assertEquals("wrong result", "172.17.0.19",
|
assertEquals("wrong result", "172.17.0.19",
|
||||||
((ARecord) recs[0]).getAddress().getHostAddress());
|
((ARecord) recs[0]).getAddress().getHostAddress());
|
||||||
|
|
||||||
recs = assertDNSQuery("comp-name.test1.root.hwx.test.", 1);
|
recs = assertDNSQuery("comp-name.test1.root.dev.test.", 1);
|
||||||
assertTrue("not an ARecord", recs[0] instanceof ARecord);
|
assertTrue("not an ARecord", recs[0] instanceof ARecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
record);
|
record);
|
||||||
|
|
||||||
Name name =
|
Name name =
|
||||||
Name.fromString("ctr-e50-1451931954322-0016-01-000002.hwx.test.");
|
Name.fromString("ctr-e50-1451931954322-0016-01-000002.dev.test.");
|
||||||
Record question = Record.newRecord(name, Type.A, DClass.IN);
|
Record question = Record.newRecord(name, Type.A, DClass.IN);
|
||||||
Message query = Message.newQuery(question);
|
Message query = Message.newQuery(question);
|
||||||
byte[] responseBytes = registryDNS.generateReply(query, null);
|
byte[] responseBytes = registryDNS.generateReply(query, null);
|
||||||
|
@ -263,12 +263,12 @@ public class TestRegistryDNS extends Assert {
|
||||||
|
|
||||||
// start assessing whether correct records are available
|
// start assessing whether correct records are available
|
||||||
Record[] recs = assertDNSQuery(
|
Record[] recs = assertDNSQuery(
|
||||||
"ctr-e50-1451931954322-0016-01-000002.hwx.test.");
|
"ctr-e50-1451931954322-0016-01-000002.dev.test.");
|
||||||
assertEquals("wrong result", "172.17.0.19",
|
assertEquals("wrong result", "172.17.0.19",
|
||||||
((ARecord) recs[0]).getAddress().getHostAddress());
|
((ARecord) recs[0]).getAddress().getHostAddress());
|
||||||
assertEquals("wrong ttl", 30L, recs[0].getTTL());
|
assertEquals("wrong ttl", 30L, recs[0].getTTL());
|
||||||
|
|
||||||
recs = assertDNSQuery("comp-name.test1.root.hwx.test.", 1);
|
recs = assertDNSQuery("comp-name.test1.root.dev.test.", 1);
|
||||||
assertTrue("not an ARecord", recs[0] instanceof ARecord);
|
assertTrue("not an ARecord", recs[0] instanceof ARecord);
|
||||||
|
|
||||||
assertEquals("wrong ttl", 30L, recs[0].getTTL());
|
assertEquals("wrong ttl", 30L, recs[0].getTTL());
|
||||||
|
@ -286,7 +286,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
// start assessing whether correct records are available
|
// start assessing whether correct records are available
|
||||||
Record[] recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1);
|
Record[] recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1);
|
||||||
assertEquals("wrong result",
|
assertEquals("wrong result",
|
||||||
"comp-name.test1.root.hwx.test.",
|
"comp-name.test1.root.dev.test.",
|
||||||
((PTRRecord) recs[0]).getTarget().toString());
|
((PTRRecord) recs[0]).getTarget().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
public void testReverseLookupInLargeNetwork() throws Exception {
|
public void testReverseLookupInLargeNetwork() throws Exception {
|
||||||
setRegistryDNS(new RegistryDNS("TestRegistry"));
|
setRegistryDNS(new RegistryDNS("TestRegistry"));
|
||||||
Configuration conf = createConfiguration();
|
Configuration conf = createConfiguration();
|
||||||
conf.set(RegistryConstants.KEY_DNS_DOMAIN, "hwx.test");
|
conf.set(RegistryConstants.KEY_DNS_DOMAIN, "dev.test");
|
||||||
conf.set(KEY_DNS_ZONE_SUBNET, "172.17.0.0");
|
conf.set(KEY_DNS_ZONE_SUBNET, "172.17.0.0");
|
||||||
conf.set(KEY_DNS_ZONE_MASK, "255.255.224.0");
|
conf.set(KEY_DNS_ZONE_MASK, "255.255.224.0");
|
||||||
conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
|
conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
|
||||||
|
@ -312,7 +312,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
// start assessing whether correct records are available
|
// start assessing whether correct records are available
|
||||||
Record[] recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1);
|
Record[] recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1);
|
||||||
assertEquals("wrong result",
|
assertEquals("wrong result",
|
||||||
"comp-name.test1.root.hwx.test.",
|
"comp-name.test1.root.dev.test.",
|
||||||
((PTRRecord) recs[0]).getTarget().toString());
|
((PTRRecord) recs[0]).getTarget().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
|
|
||||||
// start assessing whether correct records are available
|
// start assessing whether correct records are available
|
||||||
Name name =
|
Name name =
|
||||||
Name.fromString("ctr-e50-1451931954322-0016-01-000002.hwx.test.");
|
Name.fromString("ctr-e50-1451931954322-0016-01-000002.dev.test.");
|
||||||
Record question = Record.newRecord(name, Type.A, DClass.IN);
|
Record question = Record.newRecord(name, Type.A, DClass.IN);
|
||||||
Message query = Message.newQuery(question);
|
Message query = Message.newQuery(question);
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
// KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
// KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||||
// PublicKey pubKey = keyFactory.generatePublic(keySpec);
|
// PublicKey pubKey = keyFactory.generatePublic(keySpec);
|
||||||
DNSKEYRecord dnskeyRecord =
|
DNSKEYRecord dnskeyRecord =
|
||||||
new DNSKEYRecord(Name.fromString("hwxstg.site."), DClass.IN, 0,
|
new DNSKEYRecord(Name.fromString("dev.test."), DClass.IN, 0,
|
||||||
DNSKEYRecord.Flags.ZONE_KEY,
|
DNSKEYRecord.Flags.ZONE_KEY,
|
||||||
DNSKEYRecord.Protocol.DNSSEC,
|
DNSKEYRecord.Protocol.DNSSEC,
|
||||||
DNSSEC.Algorithm.RSASHA256,
|
DNSSEC.Algorithm.RSASHA256,
|
||||||
|
@ -486,11 +486,11 @@ public class TestRegistryDNS extends Assert {
|
||||||
|
|
||||||
// start assessing whether correct records are available
|
// start assessing whether correct records are available
|
||||||
Record[] recs = assertDNSQuery(
|
Record[] recs = assertDNSQuery(
|
||||||
"ctr-e50-1451931954322-0016-01-000002.hwx.test.", Type.AAAA, 1);
|
"ctr-e50-1451931954322-0016-01-000002.dev.test.", Type.AAAA, 1);
|
||||||
assertEquals("wrong result", "172.17.0.19",
|
assertEquals("wrong result", "172.17.0.19",
|
||||||
((AAAARecord) recs[0]).getAddress().getHostAddress());
|
((AAAARecord) recs[0]).getAddress().getHostAddress());
|
||||||
|
|
||||||
recs = assertDNSQuery("comp-name.test1.root.hwx.test.", Type.AAAA, 1);
|
recs = assertDNSQuery("comp-name.test1.root.dev.test.", Type.AAAA, 1);
|
||||||
assertTrue("not an ARecord", recs[0] instanceof AAAARecord);
|
assertTrue("not an ARecord", recs[0] instanceof AAAARecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
record);
|
record);
|
||||||
|
|
||||||
// start assessing whether correct records are available
|
// start assessing whether correct records are available
|
||||||
Name name = Name.fromString("missing.hwx.test.");
|
Name name = Name.fromString("missing.dev.test.");
|
||||||
Record question = Record.newRecord(name, Type.A, DClass.IN);
|
Record question = Record.newRecord(name, Type.A, DClass.IN);
|
||||||
Message query = Message.newQuery(question);
|
Message query = Message.newQuery(question);
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
public void testReadMasterFile() throws Exception {
|
public void testReadMasterFile() throws Exception {
|
||||||
setRegistryDNS(new RegistryDNS("TestRegistry"));
|
setRegistryDNS(new RegistryDNS("TestRegistry"));
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
conf.set(RegistryConstants.KEY_DNS_DOMAIN, "hwx.test");
|
conf.set(RegistryConstants.KEY_DNS_DOMAIN, "dev.test");
|
||||||
conf.set(RegistryConstants.KEY_DNS_ZONE_SUBNET, "172.17.0");
|
conf.set(RegistryConstants.KEY_DNS_ZONE_SUBNET, "172.17.0");
|
||||||
conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
|
conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
|
||||||
conf.set(RegistryConstants.KEY_DNS_ZONES_DIR,
|
conf.set(RegistryConstants.KEY_DNS_ZONES_DIR,
|
||||||
|
@ -561,17 +561,17 @@ public class TestRegistryDNS extends Assert {
|
||||||
|
|
||||||
// start assessing whether correct records are available
|
// start assessing whether correct records are available
|
||||||
Record[] recs =
|
Record[] recs =
|
||||||
assertDNSQuery("ctr-e50-1451931954322-0016-01-000002.hwx.test.");
|
assertDNSQuery("ctr-e50-1451931954322-0016-01-000002.dev.test.");
|
||||||
assertEquals("wrong result", "172.17.0.19",
|
assertEquals("wrong result", "172.17.0.19",
|
||||||
((ARecord) recs[0]).getAddress().getHostAddress());
|
((ARecord) recs[0]).getAddress().getHostAddress());
|
||||||
|
|
||||||
recs = assertDNSQuery("comp-name.test1.root.hwx.test.", 1);
|
recs = assertDNSQuery("comp-name.test1.root.dev.test.", 1);
|
||||||
assertTrue("not an ARecord", recs[0] instanceof ARecord);
|
assertTrue("not an ARecord", recs[0] instanceof ARecord);
|
||||||
|
|
||||||
// lookup dyanmic reverse records
|
// lookup dyanmic reverse records
|
||||||
recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1);
|
recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1);
|
||||||
assertEquals("wrong result",
|
assertEquals("wrong result",
|
||||||
"comp-name.test1.root.hwx.test.",
|
"comp-name.test1.root.dev.test.",
|
||||||
((PTRRecord) recs[0]).getTarget().toString());
|
((PTRRecord) recs[0]).getTarget().toString());
|
||||||
|
|
||||||
// now lookup static reverse records
|
// now lookup static reverse records
|
||||||
|
@ -583,7 +583,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
byte[] responseBytes = getRegistryDNS().generateReply(query, null);
|
byte[] responseBytes = getRegistryDNS().generateReply(query, null);
|
||||||
Message response = new Message(responseBytes);
|
Message response = new Message(responseBytes);
|
||||||
recs = response.getSectionArray(Section.ANSWER);
|
recs = response.getSectionArray(Section.ANSWER);
|
||||||
assertEquals("wrong result", "cn005.hwx.test.",
|
assertEquals("wrong result", "cn005.dev.test.",
|
||||||
((PTRRecord) recs[0]).getTarget().toString());
|
((PTRRecord) recs[0]).getTarget().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,7 +636,7 @@ public class TestRegistryDNS extends Assert {
|
||||||
public void testExternalCNAMERecord() throws Exception {
|
public void testExternalCNAMERecord() throws Exception {
|
||||||
setRegistryDNS(new RegistryDNS("TestRegistry"));
|
setRegistryDNS(new RegistryDNS("TestRegistry"));
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
conf.set(RegistryConstants.KEY_DNS_DOMAIN, "hwx.test");
|
conf.set(RegistryConstants.KEY_DNS_DOMAIN, "dev.test");
|
||||||
conf.set(RegistryConstants.KEY_DNS_ZONE_SUBNET, "172.17.0");
|
conf.set(RegistryConstants.KEY_DNS_ZONE_SUBNET, "172.17.0");
|
||||||
conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
|
conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
|
||||||
conf.set(RegistryConstants.KEY_DNS_ZONES_DIR,
|
conf.set(RegistryConstants.KEY_DNS_ZONES_DIR,
|
||||||
|
|
|
@ -19,18 +19,18 @@
|
||||||
$ORIGIN .
|
$ORIGIN .
|
||||||
$TTL 1800 ; 30 minutes
|
$TTL 1800 ; 30 minutes
|
||||||
0.17.172.in-addr.arpa IN SOA ns.hwhq.hortonworks.com. it.hortonworks.com. (
|
0.17.172.in-addr.arpa IN SOA ns.hwhq.hortonworks.com. it.hortonworks.com. (
|
||||||
2015081000 ; serial
|
2015081000 ; serial
|
||||||
10800 ; refresh (3 hours)
|
10800 ; refresh (3 hours)
|
||||||
900 ; retry (15 minutes)
|
900 ; retry (15 minutes)
|
||||||
1814400 ; expire (3 weeks)
|
1814400 ; expire (3 weeks)
|
||||||
10800 ; minimum (3 hours)
|
10800 ; minimum (3 hours)
|
||||||
)
|
)
|
||||||
NS ns.hwhq.hortonworks.com.
|
NS ns.hwhq.hortonworks.com.
|
||||||
NS ns2.hwhq.hortonworks.com.
|
NS ns2.hwhq.hortonworks.com.
|
||||||
|
|
||||||
$ORIGIN 0.17.172.in-addr.arpa.
|
$ORIGIN 0.17.172.in-addr.arpa.
|
||||||
5 PTR cn005.hwx.test.
|
5 PTR cn005.dev.test.
|
||||||
6 PTR cn006.hwx.test.
|
6 PTR cn006.dev.test.
|
||||||
7 PTR cn007.hwx.test.
|
7 PTR cn007.dev.test.
|
||||||
8 PTR cn008.hwx.test.
|
8 PTR cn008.dev.test.
|
||||||
9 PTR cn009.hwx.test.
|
9 PTR cn009.dev.test.
|
||||||
|
|
|
@ -141,12 +141,12 @@ User can use these constants in their configurations to be dynamically substitut
|
||||||
```
|
```
|
||||||
Here, `COMPONENT_INSTANCE_NAME` and `SERVICE_NAME` are the constants to be substituted by the system.
|
Here, `COMPONENT_INSTANCE_NAME` and `SERVICE_NAME` are the constants to be substituted by the system.
|
||||||
|
|
||||||
Suppose the `COMPONENT_INSTANCE_NAME` is `regionserver-0` and `SERVICE_NAME` is defined by user as `hbase`, user name is `devuser` and domain name is `hwxdev.site`.
|
Suppose the `COMPONENT_INSTANCE_NAME` is `regionserver-0` and `SERVICE_NAME` is defined by user as `hbase`, user name is `devuser` and domain name is `dev.test`.
|
||||||
Then, the config will be substituted by the service AM and written in the config file `/etc/hadoop/hbase-site.xml` inside the container as below:
|
Then, the config will be substituted by the service AM and written in the config file `/etc/hadoop/hbase-site.xml` inside the container as below:
|
||||||
```
|
```
|
||||||
<property>
|
<property>
|
||||||
<name>hbase.regionserver.hostname</name>
|
<name>hbase.regionserver.hostname</name>
|
||||||
<value>regionserver-0.hbase.devuser.hwxdev.site</value>
|
<value>regionserver-0.hbase.devuser.dev.test</value>
|
||||||
</property>
|
</property>
|
||||||
```
|
```
|
||||||
where `regionserver-0` is the actual component instance name assigned by the system for this container.
|
where `regionserver-0` is the actual component instance name assigned by the system for this container.
|
||||||
|
|
Loading…
Reference in New Issue