Skip to content

Commit

Permalink
feat: add haproxy support
Browse files Browse the repository at this point in the history
  • Loading branch information
shahargl committed Nov 15, 2024
1 parent 9273adc commit 8b8d2eb
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 3 deletions.
4 changes: 2 additions & 2 deletions charts/keep/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: v2
name: keep
version: 0.1.39
version: 0.1.40
description: Keep Helm Chart
type: application
icon: https://platform.keephq.dev/_next/image?url=%2Fkeep.png&w=48&q=75
appVersion: 0.28.9
appVersion: 0.28.10
deprecated: false
annotations:
app: keep
Expand Down
105 changes: 105 additions & 0 deletions charts/keep/templates/ingress-haproxy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{{- if and .Values.global.ingress.enabled (or (eq .Values.global.ingress.className "haproxy") (eq .Values.global.ingress.classType "haproxy")) }}
{{- $fullName := include "keep.fullname" . }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}-ingress
labels:
{{- include "keep.labels" . | nindent 4 }}
annotations:
kubernetes.io/ingress.class: "haproxy"
# HAProxy timeout configurations
haproxy-ingress.github.io/timeout-client: "3600s"
haproxy-ingress.github.io/timeout-server: "3600s"
haproxy-ingress.github.io/timeout-connect: "3600s"
haproxy-ingress.github.io/timeout-tunnel: "3600s"

# WebSocket support
haproxy-ingress.github.io/config-backend: |
timeout tunnel 3600s
option http-keep-alive
http-reuse safe
haproxy-ingress.github.io/ssl-redirect: "false"

# Backend configurations for path rewrites
haproxy-ingress.github.io/config-backend: |
acl path_v2 path_beg /v2/
acl path_ws path_beg /websocket/
http-request set-path %[path,regsub(^/v2/,/)] if path_v2
http-request set-path %[path,regsub(^/websocket/,/)] if path_ws
spec:
ingressClassName: haproxy
{{- if .Values.global.ingress.tls }}
tls:
{{- range .Values.global.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- if .Values.global.ingress.hosts }}
{{- range .Values.global.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- if $.Values.websocket.enabled }}
- path: "/websocket"
pathType: Prefix
backend:
service:
name: {{ $fullName }}-websocket
port:
number: {{ $.Values.websocket.service.port }}
{{- end }}
{{- if $.Values.backend.enabled }}
- path: "/v2"
pathType: Prefix
backend:
service:
name: {{ $fullName }}-backend
port:
number: {{ $.Values.backend.service.port }}
{{- end }}
- path: "/"
pathType: Prefix
backend:
service:
name: {{ $fullName }}-frontend
port:
number: {{ $.Values.frontend.service.port }}
{{- end }}
{{- else }}
- http:
paths:
{{- if $.Values.websocket.enabled }}
- path: "/websocket"
pathType: Prefix
backend:
service:
name: {{ $fullName }}-websocket
port:
number: {{ $.Values.websocket.service.port }}
{{- end }}
{{- if $.Values.backend.enabled }}
- path: "/v2"
pathType: Prefix
backend:
service:
name: {{ $fullName }}-backend
port:
number: {{ $.Values.backend.service.port }}
{{- end }}
- path: "/"
pathType: Prefix
backend:
service:
name: {{ $fullName }}-frontend
port:
number: {{ $.Values.frontend.service.port }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.global.ingress.enabled }}
{{- if and .Values.global.ingress.enabled (or (eq .Values.global.ingress.className "nginx") (eq .Values.global.ingress.classType "nginx")) }}
{{- $fullName := include "keep.fullname" . }}
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand Down

0 comments on commit 8b8d2eb

Please sign in to comment.