private void configureKerberos(AddServiceInfo request, Cluster cluster, Set<String> existingServices) {
    if (cluster.getSecurityType() == SecurityType.KERBEROS) {
      LOG.info("Configuring Kerberos for {}", request);

      Configuration stackDefaultConfig = request.getStack().getValidDefaultConfig();
      Set<String> newServices = request.newServices().keySet();
      Set<String> services = ImmutableSet.copyOf(Sets.union(newServices, existingServices));
      Map<String, Map<String, String>> existingConfigurations = request.getConfig().getFullProperties();
      existingConfigurations.put(KerberosHelper.CLUSTER_HOST_INFO, createComponentHostMap(cluster));

      try {
        KerberosHelper kerberosHelper = controller.getKerberosHelper();
        kerberosHelper.ensureHeadlessIdentities(cluster, existingConfigurations, services);
        request.getConfig().applyUpdatesToStackDefaultProperties(stackDefaultConfig, existingConfigurations,
          kerberosHelper.getServiceConfigurationUpdates(
            cluster, existingConfigurations, createServiceComponentMap(cluster), null, existingServices, true, true
          )
        );
      } catch (AmbariException | KerberosInvalidConfigurationException e) {
        CHECK.wrapInUnchecked(e, RuntimeException::new, "Error configuring Kerberos for %s: %s", request, e);
      }
    }
  }
Creates the service, component and host component resources for the request.
ambari-server/src/main/java/org/apache/ambari/server/topology/addservice/AddServiceOrchestrator.java