Repository: ambari Updated Branches: refs/heads/trunk 47f925eff -> 862827df6
AMBARI-12000. Blueprint export incorrectly includes Kerberos host information. (rnettleton) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/862827df Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/862827df Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/862827df Branch: refs/heads/trunk Commit: 862827df6107d7e0aec968e03bbf396bf2fe46a2 Parents: 47f925e Author: Bob Nettleton <[email protected]> Authored: Thu Jun 18 11:47:43 2015 -0400 Committer: Bob Nettleton <[email protected]> Committed: Thu Jun 18 11:48:19 2015 -0400 ---------------------------------------------------------------------- .../BlueprintConfigurationProcessor.java | 5 +- .../BlueprintConfigurationProcessorTest.java | 54 ++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/862827df/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java index af3b331..f567c64 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java @@ -127,7 +127,9 @@ public class BlueprintConfigurationProcessor { */ private static final PropertyFilter[] exportPropertyFilters = { new PasswordPropertyFilter(), - new SimplePropertyNameExportFilter("tez.tez-ui.history-url.base", "tez-site")}; + new SimplePropertyNameExportFilter("tez.tez-ui.history-url.base", "tez-site"), + new SimplePropertyNameExportFilter("admin_server_host", "kerberos-env"), + new SimplePropertyNameExportFilter("kdc_host", "kerberos-env")}; /** * Statically-defined list of filters to apply on cluster config @@ -1941,6 +1943,7 @@ public class BlueprintConfigurationProcessor { multiCoreSiteMap.put("hadoop.proxyuser.hive.hosts", new MultipleHostTopologyUpdater("HIVE_SERVER")); multiCoreSiteMap.put("hadoop.proxyuser.HTTP.hosts", new MultipleHostTopologyUpdater("WEBHCAT_SERVER")); multiCoreSiteMap.put("hadoop.proxyuser.hcat.hosts", new MultipleHostTopologyUpdater("WEBHCAT_SERVER")); + multiCoreSiteMap.put("hadoop.proxyuser.yarn.hosts", new MultipleHostTopologyUpdater("RESOURCEMANAGER")); multiWebhcatSiteMap.put("templeton.hive.properties", new TempletonHivePropertyUpdater()); multiWebhcatSiteMap.put("templeton.kerberos.principal", new MultipleHostTopologyUpdater("WEBHCAT_SERVER")); hiveEnvMap.put("hive_hostname", new SingleHostTopologyUpdater("HIVE_SERVER")); http://git-wip-us.apache.org/repos/asf/ambari/blob/862827df/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java index abf5675..c8daf09 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java @@ -714,6 +714,60 @@ public class BlueprintConfigurationProcessorTest { tezSiteProperties.containsKey("tez.tez-ui.history-url.base")); } + /** + * There is no support currently for deploying a fully Kerberized + * cluster with Blueprints. This test verifies the current treatment + * of Kerberos-related properties in a Blueprint export. + * + * @throws Exception + */ + @Test + public void testKerberosConfigExport() throws Exception { + final String expectedHostName = "c6401.apache.ambari.org"; + final String expectedHostGroupName = "host_group_1"; + + Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); + Map<String, String> kerberosEnvProperties = new HashMap<String, String>(); + Map<String, String> coreSiteProperties = new HashMap<String, String>(); + configProperties.put("kerberos-env", kerberosEnvProperties); + configProperties.put("core-site", coreSiteProperties); + + // simulate the case of a Kerberized cluster, including config + // added by the Kerberos service + kerberosEnvProperties.put("admin_server_host", expectedHostName); + kerberosEnvProperties.put("kdc_host", expectedHostName); + coreSiteProperties.put("hadoop.proxyuser.yarn.hosts", expectedHostName); + + Configuration clusterConfig = new Configuration(configProperties, + Collections.<String, Map<String, Map<String, String>>>emptyMap()); + + // note: test hostgroups may not accurately reflect the required components for the config properties + // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components + // are not validated + Collection<String> groupComponents = new HashSet<String>(); + groupComponents.add("TEZ_CLIENT"); + groupComponents.add("RESOURCEMANAGER"); + Collection<String> hosts = new ArrayList<String>(); + hosts.add(expectedHostName); + hosts.add("serverTwo"); + TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); + + Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + hostGroups.add(group); + + ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); + BlueprintConfigurationProcessor configProcessor = new BlueprintConfigurationProcessor(topology); + configProcessor.doUpdateForBlueprintExport(); + + // verify that these properties are filtered out of the exported configuration + assertFalse("admin_server_host should not be present in exported blueprint in kerberos-env", + kerberosEnvProperties.containsKey("admin_server_host")); + assertFalse("kdc_host should not be present in exported blueprint in kerberos-env", + kerberosEnvProperties.containsKey("kdc_host")); + assertEquals("hadoop.proxyuser.yarn.hosts was not exported correctly", + createExportedHostName("host_group_1"), coreSiteProperties.get("hadoop.proxyuser.yarn.hosts")); + } + @Test public void testDoNameNodeHighAvailabilityExportWithHAEnabled() throws Exception { final String expectedNameService = "mynameservice";
