Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions .github/workflows/build-push-artifacts.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Adapted from https://github.com/stackhpc/azimuth/blob/master/.github/workflows/build-push-artifacts.yaml
name: Publish artifacts
# Run the tasks on every push
# TODO: Add path filtering to only run on relevant changes
on: push
jobs:
# Job to run change detection
Expand All @@ -24,9 +23,10 @@ jobs:
id: filter
with:
base: ${{ github.ref_name }}
# TODO: Make image filters more granular
filters: |
images:
- 'images/**'
- 'web-apps/**'
chart:
- 'chart/**'

Expand All @@ -39,8 +39,7 @@ jobs:
strategy:
matrix:
include:
# - component: api
- component: ui
- component: chat-interface
steps:
- name: Check out the repository
uses: actions/checkout@v4
Expand All @@ -56,23 +55,22 @@ jobs:
id: image-meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/stackhpc/azimuth-llm-${{ matrix.component }}-base
images: ghcr.io/stackhpc/azimuth-llm-${{ matrix.component }}
# Produce the branch name or tag and the SHA as tags
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha,prefix=

- name: Build and push image
uses: stackhpc/github-actions/docker-multiarch-build-push@allow-continue-after-scan
uses: azimuth-cloud/github-actions/docker-multiarch-build-push@update-trivy-action
with:
cache-key: ${{ matrix.component }}-base
context: ./images/${{ matrix.component }}-base
cache-key: ${{ matrix.component }}
context: ./web-apps/${{ matrix.component }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.image-meta.outputs.tags }}
labels: ${{ steps.image-meta.outputs.labels }}
fail_on_high_severity_cve: false

# Job to build and publish Helm chart
build_push_chart:
Expand All @@ -91,10 +89,10 @@ jobs:

- name: Get SemVer version for current commit
id: semver
uses: stackhpc/github-actions/semver@master
uses: azimuth-cloud/github-actions/semver@master

- name: Publish Helm charts
uses: stackhpc/github-actions/helm-publish@master
uses: azimuth-cloud/github-actions/helm-publish@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ steps.semver.outputs.version }}
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test pull request
on:
pull_request:
types:
- opened
- reopened
- ready_for_review
- synchronize
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
chart_validation:
runs-on: ubuntu-latest
env:
CLUSTER_NAME: chart-testing
RELEASE_NAME: ci-test
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Install Helm
uses: azure/setup-helm@v4

- name: Set up chart testing
uses: helm/chart-testing-action@v2

- name: Run chart linting
run: ct lint --config ct.yaml

- name: Run helm template with default values
run: helm template ci-test .
working-directory: chart

- name: Create Kind Cluster
uses: helm/kind-action@v1
with:
cluster_name: ${{ env.CLUSTER_NAME }}

- name: Add Helm repos for dependencies
run: |
helm repo add stakater https://stakater.github.io/stakater-charts

# https://github.com/helm/charts/blob/master/test/README.md#providing-custom-test-values
# Each chart/ci/*-values.yaml file will be treated as a separate test case with it's
# own helm install/test process.
- name: Run chart install and test
run: ct install --config ct.yaml

5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ __pycache__/

# Ignore local dev helpers
test-values.y[a]ml
chart/web-app/settings.yml
gradio-client-test.py
**venv*/


# Helm chart stuff
chart/Chart.lock
chart/charts
chart/charts
9 changes: 3 additions & 6 deletions chart/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@
# Others
README.md
Dockerfile
kubeconfig.yml
*kubeconfig.y[a]ml
venv/
__pycache__/
images/
.hf-token.secret
hu-poc/
test-values.yaml
web-app/settings.yml
web-app/example-settings.yml
*.secret
ci/
5 changes: 4 additions & 1 deletion chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
apiVersion: v2
name: azimuth-llm
description: HuggingFace LLM model serving along with a simple web interface.
maintainers:
- name: "Scott Davidson"
email: [email protected]

