From ff4040bbe125fb434f143f794adb41412df3cb4c Mon Sep 17 00:00:00 2001 From: Const-antine Date: Thu, 28 Aug 2025 09:22:15 -0400 Subject: [PATCH 1/7] add functionality to mount existing configmap if needed --- .../charts/litellm-helm/templates/configmap-litellm.yaml | 4 +++- deploy/charts/litellm-helm/templates/deployment.yaml | 8 +++++++- deploy/charts/litellm-helm/values.yaml | 8 ++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) 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/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 From 409429ddd62b9193e6921513cfc125267830cba2 Mon Sep 17 00:00:00 2001 From: Const-antine Date: Thu, 28 Aug 2025 09:22:26 -0400 Subject: [PATCH 2/7] add new tests --- .../litellm-helm/tests/deployment_tests.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/deploy/charts/litellm-helm/tests/deployment_tests.yaml b/deploy/charts/litellm-helm/tests/deployment_tests.yaml index b71f91377f1..81fe6268eb9 100644 --- a/deploy/charts/litellm-helm/tests/deployment_tests.yaml +++ b/deploy/charts/litellm-helm/tests/deployment_tests.yaml @@ -115,3 +115,17 @@ 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: + - equal: + path: spec.template.spec.volumes[?(@.name=="litellm-config")].configMap.name | first + value: my-litellm-config + - equal: + path: spec.template.spec.volumes[?(@.name=="litellm-config")].configMap.items[0].key + value: custom.yaml From 5d973ea06e03393543d6060e395c366621d7dda0 Mon Sep 17 00:00:00 2001 From: Const-antine Date: Thu, 28 Aug 2025 09:22:37 -0400 Subject: [PATCH 3/7] update readme --- deploy/charts/litellm-helm/README.md | 34 +++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/deploy/charts/litellm-helm/README.md b/deploy/charts/litellm-helm/README.md index 73b722b64c6..41f30daf474 100644 --- a/deploy/charts/litellm-helm/README.md +++ b/deploy/charts/litellm-helm/README.md @@ -36,9 +36,41 @@ 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 | + +| `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 ``` From 730e9c90a245205159341d35775958f3c0c30cb4 Mon Sep 17 00:00:00 2001 From: Const-antine Date: Thu, 28 Aug 2025 12:34:03 -0400 Subject: [PATCH 4/7] fix formatting --- deploy/charts/litellm-helm/README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/deploy/charts/litellm-helm/README.md b/deploy/charts/litellm-helm/README.md index 41f30daf474..ba95d2846a5 100644 --- a/deploy/charts/litellm-helm/README.md +++ b/deploy/charts/litellm-helm/README.md @@ -36,12 +36,11 @@ 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 | - -| `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. | `[]` | +| `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): From d3b526041f3f2dc39f6b64911666d78cb7eb1fb1 Mon Sep 17 00:00:00 2001 From: Const-antine Date: Thu, 28 Aug 2025 12:45:56 -0400 Subject: [PATCH 5/7] better formatting --- deploy/charts/litellm-helm/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/charts/litellm-helm/README.md b/deploy/charts/litellm-helm/README.md index ba95d2846a5..86b5918f01c 100644 --- a/deploy/charts/litellm-helm/README.md +++ b/deploy/charts/litellm-helm/README.md @@ -44,6 +44,7 @@ If `db.useStackgresOperator` is used (not yet implemented): #### Example `proxy_config` ConfigMap from values (default): + ``` proxyConfigMap: create: true @@ -61,6 +62,7 @@ proxy_config: #### Example using existing `proxyConfigMap` instead of creating it: + ``` proxyConfigMap: create: false @@ -72,6 +74,7 @@ proxyConfigMap: #### Example `environmentSecrets` Secret + ``` apiVersion: v1 kind: Secret From 13503365150e57566a762904ccc6361a486d8150 Mon Sep 17 00:00:00 2001 From: Const-antine Date: Thu, 28 Aug 2025 13:30:11 -0400 Subject: [PATCH 6/7] fix tests --- deploy/charts/litellm-helm/tests/deployment_tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/charts/litellm-helm/tests/deployment_tests.yaml b/deploy/charts/litellm-helm/tests/deployment_tests.yaml index 81fe6268eb9..c14d3c3f4f2 100644 --- a/deploy/charts/litellm-helm/tests/deployment_tests.yaml +++ b/deploy/charts/litellm-helm/tests/deployment_tests.yaml @@ -124,8 +124,8 @@ tests: key: custom.yaml asserts: - equal: - path: spec.template.spec.volumes[?(@.name=="litellm-config")].configMap.name | first + path: spec.template.spec.volumes[?(@.name=="litellm-config")][0].configMap.name value: my-litellm-config - equal: - path: spec.template.spec.volumes[?(@.name=="litellm-config")].configMap.items[0].key + path: spec.template.spec.volumes[?(@.name=="litellm-config")][0].configMap.items[0].key value: custom.yaml From f8d1e034507e98c40ad62537e475b0229a009a93 Mon Sep 17 00:00:00 2001 From: Const-antine Date: Thu, 28 Aug 2025 13:39:09 -0400 Subject: [PATCH 7/7] rework tests --- .../litellm-helm/tests/deployment_tests.yaml | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/deploy/charts/litellm-helm/tests/deployment_tests.yaml b/deploy/charts/litellm-helm/tests/deployment_tests.yaml index c14d3c3f4f2..f9c83966696 100644 --- a/deploy/charts/litellm-helm/tests/deployment_tests.yaml +++ b/deploy/charts/litellm-helm/tests/deployment_tests.yaml @@ -123,9 +123,17 @@ tests: name: my-litellm-config key: custom.yaml asserts: - - equal: - path: spec.template.spec.volumes[?(@.name=="litellm-config")][0].configMap.name - value: my-litellm-config - - equal: - path: spec.template.spec.volumes[?(@.name=="litellm-config")][0].configMap.items[0].key - value: custom.yaml + - 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