private void removeOrphanConfigTypes(Configuration configuration) {
    Blueprint blueprint = clusterTopology.getBlueprint();

    Collection<String> configTypes = configuration.getAllConfigTypes();
    for (String configType : configTypes) {
      if (!blueprint.isValidConfigType(configType)) {
        configuration.removeConfigType(configType);
        LOG.info("Removing config type '{}' as related service is not present in either Blueprint or cluster creation template.", configType);
      }
    }
  }
Remove config-types from the given configuration 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