fix(element-call): improve auto-restart, optional lk-jwt and networkpolicy

This commit is contained in:
WrenIX 2024-08-23 15:16:47 +02:00
parent d9944d6c3f
commit b9234328e9
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
10 changed files with 146 additions and 8 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
name: element-call name: element-call
description: Run Element-Call and his dependencies description: Run Element-Call and his dependencies
type: application type: application
version: 0.0.2 version: 0.1.0
# renovate: image=ghcr.io/element-hq/element-call # renovate: image=ghcr.io/element-hq/element-call
appVersion: "0.6.0" appVersion: "0.6.0"
maintainers: maintainers:

View file

@ -2,7 +2,7 @@
= element-call = element-call
image::https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square[Version: 0.0.2] image::https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square[Version: 0.1.0]
image::https://img.shields.io/badge/Version-application-informational?style=flat-square[Type: application] image::https://img.shields.io/badge/Version-application-informational?style=flat-square[Type: application]
image::https://img.shields.io/badge/AppVersion-0.6.0-informational?style=flat-square[AppVersion: 0.6.0] image::https://img.shields.io/badge/AppVersion-0.6.0-informational?style=flat-square[AppVersion: 0.6.0]
== Maintainers == Maintainers
@ -157,6 +157,26 @@ helm uninstall element-call-release
| `"http"` | `"http"`
| |
| service.call.networkPolicy.egress.enabled
| bool
| `true`
| activate egress no networkpolicy
| service.call.networkPolicy.egress.extra
| list
| `[]`
| egress rules
| service.call.networkPolicy.enabled
| bool
| `false`
|
| service.call.networkPolicy.ingress.http
| list
| `[]`
| ingress for http port (e.g. ingress-controller)
| service.call.nodeSelector | service.call.nodeSelector
| object | object
| `{}` | `{}`
@ -247,6 +267,11 @@ helm uninstall element-call-release
| `""` | `""`
| |
| service.lkJWT.enabled
| bool
| `true`
|
| service.lkJWT.image.pullPolicy | service.lkJWT.image.pullPolicy
| string | string
| `"IfNotPresent"` | `"IfNotPresent"`
@ -282,6 +307,26 @@ helm uninstall element-call-release
| `"http"` | `"http"`
| |
| service.lkJWT.networkPolicy.egress.enabled
| bool
| `false`
| activate egress no networkpolicy
| service.lkJWT.networkPolicy.egress.extra
| list
| `[]`
| egress rules
| service.lkJWT.networkPolicy.enabled
| bool
| `false`
|
| service.lkJWT.networkPolicy.ingress.http
| list
| `[]`
| ingress for http port (e.g. ingress-controller)
| service.lkJWT.nodeSelector | service.lkJWT.nodeSelector
| object | object
| `{}` | `{}`

View file

@ -29,9 +29,12 @@ spec:
name: {{ $fullName }} name: {{ $fullName }}
port: port:
name: http name: http
{{- if .Values.service.lkJWT.enabled }}
{{- if (eq .Values.service.lkJWT.ingress.host .Values.service.call.ingress.host)}}
- host: {{ .Values.service.lkJWT.ingress.host | quote }} - host: {{ .Values.service.lkJWT.ingress.host | quote }}
http: http:
paths: paths:
{{- end }}
- path: /sfu/get - path: /sfu/get
pathType: Exact pathType: Exact
backend: backend:
@ -39,4 +42,5 @@ spec:
name: {{ $fullName }}-lk-jwt name: {{ $fullName }}-lk-jwt
port: port:
name: http name: http
{{- end }}
{{- end }} {{- end }}

View file

@ -1,5 +1,6 @@
{{- $fullName := include "element-call.fullname" . -}} {{- $fullName := include "element-call.fullname" . -}}
{{- with .Values.service.lkJWT }} {{- with .Values.service.lkJWT }}
{{- if .enabled }}
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@ -17,10 +18,11 @@ spec:
app.kubernetes.io/component: lk-jwt app.kubernetes.io/component: lk-jwt
template: template:
metadata: metadata:
{{- with .podAnnotations }}
annotations: annotations:
secret-env-hash: {{ include (print $.Template.BasePath "/lk-jwt/secret.yaml") $ | sha256sum }}
{{- with .podAnnotations }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
labels: labels:
{{- include "element-call.labels" $ | nindent 8 }} {{- include "element-call.labels" $ | nindent 8 }}
app.kubernetes.io/component: lk-jwt app.kubernetes.io/component: lk-jwt
@ -73,4 +75,5 @@ spec:
tolerations: tolerations:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- end }}{{/* end-if .enabled */}}
{{- end }}{{/* end-with .Values.service.lkJWT */}} {{- end }}{{/* end-with .Values.service.lkJWT */}}

View file

@ -0,0 +1,31 @@
{{- with .Values.service.lkJWT.networkPolicy }}
{{- if and $.Values.service.lkJWT.enabled .enabled }}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "element-call.fullname" $ }}-lk-jwt
labels:
{{- include "element-call.labels" $ | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "element-call.selectorLabels" $ | nindent 6 }}
app.kubernetes.io/component: lk-jwt
policyTypes:
- Ingress
{{- if .egress.enabled }}
- Egress
{{- end }}
ingress:
- ports:
- port: 8080
protocol: TCP
from:
{{- toYaml .ingress.http | nindent 8 }}
{{- with .egress }}
egress:
{{- toYaml .extra | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}

View file

@ -1,3 +1,4 @@
{{- if .Values.service.lkJWT.enabled }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
@ -10,3 +11,4 @@ data:
LIVEKIT_KEY: {{ .key | b64enc }} LIVEKIT_KEY: {{ .key | b64enc }}
LIVEKIT_SECRET: {{ .secret | b64enc }} LIVEKIT_SECRET: {{ .secret | b64enc }}
{{- end }} {{- end }}
{{- end }}

View file

@ -1,3 +1,5 @@
{{- if .Values.service.lkJWT.enabled }}
---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
@ -14,3 +16,4 @@ spec:
selector: selector:
{{- include "element-call.selectorLabels" . | nindent 4 }} {{- include "element-call.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: lk-jwt app.kubernetes.io/component: lk-jwt
{{- end }}

View file

@ -1,5 +1,5 @@
{{- with .Values.service.lkJWT }} {{- with .Values.service.lkJWT }}
{{- if .serviceAccount.create -}} {{- if and .enabled .serviceAccount.create -}}
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:

View file

@ -0,0 +1,31 @@
{{- with .Values.service.call.networkPolicy }}
{{- if .enabled }}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "element-call.fullname" $ }}
labels:
{{- include "element-call.labels" $ | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "element-call.selectorLabels" $ | nindent 6 }}
app.kubernetes.io/component: call
policyTypes:
- Ingress
{{- if .egress.enabled }}
- Egress
{{- end }}
ingress:
- ports:
- port: 8080
protocol: TCP
from:
{{- toYaml .ingress.http | nindent 8 }}
{{- with .egress }}
egress:
{{- toYaml .extra | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}

View file

@ -9,8 +9,6 @@ imagePullSecrets: []
nameOverride: "" nameOverride: ""
fullnameOverride: "" fullnameOverride: ""
ingress: ingress:
enabled: false enabled: false
className: "" className: ""
@ -39,6 +37,16 @@ service:
config: {} config: {}
ingress: ingress:
host: host:
networkPolicy:
enabled: false
ingress:
# -- ingress for http port (e.g. ingress-controller)
http: []
egress:
# -- activate egress no networkpolicy
enabled: true
# -- egress rules
extra: []
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
@ -77,6 +85,7 @@ service:
affinity: {} affinity: {}
lkJWT: lkJWT:
enabled: true
replicaCount: 1 replicaCount: 1
image: image:
registry: ghcr.io registry: ghcr.io
@ -89,6 +98,16 @@ service:
secret: "secret" secret: "secret"
ingress: ingress:
host: host:
networkPolicy:
enabled: false
ingress:
# -- ingress for http port (e.g. ingress-controller)
http: []
egress:
# -- activate egress no networkpolicy
enabled: false
# -- egress rules
extra: []
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz