fix oauth2 longhorn proxy

This commit is contained in:
2025-03-20 02:56:32 +01:00
parent 35af177b45
commit d1fd69888a
6 changed files with 75 additions and 36 deletions

View File

@@ -1,7 +0,0 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- longhorn-ingress.yaml
- oauth2-proxy-longhorn-svc.yaml
- oauth2-proxy-longhorn.yaml

View File

@@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: longhorn-dashboard
namespace: longhorn-system
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/auth-signin: https://$host/oauth2/start?rd=$escaped_request_uri
nginx.ingress.kubernetes.io/auth-url: https://$host/oauth2/auth
spec:
tls:
- hosts:
- longhorn.panic.haus
secretName: longhorn-tls
rules:
- host: longhorn.panic.haus
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: longhorn-frontend
port:
number: 80

View File

@@ -6,28 +6,28 @@ metadata:
annotations:
kubernetes.io/ingress.class: "nginx"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/auth-url: "https://longhorn.panic.haus/oauth2/auth"
nginx.ingress.kubernetes.io/auth-signin: "https://longhorn.panic.haus/oauth2/start?rd=$scheme://$host$request_uri"
nginx.ingress.kubernetes.io/auth-url: "http://oauth2-proxy-service.longhorn-system.svc.cluster.local:4180/oauth2/auth"
nginx.ingress.kubernetes.io/auth-signin: "https://longhorn.panic.haus/oauth2/start?rd=$escaped_request_uri"
spec:
tls:
- hosts:
- longhorn.panic.haus
secretName: longhorn-tls
- hosts:
- longhorn.panic.haus
secretName: longhorn-tls
rules:
- host: longhorn.panic.haus
http:
paths:
- path: /oauth2
pathType: Prefix
backend:
service:
name: oauth2-proxy
port:
number: 4180
- path: /
pathType: Prefix
backend:
service:
name: longhorn-frontend
port:
number: 80
- host: longhorn.panic.haus
http:
paths:
- path: /oauth2
pathType: Prefix
backend:
service:
name: oauth2-proxy-longhorn-service
port:
number: 4180
- path: /
pathType: Prefix
backend:
service:
name: longhorn-frontend
port:
number: 80

View File

@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: oauth2-proxy-longhorn-ingress
namespace: longhorn-system
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: longhorn.panic.haus
http:
paths:
- path: /oauth2
pathType: Prefix
backend:
service:
name: oauth2-proxy-longhorn-service
port:
number: 4180

View File

@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: oauth2-proxy-longhorn
name: oauth2-proxy-longhorn-service
namespace: longhorn-system
spec:
ports:

View File

@@ -14,23 +14,23 @@ spec:
app: oauth2-proxy-longhorn
spec:
containers:
- name: oauth2-proxy
- name: oauth2-proxy-longhorn
image: quay.io/oauth2-proxy/oauth2-proxy:v7.8.1
args:
- --provider=keycloak
- --client-id=longhorn
- --client-secret=0U2QuP1QMAXln8bzwJ3aJMIvaH9t2QvJ
- --cookie-secret=lDE7du7SlDuG1UySIZUhcHfuk5HlgFlgDWdHD_PQ9UI=
- --oidc-issuer-url=https://sso.beatrice.wtf/realms/panic-haus
- --oidc-issuer-url=https://sso.beatrice.wtf/auth/realms/panic-haus
- --cookie-domain=longhorn.panic.haus
- --email-domain=*
- --http-address=0.0.0.0:4180
- --redirect-url=https://longhorn.panic.haus/oauth2/callback
- --upstream=http://longhorn-frontend.longhorn-system.svc.cluster.local:80
- --scope=openid
- --login-url=https://sso.beatrice.wtf/realms/panic-haus/protocol/openid-connect/auth
- --validate-url=https://sso.beatrice.wtf/realms/panic-haus/protocol/openid-connect/userinfo
- --redeem-url=https://sso.beatrice.wtf/realms/panic-haus/protocol/openid-connect/token
- --login-url=https://sso.beatrice.wtf/auth/realms/panic-haus/protocol/openid-connect/auth
- --validate-url=https://sso.beatrice.wtf/auth/realms/panic-haus/protocol/openid-connect/userinfo
- --redeem-url=https://sso.beatrice.wtf/auth/realms/panic-haus/protocol/openid-connect/token
- --skip-auth-regex=^(?:https?:\/\/)?longhorn\.panic\.haus\/(favicon\.ico|.*\.(?:js|css)(\.map)?)$|^\/(favicon\.ico|.*\.(?:js|css)(\.map)?)$
ports:
- name: http