private Map<String, Set<String>> calculateInstalledServices(Cluster cluster) {
    Map<String, Set<String>> installedServices = new HashMap<>();
    Map<String, Service> services = cluster.getServices();

    for (Service service : services.values()) {
      installedServices.put(service.getName(), service.getServiceComponents().keySet());
    }

    return installedServices;
  }
Given a Cluster object creates a map of service names to sets of the installed components for that
service.

@param cluster the cluster
@return a map of (installed) service names to the relevant set of (installed) component names
ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java