postee icon indicating copy to clipboard operation
postee copied to clipboard

How to mount rego templates?

Open HW-Jeremy opened this issue 2 years ago • 4 comments

Hi,

We installed postee with the supplied Helm chart, however it doesn't seem to support volume mounting anywhere other than on the host. Is it possible to modify the chart to support the existing volume mount?

Regards

HW-Jeremy avatar Feb 23 '23 08:02 HW-Jeremy

UP :)

HW-Jeremy avatar Mar 03 '23 16:03 HW-Jeremy

I have the same issue, later I use the URL to solve the problem.

weibo-zhao avatar Mar 08 '23 08:03 weibo-zhao

@weibo-zhao when you say you use the URL, it's postee-ui?

HW-Jeremy avatar Mar 08 '23 08:03 HW-Jeremy

i have postee also deployed with the helm chart and you can make use of the extra mount vars in the chart to mount a template(s) from a configmap to a sub folder in /server/rego-templates : i'm using version v2.12.0

configmap with template(s):

apiVersion: v1
kind: ConfigMap
metadata:
  name: postee-templates
data:
  trivy-operator-jira.rego: |
    package postee.trivyoperator.jira

    with_default(obj, prop, default_value) = default_value{
    not obj[prop]
    
    etc...
  trivy-operator-custom-slack.rego: |
    package postee.trivyoperator.custom.slack
    
    etc

values postee chart:

  # Extra Volumes to add to the postee Statefulset
  extraVolumes:
  - name: custom-templates
    configMap:
      name: postee-templates 
      items:
        - key: trivy-operator-jira.rego
          path: trivy-operator-jira.rego
        - key: trivy-operator-custom-slack.rego
          path: trivy-operator-custom-slack.rego
  # Extra Volumes Mounts to add to the postee Statefulset
  extraVolumeMounts: 
    - name: custom-templates
      mountPath: /server/rego-templates/my-custom-templates 

and add the template in the values:

    # Templates are used to format a message
    templates:
    - name: trivy-operator-jira
      rego-package: postee.trivyoperator.jira
    - name: trivy-operator-custom-slack
      rego-package: postee.trivyoperator.custom.slack

martijnvdp avatar Aug 01 '23 06:08 martijnvdp