Skip to content

Commit

Permalink
Merge pull request #39 from carverauto/updates/use_gofr_oauth
Browse files Browse the repository at this point in the history
🔧 WIP ory crap
  • Loading branch information
mfreeman451 authored Oct 30, 2024
2 parents 2124ca8 + 8eda34d commit f88195a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 21 deletions.
19 changes: 8 additions & 11 deletions k8s/auth-server/base/auth-server-configmaps.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: oathkeeper-rules-data
name: oathkeeper-rules
namespace: eventrunner
data:
rules.json: |
[
{
"id": "k8s-health",
"id": "health-check",
"match": {
"url": "<^/health/(ready|alive|live)$>",
"methods": ["GET"]
Expand All @@ -26,18 +26,19 @@ data:
}
],
"upstream": {
"url": "http://oathkeeper-proxy.default.svc.cluster.local:4455"
"url": "http://eventrunner-api.eventrunner.svc.cluster.local:8200",
"preserve_host": true
}
},
{
"id": "wellknown-endpoints",
"id": "well-known",
"match": {
"url": "<^/decisions/.well-known/(alive|health)>",
"url": "<^/decisions($|/.*)$>",
"methods": ["GET"]
},
"authenticators": [
{
"handler": "noop"
"handler": "anonymous"
}
],
"authorizer": {
Expand All @@ -47,10 +48,6 @@ data:
{
"handler": "noop"
}
],
"upstream": {
"url": "http://eventrunner-api.eventrunner.svc.cluster.local:8200/.well-known/alive",
"preserve_host": true
}
]
}
]
2 changes: 1 addition & 1 deletion k8s/auth-server/base/auth-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
volumes:
- name: rules-volume
configMap:
name: oathkeeper-rules-data
name: oathkeeper-rules
items:
- key: rules.json
path: rules.json
Expand Down
13 changes: 6 additions & 7 deletions k8s/eventrunner-api/base/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ metadata:
name: eventrunner-api
namespace: eventrunner
annotations:
nginx.ingress.kubernetes.io/auth-url: "http://oathkeeper-proxy.default.svc.cluster.local:4455/decisions$request_uri"
nginx.ingress.kubernetes.io/auth-method: GET
nginx.ingress.kubernetes.io/auth-response-headers: "Authorization"
nginx.ingress.kubernetes.io/auth-snippet: |
proxy_set_header Host $http_host;
nginx.ingress.kubernetes.io/auth-url: "http://oathkeeper-api.default.svc.cluster.local:4456/decisions"
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Method $request_method;
proxy_set_header Content-Length "";
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Uri $request_uri;
spec:
ingressClassName: nginx
rules:
- host: api.tunnel.threadr.ai
http:
paths:
- path: /.well-known
- path: /
pathType: Prefix
backend:
service:
Expand Down
19 changes: 19 additions & 0 deletions k8s/nginx/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: ingress-nginx-controller
namespace: ingress-nginx
data:
proxy-buffer-size: "16k"
server-snippet: |
location = /auth {
internal;
proxy_pass http://oathkeeper-api.default.svc.cluster.local:4456/decisions;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Original-Method $request_method;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host:$server_port;
}
6 changes: 4 additions & 2 deletions k8s/ory/oathkeeper/oathkeeper-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ oathkeeper:
- X-User
- X-Tenant-ID
- X-Request-Id
- Content-Type
allow_credentials: true
debug: true
api:
Expand All @@ -35,7 +36,7 @@ oathkeeper:
anonymous:
enabled: true
config:
subject: "guest"
subject: guest
noop:
enabled: true

Expand Down Expand Up @@ -64,4 +65,5 @@ oathkeeper:

log:
level: debug
format: json
format: json
leak_sensitive_values: true

0 comments on commit f88195a

Please sign in to comment.