Skip to content

Commit ce1997e

Browse files
authored
Merge pull request #3 from FIWARE/fix/opa-plugin
Fix APISIX integration with OPA
2 parents a02f5ff + 7b2a5ec commit ce1997e

6 files changed

Lines changed: 12 additions & 10 deletions

File tree

charts/odrl-authorization/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ apiVersion: v2
22
name: odrl-authorization
33
description: Umbrella chart to deploy FIWARE ODRL Authorization
44
type: application
5-
version: 1.0.1
5+
version: 1.0.2
66
dependencies:
77
# authorization
88
- name: odrl-pap
99
condition: odrl-pap.enabled
10-
version: 2.0.2
10+
version: 2.3.0
1111
repository: https://fiware.github.io/helm-charts
1212
- name: apisix
1313
condition: apisix.enabled

charts/odrl-authorization/files/apixis-helper.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ local function build_http_request(conf, ctx)
4848
}
4949

5050
if conf.with_body then
51-
http.body = core.json.decode(core.request.get_body())
51+
http.body = core.json.decode(core.request.get_body())
5252
end
5353

5454
return http

charts/odrl-authorization/files/apixis-opa.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
local core = require("apisix.core")
1919
local http = require("resty.http")
20-
local helper = require("apisix.plugins.opa.helper")
20+
local helper = require("apisix.plugins.helper")
2121
local type = type
2222
local ipairs = ipairs
2323

@@ -72,7 +72,6 @@ end
7272

7373
function _M.access(conf, ctx)
7474
local body = helper.build_opa_input(conf, ctx, "http")
75-
7675
local params = {
7776
method = "POST",
7877
body = core.json.encode(body),

charts/odrl-authorization/templates/catchall-route.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@ spec:
5050
config:
5151
host: "{{ required "Open Agent Policy host is required when catchAllRoute is enabled" .Values.apisix.catchAllRoute.opa.host }}"
5252
policy: policy/main
53+
with_body: true
5354
{{- end }}

charts/odrl-authorization/templates/routes.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ data:
6060
opa:
6161
host: {{ required "Open Agent Policy host is required when catchAllRoute is enabled" .Values.apisix.catchAllRoute.opa.host}}
6262
policy: policy/main
63+
with_body: true
6364
{{- end }}
6465
{{- if .Values.apisix.routes }}
6566
{{- .Values.apisix.routes | toYaml | nindent 6 }}

charts/odrl-authorization/values.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ apisix:
2121
- name: "opa-lua"
2222
configMap:
2323
name: opa-lua
24+
# The plugin file must be located under the /{custom_path}/apisix/plugins directory.
25+
# Reference: https://apisix.apache.org/docs/apisix/plugin-develop/#where-to-put-your-plugins
2426
mounts:
2527
- key: opa.lua
26-
path: /opts/custom_plugins/opa.lua"
28+
path: /opts/custom_plugins/apisix/plugins/opa.lua
2729
- key: helper.lua
28-
path: /opts/custom_plugins/helper.lua
29-
30+
path: /opts/custom_plugins/apisix/plugins/helper.lua
3031
extraContainers:
3132
# -- we want to deploy the open-policy-agent as a pdp
3233
- name: open-policy-agent
33-
image: openpolicyagent/opa:1.2.0
34+
image: openpolicyagent/opa:1.11.0
3435
imagePullPolicy: IfNotPresent
3536
ports:
3637
- name: opa-http
@@ -124,4 +125,4 @@ odrl-pap:
124125
existingSecret:
125126
enabled: true
126127
name: database-secret
127-
key: postgres-admin-password
128+
key: postgres-admin-password

0 commit comments

Comments
 (0)