8000 Helm webhook custom templates by ndegory · Pull Request #3942 · aquasecurity/tracee · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Helm webhook custom templates #3942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ndegory
Copy link
Contributor
@ndegory ndegory commented Mar 29, 2024

1. Explain what the PR does

2. Explain how to test it

➜ cat > test.yaml <<EOF
extraWebhookTemplates:
  - name: custom.tmpl
    goTemplate: |-
      {
        "event": "{{ .Event }}"
      }
config:
  output:
    webhook:
      name: local
      protocol: http
      host: localhost
      port: 8080
      goTemplate: /tracee/templates/custom.tmpl
EOF
➜ helm template tracee ./deploy/helm/tracee --show-only templates/tracee-templates.yaml -f test.yaml
---
# Source: tracee/templates/tracee-templates.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: tracee-templates
  labels:
    helm.sh/chart: tracee-0.20.0
    app.kubernetes.io/name: tracee
    app.kubernetes.io/instance: tracee
    app.kubernetes.io/version: "0.20.0"
    app.kubernetes.io/managed-by: Helm
data:
  custom.tmpl: |
    {
      "event": "{{ .Event }}"
    }
➜ helm template tracee ./deploy/helm/tracee --show-only templates/daemonset.yaml -f test.yaml | yq '.spec.template.spec.volumes[] | select(.name == "tracee-templates")'
name: "tracee-templates"
configMap:
  name: tracee-templates
➜ helm template tracee ./deploy/helm/tracee --show-only templates/daemonset.yaml -f test.yaml | yq '.spec.template.spec.containers[0].volumeMounts[] | select(.name == "tracee-templates")'
name: tracee-templates
readonly: true
mountPath: "/tracee/templates/custom.tmpl"
subPath: custom.tmpl

Also tested no regressions when no extra templates are defined in the values file.

3. Other comments

Fix: #3886
Fix: #3866

ndegory added 2 commits March 28, 2024 18:01
tracee up to 0.20.0 builds the flags with query delimiters, even for
fragment. This fix allows to only set the goTemplate query without other
fragments, making the URL parsable.

Signed-off-by: Nicolas Degory <nicolas.degory@gmail.com>
@ndegory
Copy link
Contributor Author
ndegory commented Mar 29, 2024

@josedonizetti this PR is ready for review

@geyslan
Copy link
Member
geyslan commented Apr 17, 2024

@ndegory we have this fix #3984. Do you think it would conflict with this PR?

@ndegory
Copy link
Contributor Author
ndegory commented Apr 17, 2024

@geyslan it shouldn't conflict, the other PR will need this one if the webhook url includes a custom template file flag.

@josedonizetti josedonizetti merged commit 59551f0 into aquasecurity:main Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Pro 4E90 jects
None yet
Development

Successfully merging this pull request may close these issues.

helm: allow user to configure gotemplate tracee can't load webhook config when not using an URL
3 participants
0