Skip to content

Commit

Permalink
salt: Expose Loki API to metalk8s-ui
Browse files Browse the repository at this point in the history
We also need to enable CORS to allow Cross Origin
requests coming from the web UI.

Refs: #3180
  • Loading branch information
alexandre-allard committed Apr 6, 2021
1 parent e0e7e11 commit 42fe9a6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
18 changes: 18 additions & 0 deletions salt/metalk8s/addons/ui/deployed/dependencies.sls
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,21 @@ spec:
ports:
- name: http
port: 9093
---
kind: Service
apiVersion: v1
metadata:
name: loki-api
namespace: metalk8s-ui
labels:
app: metalk8s-ui
app.kubernetes.io/managed-by: salt
app.kubernetes.io/name: metalk8s-ui
app.kubernetes.io/part-of: metalk8s
heritage: metalk8s
spec:
type: ExternalName
externalName: loki.metalk8s-logging.svc.cluster.local
ports:
- name: http
port: 3100
10 changes: 8 additions & 2 deletions salt/metalk8s/addons/ui/deployed/ingress.sls
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ metadata:
app.kubernetes.io/part-of: metalk8s
heritage: metalk8s
annotations:
kubernetes.io/ingress.class: "nginx-control-plane"
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
nginx.ingress.kubernetes.io/cors-allow-headers: "Access-Control-Allow-Origin"
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/rewrite-target: '/$2'
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
kubernetes.io/ingress.class: "nginx-control-plane"
spec:
rules:
- http:
Expand All @@ -67,6 +69,10 @@ spec:
backend:
serviceName: alertmanager-api
servicePort: 9093
- path: /api/loki(/|$)(.*)
backend:
serviceName: loki-api
servicePort: 3100
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
Expand Down

0 comments on commit 42fe9a6

Please sign in to comment.