# A chart can be either an 'application' or a 'library' chart.
#
Expand Down Expand Up @@ -32,4 +35,4 @@ dependencies:
- name: reloader
version: 1.0.63
repository: https://stakater.github.io/stakater-charts
condition: ui.enabled
condition: ui.enabled
6 changes: 6 additions & 0 deletions chart/ci/web-apps-only-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
api:
enabled: false
ui:
service:
zenith:
enabled: false
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.api.monitoring.enabled -}}
{{- if and .Values.api.enabled .Values.api.monitoring.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.api.monitoring.enabled -}}
{{- if and .Values.api.enabled .Values.api.monitoring.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
2 changes: 2 additions & 0 deletions chart/templates/api/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.api.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -64,3 +65,4 @@ spec:
emptyDir:
medium: Memory
sizeLimit: 1Gi
{{- end -}}
2 changes: 1 addition & 1 deletion chart/templates/api/ingress.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.ingress.api.enabled -}}
{{- if and .Values.api.enabled .Values.ingress.api.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/api/service-monitor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.api.monitoring.enabled -}}
{{- if and .Values.api.enabled .Values.api.monitoring.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand Down
2 changes: 2 additions & 0 deletions chart/templates/api/service.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.api.enabled -}}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -13,3 +14,4 @@ spec:
type: {{ .Values.api.service.type }}
selector:
{{- include "azimuth-llm.api-selectorLabels" . | nindent 4 }}
{{- end -}}
4 changes: 2 additions & 2 deletions chart/templates/api/zenith-client.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.api.service.zenith.enabled -}}
{{- if and .Values.api.enabled .Values.api.service.zenith.enabled -}}
apiVersion: zenith.stackhpc.com/v1alpha1
kind: Client
metadata:
Expand All @@ -11,4 +11,4 @@ spec:
serviceName: {{ .Values.api.service.name }}
auth:
skip: {{ .Values.api.service.zenith.skipAuth }}
{{- end -}}
{{- end -}}
4 changes: 2 additions & 2 deletions chart/templates/api/zenith-reservation.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.api.service.zenith.enabled -}}
{{- if and .Values.api.enabled .Values.api.service.zenith.enabled -}}
apiVersion: zenith.stackhpc.com/v1alpha1
kind: Reservation
metadata:
Expand All @@ -13,4 +13,4 @@ metadata:
{{- end }}
spec:
credentialSecretName: {{ .Release.Name }}-api-zenith-credential
{{- end -}}
{{- end -}}
27 changes: 27 additions & 0 deletions chart/templates/test/end-to-end.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if and .Values.ui.enabled .Values.api.enabled -}}
apiVersion: batch/v1
kind: Job
metadata:
name: gradio-client-response
annotations:
"helm.sh/hook": test
spec:
template:
spec:
containers:
- name: gradio-client-test
image: ghcr.io/stackhpc/azimuth-llm-chat-interface:{{ .Values.ui.image.version }}
imagePullPolicy: IfNotPresent
command:
- python
- gradio-client-test.py
{{- if .Values.ingress.ui.enabled }}
- {{ .Values.ingress.host }}{{ .Values.ingress.ui.path }}
{{- else }}
- http://{{ .Values.ui.service.name }}.{{ .Release.Namespace }}.svc
{{- end }}
restartPolicy: Never
# Allow plenty of retries since downloading
# model weights can take a long time.
backoffLimit: 10
{{- end -}}
26 changes: 26 additions & 0 deletions chart/templates/test/web-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if and .Values.ui.enabled (not .Values.api.enabled) -}}
apiVersion: batch/v1
kind: Job
metadata:
name: web-app-liveness
annotations:
"helm.sh/hook": test
spec:
template:
spec:
containers:
- name: web-app-test
image: nicolaka/netshoot:v0.12
imagePullPolicy: IfNotPresent
command:
- nc
- -vz
{{- if .Values.ingress.ui.enabled }}
- {{ .Values.ingress.host | trimPrefix "http://" | trimPrefix "https://" }}{{ .Values.ingress.ui.path }}
{{- else }}
- {{ .Values.ui.service.name }}.{{ .Release.Namespace }}.svc
{{- end }}
- "80"
restartPolicy: Never
backoffLimit: 3
{{- end -}}
5 changes: 2 additions & 3 deletions chart/templates/ui/app-config-map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
labels:
{{- include "azimuth-llm.labels" . | nindent 4 }}
data:
{{ (.Files.Glob "web-app/*").AsConfig | nindent 2 }}
settings.yml: |
overrides.yml: |
{{- .Values.ui.appSettings | toYaml | nindent 4 }}
{{- end -}}
{{- end -}}
17 changes: 8 additions & 9 deletions chart/templates/ui/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,25 @@ spec:
spec:
containers:
- name: {{ .Release.Name }}-ui
image: {{ printf "%s:%s" .Values.ui.image.repository .Values.ui.image.version }}
{{- with .Values.ui.image }}
image: {{ printf "%s:%s" .repository .version }}
{{- if .imagePullPolicy }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- end -}}
{{- end }}
ports:
- name: ui
containerPort: 7680
workingDir: /etc/web-app
containerPort: 7860
volumeMounts:
- name: app
mountPath: /etc/web-app
command:
- python
args:
- {{ .Values.ui.entrypoint }}
- {{ .Values.huggingface.model }}
env:
- name: PYTHONUNBUFFERED
value: "1"
tty: true # Make stdout from python visible in k8s logs
readinessProbe:
tcpSocket:
port: 7680
port: 7860
periodSeconds: 5
volumes:
- name: app
Expand Down
6 changes: 4 additions & 2 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ huggingface:
token:
# Configuration for the backend model serving API
api:
enabled: true
# Container image config
image:
repository: vllm/vllm-openai
Expand Down Expand Up @@ -99,8 +100,9 @@ ui:
- Arial
# Container image config
image:
repository: ghcr.io/stackhpc/azimuth-llm-ui-base
version: "0.3.0"
repository: ghcr.io/stackhpc/azimuth-llm-chat-interface
version: 87a0342
imagePullPolicy:
# Service config
service:
name: web-app
Expand Down
Loading
Loading