From 09a471d5e5800e28760ffcf6c5d9923b30e59639 Mon Sep 17 00:00:00 2001 From: jerger Date: Wed, 6 Jul 2022 18:25:02 +0200 Subject: [PATCH] new way of trafik redirect --- src/main/cljc/dda/c4k_gitea/core.cljc | 3 ++- src/main/cljc/dda/c4k_gitea/gitea.cljc | 1 + src/main/resources/gitea/ingress.yaml | 1 + src/main/resources/gitea/traefik-middleware.yaml | 8 ++++++++ 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/gitea/traefik-middleware.yaml diff --git a/src/main/cljc/dda/c4k_gitea/core.cljc b/src/main/cljc/dda/c4k_gitea/core.cljc index 3342811..a36d290 100644 --- a/src/main/cljc/dda/c4k_gitea/core.cljc +++ b/src/main/cljc/dda/c4k_gitea/core.cljc @@ -11,7 +11,8 @@ [(yaml/load-resource "gitea/volumes.yaml") (yaml/load-resource "gitea/appini-configmap.yaml") (yaml/load-resource "gitea/deployment.yaml") - (yaml/load-resource "gitea/services.yaml")] + (yaml/load-resource "gitea/services.yaml") + (yaml/load-resource "gitea/traefik-middleware.yaml")] (map yaml/to-string [(postgres/generate-config {:postgres-size :2gb :db-name "gitea"}) diff --git a/src/main/cljc/dda/c4k_gitea/gitea.cljc b/src/main/cljc/dda/c4k_gitea/gitea.cljc index dd8160e..b37849f 100644 --- a/src/main/cljc/dda/c4k_gitea/gitea.cljc +++ b/src/main/cljc/dda/c4k_gitea/gitea.cljc @@ -28,6 +28,7 @@ "gitea/certificate.yaml" (rc/inline "gitea/certificate.yaml") "gitea/ingress.yaml" (rc/inline "gitea/ingress.yaml") "gitea/services.yaml" (rc/inline "gitea/services.yaml") + "gitea/traefik-middleware.yaml" (rc/inline "gitea/traefik-middleware.yaml") "gitea/volumes.yaml" (rc/inline "gitea/volumes.yaml") (throw (js/Error. "Undefined Resource!"))))) diff --git a/src/main/resources/gitea/ingress.yaml b/src/main/resources/gitea/ingress.yaml index 1e59913..2844aeb 100644 --- a/src/main/resources/gitea/ingress.yaml +++ b/src/main/resources/gitea/ingress.yaml @@ -5,6 +5,7 @@ metadata: namespace: default annotations: ingress.kubernetes.io/ssl-redirect: "true" + traefik.ingress.kubernetes.io/router.middlewares: default-redirect-https@kubernetescrd spec: tls: - hosts: diff --git a/src/main/resources/gitea/traefik-middleware.yaml b/src/main/resources/gitea/traefik-middleware.yaml new file mode 100644 index 0000000..a327dba --- /dev/null +++ b/src/main/resources/gitea/traefik-middleware.yaml @@ -0,0 +1,8 @@ +apiVersion: traefik.containo.us/v1alpha1 +kind: Middleware +metadata: + name: redirect-https +spec: + redirectScheme: + scheme: https + permanent: true \ No newline at end of file