aquasecurity / postee

Notice: Postee is no longer under active development or maintenance.
https://aquasecurity.github.io/postee/latest
MIT License
209 stars 71 forks source link

How to mount rego templates? #532

Open HW-Jeremy opened 1 year ago

HW-Jeremy commented 1 year ago

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 commented 1 year ago

UP :)

weibo-zhao commented 1 year ago

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

HW-Jeremy commented 1 year ago

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

martijnvdp commented 1 year ago

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