Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: websocket ingress #53

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
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 All @@ -238,7 +260,7 @@
tag: "latest"
env:
- name: MYSQL_ALLOW_EMPTY_PASSWORD
value: yes

Check warning on line 263 in charts/keep/values.yaml

View workflow job for this annotation

GitHub Actions / lint-chart

263:14 [truthy] truthy value should be one of [false, true]
- name: MYSQL_DATABASE
value: keep
- name: MYSQL_PASSWORD
Expand Down
Loading