@Override
  public void configureServices(Cluster cluster, Map<String, Collection<String>> serviceFilter)
    throws AmbariException, KerberosInvalidConfigurationException {
    final Map<String, Set<String>> installedServices = new HashMap<>();
    final Set<String> previouslyExistingServices = new HashSet<>();

    // Calculate the map of installed services to installed components.
    // We can create the map in the "shouldIncludeCommand" Command to avoid having to iterate
    // over the returned ServiceComponentHost List.
    getServiceComponentHosts(cluster,
      sch -> {
        if (sch != null) {
          String serviceName = sch.getServiceName();

          Set<String> installedComponents = installedServices.computeIfAbsent(serviceName, k -> new HashSet<>());
          installedComponents.add(sch.getServiceComponentName());

          // Determine if this component was PREVIOUSLY installed, which implies that its containing service was PREVIOUSLY installed
          if (!previouslyExistingServices.contains(serviceName) && PREVIOUSLY_INSTALLED_STATES.contains(sch.getState())) {
            previouslyExistingServices.add(serviceName);
          }

          return true;
        }

        return false;
      });

    Map<String, Map<String, String>> existingConfigurations = configHelper.calculateExistingConfigurations(ambariManagementController, cluster, null, null);
    Map<String, Map<String, String>> updates = getServiceConfigurationUpdates(cluster,
      existingConfigurations, installedServices, serviceFilter, previouslyExistingServices, true, true);

    // Store the updates...
    for (Map.Entry<String, Map<String, String>> entry : updates.entrySet()) {
      configHelper.updateConfigType(cluster, cluster.getDesiredStackVersion(), ambariManagementController,
              entry.getKey(), entry.getValue(), null, ambariManagementController.getAuthName(),
              "Enabling Kerberos for added components");
    }
  }
Deletes the kerberos identities of the given component, even if the component is already deleted.
ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java