diff --git a/cluster/coder-ingress-route/coder-ingress-route.yaml b/cluster/coder-ingress-route/coder-ingress-route.yaml new file mode 100644 index 0000000..2c6bdf9 --- /dev/null +++ b/cluster/coder-ingress-route/coder-ingress-route.yaml @@ -0,0 +1,52 @@ +apiVersion: v1 +kind: Secret +metadata: + name: basic-auth-users-secret + namespace: longhorn-system +data: + users: dXNlcjokYXByMSREdjgvWEFWayR1RmhjMlNyalloMGJuR09IYmNrV2oxCgo= + +--- +# Declaring the user list +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: ingress-auth + namespace: longhorn-system +spec: + basicAuth: + secret: basic-auth-users-secret + +--- +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: strip-longhorn + namespace: longhorn-system +spec: + stripPrefix: + prefixes: + - "/longhorn" + forceSlash: true + +--- +# Host(`test.traefik.local`) && PathPrefix(`/longhorn`) +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: longhorn-ingress + namespace: longhorn-system +spec: + entryPoints: + - web + routes: + - match: PathPrefix(`/longhorn`) + kind: Rule + middlewares: + - name: ingress-auth + namespace: longhorn-system + - name: strip-longhorn + namespace: longhorn-system + services: + - name: longhorn-frontend + port: 80 diff --git a/cluster/coder-ingress-route/coder-ingress.yaml b/cluster/coder-ingress-route/coder-ingress.yaml new file mode 100644 index 0000000..210282d --- /dev/null +++ b/cluster/coder-ingress-route/coder-ingress.yaml @@ -0,0 +1,40 @@ +# Declaring the user list +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: basic-auth +spec: + basicAuth: + secret: basic-auth + +# --- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: longhorn-ingress + namespace: longhorn-system + annotations: + traefik.ingress.kubernetes.io/router.middlewares: longhorn-system-basic-auth@kubernetescrd + traefik.ingress.kubernetes.io/router.entrypoints: web + # type of authentication + nginx.ingress.kubernetes.io/auth-type: basic + # prevent the controller from redirecting (308) to HTTPS + nginx.ingress.kubernetes.io/ssl-redirect: 'false' + # name of the secret that contains the user/password definitions + nginx.ingress.kubernetes.io/auth-secret: basic-auth + # message to display with an appropriate context why the authentication is required + nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required ' + # custom max body size for file uploading like backing image uploading + nginx.ingress.kubernetes.io/proxy-body-size: 10000m +spec: + rules: + - http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: longhorn-frontend + port: + number: 80 +