Uploaded image for project: 'Red Hat Advanced Cluster Management'
  1. Red Hat Advanced Cluster Management
  2. ACM-10713

Supporting dictionaries and Sprig's dictionary functions in policies and policy templating

XMLWordPrintable

    • 2
    • False
    • None
    • False
    • GRC Sprint 2024-07, GRC Sprint 2024-08
    • No

      Currently the only supported dictionary operation in policies is the `dig` function. In contrast to this, governance has a more rich set of functions for `list`.

      While preparing ACM policies, having dictionary support will improve the flexibility of the templating language. Some of the functions that could be supported might be as follows ( http://masterminds.github.io/sprig/dicts.html ):

      • Using `dict` to create variables of type dictionary
      • Supporting `hasKey` function
      • Supporting `merge`/`mustMerge` to merge multiple dictionaries
      • Supporting `get`/`set`/`unset` functions on dictionaries

      Having `dict` support will allow users to create map like structures so that accessing them is more convenient with keys - these keys might be decided by the end users too: such as creating a map of secrets where the key might be the value of a certain label and value can be the secret itself. Having merge support (since it also gives priority to the foremost parameters) and hasKey support will ensure the creation of dictionaries and control flow are easier.

      Although the same result can be achieved with list, having map like structures might be much more convenient in certain cases and dictionary support might also eliminate the unnecessary `lookup` calls in certain cases.

              dhaiduce Dale Haiducek
              rhn-gps-mileri Mervan Ileri
              Derek Ho Derek Ho
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: