Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for deploying as a StatefulSet #116

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eric-zadara
Copy link

Summary of changes:

Attempting minimal changes to allow deploying as a StatefulSet instead of a Deployment. This is to enable predictable pod naming for use by litellm bypassing the k8s service and address the pods directly.

Chart defaults as existing behavior, but can now be deployed as:

  • Deployment - No persistence/PVC - existing
  • Deployment - PVC - existing
  • StatefulSet - VolumeClaimTemplate/RWO - new
  • StatefulSet - PVC - new

Enabling PVC configuration will override the use of VolumeClaimTemplates with StatelfulSet, incase the user intends to use a shared volume instead of per-pod volumes.
Missing case is using a StatefulSet with an emptyDir but that feels counterintuitive to the intention of a StatefulSet.

Checklist:

  • I updated the artifacthub.io/changes annotation in Chart.yml according to the documentation
  • Optional: I updated in README.md the Helm Values

@jdetroyes jdetroyes added the enhancement New feature or request label Nov 25, 2024
@jdetroyes jdetroyes self-assigned this Nov 25, 2024
Copy link
Contributor

@jdetroyes jdetroyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @eric-zadara

Thanks you for your PR,

Can you create a statefulset.yaml template in order to not mix the Deployment with StatefulSet. It's a better approach, each workload type is cleanly separated, making it easier to read and understand the templates.

You can add a root value:

# -- Specify the workload management: "Deployment" or "StatefulSet"
workload:
  type: "Deployment"

{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
{{- if or .Values.updateStrategy.type .Values.updateStrategy.rollingUpdate }}
{{- if and .Values.persistence.enabled .Values.persistence.podManagementPolicy }}
podManagementPolicy: {{ .Values.persistence.podManagementPolicy }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add it at root values with a comment for StatefulSet only.

Comment on lines +280 to +301
persistence:
# -- Enable persistence using a StatefulSet
# This disables the Deployment in favor of a StatefulSet
enabled: false

# -- Ollama server data Persistent Volume Claim Template size used
size: 30Gi

# -- Ollama server data Persistent Volume Storage Class
# If defined, storageClassName: <storageClass>
# If set to "-", storageClassName: "", which disables dynamic provisioning
# If undefined (the default) or set to null, no storageClassName spec is
# set, choosing the default provisioner. (gp2 on AWS, standard on
# GKE, AWS & OpenStack)
storageClass: ""

# -- Subdirectory of Ollama server data Persistent Volume to mount
# Useful if the volume's root directory is not empty
subPath: ""

# -- Additional volumeClaimTemplates
volumeClaimTemplates: []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can reuse the persistentVolume values to avoid duplicate code and add comment to specify to indicate whether it's for Deployment or Statefulsets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants