You've already forked DataMate
feat(chart): add Helm chart for deploying Label Studio with PostgreSQL (#152)
* feat(chart): add Helm chart for deploying Label Studio with PostgreSQL * feat(milvus): update Milvus configuration to use URI and remove deprecated host/port settings
This commit is contained in:
26
deployment/helm/label-studio/templates/_helpers.tpl
Normal file
26
deployment/helm/label-studio/templates/_helpers.tpl
Normal file
@@ -0,0 +1,26 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "label-studio.name" -}}
|
||||
{{- default .Chart.name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
*/}}
|
||||
{{- define "label-studio.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.name .Values.nameOverride -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "label-studio.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.name .Chart.version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
81
deployment/helm/label-studio/templates/deployment.yaml
Normal file
81
deployment/helm/label-studio/templates/deployment.yaml
Normal file
@@ -0,0 +1,81 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "label-studio.fullname" . }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "label-studio.name" . }}
|
||||
helm.sh/chart: {{ include "label-studio.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "label-studio.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "label-studio.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
spec:
|
||||
containers:
|
||||
- name: label-studio
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
args: ["label-studio-uwsgi"]
|
||||
env:
|
||||
- name: DJANGO_DB
|
||||
value: {{ .Values.env.DJANGO_DB | quote }}
|
||||
- name: POSTGRE_NAME
|
||||
value: {{ .Values.env.POSTGRE_NAME | quote }}
|
||||
- name: POSTGRE_USER
|
||||
value: {{ .Values.env.POSTGRE_USER | quote }}
|
||||
- name: POSTGRE_PASSWORD
|
||||
value: {{ .Values.env.POSTGRE_PASSWORD | quote }}
|
||||
- name: POSTGRE_PORT
|
||||
value: {{ .Values.env.POSTGRE_PORT | quote }}
|
||||
- name: POSTGRE_HOST
|
||||
value: {{ .Values.env.POSTGRE_HOST | quote }}
|
||||
- name: LABEL_STUDIO_HOST
|
||||
value: {{ .Values.env.LABEL_STUDIO_HOST | quote }}
|
||||
- name: LOCAL_FILES_SERVING_ENABLED
|
||||
value: {{ .Values.env.LOCAL_FILES_SERVING_ENABLED | quote }}
|
||||
- name: LOCAL_FILES_DOCUMENT_ROOT
|
||||
value: {{ .Values.env.LOCAL_FILES_DOCUMENT_ROOT | quote }}
|
||||
- name: USE_USERNAME_FOR_LOGIN
|
||||
value: {{ .Values.env.USE_USERNAME_FOR_LOGIN | quote }}
|
||||
- name: LABEL_STUDIO_USERNAME
|
||||
value: {{ .Values.env.LABEL_STUDIO_USERNAME | quote }}
|
||||
- name: LABEL_STUDIO_PASSWORD
|
||||
value: {{ .Values.env.LABEL_STUDIO_PASSWORD | quote }}
|
||||
- name: LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN
|
||||
value: {{ .Values.env.LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN | quote }}
|
||||
- name: LABEL_STUDIO_USER_TOKEN
|
||||
value: {{ .Values.env.LABEL_STUDIO_USER_TOKEN | quote }}
|
||||
- name: LOG_LEVEL
|
||||
value: {{ .Values.env.LOG_LEVEL | quote }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8000
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /label-studio/data
|
||||
- name: dataset
|
||||
mountPath: /label-studio/local
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{ else }}{{ include "label-studio.fullname" . }}-data{{ end }}
|
||||
- name: dataset
|
||||
{{- if and .Values.datasetVolume.enabled .Values.datasetVolume.claimName }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Values.datasetVolume.claimName }}
|
||||
{{- else }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{ else }}{{ include "label-studio.fullname" . }}-dataset{{ end }}
|
||||
{{- end }}
|
||||
|
||||
34
deployment/helm/label-studio/templates/ingress.yaml
Normal file
34
deployment/helm/label-studio/templates/ingress.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- if .Values.ingress.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "label-studio.fullname" . }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
pathType: {{ .pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "label-studio.fullname" $ }}
|
||||
port:
|
||||
number: {{ $.Values.service.port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- toYaml .Values.ingress.tls | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
62
deployment/helm/label-studio/templates/postgres.yaml
Normal file
62
deployment/helm/label-studio/templates/postgres.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
{{- if .Values.postgres.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "label-studio.fullname" . }}-postgres
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "label-studio.name" . }}-postgres
|
||||
spec:
|
||||
ports:
|
||||
- port: 5432
|
||||
targetPort: 5432
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "label-studio.name" . }}-postgres
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "label-studio.fullname" . }}-postgres
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "label-studio.name" . }}-postgres
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "label-studio.name" . }}-postgres
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "label-studio.name" . }}-postgres
|
||||
spec:
|
||||
containers:
|
||||
- name: postgres
|
||||
image: "{{ .Values.postgres.image.repository }}:{{ .Values.postgres.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.postgres.image.pullPolicy }}
|
||||
env:
|
||||
- name: POSTGRES_HOST_AUTH_METHOD
|
||||
value: {{ .Values.postgres.authMethod | quote }}
|
||||
- name: POSTGRES_USER
|
||||
value: {{ .Values.postgres.username | quote }}
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
volumeMounts:
|
||||
- name: postgres-data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
volumes:
|
||||
- name: postgres-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "label-studio.fullname" . }}-postgres
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "label-studio.fullname" . }}-postgres
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.postgres.persistence.size }}
|
||||
{{- end }}
|
||||
|
||||
31
deployment/helm/label-studio/templates/pvc.yaml
Normal file
31
deployment/helm/label-studio/templates/pvc.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "label-studio.fullname" . }}-data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size }}
|
||||
{{- if .Values.persistence.storageClassName }}
|
||||
storageClassName: {{ .Values.persistence.storageClassName }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "label-studio.fullname" . }}-dataset
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size }}
|
||||
{{- if .Values.persistence.storageClassName }}
|
||||
storageClassName: {{ .Values.persistence.storageClassName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
23
deployment/helm/label-studio/templates/service.yaml
Normal file
23
deployment/helm/label-studio/templates/service.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "label-studio.fullname" . }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "label-studio.name" . }}
|
||||
helm.sh/chart: {{ include "label-studio.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
{{- if and (eq .Values.service.type "NodePort") .Values.service.nodePort }}
|
||||
nodePort: {{ .Values.service.nodePort }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "label-studio.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
|
||||
Reference in New Issue
Block a user