private void buildFilter(Collection<? extends AbstractKerberosDescriptorContainer> containers,
                           Map<String, Set<String>> propertyFilter,
                           Map<String, Map<String, String>> replacements)
      throws AmbariException {
    if (containers != null) {
      for (AbstractKerberosDescriptorContainer container : containers) {
        Map<String, KerberosConfigurationDescriptor> configurationDescriptors = container.getConfigurations(false);

        if (!MapUtils.isEmpty(configurationDescriptors)) {
          for (KerberosConfigurationDescriptor configurationDescriptor : configurationDescriptors.values()) {
            Map<String, String> properties = configurationDescriptor.getProperties();

            if (!MapUtils.isEmpty(properties)) {
              String configType = configurationDescriptor.getType();

              Set<String> propertyNames = propertyFilter.get(configType);
              if (propertyNames == null) {
                propertyNames = new HashSet<>();
                propertyFilter.put(configType, propertyNames);
              }

              // Replace variables in the property name. For example ${knox-env/knox_user}.
              for (String propertyName : properties.keySet()) {
                propertyNames.add(variableReplacementHelper.replaceVariables(propertyName, replacements));
              }
            }
          }
        }

        Collection<? extends AbstractKerberosDescriptorContainer> childContainers = container.getChildContainers();
        if (childContainers != null) {
          buildFilter(childContainers, propertyFilter, replacements);
        }
      }
    }
  }
Adds entries to the property filter (<code>propertyFilter</code>) found in the {@link KerberosConfigurationDescriptor}s
within the specified node of the Kerberos descriptor.

@param containers     the Kerberos descriptor containers to process
@param propertyFilter the property filter map to update
@param replacements   replacement values to use when attempting to perform variable replacements on the property names
@throws AmbariException if an issue occurs while replacing variables in the property names
ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java