YARN-8069. Clean up example hostnames for RegistryDNS.

Contributed by Billie Rinaldi
This commit is contained in:
Eric Yang 2018-03-28 20:17:37 -04:00
parent a991e899fb
commit 3d185d62fc
3 changed files with 47 additions and 47 deletions

View File

@ -156,7 +156,7 @@ public void initialize() throws Exception {
protected Configuration createConfiguration() {
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.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
return conf;
@ -179,39 +179,39 @@ public void testAppRegistration() throws Exception {
"/registry/users/root/services/org-apache-slider/test1/", record);
// 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",
((ARecord) recs[0]).getAddress().getHostAddress());
recs = assertDNSQuery("management-api.test1.root.hwx.test.", 2);
assertEquals("wrong target name", "test1.root.hwx.test.",
recs = assertDNSQuery("management-api.test1.root.dev.test.", 2);
assertEquals("wrong target name", "test1.root.dev.test.",
((CNAMERecord) recs[0]).getTarget().toString());
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);
assertTrue("not an SRV record", recs[0] instanceof SRVRecord);
assertEquals("wrong port", 1026, ((SRVRecord) recs[0]).getPort());
recs = assertDNSQuery("appmaster-ipc-api.test1.root.hwx.test.", 2);
assertEquals("wrong target name", "test1.root.hwx.test.",
recs = assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.", 2);
assertEquals("wrong target name", "test1.root.dev.test.",
((CNAMERecord) recs[0]).getTarget().toString());
assertTrue("not an ARecord", recs[isSecure() ? 2 : 1] instanceof ARecord);
recs = assertDNSQuery("http-api.test1.root.hwx.test.", 2);
assertEquals("wrong target name", "test1.root.hwx.test.",
recs = assertDNSQuery("http-api.test1.root.dev.test.", 2);
assertEquals("wrong target name", "test1.root.dev.test.",
((CNAMERecord) recs[0]).getTarget().toString());
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);
assertTrue("not an SRV record", recs[0] instanceof SRVRecord);
assertEquals("wrong port", 1027, ((SRVRecord) recs[0]).getPort());
assertDNSQuery("test1.root.hwx.test.", Type.TXT, 3);
assertDNSQuery("appmaster-ipc-api.test1.root.hwx.test.", Type.TXT, 1);
assertDNSQuery("http-api.test1.root.hwx.test.", Type.TXT, 1);
assertDNSQuery("management-api.test1.root.hwx.test.", Type.TXT, 1);
assertDNSQuery("test1.root.dev.test.", Type.TXT, 3);
assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.", Type.TXT, 1);
assertDNSQuery("http-api.test1.root.dev.test.", Type.TXT, 1);
assertDNSQuery("management-api.test1.root.dev.test.", Type.TXT, 1);
}
@Test
@ -225,11 +225,11 @@ public void testContainerRegistration() throws Exception {
// start assessing whether correct records are available
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",
((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);
}
@ -243,7 +243,7 @@ public void testContainerRegistrationPersistanceAbsent() throws Exception {
record);
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);
Message query = Message.newQuery(question);
byte[] responseBytes = registryDNS.generateReply(query, null);
@ -263,12 +263,12 @@ public void testRecordTTL() throws Exception {
// start assessing whether correct records are available
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",
((ARecord) recs[0]).getAddress().getHostAddress());
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);
assertEquals("wrong ttl", 30L, recs[0].getTTL());
@ -286,7 +286,7 @@ public void testReverseLookup() throws Exception {
// start assessing whether correct records are available
Record[] recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1);
assertEquals("wrong result",
"comp-name.test1.root.hwx.test.",
"comp-name.test1.root.dev.test.",
((PTRRecord) recs[0]).getTarget().toString());
}
@ -294,7 +294,7 @@ public void testReverseLookup() throws Exception {
public void testReverseLookupInLargeNetwork() throws Exception {
setRegistryDNS(new RegistryDNS("TestRegistry"));
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_MASK, "255.255.224.0");
conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
@ -312,7 +312,7 @@ public void testReverseLookupInLargeNetwork() throws Exception {
// start assessing whether correct records are available
Record[] recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1);
assertEquals("wrong result",
"comp-name.test1.root.hwx.test.",
"comp-name.test1.root.dev.test.",
((PTRRecord) recs[0]).getTarget().toString());
}
@ -348,7 +348,7 @@ public void testNoContainerIP() throws Exception {
// start assessing whether correct records are available
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);
Message query = Message.newQuery(question);
@ -431,7 +431,7 @@ public void testDNSKEYRecord() throws Exception {
// KeyFactory keyFactory = KeyFactory.getInstance("RSA");
// PublicKey pubKey = keyFactory.generatePublic(keySpec);
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.Protocol.DNSSEC,
DNSSEC.Algorithm.RSASHA256,
@ -486,11 +486,11 @@ public void testAAAALookup() throws Exception {
// start assessing whether correct records are available
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",
((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);
}
@ -504,7 +504,7 @@ public void testNegativeLookup() throws Exception {
record);
// 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);
Message query = Message.newQuery(question);
@ -533,7 +533,7 @@ public void testNegativeLookup() throws Exception {
public void testReadMasterFile() throws Exception {
setRegistryDNS(new RegistryDNS("TestRegistry"));
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.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
conf.set(RegistryConstants.KEY_DNS_ZONES_DIR,
@ -561,17 +561,17 @@ public void testReadMasterFile() throws Exception {
// start assessing whether correct records are available
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",
((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);
// lookup dyanmic reverse records
recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1);
assertEquals("wrong result",
"comp-name.test1.root.hwx.test.",
"comp-name.test1.root.dev.test.",
((PTRRecord) recs[0]).getTarget().toString());
// now lookup static reverse records
@ -583,7 +583,7 @@ public void testReadMasterFile() throws Exception {
byte[] responseBytes = getRegistryDNS().generateReply(query, null);
Message response = new Message(responseBytes);
recs = response.getSectionArray(Section.ANSWER);
assertEquals("wrong result", "cn005.hwx.test.",
assertEquals("wrong result", "cn005.dev.test.",
((PTRRecord) recs[0]).getTarget().toString());
}
@ -636,7 +636,7 @@ public void testExampleDotCom() throws Exception {
public void testExternalCNAMERecord() throws Exception {
setRegistryDNS(new RegistryDNS("TestRegistry"));
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.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS);
conf.set(RegistryConstants.KEY_DNS_ZONES_DIR,

View File

@ -19,18 +19,18 @@
$ORIGIN .
$TTL 1800 ; 30 minutes
0.17.172.in-addr.arpa IN SOA ns.hwhq.hortonworks.com. it.hortonworks.com. (
2015081000 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
1814400 ; expire (3 weeks)
10800 ; minimum (3 hours)
2015081000 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
1814400 ; expire (3 weeks)
10800 ; minimum (3 hours)
)
NS ns.hwhq.hortonworks.com.
NS ns2.hwhq.hortonworks.com.
NS ns.hwhq.hortonworks.com.
NS ns2.hwhq.hortonworks.com.
$ORIGIN 0.17.172.in-addr.arpa.
5 PTR cn005.hwx.test.
6 PTR cn006.hwx.test.
7 PTR cn007.hwx.test.
8 PTR cn008.hwx.test.
9 PTR cn009.hwx.test.
5 PTR cn005.dev.test.
6 PTR cn006.dev.test.
7 PTR cn007.dev.test.
8 PTR cn008.dev.test.
9 PTR cn009.dev.test.

View File

@ -142,12 +142,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.
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:
```
<property>
<name>hbase.regionserver.hostname</name>
<value>regionserver-0.hbase.devuser.hwxdev.site</value>
<value>regionserver-0.hbase.devuser.dev.test</value>
</property>
```
where `regionserver-0` is the actual component instance name assigned by the system for this container.