From 4d0e369e7a477bc8410f6c871f3ea2c77589dc1d Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Thu, 25 Jan 2024 11:53:59 +1100 Subject: [PATCH 1/2] Authored a Helm chart for LiteLLM. Added GitHub workflows/actions to build and push the helm chart to the ghcr.io OCI registry. --- .../helm-oci-chart-releaser/action.yml | 77 ++++++ .github/workflows/ghcr_helm_deploy.yml | 64 +++++ .gitignore | 3 + deploy/charts/litellm-helm/.helmignore | 23 ++ deploy/charts/litellm-helm/Chart.lock | 6 + deploy/charts/litellm-helm/Chart.yaml | 34 +++ deploy/charts/litellm-helm/README.md | 107 ++++++++ .../charts/litellm-helm/templates/NOTES.txt | 22 ++ .../litellm-helm/templates/_helpers.tpl | 74 ++++++ .../templates/configmap-litellm.yaml | 7 + .../templates/deployment-proxy.yaml | 230 ++++++++++++++++++ .../litellm-helm/templates/deployment-ui.yaml | 89 +++++++ deploy/charts/litellm-helm/templates/hpa.yaml | 32 +++ .../litellm-helm/templates/ingress-proxy.yaml | 61 +++++ .../litellm-helm/templates/ingress-ui.yaml | 61 +++++ .../templates/secret-dbcredentials.yaml | 12 + .../templates/secret-masterkey.yaml | 8 + .../litellm-helm/templates/service-proxy.yaml | 15 ++ .../litellm-helm/templates/service-ui.yaml | 17 ++ .../templates/serviceaccount.yaml | 13 + .../templates/tests/test-connection.yaml | 15 ++ deploy/charts/litellm-helm/values.yaml | 219 +++++++++++++++++ 22 files changed, 1189 insertions(+) create mode 100644 .github/actions/helm-oci-chart-releaser/action.yml create mode 100644 .github/workflows/ghcr_helm_deploy.yml create mode 100644 deploy/charts/litellm-helm/.helmignore create mode 100644 deploy/charts/litellm-helm/Chart.lock create mode 100644 deploy/charts/litellm-helm/Chart.yaml create mode 100644 deploy/charts/litellm-helm/README.md create mode 100644 deploy/charts/litellm-helm/templates/NOTES.txt create mode 100644 deploy/charts/litellm-helm/templates/_helpers.tpl create mode 100644 deploy/charts/litellm-helm/templates/configmap-litellm.yaml create mode 100644 deploy/charts/litellm-helm/templates/deployment-proxy.yaml create mode 100644 deploy/charts/litellm-helm/templates/deployment-ui.yaml create mode 100644 deploy/charts/litellm-helm/templates/hpa.yaml create mode 100644 deploy/charts/litellm-helm/templates/ingress-proxy.yaml create mode 100644 deploy/charts/litellm-helm/templates/ingress-ui.yaml create mode 100644 deploy/charts/litellm-helm/templates/secret-dbcredentials.yaml create mode 100644 deploy/charts/litellm-helm/templates/secret-masterkey.yaml create mode 100644 deploy/charts/litellm-helm/templates/service-proxy.yaml create mode 100644 deploy/charts/litellm-helm/templates/service-ui.yaml create mode 100644 deploy/charts/litellm-helm/templates/serviceaccount.yaml create mode 100644 deploy/charts/litellm-helm/templates/tests/test-connection.yaml create mode 100644 deploy/charts/litellm-helm/values.yaml diff --git a/.github/actions/helm-oci-chart-releaser/action.yml b/.github/actions/helm-oci-chart-releaser/action.yml new file mode 100644 index 000000000..059277ed8 --- /dev/null +++ b/.github/actions/helm-oci-chart-releaser/action.yml @@ -0,0 +1,77 @@ +name: Helm OCI Chart Releaser +description: Push Helm charts to OCI-based (Docker) registries +author: sergeyshaykhullin +branding: + color: yellow + icon: upload-cloud +inputs: + name: + required: true + description: Chart name + repository: + required: true + description: Chart repository name + tag: + required: true + description: Chart version + app_version: + required: true + description: App version + path: + required: false + description: Chart path (Default 'charts/{name}') + registry: + required: true + description: OCI registry + registry_username: + required: true + description: OCI registry username + registry_password: + required: true + description: OCI registry password + update_dependencies: + required: false + default: 'false' + description: Update chart dependencies before packaging (Default 'false') +outputs: + image: + value: ${{ steps.output.outputs.image }} + description: Chart image (Default '{registry}/{repository}/{image}:{tag}') +runs: + using: composite + steps: + - name: Helm | Login + shell: bash + run: echo ${{ inputs.registry_password }} | helm registry login -u ${{ inputs.registry_username }} --password-stdin ${{ inputs.registry }} + env: + HELM_EXPERIMENTAL_OCI: '1' + + - name: Helm | Dependency + if: inputs.update_dependencies == 'true' + shell: bash + run: helm dependency update ${{ inputs.path == null && format('{0}/{1}', 'charts', inputs.name) || inputs.path }} + env: + HELM_EXPERIMENTAL_OCI: '1' + + - name: Helm | Package + shell: bash + run: helm package ${{ inputs.path == null && format('{0}/{1}', 'charts', inputs.name) || inputs.path }} --version ${{ inputs.tag }} --app-version ${{ inputs.app_version }} + env: + HELM_EXPERIMENTAL_OCI: '1' + + - name: Helm | Push + shell: bash + run: helm push ${{ inputs.name }}-${{ inputs.tag }}.tgz oci://${{ inputs.registry }}/${{ inputs.repository }} + env: + HELM_EXPERIMENTAL_OCI: '1' + + - name: Helm | Logout + shell: bash + run: helm registry logout ${{ inputs.registry }} + env: + HELM_EXPERIMENTAL_OCI: '1' + + - name: Helm | Output + id: output + shell: bash + run: echo "image=${{ inputs.registry }}/${{ inputs.repository }}/${{ inputs.name }}:${{ inputs.tag }}" >> $GITHUB_OUTPUT \ No newline at end of file diff --git a/.github/workflows/ghcr_helm_deploy.yml b/.github/workflows/ghcr_helm_deploy.yml new file mode 100644 index 000000000..35ea96bfb --- /dev/null +++ b/.github/workflows/ghcr_helm_deploy.yml @@ -0,0 +1,64 @@ +# this workflow is triggered by an API call when there is a new PyPI release of LiteLLM +name: Build, Publish LiteLLM Helm Chart. New Release +on: + workflow_dispatch: + inputs: + chartVersion: + description: "Update the helm chart's version to this" + +# Defines two custom environment variables for the workflow. Used for the Container registry domain, and a name for the Docker image that this workflow builds. +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + REPO_OWNER: ${{github.repository_owner}} + +# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. +jobs: + build-and-push-helm-chart: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: lowercase github.repository_owner + run: | + echo "REPO_OWNER=`echo ${{github.repository_owner}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV} + + - name: Get LiteLLM Latest Tag + id: current_app_tag + uses: WyriHaximus/github-action-get-previous-tag@v1.3.0 + + - name: Get last published chart version + id: current_version + shell: bash + run: helm show chart oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/litellm-helm | grep '^version:' | awk 'BEGIN{FS=":"}{print "current-version="$2}' | tr -d " " | tee -a $GITHUB_OUTPUT + env: + HELM_EXPERIMENTAL_OCI: '1' + + # Automatically update the helm chart version one "patch" level + - name: Bump release version + id: bump_version + uses: christian-draeger/increment-semantic-version@1.1.0 + with: + current-version: ${{ steps.current_version.outputs.current-version || '0.1.0' }} + version-fragment: 'bug' + + - uses: ./.github/actions/helm-oci-chart-releaser + with: + name: litellm-helm + repository: ${{ env.REPO_OWNER }} + tag: ${{ github.event.inputs.chartVersion || steps.bump_version.outputs.next-version || '0.1.0' }} + app_version: ${{ steps.current_app_tag.outputs.tag || 'latest' }} + path: deploy/charts/litellm-helm + registry: ${{ env.REGISTRY }} + registry_username: ${{ github.actor }} + registry_password: ${{ secrets.GITHUB_TOKEN }} + update_dependencies: true + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 77ee0fbef..3d733035a 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,6 @@ hosted_config.yaml litellm/proxy/tests/node_modules litellm/proxy/tests/package.json litellm/proxy/tests/package-lock.json +deploy/charts/litellm-helm/*.tgz +deploy/charts/litellm-helm/charts/* +deploy/charts/*.tgz diff --git a/deploy/charts/litellm-helm/.helmignore b/deploy/charts/litellm-helm/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/deploy/charts/litellm-helm/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/deploy/charts/litellm-helm/Chart.lock b/deploy/charts/litellm-helm/Chart.lock new file mode 100644 index 000000000..7b6ed69d9 --- /dev/null +++ b/deploy/charts/litellm-helm/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: postgresql + repository: oci://registry-1.docker.io/bitnamicharts + version: 13.3.1 +digest: sha256:f5c129150f0d38dd06752ab37f3c8e143d7c14d30379af058767bcd9f4ba83dd +generated: "2024-01-19T11:32:56.694808861+11:00" diff --git a/deploy/charts/litellm-helm/Chart.yaml b/deploy/charts/litellm-helm/Chart.yaml new file mode 100644 index 000000000..80eaf87dd --- /dev/null +++ b/deploy/charts/litellm-helm/Chart.yaml @@ -0,0 +1,34 @@ +apiVersion: v2 + +# We can't call ourselves just "litellm" because then we couldn't publish to the +# same OCI repository as the "litellm" OCI image +name: litellm-helm +description: Call all LLM APIs using the OpenAI format + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: v1.18.9 + +dependencies: + - name: "postgresql" + version: ">=13.3.0" + repository: oci://registry-1.docker.io/bitnamicharts + condition: db.deployStandalone + diff --git a/deploy/charts/litellm-helm/README.md b/deploy/charts/litellm-helm/README.md new file mode 100644 index 000000000..bf87501b3 --- /dev/null +++ b/deploy/charts/litellm-helm/README.md @@ -0,0 +1,107 @@ +# Helm Chart for LiteLLM + +## Prerequisites + +- Kubernetes 1.23+ +- Helm 3.8.0+ + +If `db.deployStandalone` is used: +- PV provisioner support in the underlying infrastructure + +If `db.useStackgresOperator` is used (not yet implemented): +- The Stackgres Operator must already be installed in the Kubernetes Cluster. This chart will **not** install the operator if it is missing. + +## Parameters + +### LiteLLM Proxy Deployment Settings + +| Name | Description | Value | +| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | +| `replicaCount` | The number of LiteLLM Proxy pods to be deployed | `1` | +| `masterkey` | The Master API Key for LiteLLM. If not specified, a random key is generated. | N/A | +| `environmentSecrets` | An optional array of Secret object names. The keys and values in these secrets will be presented to the LiteLLM proxy pod as environment variables. See below for an example Secret object. | `[]` | +| `image.repository` | LiteLLM Proxy image repository | `ghcr.io/berriai/litellm` | +| `image.pullPolicy` | LiteLLM Proxy image pull policy | `IfNotPresent` | +| `image.tag` | Overrides the image tag whose default the latest version of LiteLLM at the time this chart was published. | `""` | +| `image.dbReadyImage` | On Pod startup, an initContainer is used to make sure the Postgres database is available before attempting to start LiteLLM. This field specifies the image to use as that initContainer. | `docker.io/bitnami/postgresql` | +| `image.dbReadyTag` | Tag for the above image. If not specified, "latest" is used. | `""` | +| `imagePullSecrets` | Registry credentials for the LiteLLM and initContainer images. | `[]` | +| `serviceAccount.create` | Whether or not to create a Kubernetes Service Account for this deployment. The default is `false` because LiteLLM has no need to access the Kubernetes API. | `false` | +| `service.type` | Kubernetes Service type (e.g. `LoadBalancer`, `ClusterIP`, etc.) | `ClusterIP` | +| `service.port` | TCP port that the Kubernetes Service will listen on. Also the TCP port within the Pod that the proxy will listen on. | `8000` | +| `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 | + +#### Example `environmentSecrets` Secret +``` +apiVersion: v1 +kind: Secret +metadata: + name: litellm-envsecrets +data: + AZURE_OPENAI_API_KEY: TXlTZWN1cmVLM3k= +type: Opaque +``` + +### LiteLLM Admin UI Settings + +| Name | Description | Value | +| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | +| `ui.enabled` | Should the LiteLLM Admin UI be deployed | `true` | +| `ui.replicaCount` | The number of LiteLLM Admin UI pods to be deployed | `1` | +| `ui.image.repository` | LiteLLM Admin UI image repository | `ghcr.io/berriai/litellm` | +| `ui.image.pullPolicy` | LiteLLM Admin UI image pull policy | `IfNotPresent` | +| `ui.image.tag` | Overrides the image tag whose default the latest version of LiteLLM at the time this chart was published. | `""` | +| `ui.imagePullSecrets` | Registry credentials for the above images. | `[]` | +| `ui.service.type` | Kubernetes Service type (e.g. `LoadBalancer`, `ClusterIP`, etc.) | `ClusterIP` | +| `ui.service.port` | TCP port that the Kubernetes Service will listen on. Also the TCP port within the Pod that the web server will listen on. | `8000` | +| `ui.ingress.*` | See [values.yaml](./values.yaml) for example settings | N/A | + +### Database Settings +| Name | Description | Value | +| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | +| `db.useExisting` | Use an existing Postgres database. A Kubernetes Secret object must exist that contains credentials for connecting to the database. An example secret object definition is provided below. | `false` | +| `db.endpoint` | If `db.useExisting` is `true`, this is the IP, Hostname or Service Name of the Postgres server to connect to. | `localhost` | +| `db.database` | If `db.useExisting` is `true`, the name of the existing database to connect to. | `litellm` | +| `db.secret.name` | If `db.useExisting` is `true`, the name of the Kubernetes Secret that contains credentials. | `postgres` | +| `db.secret.usernameKey` | If `db.useExisting` is `true`, the name of the key within the Kubernetes Secret that holds the username for authenticating with the Postgres instance. | `username` | +| `db.secret.passwordKey` | If `db.useExisting` is `true`, the name of the key within the Kubernetes Secret that holds the password associates with the above user. | `password` | +| `db.useStackgresOperator` | Not yet implemented. | `false` | +| `db.deployStandalone` | Deploy a standalone, single instance deployment of Postgres, using the Bitnami postgresql chart. This is useful for getting started but doesn't provide HA or (by default) data backups. | `true` | +| `postgresql.*` | If `db.deployStandalone` is `true`, configuration passed to the Bitnami postgresql chart. See the [Bitnami Documentation](https://github.com/bitnami/charts/tree/main/bitnami/postgresql) for full configuration details. See [values.yaml](./values.yaml) for the default configuration. | See [values.yaml](./values.yaml) | +| `postgresql.auth.*` | If `db.deployStandalone` is `true`, care should be taken to ensure the default `password` and `postgres-password` values are **NOT** used. | `NoTaGrEaTpAsSwOrD` | + +#### Example Postgres `db.useExisting` Secret +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: postgres +data: + # Password for the "postgres" user + postgres-password: + username: litellm + password: +type: Opaque +``` + +## Accessing the Admin UI +When browsing to the URL published per the settings in `ui.ingress.*`, you will +be prompted for **Admin Configuration**. The **Proxy Endpoint** is the internal +(from the `litellm-ui` pod's perspective) URL published by the `litellm-proxy` +Kubernetes Service. If the deployment uses the default settings for this +service, the **Proxy Endpoint** should be set to `http://litellm-proxy:8000`. + +The **Proxy Key** is the value specified for `masterkey` or, if a `masterkey` +was not provided to the helm command line, the `masterkey` is a randomly +generated string stored in the `litellm-masterkey` Kubernetes Secret. + +```bash +kubectl -n litellm get secret litellm-masterkey -o jsonpath="{.data.masterkey}" +``` + +## Admin UI Limitations +At the time of writing, the Admin UI is unable to add models. This is because +it would need to update the `config.yaml` file which is a exposed ConfigMap, and +therefore, read-only. This is a limitation of this helm chart, not the Admin UI +itself. \ No newline at end of file diff --git a/deploy/charts/litellm-helm/templates/NOTES.txt b/deploy/charts/litellm-helm/templates/NOTES.txt new file mode 100644 index 000000000..e72c99160 --- /dev/null +++ b/deploy/charts/litellm-helm/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "litellm.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "litellm.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "litellm.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "litellm.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/deploy/charts/litellm-helm/templates/_helpers.tpl b/deploy/charts/litellm-helm/templates/_helpers.tpl new file mode 100644 index 000000000..7e7aa8f4c --- /dev/null +++ b/deploy/charts/litellm-helm/templates/_helpers.tpl @@ -0,0 +1,74 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "litellm.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "litellm.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "litellm.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "litellm.labels" -}} +helm.sh/chart: {{ include "litellm.chart" . }} +{{ include "litellm.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} +{{- define "litellm.ui.labels" -}} +helm.sh/chart: {{ include "litellm.chart" . }} +{{ include "litellm.ui.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "litellm.selectorLabels" -}} +app.kubernetes.io/name: {{ include "litellm.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} +{{- define "litellm.ui.selectorLabels" -}} +app.kubernetes.io/name: {{ include "litellm.name" . }}-ui +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "litellm.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "litellm.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/deploy/charts/litellm-helm/templates/configmap-litellm.yaml b/deploy/charts/litellm-helm/templates/configmap-litellm.yaml new file mode 100644 index 000000000..4598054a9 --- /dev/null +++ b/deploy/charts/litellm-helm/templates/configmap-litellm.yaml @@ -0,0 +1,7 @@ +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 diff --git a/deploy/charts/litellm-helm/templates/deployment-proxy.yaml b/deploy/charts/litellm-helm/templates/deployment-proxy.yaml new file mode 100644 index 000000000..cdcd207c0 --- /dev/null +++ b/deploy/charts/litellm-helm/templates/deployment-proxy.yaml @@ -0,0 +1,230 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "litellm.fullname" . }}-proxy + labels: + {{- include "litellm.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "litellm.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "litellm.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "litellm.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + initContainers: + - name: db-ready + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "docker.io/bitnami/postgresql:16.1.0-debian-11-r20" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- if .Values.db.deployStandalone }} + - name: DATABASE_USERNAME + valueFrom: + secretKeyRef: + name: {{ include "litellm.name" . }}-dbcredentials + key: username + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: {{ include "litellm.name" . }}-dbcredentials + key: password + - name: DATABASE_HOST + value: {{ .Release.Name }}-postgresql + - name: DATABASE_NAME + value: litellm + {{- else if .Values.db.useExisting }} + - name: DATABASE_USERNAME + valueFrom: + secretKeyRef: + name: {{ .Values.db.secret.name }} + key: {{ .Values.db.secret.usernameKey }} + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.db.secret.name }} + key: {{ .Values.db.secret.passwordKey }} + - name: DATABASE_HOST + value: {{ .Values.db.endpoint }} + - name: DATABASE_NAME + value: litellm + {{- end }} + command: + - sh + - -c + - | + # Maximum wait time will be (limit * 2) seconds. + limit=60 + current=0 + ret=1 + while [ $current -lt $limit ] && [ $ret -ne 0 ]; do + echo "Waiting for database to be ready $current" + psql -U $(DATABASE_USERNAME) -h $(DATABASE_HOST) -l + ret=$? + current=$(( $current + 1 )) + sleep 2 + done + if [ $ret -eq 0 ]; then + echo "Database is ready" + else + echo "Database failed to become ready before we gave up waiting." + fi + {{ if .Values.securityContext.readOnlyRootFilesystem }} + volumeMounts: + - name: tmp + mountPath: /tmp + {{ end }} + containers: + - name: {{ include "litellm.name" . }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "main-%s" .Chart.AppVersion) }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: HOST + value: "0.0.0.0" + - name: PORT + value: {{ .Values.service.port | quote}} + {{- if .Values.db.deployStandalone }} + - name: DATABASE_USERNAME + valueFrom: + secretKeyRef: + name: {{ include "litellm.name" . }}-dbcredentials + key: username + - name: DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "litellm.name" . }}-dbcredentials + key: password + - name: DATABASE_HOST + value: {{ .Release.Name }}-postgresql + - name: DATABASE_NAME + value: litellm + {{- else if .Values.db.useExisting }} + - name: DATABASE_USERNAME + valueFrom: + secretKeyRef: + name: {{ .Values.db.secret.name }} + key: {{ .Values.db.secret.usernameKey }} + - name: DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.db.secret.name }} + key: {{ .Values.db.secret.passwordKey }} + - name: DATABASE_HOST + value: {{ .Values.db.endpoint }} + - name: DATABASE_NAME + value: {{ .Values.db.database }} + {{- end }} + - name: DATABASE_URL + value: "postgresql://$(DATABASE_USERNAME):$(DATABASE_PASSWORD)@$(DATABASE_HOST)/$(DATABASE_NAME)" + - name: PROXY_MASTER_KEY + valueFrom: + secretKeyRef: + name: {{ include "litellm.name" . }}-masterkey + key: masterkey + envFrom: + {{- range .Values.environmentSecrets }} + - secretRef: + name: {{ . }} + {{- end }} + args: + - --config + - /etc/litellm/config.yaml + # command: + # - bash + # - -c + # - | + # ls -la /etc/litellm/; cat /etc/litellm/config.yaml; export + # find / 2>/dev/null | grep -v -e '^/proc' -e '^/sys' -e '^/dev' >/tmp/before.list + # prisma generate + # find / 2>/dev/null | grep -v -e '^/proc' -e '^/sys' -e '^/dev' >/tmp/after.list + # diff -ruN /tmp/before.list /tmp/after.list + # sleep 3600 + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + httpGet: + path: /health/liveliness + port: http + readinessProbe: + httpGet: + path: /health/readiness + port: http + # Give the container time to start up. Up to 5 minutes (10 * 30 seconds) + startupProbe: + httpGet: + path: /health/readiness + port: http + failureThreshold: 30 + periodSeconds: 10 + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: litellm-config + mountPath: /etc/litellm/ + {{ if .Values.securityContext.readOnlyRootFilesystem }} + - name: tmp + mountPath: /tmp + - name: cache + mountPath: /.cache + - name: npm + mountPath: /.npm + {{- end }} + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + volumes: + {{ if .Values.securityContext.readOnlyRootFilesystem }} + - name: tmp + emptyDir: + sizeLimit: 500Mi + - name: cache + emptyDir: + sizeLimit: 500Mi + - name: npm + emptyDir: + sizeLimit: 500Mi + {{- end }} + - name: litellm-config + configMap: + name: {{ include "litellm.fullname" . }}-config + items: + - key: "config.yaml" + path: "config.yaml" + {{- with .Values.volumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/deploy/charts/litellm-helm/templates/deployment-ui.yaml b/deploy/charts/litellm-helm/templates/deployment-ui.yaml new file mode 100644 index 000000000..f949e2029 --- /dev/null +++ b/deploy/charts/litellm-helm/templates/deployment-ui.yaml @@ -0,0 +1,89 @@ +{{- if .Values.ui.enabled -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "litellm.fullname" . }}-ui + labels: + {{- include "litellm.labels" . | nindent 4 }} +spec: + {{- if not .Values.ui.autoscaling.enabled }} + replicas: {{ .Values.ui.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "litellm.ui.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "litellm.ui.labels" . | nindent 8 }} + {{- with .Values.ui.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "litellm.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.ui.podSecurityContext | nindent 8 }} + containers: + - name: {{ include "litellm.name" . }}-ui + securityContext: + {{- toYaml .Values.ui.securityContext | nindent 12 }} + image: "{{ .Values.ui.image.repository }}:{{ .Values.ui.image.tag | default (printf "main-%s" .Chart.AppVersion) }}" + imagePullPolicy: {{ .Values.ui.image.pullPolicy }} + env: + - name: BASE_URL + value: {{ (index .Values.ui.ingress.hosts 0).host | default "example.com" }} + ports: + - name: http + containerPort: {{ .Values.ui.service.port }} + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + # Give the container time to start up. Up to 5 minutes (10 * 30 seconds) + startupProbe: + httpGet: + path: / + port: http + failureThreshold: 30 + periodSeconds: 10 + resources: + {{- toYaml .Values.ui.resources | nindent 12 }} + volumeMounts: + - name: tmp + mountPath: /tmp + {{- with .Values.ui.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + volumes: + - name: tmp + emptyDir: + sizeLimit: 500Mi + {{- with .Values.ui.volumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.ui.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.ui.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.ui.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end -}} \ No newline at end of file diff --git a/deploy/charts/litellm-helm/templates/hpa.yaml b/deploy/charts/litellm-helm/templates/hpa.yaml new file mode 100644 index 000000000..71e199c5a --- /dev/null +++ b/deploy/charts/litellm-helm/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "litellm.fullname" . }} + labels: + {{- include "litellm.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "litellm.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/deploy/charts/litellm-helm/templates/ingress-proxy.yaml b/deploy/charts/litellm-helm/templates/ingress-proxy.yaml new file mode 100644 index 000000000..95bf83c99 --- /dev/null +++ b/deploy/charts/litellm-helm/templates/ingress-proxy.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := (printf "%s%s" (include "litellm.fullname" .) "-proxy") -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "litellm.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/deploy/charts/litellm-helm/templates/ingress-ui.yaml b/deploy/charts/litellm-helm/templates/ingress-ui.yaml new file mode 100644 index 000000000..791ccf2b0 --- /dev/null +++ b/deploy/charts/litellm-helm/templates/ingress-ui.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ui.ingress.enabled -}} +{{- $fullName := (printf "%s%s" (include "litellm.fullname" .) "-ui") -}} +{{- $svcPort := .Values.ui.service.port -}} +{{- if and .Values.ui.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ui.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ui.ingress.annotations "kubernetes.io/ingress.class" .Values.ui.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "litellm.ui.labels" . | nindent 4 }} + {{- with .Values.ui.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ui.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ui.ingress.className }} + {{- end }} + {{- if .Values.ui.ingress.tls }} + tls: + {{- range .Values.ui.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ui.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/deploy/charts/litellm-helm/templates/secret-dbcredentials.yaml b/deploy/charts/litellm-helm/templates/secret-dbcredentials.yaml new file mode 100644 index 000000000..fc688effb --- /dev/null +++ b/deploy/charts/litellm-helm/templates/secret-dbcredentials.yaml @@ -0,0 +1,12 @@ +{{- if .Values.db.deployStandalone -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "litellm.name" . }}-dbcredentials +data: + # Password for the "postgres" user + postgres-password: {{ ( index .Values.postgresql.auth "postgres-password") | default "litellm" | b64enc }} + username: {{ .Values.postgresql.auth.username | default "litellm" | b64enc }} + password: {{ .Values.postgresql.auth.password | default "litellm" | b64enc }} +type: Opaque +{{- end -}} \ No newline at end of file diff --git a/deploy/charts/litellm-helm/templates/secret-masterkey.yaml b/deploy/charts/litellm-helm/templates/secret-masterkey.yaml new file mode 100644 index 000000000..8b22b476c --- /dev/null +++ b/deploy/charts/litellm-helm/templates/secret-masterkey.yaml @@ -0,0 +1,8 @@ +{{ $masterkey := (.Values.masterkey | default (randAlphaNum 17)) }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "litellm.name" . }}-masterkey +data: + masterkey: {{ $masterkey | b64enc }} +type: Opaque \ No newline at end of file diff --git a/deploy/charts/litellm-helm/templates/service-proxy.yaml b/deploy/charts/litellm-helm/templates/service-proxy.yaml new file mode 100644 index 000000000..3c3c744b5 --- /dev/null +++ b/deploy/charts/litellm-helm/templates/service-proxy.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "litellm.fullname" . }}-proxy + labels: + {{- include "litellm.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "litellm.selectorLabels" . | nindent 4 }} diff --git a/deploy/charts/litellm-helm/templates/service-ui.yaml b/deploy/charts/litellm-helm/templates/service-ui.yaml new file mode 100644 index 000000000..50781899d --- /dev/null +++ b/deploy/charts/litellm-helm/templates/service-ui.yaml @@ -0,0 +1,17 @@ +{{- if .Values.ui.enabled -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "litellm.fullname" . }}-ui + labels: + {{- include "litellm.labels" . | nindent 4 }} +spec: + type: {{ .Values.ui.service.type }} + ports: + - port: {{ .Values.ui.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "litellm.ui.selectorLabels" . | nindent 4 }} +{{ end -}} \ No newline at end of file diff --git a/deploy/charts/litellm-helm/templates/serviceaccount.yaml b/deploy/charts/litellm-helm/templates/serviceaccount.yaml new file mode 100644 index 000000000..7655470fa --- /dev/null +++ b/deploy/charts/litellm-helm/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "litellm.serviceAccountName" . }} + labels: + {{- include "litellm.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/deploy/charts/litellm-helm/templates/tests/test-connection.yaml b/deploy/charts/litellm-helm/templates/tests/test-connection.yaml new file mode 100644 index 000000000..1f072069c --- /dev/null +++ b/deploy/charts/litellm-helm/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "litellm.fullname" . }}-test-connection" + labels: + {{- include "litellm.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "litellm.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/deploy/charts/litellm-helm/values.yaml b/deploy/charts/litellm-helm/values.yaml new file mode 100644 index 000000000..3c7131055 --- /dev/null +++ b/deploy/charts/litellm-helm/values.yaml @@ -0,0 +1,219 @@ +# Default values for litellm. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: ghcr.io/berriai/litellm + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + # tag: "main-latest" + tag: "" + + # Image and tag used for the init container to check and wait for the + # readiness of the postgres database. + dbReadyImage: docker.io/bitnami/postgresql + dbReadyTag: "" + +imagePullSecrets: [] +nameOverride: "litellm" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: false + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +# At the time of writing, the litellm docker image requires write access to the +# filesystem on startup so that prisma can install some dependencies. +podSecurityContext: {} +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: false + # runAsNonRoot: true + # runAsUser: 1000 + +# A list of Kubernetes Secret objects that will be exported to the LiteLLM proxy +# pod as environment variables. These secrets can then be referenced in the +# configuration file (or "litellm" ConfigMap) with `os.environ/` +environmentSecrets: [] + # - litellm-envsecrets + +service: + type: ClusterIP + port: 8000 + +ingress: + enabled: true + className: "nginx" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: api.example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +# 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 +proxy_config: + model_list: + # At least one model must exist for the proxy to start. + - model_name: gpt-3.5-turbo + litellm_params: + model: gpt-3.5-turbo + api_key: eXaMpLeOnLy + general_settings: + master_key: os.environ/PROXY_MASTER_KEY + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +db: + # Use an existing postgres server/cluster + useExisting: false + + # How to connect to the existing postgres server/cluster + endpoint: localhost + database: litellm + secret: + name: postgres + usernameKey: username + passwordKey: password + + # Use the Stackgres Helm chart to deploy an instance of a Stackgres cluster. + # The Stackgres Operator must already be installed within the target + # Kubernetes cluster. + # TODO: Stackgres deployment currently unsupported + useStackgresOperator: false + + # Use the Postgres Helm chart to create a single node, stand alone postgres + # instance. See the "postgresql" top level key for additional configuration. + deployStandalone: true + +# Settings for Bitnami postgresql chart (if db.deployStandalone is true, ignored +# otherwise) +postgresql: + architecture: standalone + auth: + username: litellm + database: litellm + + # You should override these on the helm command line with + # `--set postgresql.auth.postgres-password=,postgresql.auth.password=` + password: NoTaGrEaTpAsSwOrD + postgres-password: NoTaGrEaTpAsSwOrD + + # A secret is created by this chart (litellm-helm) with the credentials that + # the new Postgres instance should use. + existingSecret: litellm-dbcredentials + secretKeys: + userPasswordKey: password + +ui: + enabled: true + replicaCount: 1 + autoscaling: + enabled: false + image: + repository: ghcr.io/berriai/litellm-ui + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + # tag: "main-latest" + # TODO: Switch to BerryAI repo and tags if/when they provide a ui image + # https://github.com/BerriAI/litellm/pull/1505 + tag: "" + + service: + type: ClusterIP + port: 8501 + + ingress: + enabled: true + className: "nginx" + annotations: {} + hosts: + - host: ui.example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + + podAnnotations: {} + podLabels: {} + + podSecurityContext: + fsGroup: 1000 + + securityContext: + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + + resources: {} + + volumes: [] + + volumeMounts: [] + + nodeSelector: {} + + tolerations: [] + + affinity: {} \ No newline at end of file From fb4c228c39598c798e5915379717804aea8c1cda Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Tue, 30 Jan 2024 09:38:54 +1100 Subject: [PATCH 2/2] Merge upstream .gitignore changes --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 3d733035a..730898a5b 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,11 @@ hosted_config.yaml litellm/proxy/tests/node_modules litellm/proxy/tests/package.json litellm/proxy/tests/package-lock.json +ui/litellm-dashboard/.next +ui/litellm-dashboard/node_modules +ui/litellm-dashboard/next-env.d.ts +ui/litellm-dashboard/package.json +ui/litellm-dashboard/package-lock.json deploy/charts/litellm-helm/*.tgz deploy/charts/litellm-helm/charts/* deploy/charts/*.tgz