diff --git a/deploy/charts/litellm-helm/README.md b/deploy/charts/litellm-helm/README.md index 73b722b64c6..86b5918f01c 100644 --- a/deploy/charts/litellm-helm/README.md +++ b/deploy/charts/litellm-helm/README.md @@ -36,11 +36,45 @@ If `db.useStackgresOperator` is used (not yet implemented): | `service.port` | TCP port that the Kubernetes Service will listen on. Also the TCP port within the Pod that the proxy will listen on. | `4000` | | `service.loadBalancerClass` | Optional LoadBalancer implementation class (only used when `service.type` is `LoadBalancer`) | `""` | | `ingress.*` | See [values.yaml](./values.yaml) for example settings | N/A | -| `proxy_config.*` | See [values.yaml](./values.yaml) for default settings. See [example_config_yaml](../../../litellm/proxy/example_config_yaml/) for configuration examples. | N/A | -| `extraContainers[]` | An array of additional containers to be deployed as sidecars alongside the LiteLLM Proxy. | `[]` | +| `proxyConfigMap.create` | When `true`, render a ConfigMap from `.Values.proxy_config` and mount it. | `true` | +| `proxyConfigMap.name` | When `create=false`, name of the existing ConfigMap to mount. | `""` | +| `proxyConfigMap.key` | Key in the ConfigMap that contains the proxy config file. | `"config.yaml"` | +| `proxy_config.*` | See [values.yaml](./values.yaml) for default settings. Rendered into the ConfigMap’s `config.yaml` only when `proxyConfigMap.create=true`. See [example_config_yaml](../../../litellm/proxy/example_config_yaml/) for configuration examples. | `N/A` | +| `extraContainers[]` | An array of additional containers to be deployed as sidecars alongside the LiteLLM Proxy. + +#### Example `proxy_config` ConfigMap from values (default): + + +``` +proxyConfigMap: + create: true + key: "config.yaml" + +proxy_config: + general_settings: + master_key: os.environ/PROXY_MASTER_KEY + model_list: + - model_name: gpt-3.5-turbo + litellm_params: + model: gpt-3.5-turbo + api_key: eXaMpLeOnLy +``` + +#### Example using existing `proxyConfigMap` instead of creating it: + + +``` +proxyConfigMap: + create: false + name: my-litellm-config + key: config.yaml + +# proxy_config is ignored in this mode +``` #### Example `environmentSecrets` Secret + ``` apiVersion: v1 kind: Secret diff --git a/deploy/charts/litellm-helm/templates/configmap-litellm.yaml b/deploy/charts/litellm-helm/templates/configmap-litellm.yaml index 4598054a9d0..cf35917da03 100644 --- a/deploy/charts/litellm-helm/templates/configmap-litellm.yaml +++ b/deploy/charts/litellm-helm/templates/configmap-litellm.yaml @@ -1,7 +1,9 @@ +{{- if .Values.proxyConfigMap.create }} apiVersion: v1 kind: ConfigMap metadata: name: {{ include "litellm.fullname" . }}-config data: config.yaml: | -{{ .Values.proxy_config | toYaml | indent 6 }} \ No newline at end of file +{{ .Values.proxy_config | toYaml | indent 6 }} +{{- end }} \ No newline at end of file diff --git a/deploy/charts/litellm-helm/templates/deployment.yaml b/deploy/charts/litellm-helm/templates/deployment.yaml index b30b8829325..6a5a6e87577 100644 --- a/deploy/charts/litellm-helm/templates/deployment.yaml +++ b/deploy/charts/litellm-helm/templates/deployment.yaml @@ -16,7 +16,9 @@ spec: template: metadata: annotations: + {{- if .Values.proxyConfigMap.create }} checksum/config: {{ include (print $.Template.BasePath "/configmap-litellm.yaml") . | sha256sum }} + {{- end }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} @@ -183,9 +185,13 @@ spec: {{- end }} - name: litellm-config configMap: + {{- if .Values.proxyConfigMap.create }} name: {{ include "litellm.fullname" . }}-config + {{- else }} + name: {{ .Values.proxyConfigMap.name }} + {{- end }} items: - - key: "config.yaml" + - key: {{ .Values.proxyConfigMap.key | default "config.yaml" }} path: "config.yaml" {{- with .Values.volumes }} {{- toYaml . | nindent 8 }} diff --git a/deploy/charts/litellm-helm/tests/deployment_tests.yaml b/deploy/charts/litellm-helm/tests/deployment_tests.yaml index b71f91377f1..f9c83966696 100644 --- a/deploy/charts/litellm-helm/tests/deployment_tests.yaml +++ b/deploy/charts/litellm-helm/tests/deployment_tests.yaml @@ -115,3 +115,25 @@ tests: content: name: EXTRA_ENV_VAR value: EXTRA_ENV_VAR_VALUE + - it: should mount existing configmap when create=false + template: deployment.yaml + set: + proxyConfigMap: + create: false + name: my-litellm-config + key: custom.yaml + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: litellm-config + configMap: + name: my-litellm-config + items: + - key: custom.yaml + path: config.yaml + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: litellm-config + mountPath: /etc/litellm/ \ No newline at end of file diff --git a/deploy/charts/litellm-helm/values.yaml b/deploy/charts/litellm-helm/values.yaml index 0bd95003c10..58d1880cd4c 100644 --- a/deploy/charts/litellm-helm/values.yaml +++ b/deploy/charts/litellm-helm/values.yaml @@ -93,6 +93,14 @@ masterkeySecretName: "" # if set, use this secret key for the master key; otherwise, use the default key masterkeySecretKey: "" +proxyConfigMap: + # when true, creates a new configmap + create: true + # if create is false and name is set, use existing ConfigMap + # create: false + # name: "" + # key: "config.yaml" + # The elements within proxy_config are rendered as config.yaml for the proxy # Examples: https://github.com/BerriAI/litellm/tree/main/litellm/proxy/example_config_yaml # Reference: https://docs.litellm.ai/docs/proxy/configs