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 Jul 19, 2023
1 parent 4f60e89 commit 6533272
Show file tree
Hide file tree
Showing 7 changed files with 218 additions and 29 deletions.
2 changes: 1 addition & 1 deletion charts/studio/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.2.10
version: 0.2.12

# 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
Expand Down
29 changes: 22 additions & 7 deletions charts/studio/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# studio

![Version: 0.2.10](https://img.shields.io/badge/Version-0.2.10-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.9.1](https://img.shields.io/badge/AppVersion-v2.9.1-informational?style=flat-square)
![Version: 0.2.12](https://img.shields.io/badge/Version-0.2.12-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.9.1](https://img.shields.io/badge/AppVersion-v2.9.1-informational?style=flat-square)

A Helm chart for Kubernetes

Expand Down Expand Up @@ -113,10 +113,8 @@ A Helm chart for Kubernetes
| studioBackend.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| studioBackend.envFromSecret | string | `""` | Studio: The name of an existing Secret that contains sensitive environment variables passed to backend pods. |
| studioBackend.envVars | object | `{}` | Studio: Additional environment variables for backend pods |
| studioBackend.fullnameOverride | string | `""` | |
| studioBackend.image.pullPolicy | string | `"IfNotPresent"` | |
| studioBackend.image.repository | string | `"docker.iterative.ai/viewer_backend"` | |
| studioBackend.nameOverride | string | `""` | |
| studioBackend.nodeSelector | object | `{}` | |
| studioBackend.podAnnotations | object | `{}` | |
| studioBackend.podSecurityContext | object | `{}` | |
Expand All @@ -136,8 +134,6 @@ A Helm chart for Kubernetes
| studioBeat.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| studioBeat.envFromSecret | string | `""` | Studio: The name of an existing Secret that contains sensitive environment variables passed to beat pods. |
| studioBeat.envVars | object | `{}` | Studio: Additional environment variables for beat pods |
| studioBeat.fullnameOverride | string | `""` | |
| studioBeat.nameOverride | string | `""` | |
| studioBeat.nodeSelector | object | `{}` | |
| studioBeat.podAnnotations | object | `{}` | |
| studioBeat.podSecurityContext | object | `{}` | |
Expand All @@ -148,6 +144,27 @@ A Helm chart for Kubernetes
| studioBeat.resources.requests.memory | string | `"128Mi"` | |
| studioBeat.securityContext | object | `{}` | |
| studioBeat.tolerations | list | `[]` | |
| studioLeo.affinity | object | `{}` | |
| studioLeo.autoscaling.enabled | bool | `false` | |
| studioLeo.autoscaling.maxReplicas | int | `1` | |
| studioLeo.autoscaling.minReplicas | int | `1` | |
| studioLeo.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| studioLeo.envFromSecret | string | `""` | Studio: The name of an existing Secret that contains sensitive environment variables passed to leo pods. |
| studioLeo.envVars | object | `{}` | Studio: Additional environment variables for leo pods |
| studioLeo.image.pullPolicy | string | `"IfNotPresent"` | |
| studioLeo.image.repository | string | `"docker.iterative.ai/leo-server"` | |
| studioLeo.nodeSelector | object | `{}` | |
| studioLeo.podAnnotations | object | `{}` | |
| studioLeo.podSecurityContext | object | `{}` | |
| studioLeo.replicaCount | int | `1` | |
| studioLeo.resources.limits.cpu | string | `"500m"` | |
| studioLeo.resources.limits.memory | string | `"1Gi"` | |
| studioLeo.resources.requests.cpu | string | `"100m"` | |
| studioLeo.resources.requests.memory | string | `"512Mi"` | |
| studioLeo.securityContext | object | `{}` | |
| studioLeo.service.port | int | `8181` | |
| studioLeo.service.type | string | `"ClusterIP"` | |
| studioLeo.tolerations | list | `[]` | |
| studioUi.affinity | object | `{}` | |
| studioUi.autoscaling.enabled | bool | `false` | |
| studioUi.autoscaling.maxReplicas | int | `5` | |
Expand Down Expand Up @@ -178,8 +195,6 @@ A Helm chart for Kubernetes
| studioWorker.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| studioWorker.envFromSecret | string | `""` | Studio: The name of an existing Secret that contains sensitive environment variables passed to worker pods. |
| studioWorker.envVars | object | `{}` | Studio: Additional environment variables for worker pods |
| studioWorker.fullnameOverride | string | `""` | |
| studioWorker.nameOverride | string | `""` | |
| studioWorker.nodeSelector | object | `{}` | |
| studioWorker.podAnnotations | object | `{}` | |
| studioWorker.podSecurityContext | object | `{}` | |
Expand Down
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 @@ -419,10 +419,6 @@ studioBackend:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

nameOverride: ""

fullnameOverride: ""

podAnnotations: {}

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

nameOverride: ""

fullnameOverride: ""

podAnnotations: {}

podSecurityContext: {}
Expand All @@ -493,6 +485,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 @@ -521,10 +570,6 @@ studioWorker:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

nameOverride: ""

fullnameOverride: ""

podAnnotations: {}

podSecurityContext: {}
Expand Down

0 comments on commit 6533272

Please sign in to comment.