Skip to content

Commit

Permalink
chore: better handling redis deployment architecture and connection
Browse files Browse the repository at this point in the history
  • Loading branch information
debdutdeb committed Mar 9, 2024
1 parent b3646f6 commit eea803c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
16 changes: 15 additions & 1 deletion deploy/charts/litellm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ Create the name of the service account to use
Get redis service name
*/}}
{{- define "litellm.redis.serviceName" -}}
{{- printf "%s-headless" (default "redis" .Values.redis.nameOverride | trunc 63 | trimSuffix "-") -}}
{{- if and (eq .Values.redis.architecture "standalone") .Values.redis.sentinel.enabled -}}
{{- printf "%s-%s" .Release.Name (default "redis" .Values.redis.nameOverride | trunc 63 | trimSuffix "-") -}}
{{- else -}}
{{- printf "%s-%s-master" .Release.Name (default "redis" .Values.redis.nameOverride | trunc 63 | trimSuffix "-") -}}
{{- end -}}
{{- end -}}

{{/*
Get redis service port
*/}}
{{- define "litellm.redis.port" -}}
{{- if .Values.redis.sentinel.enabled -}}
{{ .Values.redis.sentinel.service.ports.sentinel }}
{{- else -}}
{{ .Values.redis.master.service.ports.redis }}
{{- end -}}
{{- end -}}
4 changes: 2 additions & 2 deletions deploy/charts/litellm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ spec:
key: masterkey
{{- if .Values.redis.enabled }}
- name: REDIS_HOST
value: {{ template "litellm.redis.serviceName" . }}
value: {{ include "litellm.redis.serviceName" . }}
- name: REDIS_PORT
value: {{ if .Values.redis.sentinel.enabled }}{{ .Values.redis.sentinel.service.ports.sentinel }}{{ else }}{{ .Values.redis.master.service.ports.redis}}{{ end }}
value: {{ include "litellm.redis.port" . | quote }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
Expand Down
3 changes: 3 additions & 0 deletions deploy/charts/litellm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ proxy_config:
api_key: eXaMpLeOnLy
general_settings:
master_key: os.environ/PROXY_MASTER_KEY
# litellm_settings:
# cache: true

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
Expand Down Expand Up @@ -172,3 +174,4 @@ postgresql:
# with cache: true to use existing redis instance
redis:
enabled: false
architecture: replication

0 comments on commit eea803c

Please sign in to comment.