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

Helm chart #5512

Merged
merged 49 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8494dda
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 27, 2023
a3bcc4a
added helm chart
Arvind644 Oct 27, 2023
cc31bb2
fixed indentation in Chart.yaml
Arvind644 Oct 27, 2023
5ecad78
fixes helm chart
Arvind644 Nov 2, 2023
984d753
Merge branch 'develop' of https://github.com/Arvind644/argilla into d…
Arvind644 Nov 2, 2023
68b39aa
fixed helm chart readme
Arvind644 Nov 2, 2023
387e480
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 2, 2023
94133bf
Merge remote-tracking branch 'upstream/develop' into helm_chart
bikash119 Sep 18, 2024
36ef0f1
First working commit towards helm chart based k8s resource creation.
bikash119 Sep 18, 2024
6a80313
Working copy of making elasticsearch either a depedency chart or usin…
bikash119 Sep 20, 2024
ff1591c
Fixed linting issues with k8s resource yamls
bikash119 Sep 20, 2024
b583242
Merge remote-tracking branch 'upstream/develop' into helm_chart
bikash119 Sep 20, 2024
f6eb3e1
Made configmap optional based on if elasticsearch is installed or use…
bikash119 Sep 20, 2024
949dbe1
added redis as a dependency for Argilla chart
bikash119 Sep 20, 2024
edd2693
Elasticsearch operator used for deployment of elasticsearch
bikash119 Sep 20, 2024
001a014
removed un-necessary file which was used to test elasticsearch deploy…
bikash119 Sep 20, 2024
968df11
- Introduced PVC to store argilla data
bikash119 Sep 20, 2024
fca556a
Removed k8s folder in the under root argilla folder
bikash119 Sep 20, 2024
70059f2
- Elasticsearch deployment is made optional.
bikash119 Sep 21, 2024
a5abe5f
A getting started guide
bikash119 Sep 21, 2024
ba59362
Modified the output of Notes.txt to increase readability.
bikash119 Sep 21, 2024
be9aa36
First commit : helm unit test [ WIP ]
bikash119 Sep 23, 2024
aaf1fee
All the unit testcases are passing
bikash119 Sep 23, 2024
8ea7613
- Updated README.md to add instruction to execute helm unittest.
bikash119 Sep 23, 2024
ca7d20c
fixed typo error
bikash119 Sep 23, 2024
cc84f54
fixed typo error
bikash119 Sep 23, 2024
04eb5e9
Merge branch 'develop' into helm_chart
bikash119 Sep 23, 2024
d8a4e47
Merge branch 'develop' into helm_chart
bikash119 Sep 23, 2024
021c35d
Update examples/deployments/k8s/argilla-chart/README.md
bikash119 Sep 24, 2024
bc20af4
Update argilla-server/CHANGELOG.md
bikash119 Sep 24, 2024
9c5af60
Update examples/deployments/k8s/argilla-chart/README.md
bikash119 Sep 24, 2024
3783035
Update examples/deployments/k8s/argilla-chart/README.md
bikash119 Sep 24, 2024
9fbd738
Update examples/deployments/k8s/argilla-chart/README.md
bikash119 Sep 24, 2024
8389a11
Update examples/deployments/k8s/argilla-chart/templates/NOTES.txt
bikash119 Sep 24, 2024
c238ff7
- Added steps to install ECK Operator.
bikash119 Sep 25, 2024
b6c0c26
- Added readiness and liveliness probe to elasticsearch
bikash119 Sep 25, 2024
cb5d3bb
Merge remote-tracking branch 'upstream/develop' into helm_chart
bikash119 Sep 25, 2024
eb032ce
Merge branch 'develop' into helm_chart
bikash119 Sep 26, 2024
2ede26c
- Updated README.md
bikash119 Sep 27, 2024
351210c
- Added api-key to enable integration test
bikash119 Sep 27, 2024
859964c
Updated the README to include steps to check status of deployement an…
bikash119 Sep 27, 2024
9a16369
- fixed typo
bikash119 Sep 27, 2024
fa4d688
- fixed typo
bikash119 Sep 27, 2024
8b89e5a
- few more instruction to check if all the intermediate steps complet…
bikash119 Sep 27, 2024
7d5a1f5
Merge branch 'develop' into helm_chart
bikash119 Sep 27, 2024
a25d5ed
Merge branch 'develop' into helm_chart
bikash119 Sep 27, 2024
0d3ea85
Merge branch 'develop' into helm_chart
bikash119 Sep 27, 2024
10aa543
Merge branch 'develop' into helm_chart
bikash119 Sep 30, 2024
e41d372
Merge branch 'develop' into helm_chart
bikash119 Sep 30, 2024
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
13 changes: 12 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
rev: v4.6.0
hooks:
- id: check-yaml
exclude: argilla/mkdocs.yml
exclude: argilla/mkdocs.yml|examples/deployments/k8s
- id: end-of-file-fixer
exclude_types: [text, jupyter]
- id: trailing-whitespace
Expand Down Expand Up @@ -71,6 +71,17 @@ repos:
- argilla-server/LICENSE_HEADER
- --fuzzy-match-generates-todo

##############################################################################
# Helm lint hook
##############################################################################
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.23
hooks:
- id: helmlint
name: Helm lint
files: '^examples/deployments/k8s/.*\.yaml$'
args: ['helm', 'lint','examples/deployments/k8s/']

ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
Expand Down
4 changes: 4 additions & 0 deletions argilla-server/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ These are the section headers that we use:

## [Unreleased]()

### Added

- Added helm chart for argilla. ([#5512](https://github.com/argilla-io/argilla/pull/5512))

## [2.2.0](https://github.com/argilla-io/argilla/compare/v2.1.0...v2.2.0)

### Added
Expand Down
24 changes: 24 additions & 0 deletions examples/deployments/k8s/argilla-chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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/
tests/
6 changes: 6 additions & 0 deletions examples/deployments/k8s/argilla-chart/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 17.3.14
digest: sha256:71d2c604edd00d02c85a62e0da12f7a481cec0bd2ebc6cf8dce5544c9595da5a
generated: "2024-09-21T08:31:14.356995+05:30"
29 changes: 29 additions & 0 deletions examples/deployments/k8s/argilla-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v2
name: argilla
description: A Helm chart for Argilla Server on Kubernetes

# 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: "latest"
dependencies:
- name: redis
version: "17.3.14"
repository: "https://charts.bitnami.com/bitnami"
condition: redis.enabled
143 changes: 143 additions & 0 deletions examples/deployments/k8s/argilla-chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Argilla Helm Chart

This Helm chart deploys Argilla Server on Kubernetes.

## Prerequisites

- Kubernetes 1.12+
- Helm 3.0+
- PV provisioner support in the underlying infrastructure (if persistence is enabled)

## Installing Helm

Before you can use this chart, you need to have Helm installed. If you haven't installed Helm yet, follow these steps:

1. Use package manager to install [Helm](https://helm.sh/docs/intro/install/#through-package-managers).

2. (Optional) If you're using Helm for the first time, you may need to initialize it:

```bash
helm init
```

For more detailed installation instructions, please refer to the [official Helm documentation](https://helm.sh/docs/intro/install/).

## Dependencies

- Redis
- Elasticsearch

## Adding the Helm Repository

To add the Argilla Helm repository to your Helm installation, run the following command:

```bash
helm repo add stable https://charts.helm.sh/stable
helm repo add elastic https://helm.elastic.co
helm repo update
```

## Minikube
> Assumes you have Docker Desktop installed
```bash
minikube stop
minikube delete
minikube config set memory 3g
minikube config set cpus 2
minikube start
```
## Enable Minikube Addons
```bash
minikube addons enable ingress
```

The ingress controller pod should be in the `Running` state.
```bash
kubectl get pods -n ingress-nginx
```

## Installing ECK
As we want to use the operator to manage our Elasticsearch cluster, we need to install the ECK operator.
```bash
helm install elastic-operator elastic/eck-operator -n elastic-system --create-namespace
```
The elastic-operator pod should be in the `Running` state.
```bash
kubectl get pods -n elastic-system
```

## Installing the Chart

After adding the repository, you can install the chart with the release name `my-argilla-server`:

```bash
helm install my-argilla-server examples/deployments/k8s/argilla-chart
```

Check the status of the pods:

```bash
kubectl get pods -w
```
All the pods should be in the `Running` state.

## Accessing Argilla

In a different terminal window, run the following command to access Argilla:
```bash
kubectl port-forward svc/my-argilla-server 6900
```
Argilla will be accessible at http://localhost:6900.

## Execute integration tests

Set the following environment variables:
```bash
export ARGILLA_API_URL=http://localhost:6900
export ARGILLA_API_KEY=argilla.apikey
```

Run the following command to execute the integration tests:
```bash
pytest tests/integration
```

## Uninstalling the Chart

To uninstall/delete the `my-argilla-server` deployment:

```bash
helm delete my-argilla-server
```

This command removes all the Kubernetes components associated with the chart and deletes the release.

## Running Unit Tests

This chart includes unit tests using the helm-unittest plugin. To run these tests, follow these steps:

### Installing helm-unittest plugin

1. Install the helm-unittest plugin:

```bash
helm plugin install https://github.com/helm-unittest/helm-unittest.git
```

2. Verify the installation:

```bash
helm unittest --help
```

### Running the tests

To execute the unit tests for this chart, run the following command from the root of the chart directory:

```bash
helm unittest examples/deployments/k8s/argilla-chart
```

This will run all the test files located in the `tests/` directory of the chart.

For more information on writing and running helm unit tests, please refer to the [helm-unittest documentation](https://github.com/helm-unittest/helm-unittest).
62 changes: 62 additions & 0 deletions examples/deployments/k8s/argilla-chart/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Thank you for installing {{ .Chart.Name }}.

Your release is named {{ .Release.Name }}.

To learn more about the release, try:

$ helm status {{ .Release.Name }}
$ helm get all {{ .Release.Name }}


Argilla:

{{- if .Values.argilla.ingress.enabled }}
You can access the Argilla server at: http://{{ .Values.argilla.ingress.host }}
{{- else }}
To access the Argilla server, run these commands:
$ export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "argilla.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
$ kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 6900:6900

Then access the Argilla server at http://localhost:6900
{{- end }}
{{- if .Values.argilla.persistence.enabled }}
Persistence is enabled for Argilla.
Your Argilla data will be stored in a Persistent Volume Claim named: {{ .Release.Name }}-argilla-pvc
To find the actual storage location of your Argilla data, run the following command:
$ kubectl get pvc {{ .Release.Name }}-argilla-pvc -o jsonpath="{.spec.volumeName}"
$ kubectl get pv <volume-name> -o jsonpath="{.spec.hostPath.path}"
{{- end }}


Elasticsearch:


{{- if .Values.elasticsearch.useOperator }}
Elasticsearch is running as a dependency of this chart. You can access it at:
http://{{ .Release.Name }}-elasticsearch:9200
{{- if .Values.elasticsearch.persistence.enabled }}
Persistence is enabled for Elasticsearch.
Your Elasticsearch data will be stored in a Persistent Volume Claim named: {{ .Release.Name }}-elasticsearch-pvc
{{- end }}
{{- else }}
Using external Elasticsearch at: http://{{ .Values.externalElasticsearch.host }}:{{ .Values.externalElasticsearch.port }}
{{- end }}


Redis:

{{- if .Values.redis.enabled }}
Redis is running as a dependency of this chart. You can access it at: {{ .Release.Name }}-redis-master:6379
{{- if .Values.redis.master.persistence.enabled }}
Persistence is enabled for Redis.
Your Redis data will be stored in a Persistent Volume Claim named: {{ .Release.Name }}-redis-pvc
{{- end }}
{{- else }}
Using external Redis at: {{ .Values.externalRedis.host }}:{{ .Values.externalRedis.port }}
{{- end }}

{{- if and (not .Values.redis.master.persistence.enabled) (not .Values.elasticsearch.persistence.enabled) (not .Values.argilla.persistence.enabled)}}
Persistence is disabled. Your data will not be preserved across pod restarts.
{{- end }}


77 changes: 77 additions & 0 deletions examples/deployments/k8s/argilla-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "argilla.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "argilla.worker.name" -}}
{{- printf "%s-%s" .Release.Name "worker" | 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 "argilla.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 }}

{{/*
Common labels
*/}}
{{- define "argilla.labels" -}}
helm.sh/chart: {{ include "argilla.chart" . }}
{{ include "argilla.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "argilla.selectorLabels" -}}
app.kubernetes.io/name: {{ include "argilla.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "argilla.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Argilla Worker labels
*/}}
{{- define "worker.labels" -}}
helm.sh/chart: {{ include "argilla.chart" . }}
app.kubernetes.io/component: worker
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Argilla Worker Selector labels
*/}}
{{- define "worker.selectorLabels" -}}
app.kubernetes.io/component: worker
app.kubernetes.io/name: {{ include "argilla.worker.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}-worker
{{- end }}
12 changes: 12 additions & 0 deletions examples/deployments/k8s/argilla-chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if not .Values.elasticsearch.useOperator }}
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-hosts
data:

hosts: |
127.0.0.1 localhost
::1 localhost
{{ .Values.argilla.configmap.minikubeIP }} {{ .Values.argilla.ingress.host }}
{{- end }}
Loading
Loading