Skip to content

Commit

Permalink
Merge pull request #53 from keephq/feature/websocket-ingress
Browse files Browse the repository at this point in the history
feat: websocket ingress
  • Loading branch information
shahargl authored Oct 10, 2024
2 parents 57190a8 + 49457bc commit 2963aa1
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/keep/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: keep
version: 0.1.18
version: 0.1.19
description: Keep Helm Chart
type: application
icon: https://platform.keephq.dev/_next/image?url=%2Fkeep.png&w=48&q=75
Expand Down
64 changes: 64 additions & 0 deletions charts/keep/templates/websocket-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{- if and .Values.websocket.enabled .Values.websocket.ingress.enabled -}}
{{- $fullName := include "keep.fullname" . -}}
{{- $svcPort := .Values.websocket.service.port -}}
{{- if and .Values.websocket.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.websocket.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.websocket.ingress.annotations "kubernetes.io/ingress.class" .Values.websocket.ingress.className }}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-websocket
labels:
{{- include "keep.labels" . | nindent 4 }}
{{- with .Values.websocket.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.websocket.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.websocket.ingress.className }}
{{- end }}
{{- if .Values.websocket.ingress.tls }}
tls:
{{- range .Values.websocket.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.websocket.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-websocket
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}-websocket
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.websocket.extraIngress -}}
{{ toYaml .Values.websocket.extraIngress | nindent 2 }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/keep/templates/websocket-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if and .Values.websocket.enabled .Values.websocket.route.enabled -}}
{{- $fullName := include "keep.fullname" . -}}
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{ $fullName }}-websocket
labels:
{{- include "keep.labels" . | nindent 4 }}
spec:
host: {{ .Values.websocket.route.host }}
to:
kind: Service
name: {{ $fullName }}-websocket
weight: 100
port:
targetPort: {{ .Values.websocket.service.port }}
wildcardPolicy: {{ .Values.websocket.route.wildcardPolicy }}
tls:
{{ toYaml .Values.websocket.route.tls | indent 4 }}
{{- end }}
34 changes: 28 additions & 6 deletions charts/keep/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,26 @@ websocket:
service:
type: ClusterIP
port: 6001
ingress:
enabled: true
className: ""
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/enable-websocket: "true"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
hosts:
- host: websocket.example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
route:
enabled: false
host: websocket.example.local
path: /
tls: []
wildcardPolicy: None
resources: {}
autoscaling:
enabled: false
Expand All @@ -213,13 +233,15 @@ websocket:
enabled: false
probes:
livenessProbe:
httpGet:
path: /
port: http
tcpSocket:
port: 6001
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: http
tcpSocket:
port: 6001
initialDelaySeconds: 30
periodSeconds: 10

database:
enabled: true
Expand Down

0 comments on commit 2963aa1

Please sign in to comment.