private Set<String> configureKerberos(Configuration clusterConfiguration, Map<String, Map<String, String>> existingConfigurations) throws AmbariException {
    Cluster cluster = getCluster();
    Blueprint blueprint = clusterTopology.getBlueprint();
    Set<String> services = ImmutableSet.copyOf(blueprint.getServices());
    Configuration stackDefaults = blueprint.getStack().getConfiguration(services);

    // add clusterHostInfo containing components to hosts map, based on Topology, to use this one instead of
    // StageUtils.getClusterInfo()
    Map<String, String> componentHostsMap = createComponentHostMap(blueprint);
    existingConfigurations.put(KerberosHelper.CLUSTER_HOST_INFO, componentHostsMap);

    try {
      KerberosHelper kerberosHelper = AmbariContext.getController().getKerberosHelper();

      // generate principals & keytabs for headless identities
      kerberosHelper.ensureHeadlessIdentities(cluster, existingConfigurations, services);

      // get Kerberos specific configurations
      Map<String, Map<String, String>> updatedConfigs = kerberosHelper.getServiceConfigurationUpdates(
        cluster, existingConfigurations, createServiceComponentMap(blueprint), null, null, true, false);

      // Since Kerberos is being enabled, make sure the cluster-env/security_enabled property is
      // set to "true"
      updatedConfigs
        .computeIfAbsent(ConfigHelper.CLUSTER_ENV, __ -> new HashMap<>())
        .put("security_enabled", "true");

      updatedConfigs.keySet().removeIf(configType -> !blueprint.isValidConfigType(configType));

      // apply Kerberos specific configurations
      return clusterConfiguration.applyUpdatesToStackDefaultProperties(stackDefaults, existingConfigurations, updatedConfigs);
    } catch (KerberosInvalidConfigurationException e) {
      LOG.error("An exception occurred while doing Kerberos related configuration update: " + e, e);
    }

    return ImmutableSet.of();
  }
Remove config-types, if there is no any services related to them (except cluster-env and global).
ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java