Skip to content
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

Upgrade to 0.49.0 breaks Oathkeeper templates with Ory functions #707

Closed
5 tasks done
David-Wobrock opened this issue Oct 1, 2024 · 2 comments · Fixed by #709
Closed
5 tasks done

Upgrade to 0.49.0 breaks Oathkeeper templates with Ory functions #707

David-Wobrock opened this issue Oct 1, 2024 · 2 comments · Fixed by #709
Assignees
Labels
bug Something is not working.

Comments

@David-Wobrock
Copy link
Contributor

David-Wobrock commented Oct 1, 2024

Preflight checklist

Ory Network Project

No response

Describe the bug

We use an Oathkeeper remote_json authorizer with a custom payload, that uses the printIndex function.
See https://github.com/ory/oathkeeper/blob/v0.40.7/x/template.go

However, when doing that and using 0.49.0 we get an error:

Error: template: oathkeeper/charts/oathkeeper/templates/deployment-controller.yaml:41:12: executing "oathkeeper/charts/oathkeeper/templates/deployment-controller.yaml" at <include "oathkeeper.annotations.checksum" .>:
error calling include: template: oathkeeper/charts/oathkeeper/templates/_helpers.tpl:111:31: executing "oathkeeper.annotations.checksum" at <include (print $.Template.BasePath $oathkeeperConfigMapFile) .>:
error calling include: template: oathkeeper/charts/oathkeeper/templates/configmap-config.yaml:14:8: executing "oathkeeper/charts/oathkeeper/templates/configmap-config.yaml" at <include "oathkeeper.configmap" .>:
error calling include: template: oathkeeper/charts/oathkeeper/templates/_helpers.tpl:33:4: executing "oathkeeper.configmap" at <tpl (toYaml $config) .>:
error calling tpl: cannot parse template "BLABLABLA-our-custom-config-BLABLABLA": template: gotpl:96: function "printIndex" not defined

See example config below:

Reproducing the bug

      authorizers:
        remote_json:
          enabled: true
          config:
            remote: http://127.0.0.1:8181/openpolicyagent
            payload: |
              {
                "input": {
                  "http": {
                    "url": "{{ print .MatchContext.URL }}",
                    "domain": "{{ printIndex .MatchContext.RegexpCaptureGroups 1 }}",
                    "path": "{{ printIndex .MatchContext.RegexpCaptureGroups 2 }}"
                  }
                }
              }

Relevant log output

No response

Relevant configuration

No response

Version

0.49.0

On which operating system are you observing this issue?

None

In which environment are you deploying?

Kubernetes with Helm

Additional Context

No response

@David-Wobrock David-Wobrock added the bug Something is not working. label Oct 1, 2024
@David-Wobrock David-Wobrock changed the title Upgrade to 0.49.0 breaks templates with Ory functions Upgrade to 0.49.0 breaks Oathkeeper templates with Ory functions Oct 1, 2024
@quizmoon
Copy link

quizmoon commented Oct 2, 2024

Having exactly the same issue starting of 0.49.0

@Demonsthere
Copy link
Collaborator

oh i think i see the issue, we use the tpl function to allow helm parsing, and since this is using go templates too, it tries to run the functions on helm install/upgrade 🤔
As a workaround i would suggest sideloading the config using a custom config map, as we would need to add an option to enable or disable the templating step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants