Skip to content

Commit

Permalink
Merge branch 'main' into slf-113
Browse files Browse the repository at this point in the history
  • Loading branch information
ianstanton authored Oct 16, 2024
2 parents 5eb0654 + 9be38d6 commit bb06428
Show file tree
Hide file tree
Showing 39 changed files with 677 additions and 271 deletions.
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.helm.parameters.[] | select(.name == "image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai-events-reporter.yaml
Expand Down Expand Up @@ -103,6 +104,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
24 changes: 13 additions & 11 deletions .github/actions/build-and-push-to-quay/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Build and push to Quay'
description: 'Builds a container image and pushes it to our Quay organization'
name: "Build and push to Quay"
description: "Builds a container image and pushes it to our Quay organization"
inputs:
image_name:
description: 'The name of the image, not including the registry or the tag, for example "postgres"'
Expand All @@ -13,9 +13,9 @@ inputs:
required: false
default: "quay.io/tembo"
docker_directory:
description: 'The relative path to a directory in which there is a Dockerfile'
description: "The relative path to a directory in which there is a Dockerfile"
required: false
default: '.'
default: "."
quay_user:
required: true
description: "Quay 'robot user' user name"
Expand All @@ -29,11 +29,11 @@ inputs:
required: true
description: "Quay 'robot user' access token for Tembo org"
publish_calver:
description: 'Should we tag with calendar versioning?'
description: "Should we tag with calendar versioning?"
required: false
default: false
calver_suffix:
description: 'Optional suffix to the calendar version'
description: "Optional suffix to the calendar version"
required: false
default: ""
publish_latest:
Expand All @@ -55,11 +55,13 @@ runs:
- name: Install TOML parser
shell: bash
run: |
set -xe
wget https://github.com/freshautomations/stoml/releases/download/v0.7.1/stoml_linux_amd64
mv stoml_linux_amd64 stoml
chmod +x stoml
sudo mv stoml /usr/local/bin/
set -xe
sudo apt-get update
sudo apt-get install -y wget
wget https://github.com/freshautomations/stoml/releases/download/v0.7.1/stoml_linux_amd64
mv stoml_linux_amd64 stoml
chmod +x stoml
sudo mv stoml /usr/local/bin/
- name: Create whitespace-separated tags list
shell: bash
id: tags
Expand Down
80 changes: 41 additions & 39 deletions .github/actions/pgx-init/action.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
name: 'pgrx initialization'
description: 'Initialize PGRX if it is a dependency, otherwise do nothing.'
name: "pgrx initialization"
description: "Initialize PGRX if it is a dependency, otherwise do nothing."
inputs:
working-directory:
description: 'The directory in which there is a pgrx extension project'
description: "The directory in which there is a pgrx extension project"
required: true
outputs: {}
runs:
using: "composite"
steps:
- name: Install TOML parser
shell: bash
run: |
set -xe
wget https://github.com/freshautomations/stoml/releases/download/v0.7.1/stoml_linux_amd64 &> /dev/null
mv stoml_linux_amd64 stoml
chmod +x stoml
sudo mv stoml /usr/local/bin/
- name: setup pgrx
shell: bash
id: pgrx_install
working-directory: ${{ inputs.working-directory }}
run: |
pgrx_version=$(stoml Cargo.toml dependencies.pgrx)
if [ -z "${pgrx_version}" ]; then
echo "pgrx is not a dependency: skipping"
echo "skip=true" >> $GITHUB_OUTPUT
else
cargo install --version ${pgrx_version} cargo-pgrx
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: pgrx init
shell: bash
if: steps.pgrx_install.outputs.skip == 'false'
working-directory: ${{ inputs.working-directory }}
run: |
set -x
pg_version=$(stoml Cargo.toml features.default)
# pgrx init can take a long time, and it re-compiles postgres even when there
# is a cached version. So, we can just check for the directory and
cat /home/runner/.pgrx/config.toml || true
if find /home/runner/.pgrx | grep $(awk -F "=" '/${pg_version}/ {print $2}' /home/runner/.pgrx/config.toml | tr -d '"'); then
echo "Already found pgrx is initialized. Skipping 'cargo pgrx init' command."
else
cargo pgrx init --${pg_version} download || true
fi
- name: Install TOML parser
shell: bash
run: |
set -xe
sudo apt-get update
sudo apt-get install -y wget
wget https://github.com/freshautomations/stoml/releases/download/v0.7.1/stoml_linux_amd64 &> /dev/null
mv stoml_linux_amd64 stoml
chmod +x stoml
sudo mv stoml /usr/local/bin/
- name: setup pgrx
shell: bash
id: pgrx_install
working-directory: ${{ inputs.working-directory }}
run: |
pgrx_version=$(stoml Cargo.toml dependencies.pgrx)
if [ -z "${pgrx_version}" ]; then
echo "pgrx is not a dependency: skipping"
echo "skip=true" >> $GITHUB_OUTPUT
else
cargo install --version ${pgrx_version} cargo-pgrx
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: pgrx init
shell: bash
if: steps.pgrx_install.outputs.skip == 'false'
working-directory: ${{ inputs.working-directory }}
run: |
set -x
pg_version=$(stoml Cargo.toml features.default)
# pgrx init can take a long time, and it re-compiles postgres even when there
# is a cached version. So, we can just check for the directory and
cat /home/runner/.pgrx/config.toml || true
if find /home/runner/.pgrx | grep $(awk -F "=" '/${pg_version}/ {print $2}' /home/runner/.pgrx/config.toml | tr -d '"'); then
echo "Already found pgrx is initialized. Skipping 'cargo pgrx init' command."
else
cargo pgrx init --${pg_version} download || true
fi
16 changes: 9 additions & 7 deletions .github/actions/publish-crate/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Publish to crates.io'
description: 'Publish cratest to crates.io and some other crates.io-related actions, like checking if a version is already published.'
name: "Publish to crates.io"
description: "Publish cratest to crates.io and some other crates.io-related actions, like checking if a version is already published."
inputs:
working-directory:
required: false
Expand Down Expand Up @@ -30,11 +30,13 @@ runs:
- name: Install TOML parser
shell: bash
run: |
set -xe
wget https://github.com/freshautomations/stoml/releases/download/v0.7.1/stoml_linux_amd64 &> /dev/null
mv stoml_linux_amd64 stoml
chmod +x stoml
sudo mv stoml /usr/local/bin/
set -xe
sudo apt-get update
sudo apt-get install wget -y
wget https://github.com/freshautomations/stoml/releases/download/v0.7.1/stoml_linux_amd64 &> /dev/null
mv stoml_linux_amd64 stoml
chmod +x stoml
sudo mv stoml /usr/local/bin/
- name: Publish
shell: bash
working-directory: ${{ inputs.working-directory }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/cargo-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
push:
branches: ["main"]
paths-ignore:
- 'tembo-py/**'
- "tembo-py/**"
pull_request:
branches: ["main"]
paths-ignore:
- 'tembo-py/**'
- "tembo-py/**"

jobs:
find_directories:
Expand All @@ -25,7 +25,7 @@ jobs:
with:
contains_the_file: Cargo.toml
changed_relative_to_ref: origin/${{ github.base_ref || 'not-a-branch' }}
ignore_dirs: ".coredb examples tembo-cli/temboclient tembo-cli/tembodataclient"
ignore_dirs: ".coredb examples tembo-cli/temboclient tembo-cli/tembodataclient inference-gateway"

lint:
name: Run linters
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
run: |
set -xe
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev lsb-release
sudo apt-get install -y pkg-config libssl-dev lsb-release wget
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
sudo apt-get update && sudo apt-get install -y postgresql-client
Expand All @@ -103,7 +103,7 @@ jobs:
export PROMETHEUS_URL=https://prometheus-data-1.use1.dev.plat.cdb-svc.com
cd ${{ matrix.path }} && cargo test
env:
ORG_ID: org_2YW4TYIMI1LeOqJTXIyvkHOHCUo
ORG_ID: org_2YW4TYIMI1LeOqJTXIyvkHOHCUo
ACCESS_TOKEN: ${{ secrets.TEMBO_TOKEN_TEST_ORG_DEV }}
TEMBO_HOST: ${{ secrets.TEMBO_HOST }}
TEMBO_DATA_HOST: ${{ secrets.TEMBO_DATA_HOST }}
1 change: 1 addition & 0 deletions .github/workflows/tembo_ai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ on:
jobs:
tests:
name: Run tests

runs-on:
- self-hosted
- dind
Expand Down
9 changes: 5 additions & 4 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.github/** @nhudson @ianstanton @shahadarsh
.github/** @nhudson @ianstanton @shahadarsh @vrmiguel
charts/** @nhudson @ianstanton @shahadarsh
tembo-operator/** @nhudson @ianstanton @ChuckHend
conductor/** @nhudson @ianstanton @ChuckHend
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 @joshuajerin
tembo-py/** @chuckhend
tembo-stacks/** @chuckhend @jasonmp85
inference-gateway/** @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.1

# 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 -}}
26 changes: 17 additions & 9 deletions charts/tembo-ai/templates/inference-service/external-secret.yaml
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 }}
Loading

0 comments on commit bb06428

Please sign in to comment.