private static List<KerberosIdentityDescriptor> componentIdentities(KerberosServiceDescriptor serviceDescriptor, Service service, ComponentExclude componentExclude) {
    return service.getServiceComponents().values()
      .stream()
      .filter(component -> !isComponentExcluded(service, componentExclude, component))
      .flatMap(component -> serviceDescriptor.getComponentIdentities(component.getName()).stream())
      .collect(toList());
  }
Get all identities of the installed services and components. Skip service or component that is excluded.
ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/UsedIdentities.java