From 8ab4eb65e7a183ec9aadb545ef4f531919c9d52c Mon Sep 17 00:00:00 2001 From: Ivan Vandot Date: Tue, 18 Oct 2022 13:12:53 +0200 Subject: [PATCH] chore: add support for traefik ingress for geth-swap --- charts/geth-swap/Chart.yaml | 2 +- charts/geth-swap/templates/ingress.yaml | 26 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/charts/geth-swap/Chart.yaml b/charts/geth-swap/Chart.yaml index f7017bd..1b5b8d2 100644 --- a/charts/geth-swap/Chart.yaml +++ b/charts/geth-swap/Chart.yaml @@ -20,7 +20,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 0.3.7 +version: 0.3.8 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. diff --git a/charts/geth-swap/templates/ingress.yaml b/charts/geth-swap/templates/ingress.yaml index 9c506d0..d5b4cad 100644 --- a/charts/geth-swap/templates/ingress.yaml +++ b/charts/geth-swap/templates/ingress.yaml @@ -1,6 +1,31 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "geth-swap.fullname" . -}} {{- $svcPort := .Values.service.port -}} +{{- if eq .Values.ingress.class "traefik" -}} +{{- $namespace := .Release.Namespace -}} +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: {{ $fullName }} + namespace: {{ $namespace }} +spec: + routes: + {{- range .Values.ingress.hosts }} + {{- $ingressHost := $fullName -}} + {{- if .domain }} + {{- $ingressHost = printf "%s.%s" $fullName .domain -}} + {{- end }} + {{- range .paths }} + - kind: Rule + match: Host({{ $ingressHost | quote }}) && PathPrefix({{ . | quote }}) + services: + - kind: Service + name: {{ $fullName }} + namespace: {{ $namespace }} + port: {{ $svcPort }} + {{- end }} + {{- end }} +{{- else -}} {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version -}} apiVersion: networking.k8s.io/v1 {{- else -}} @@ -43,3 +68,4 @@ spec: {{- end }} {{- end }} {{- end }} +{{- end }}