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

Expose the "pick" sprig function in Policy templates

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • ACM 2.13.0
    • GRC
    • False
    • Hide

      None

      Show
      None
    • False
    • Hide

      Provide the required acceptance criteria using this template.

      • The pick function is available in ACM and is listed in the official documentation
      Show
      Provide the required acceptance criteria using this template. The pick function is available in ACM and is listed in the official documentation
    • Not Selected
    • None

      Value Statement

      I need the pick function for something like this:

       

      ---
      apiVersion: policy.open-cluster-management.io/v1
      kind: ConfigurationPolicy
      metadata:
        name: clone-sc-rbd-to-thin
      spec:
        remediationAction: inform
        severity: medium
        object-templates-raw: |
          {{- $src := (lookup "storage.k8s.io/v1" "StorageClass" "" "ocs-storagecluster-ceph-rbd") -}}
          {{- if $src }}
          - complianceType: musthave
            objectDefinition:
              apiVersion: storage.k8s.io/v1
              kind: StorageClass
              metadata:
                name: thin
              # Use 'pick' directly on the $src object
              {{- pick $src "provisioner" "parameters" "reclaimPolicy" "allowVolumeExpansion" "volumeBindingMode" | toYaml | nindent 8 }}
          {{- end }} 

       

       

      But the function is not available in ACM ([it is available in sprig|https://masterminds.github.io/sprig/dicts.html:]

       

      template: tmpl:12: function "pick" not defined 

      Definition of Done for Engineering Story Owner (Checklist)

      • pick function to be defined in the Policy templates

      Development Complete

      • The code is complete.
      • Functionality is working.
      • Any required downstream Docker file changes are made.

      Tests Automated

      • [ ] Unit/function tests have been automated and incorporated into the
        build.
      • [ ] 100% automated unit/function test coverage for new or changed APIs.

      Secure Design

      • [ ] Security has been assessed and incorporated into your threat model.

      Multidisciplinary Teams Readiness

      • [ ] Create an informative documentation issue using the Customer

      Portal Doc template that you can access from [The Playbook](

      https://docs.google.com/document/d/1YTqpZRH54Bnn4WJ2nZmjaCoiRtqmrc2w6DdQxe_yLZ8/edit#heading=h.9fvyr2rdriby),

      and ensure doc acceptance criteria is met.

      • Call out this sentence as it's own action:
      • [ ] Link the development issue to the doc issue.

      Support Readiness

      • [ ] The must-gather script has been updated.

              jkulikau@redhat.com Justin Kulikauskas
              lmaly-redhat.com Lucian Maly
              Derek Ho Derek Ho
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: