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

Add ability to deploy multiple inference-service services #994

Merged
merged 11 commits into from
Oct 10, 2024
2 changes: 2 additions & 0 deletions .github/actions/argocd-update/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ runs:
yq -i '(.spec.source.helm.parameters.[] | select(.name == "pod-init.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-operator.yaml
yq -i '(.spec.source.helm.parameters.[] | select(.name == "pod-init.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-operator-euc1.yaml
yq -i '(.spec.source.helm.parameters.[] | select(.name == "inferenceGateway.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai.yaml
yq -i '(.spec.source.helm.parameters.[] | select(.name == "inferenceService.default.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai.yaml
yq -i '(.spec.source.helm.parameters.[] | select(.name == "controller.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-operator-gke-usc1.yaml
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai.yaml
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai-events-reporter.yaml
Expand Down Expand Up @@ -102,6 +103,7 @@ runs:
yq -i '(.spec.source.helm.parameters.[] | select(.name == "pod-init.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-operator-usw2.yaml
yq -i '(.spec.source.helm.parameters.[] | select(.name == "pod-init.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-operator-gke-usc1.yaml
yq -i '(.spec.source.helm.parameters.[] | select(.name == "inferenceGateway.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai.yaml
yq -i '(.spec.source.helm.parameters.[] | select(.name == "inferenceService.default.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai.yaml
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai.yaml

- name: Git commit and push to remote
Expand Down
20 changes: 10 additions & 10 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.github/** @sjmiller609 @nhudson @ianstanton
charts/** @sjmiller609 @nhudson @ianstanton
dataplane-webserver/** @sjmiller609
tembo-operator/** @sjmiller609 @nhudson @ianstanton @ChuckHend
conductor/** @sjmiller609 @nhudson @ianstanton @ChuckHend
tembo-pod-init/** @nhudson
tembo-cli/** @shahadarsh @vrmiguel @DarrenBaldwin07 @sjmiller609
tembo-py/** @chuckhend @EvanHStanton
tembo-stacks/** @chuckhend @jasonmp85 @shhnwz
inference-gateway/** @chuckhend @jasonmp85 @shhnwz
.github/** @nhudson @ianstanton @vrmiguel
charts/** @nhudson @ianstanton
dataplane-webserver/** @nhudson @ianstanton @vrmiguel
tembo-operator/** @nhudson @ianstanton @ChuckHend @vrmiguel
conductor/** @nhudson @ianstanton @ChuckHend @vrmiguel
tembo-pod-init/** @nhudson @ianstanton
tembo-cli/** @shahadarsh @vrmiguel @DarrenBaldwin07
tembo-py/** @chuckhend
tembo-stacks/** @chuckhend @jasonmp85
inference-gateway/** @chuckhend @jasonmp85
2 changes: 1 addition & 1 deletion charts/tembo-ai/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.0
version: 0.3.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
Expand Down
7 changes: 7 additions & 0 deletions charts/tembo-ai/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Define the namespace to use across the Helm chart
*/}}
{{- define "tembo-ai.namespace" -}}
{{- default .Release.Namespace }}
{{- 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).
Expand Down
21 changes: 20 additions & 1 deletion charts/tembo-ai/templates/inference-service/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Inference service specific labels
*/}}
{{- define "tembo-ai.inferenceService.labels" -}}
app.kubernetes.io/component: inference-service
{{ include "tembo-ai.labels" . }}
{{- end }}

Expand All @@ -20,3 +19,23 @@ Create the name of the inference-service service account to use
{{- define "tembo-ai.inferenceService.serviceAccountName" -}}
{{- include "tembo-ai.fullname" . }}-service
{{- end }}

{{/*
Deepmerge the inference-service default configs and the services sepecific configs
*/}}
{{- define "tembo-ai.inferenceService.deepMerge" -}}
{{- $result := deepCopy (index . 0) -}}
{{- range $key, $value := index . 1 -}}
{{- if kindIs "map" $value -}}
{{- if hasKey $result $key -}}
{{- $newValue := fromYaml (include "tembo-ai.inferenceService.deepMerge" (list (get $result $key) $value)) -}}
{{- $_ := set $result $key $newValue -}}
{{- else -}}
{{- $_ := set $result $key $value -}}
{{- end -}}
{{- else -}}
{{- $_ := set $result $key $value -}}
{{- end -}}
{{- end -}}
{{- $result | toYaml -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
{{- if .Values.inferenceService.externalSecrets.secretName -}}
{{- if .Values.inferenceService.services }}
{{- $defaults := .Values.inferenceService.defaults }}
{{- range $serviceName, $serviceConfig := .Values.inferenceService.services }}
{{- $mergedConfig := fromYaml (include "tembo-ai.inferenceService.deepMerge" (list $defaults $serviceConfig)) }}
{{- if and (default false $mergedConfig.enabled) $mergedConfig.externalSecrets.secretName }}
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: {{ include "tembo-ai.fullname" . }}-service
namespace: {{ .Release.Namespace }}
name: {{ include "tembo-ai.fullname" $ }}-{{ $serviceName }}
namespace: {{ include "tembo-ai.namespace" $ }}
labels:
{{- include "tembo-ai.inferenceService.labels" . | nindent 4 }}
{{- include "tembo-ai.inferenceService.labels" $ | nindent 4 }}
app.kubernetes.io/component: {{ $serviceName }}
spec:
refreshInterval: {{ .Values.inferenceService.externalSecrets.refreshInterval }}
refreshInterval: {{ $mergedConfig.externalSecrets.refreshInterval }}
secretStoreRef:
name: {{ .Values.inferenceService.externalSecrets.parameterStore.name }}
kind: {{ .Values.inferenceService.externalSecrets.parameterStore.kind }}
name: {{ $mergedConfig.externalSecrets.parameterStore.name }}
kind: {{ $mergedConfig.externalSecrets.parameterStore.kind }}
target:
creationPolicy: 'Owner'
name: {{ .Values.inferenceService.externalSecrets.secretName }}
name: {{ $mergedConfig.externalSecrets.secretName }}
dataFrom:
- find:
name:
regexp: {{ .Values.inferenceService.externalSecrets.secretRegex }}
regexp: {{ $mergedConfig.externalSecrets.secretRegex }}
{{- end }}
{{- end }}
{{- end }}
31 changes: 23 additions & 8 deletions charts/tembo-ai/templates/inference-service/pod-monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
{{- if .Values.inferenceService.podMonitor.enabled -}}
{{- if .Values.inferenceService.services }}
{{- $defaults := .Values.inferenceService.defaults }}
{{- $releaseName := default "release-name" .Release.Name }}
{{- range $serviceName, $serviceConfig := .Values.inferenceService.services }}
{{- $mergedConfig := fromYaml (include "tembo-ai.inferenceService.deepMerge" (list $defaults $serviceConfig)) }}
{{- if and (default false $mergedConfig.enabled) (default false $mergedConfig.podMonitor.enabled) }}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "tembo-ai.fullname" . }}-service
namespace: {{ .Release.Namespace }}
name: {{ include "tembo-ai.fullname" $ }}-{{ $serviceName }}
namespace: {{ include "tembo-ai.namespace" $ }}
labels:
{{- include "tembo-ai.inferenceService.labels" . | nindent 4 }}
{{- include "tembo-ai.inferenceService.labels" $ | nindent 4 }}
app.kubernetes.io/component: {{ $serviceName }}
spec:
podMetricsEndpoints:
- path: {{ .Values.inferenceService.podMonitor.path }}
port: {{ .Values.inferenceService.podMonitor.portName }}
- port: {{ $mergedConfig.podMonitor.portName }}
path: {{ $mergedConfig.podMonitor.path }}
{{- with $mergedConfig.podMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with $mergedConfig.podMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
- {{ include "tembo-ai.namespace" $ }}
selector:
matchLabels:
{{- include "tembo-ai.inferenceService.selectorLabels" . | nindent 6 }}
{{- include "tembo-ai.inferenceService.selectorLabels" $ | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
22 changes: 17 additions & 5 deletions charts/tembo-ai/templates/inference-service/service.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
{{- if .Values.inferenceService.services }}
{{- $defaults := .Values.inferenceService.defaults }}
{{- range $serviceName, $serviceConfig := .Values.inferenceService.services }}
{{- $mergedConfig := fromYaml (include "tembo-ai.inferenceService.deepMerge" (list $defaults $serviceConfig)) }}
{{- if and (default false $mergedConfig.enabled) (default true $mergedConfig.service.enabled) }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "tembo-ai.fullname" . }}-service
name: {{ include "tembo-ai.fullname" $ }}-{{ $serviceName }}
namespace: {{ include "tembo-ai.namespace" $ }}
labels:
{{- include "tembo-ai.inferenceService.labels" . | nindent 4 }}
{{- include "tembo-ai.inferenceService.labels" $ | nindent 4 }}
app.kubernetes.io/component: {{ $serviceName }}
spec:
clusterIP: None
type: {{ .Values.inferenceService.service.type }}
type: {{ $mergedConfig.service.type | default "ClusterIP" }}
ports:
- port: {{ .Values.inferenceService.service.port }}
- port: {{ $mergedConfig.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "tembo-ai.inferenceService.selectorLabels" . | nindent 4 }}
{{- include "tembo-ai.inferenceService.selectorLabels" $ | nindent 4 }}
app.kubernetes.io/component: {{ $serviceName }}
{{- end }}
{{- end }}
{{- end }}
27 changes: 24 additions & 3 deletions charts/tembo-ai/templates/inference-service/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
{{- if .Values.inferenceService.services }}
{{- $defaults := .Values.inferenceService.defaults }}
{{- range $serviceName, $serviceConfig := .Values.inferenceService.services }}
{{- $mergedConfig := fromYaml (include "tembo-ai.inferenceService.deepMerge" (list $defaults $serviceConfig)) }}
{{- if and (default false $mergedConfig.enabled) (default true $mergedConfig.serviceAccount.create) }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "tembo-ai.inferenceService.serviceAccountName" . }}
name: {{ include "tembo-ai.fullname" $ }}-{{ $serviceName }}
namespace: {{ include "tembo-ai.namespace" $ }}
labels:
{{- include "tembo-ai.inferenceService.labels" . | nindent 4 }}
{{- with .Values.inferenceService.serviceAccount.annotations }}
{{- include "tembo-ai.inferenceService.labels" $ | nindent 4 }}
app.kubernetes.io/component: {{ $serviceName }}
{{- with $mergedConfig.serviceAccount.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $mergedConfig.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if $mergedConfig.serviceAccount.imagePullSecrets }}
imagePullSecrets:
{{- toYaml $mergedConfig.serviceAccount.imagePullSecrets | nindent 2 }}
{{- end }}
{{- if hasKey $mergedConfig.serviceAccount "automountServiceAccountToken" }}
automountServiceAccountToken: {{ $mergedConfig.serviceAccount.automountServiceAccountToken }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Loading
Loading