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

[RFE] Expose root policy metadata as hub template context variable

XMLWordPrintable

    • False
    • None
    • False
    • Not Selected
    • 0% To Do, 0% In Progress, 100% Done

      Outcome

      A new hub template variable of `.PolicyMetadata` which has the `name`, `namespace`, `labels`, and `annotations` keys with values from the root policy.

      Original

      As a user managing Policies in a GitOps process the same Policy will end up in multiple namespaces as determined by a release/change process.

      Look up functions are limited in hub policies such that they can only gather data from the namespace where the root policy exists. In the above scenario the namespace is not known.

      Leaving the namespace blank currently works, but this is not documented behavior and could change in the future.

      data: '{{hub copySecretData "" "collector-tls" hub}}'
      

      Creating a context variable "rootPolicyMetadata" which contains the namespace and name would allow for explicit notation of the namespace.

      data: '{{hub copySecretData .rootPolicyMetadata.namespace "collector-tls" hub}}'
      

      or

      data: '{{hub (lookup "policy.open-cluster-management.io/v1" "Policy" .rootPolicyMetadata.namespace .rootPolicyMetadata.name).status.compliant hub}}'
      

              mprahl Matthew Prahl
              rhn-support-bjarvis Brian Jarvis
              Matthew Prahl Matthew Prahl
              Derek Ho Derek Ho
              Gus Parvin Gus Parvin
              Sho Weimer Sho Weimer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: