-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add basic ingressroute support
- Loading branch information
Wojciech Międzybrodzki
committed
Jan 9, 2025
1 parent
9f135c7
commit 2aeb2f8
Showing
6 changed files
with
99 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{{- define "platformex.ingressroute" }} | ||
{{- range .routes }} | ||
- match: {{ .match }} | ||
kind: Rule | ||
middlewares: | ||
{{- range .middlewares}} | ||
- name: {{ .name }} | ||
{{- end }} | ||
services: | ||
- kind: Service | ||
name: {{ $.svc }} | ||
port: {{ $.port }} | ||
{{/* # TODO: support for custom service definitions */}} | ||
{{/* # TODO: support for TraefikService */}} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "platformex.ingressroute.simple" }} | ||
{{- if .ingress.simple}} | ||
- match: Host(`{{ .ingress.simple }}`) | ||
kind: Rule | ||
services: | ||
- kind: Service | ||
name: {{ .svc }} | ||
port: {{ .port }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
{{- range $iname, $instance := .Values.instances }} | ||
{{- range $dname, $deployment := $instance.deployments }} | ||
{{- $deploymentContext := dict "iname" $iname "instance" $instance "name" $dname "deployment" $deployment "root" $ }} | ||
{{- if $deployment.ingress }} | ||
{{- $svcName := cat $iname "-" $dname | nospace }} | ||
{{- if $deployment.service.nameOverride }} | ||
{{- $svcName := $deployment.service.nameOverride }} | ||
{{- end }} | ||
- apiVersion: traefik.io/v1alpha1 | ||
kind: IngressRoute | ||
metadata: | ||
name: {{ $iname }}-{{ $dname }} | ||
labels: | ||
{{- include "platformex.kubernetesAppLabels" $deploymentContext | indent 8 }} | ||
{{- include "platformex.globalLabels" $ | indent 8 }} | ||
annotations: | ||
"kubernetes.io/ingress.class": "traefik" | ||
spec: | ||
entryPoints: | ||
{{- if $deployment.ingress.traefikEntrypoints }} | ||
{{- range $deployment.ingress.traefikEntrypoints }} | ||
- {{ . }} | ||
{{- end }} | ||
{{- else }} | ||
{{- range $.Values.global.defaults.traefikEntrypoints }} | ||
- {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
routes: | ||
{{- include "platformex.ingressroute.simple" (dict "ingress" $deployment.ingress "svc" $svcName "port" $deployment.service.port) | indent 8 }} | ||
{{- include "platformex.ingressroute" (dict "routes" $deployment.ingress.routes "svc" $svcName "port" $deployment.service.port) | indent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters