Skip to content

Commit

Permalink
adding gke-vpc-native loadbalancer configuration (#66)
Browse files Browse the repository at this point in the history
* adding gke-vpc-native loadbalancer configuration

* fix closing range and clean over added {{- end}}
  • Loading branch information
kannonski authored May 12, 2023
1 parent d8f5204 commit 4769038
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 16 deletions.
41 changes: 41 additions & 0 deletions examples/server-gke-vpc-native.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Deploy LiveKit into a VPC-native GKE cluster
# see https://cloud.google.com/kubernetes-engine/docs/concepts/alias-ips

replicaCount: 2

# Refer to https://docs.livekit.io/deploy/kubernetes/ for instructions

livekit:
rtc:
use_external_ip: true
redis:
address: <redis-address>:6379
keys:
<key>: <secret>
turn:
enabled: true
domain: <turn-address>
tls_port: 3478
secretName: <turn-tls-secret>

loadBalancer:
type: gke-vpc-native
tls:
- hosts:
- <server-address>
secretName: <server-tls-secret>

autoscaling:
enabled: true
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 60

# resources are set assuming a 8 core instance
resources:
limits:
cpu: 7500m
memory: 2048Mi
requests:
cpu: 7000m
memory: 1024Mi
2 changes: 1 addition & 1 deletion livekit-server/templates/backendconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if or (eq .Values.loadBalancer.type "gke") (eq .Values.loadBalancer.type "gke-managed-cert") -}}
{{- if or (eq .Values.loadBalancer.type "gke") (eq .Values.loadBalancer.type "gke-managed-cert") (eq .Values.loadBalancer.type "gke-vpc-native") -}}
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
Expand Down
24 changes: 13 additions & 11 deletions livekit-server/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,21 @@ spec:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- with .Values.loadBalancer }}
{{- if .tls }}
tls:
{{- range .tls }}
{{- if .hosts }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- if ne .Values.loadBalancer.type "gke-vpc-native" }}
{{- with .Values.loadBalancer }}
{{- if .tls }}
tls:
{{- range .tls }}
{{- if .hosts }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
{{- if .secretName }}
secretName: {{ .secretName | quote }}
{{- end }}
{{- if .secretName }}
secretName: {{ .secretName | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
8 changes: 5 additions & 3 deletions livekit-server/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ metadata:
name: {{ include "livekit-server.fullname" . }}
labels:
{{- include "livekit-server.labels" . | nindent 4 }}
{{- if eq .Values.loadBalancer.type "aws" }}
annotations:
{{- if eq .Values.loadBalancer.type "aws" }}
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
service.beta.kubernetes.io/aws-load-balancer-type: nlb
{{- else if or (eq .Values.loadBalancer.type "gke") (eq .Values.loadBalancer.type "gke-managed-cert") }}
annotations:
{{- else if or (eq .Values.loadBalancer.type "gke") (eq .Values.loadBalancer.type "gke-managed-cert") (eq .Values.loadBalancer.type "gke-vpc-native") }}
cloud.google.com/backend-config: '{"ports": {"{{ .Values.loadBalancer.servicePort }}":"{{ include "livekit-server.fullname" . }}"}}'
{{- end }}
{{- if eq .Values.loadBalancer.type "gke-vpc-native" }}
cloud.google.com/neg: '{"ingress": true}'
{{- end }}
spec:
{{- if or (eq .Values.loadBalancer.type "alb") (eq .Values.loadBalancer.type "gke") (eq .Values.loadBalancer.type "gke-managed-cert") (eq .Values.loadBalancer.type "do") }}
type: NodePort
Expand Down
2 changes: 1 addition & 1 deletion server-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ livekit:
serviceType: "LoadBalancer"

loadBalancer:
# valid values: disable, alb, aws, gke, gke-managed-cert, do
# valid values: disable, alb, aws, gke, gke-managed-cert, gke-native-vpc, do
# on AWS, we recommend using alb load balancer, which supports TLS termination
# * in order to use alb, aws-ingress-controller must be installed
# https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html
Expand Down

0 comments on commit 4769038

Please sign in to comment.