Skip to content

Commit

Permalink
feat(leo): Add Leo definition
Browse files Browse the repository at this point in the history
  • Loading branch information
mjasion committed Aug 10, 2023
1 parent 3d59ad4 commit e388207
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 21 deletions.
32 changes: 23 additions & 9 deletions charts/studio/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ helm.sh/chart: {{ include "studio.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}

{{- end }}
{{- define "studio-worker.labels" -}}

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

{{- define "studio-backend.labels" -}}
{{- define "studio-leo.labels" -}}
helm.sh/chart: {{ include "studio.chart" . }}
{{ include "studio-backend.selectorLabels" . }}
{{- if .Chart.AppVersion }}
Expand All @@ -79,6 +79,15 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

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

{{/*
Selector labels
*/}}
Expand All @@ -88,11 +97,6 @@ app.kubernetes.io/name: {{ include "studio.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "studio-ui.selectorLabels" -}}
app.kubernetes.io/name: studio-ui
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "studio-backend.selectorLabels" -}}
app.kubernetes.io/name: studio-backend
app.kubernetes.io/instance: {{ .Release.Name }}
Expand All @@ -103,6 +107,16 @@ app.kubernetes.io/name: studio-beat
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "studio-leo.selectorLabels" -}}
app.kubernetes.io/name: studio-leo
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "studio-ui.selectorLabels" -}}
app.kubernetes.io/name: studio-ui
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "studio-worker.selectorLabels" -}}
app.kubernetes.io/name: studio-worker
app.kubernetes.io/instance: {{ .Release.Name }}
Expand Down
6 changes: 6 additions & 0 deletions charts/studio/templates/configmap-studio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,9 @@ data:
DQL_ENABLED: {{ $dvcx.enabled | default "False" | quote }}
DVCX_ENABLED: {{ $dvcx.enabled | default "False" | quote }}

LEO_SERVICE_HOST: {{ .Release.Name }}-studio-leo
LEO_SERVICE_PORT: {{ .Values.studioLeo.service.port }}
LEO_HOST: "{{ .Release.Name }}-studio-leo:{{ .Values.studioLeo.service.port }}"
LEO_ENCODING: "utf-8"
LEO_API_PATH_PREFIX: "{{- if and .Values.global.basePath (not (eq .Values.global.basePath "/")) }}/{{ include "studio.basePath" . }}{{- end }}/leo"
LEO_ORIGIN: "http://{{.Release.Name}}-studio-leo"
94 changes: 94 additions & 0 deletions charts/studio/templates/deployment-studio-leo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-studio-leo
labels:
{{- include "studio-leo.labels" . | nindent 4 }}
spec:
{{- if not .Values.studioLeo.autoscaling.enabled }}
replicas: {{ .Values.studioLeo.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "studio-leo.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- include "studio.checksum" . | indent 8 }}
{{- with .Values.studioLeo.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "studio-leo.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "studio.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.studioLeo.podSecurityContext | nindent 8 }}
containers:
- name: studio-leo
securityContext:
{{- toYaml .Values.studioLeo.securityContext | nindent 12 }}
image: "{{ .Values.studioLeo.image.repository }}:{{ .Values.studioLeo.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.studioBackend.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
startupProbe:
tcpSocket:
port: 80
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 80
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
httpGet:
path: /leo/debug/version
port: 80
initialDelaySeconds: 5
periodSeconds: 25
successThreshold: 3
timeoutSeconds: 120
resources:
{{- toYaml .Values.studioLeo.resources | nindent 12 }}
envFrom:
- secretRef:
name: studio
{{- if .Values.global.envFromSecret }}
- secretRef:
name: {{ .Values.global.envFromSecret }}
{{- end }}
{{- if .Values.studioLeo.envFromSecret }}
- secretRef:
name: {{ .Values.studioLeo.envFromSecret }}
{{- end }}
volumeMounts:
{{- if .Values.global.customCaCert }}
- name: studio-ca-certificates
mountPath: /usr/local/share/ca-certificates
{{- end }}
volumes:
{{- if .Values.global.customCaCert }}
- name: studio-ca-certificates
configMap:
name: studio-ca-certificates
{{- end }}
{{- with .Values.studioLeo.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.studioLeo.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.studioLeo.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/studio/templates/service-leo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name}}-studio-leo
labels:
{{- include "studio-leo.labels" . | nindent 4 }}
spec:
type: {{ .Values.studioLeo.service.type }}
ports:
- port: {{ .Values.studioLeo.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "studio-leo.selectorLabels" . | nindent 4 }}
69 changes: 57 additions & 12 deletions charts/studio/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,6 @@ studioBackend:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

nameOverride: ""

fullnameOverride: ""

podAnnotations: {}

podSecurityContext: {}
Expand Down Expand Up @@ -483,10 +479,6 @@ studioBeat:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

nameOverride: ""

fullnameOverride: ""

podAnnotations: {}

podSecurityContext: {}
Expand All @@ -506,6 +498,63 @@ studioBeat:

affinity: {}

studioLeo:
# -- Studio: Additional environment variables for leo pods
envVars: {}
# Example:
# envVars:
# DEBUG: "True"

# -- Studio: The name of an existing Secret that contains sensitive environment variables
# passed to leo pods.
envFromSecret: ""

replicaCount: 1

image:
repository: docker.iterative.ai/leo-server
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
# tag: "v1.34.0"

service:
type: ClusterIP
port: 8181

resources:
requests:
cpu: 100m
memory: 512Mi
limits:
cpu: 500m
memory: 1Gi

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 1
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

nodeSelector: {}

tolerations: []

affinity: {}

studioWorker:
# -- Studio: Additional environment variables for worker pods
envVars: {}
Expand Down Expand Up @@ -534,10 +583,6 @@ studioWorker:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

nameOverride: ""

fullnameOverride: ""

podAnnotations: {}

podSecurityContext: {}
Expand Down

0 comments on commit e388207

Please sign in to comment.