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: added helm chart #4065

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions k8s/helm chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# argilla-helm-chart

1. Init helm chart
```
helm create argilla
```

2. Deploy the helm chart
```
helm install argilla-chart argilla/ --values argilla/values.yaml --set enableOptionalResource=false
```
Empty file.
6 changes: 6 additions & 0 deletions k8s/helm chart/argilla/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: argilla
description: A Helm chart for Argilla Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"
38 changes: 38 additions & 0 deletions k8s/helm chart/argilla/templates/argilla-server-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: apps/v1

Choose a reason for hiding this comment

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

Suggestion: I would consider adding a PVC for the Argilla deployment so that workspaces/users persist beyond restarts/redeployments and mount it to ARGILLA_HOME_PATH.

kind: Deployment
metadata:
name: argilla-server-deployment
labels:
app: argilla-server
spec:
replicas: 1
selector:
matchLabels:
app: argilla-server
template:
metadata:
labels:
app: argilla-server
spec:
{{- if .Values.enableOptionalResource }}
initContainers:
- name: wait-for-elasticsearch
image: alpine/curl:latest
command: [ "sh", "-c",
"ELASTICSEARCH_URL={{ .Values.argilladeployment.elasticurl }}; status_code=$(curl -s -o /dev/null -w '%{http_code}' $ELASTICSEARCH_URL);
while [ $status_code -ne 200 ]; do sleep 5; status_code=$(curl -s -o /dev/null -w '%{http_code}' $ELASTICSEARCH_URL);
echo Sleeping...; done; echo Elasticsearch Connected " ]
{{- end }}
containers:
- name: argilla-server
image: argilla/argilla-server:latest

Choose a reason for hiding this comment

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

Suggestion: swap latest for something like Values.imageTag in case users want to pin the image version (e.g., to 1.16 or something)

Copy link
Contributor

Choose a reason for hiding this comment

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

env:
- name: {{ .Values.argilladeployment.name }}

Choose a reason for hiding this comment

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

This env name is required by Argilla and wouln't change between deployments. Leaving it as ARGILLA_ELASTICSEARCH should suffice.

Copy link
Contributor

Choose a reason for hiding this comment

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

value: "http://elasticsearch:9200"

Choose a reason for hiding this comment

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

This should also be Values.argilladeployment.elasticurl

Copy link
Contributor

Choose a reason for hiding this comment

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

ports:
- containerPort: 6900
resources:

Choose a reason for hiding this comment

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

Suggestions: resources often vary among deployments, and so making these into Values values is probably a good practice

Copy link
Contributor

Choose a reason for hiding this comment

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

requests:
cpu: "0.5"
limits:
cpu: "1"
18 changes: 18 additions & 0 deletions k8s/helm chart/argilla/templates/argilla-server-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: autoscaling/v2

Choose a reason for hiding this comment

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

Suggestion: wrap HPAs in something like {{- if .Values.autoscaling.enabled }}

Copy link
Contributor

Choose a reason for hiding this comment

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

kind: HorizontalPodAutoscaler
metadata:
name: argilla-server-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: argilla-server-deployment
minReplicas: {{ .Values.replicas.min }}
maxReplicas: {{ .Values.replicas.max }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
17 changes: 17 additions & 0 deletions k8s/helm chart/argilla/templates/argilla-server-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: argilla-server-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argilla-server
port:
number: 6900
12 changes: 12 additions & 0 deletions k8s/helm chart/argilla/templates/argilla-server-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: argilla-server
labels:
app: argilla-server
spec:
selector:
app: argilla-server
ports:
- name: http
port: 6900
46 changes: 46 additions & 0 deletions k8s/helm chart/argilla/templates/elasticsearch-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{- if .Values.enableOptionalResource }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch
labels:
app: elasticsearch
spec:
selector:
matchLabels:
app: elasticsearch
replicas: 1
template:
metadata:
labels:
app: elasticsearch
spec:
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:8.5.3
resources:
requests:
cpu: 0.25
memory: 1Gi
limits:
cpu: 1
memory: 2Gi
ports:
- containerPort: 9200
env:
- name: discovery.type
value: single-node
- name: ES_JAVA_OPTS
value: -Xms256m -Xmx256m
- name: cluster.routing.allocation.disk.threshold_enabled
value: "false"
- name: xpack.security.enabled
value: "false"
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-data
volumes:
- name: elasticsearch-data
persistentVolumeClaim:
claimName: elasticsearch-pvc
{{- end }}
10 changes: 10 additions & 0 deletions k8s/helm chart/argilla/templates/elasticsearch-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: elasticsearch-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
12 changes: 12 additions & 0 deletions k8s/helm chart/argilla/templates/elasticsearch-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: elasticsearch
labels:
app: elasticsearch
spec:
selector:
app: elasticsearch
ports:
- name: http
port: 9200
9 changes: 9 additions & 0 deletions k8s/helm chart/argilla/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
argilladeployment:
elasticurl: http://elasticsearch:9200
name: ARGILLA_ELASTICSEARCH

replicas:
min: 1
max: 3

enableOptionalResource: true