Skip to content

Commit

Permalink
Merge pull request #12 from amun-ai/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ctr26 authored Sep 29, 2023
2 parents d6d2c64 + 2ed84e5 commit 7ae3c94
Show file tree
Hide file tree
Showing 25 changed files with 240 additions and 197 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/helm-lint-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# See https://github.com/helm/chart-testing-action
name: Lint and Test Charts

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:

jobs:
lint-test:
runs-on: ubuntu-latest
# strategy:
# matrix:
# k8s: ["1.19.16", "1.21.14", "1.22.9", "1.23.12", "1.24.7", "1.25.2"]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Helm
uses: azure/[email protected]
# as of 2022/12 the set-output still not fixed in this action
# https://github.com/Azure/setup-helm/issues/103
with:
version: v3.7.0

- name: Install chart-testing
uses: helm/[email protected]

- name: Run chart-testing (lint)
run: ct lint --config ct.yaml

- name: Create kind cluster
uses: helm/[email protected]

# See https://github.com/helm/chart-testing/blob/main/doc/ct_install.md
- name: Run chart-testing (install)
run: ct install --config ct.yaml --debug
27 changes: 19 additions & 8 deletions .github/workflows/helm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ on:
push:
branches:
- main
- dev

jobs:
release:
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
fetch-depth: 0 # Ensure tags are fetched too

- name: Configure Git
run: |
Expand All @@ -27,10 +26,7 @@ jobs:
uses: azure/setup-helm@v1
with:
version: v3.9.3
# https://hoetker.engineer/post/helm-github-workflow-dependency/
# This is bad practise, but it works for now. Chart-releaser
# should add the helm repos but doesn't
#TODO fix hard coding

- name: Add Helm dependency repos
run: |
helm repo add docker-registry https://helm.twun.io
Expand All @@ -41,7 +37,22 @@ jobs:
run: |
helm dependency update charts/hypha
helm dependency build charts/hypha
- name: Get semantic version
id: semver
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

# - name: Update Chart.yaml version
# uses: fjogeleit/[email protected]
# with:
# valueFile: 'charts/hypha/Chart.yaml'
# propertyPath: 'version'
# value: ${{ steps.semver.outputs.new_tag }}

- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
VERSION: "${{ steps.semver.outputs.new_tag }}"
57 changes: 0 additions & 57 deletions .github/workflows/helm-test.yml

This file was deleted.

10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
secrets.yaml
.history
/*
!.gitignore
!Makefile
!README.md
# !helmsman.yaml
!charts
!.github
!ct.yaml
22 changes: 18 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
.PHONY: minikube.setup

minikube.setup:
minikube config set memory 16384
minikube config set cpus 4
minikube start

minikube config set disk-size 32GB
minikube start --addons=gpu,ingress,nvidia-driver-installer,nvidia-gpu-device-plugin

helm.package:
helm package charts/hypha --dependency-update --destination helm-chart
helm package charts/tritoninferenceserver-hypha --dependency-update --destination helm-chart
# VERSION=$(shell grep -Eo '[0-9]\.[0-9]\.[0-9]+' helm-chart/hypha/Chart.yaml | head -1)

VERSION=$(shell grep -Po "(?<=version: )([0-9]|\.)*(?=\s|$$)" charts/hypha/Chart.yaml | head -1)
Expand All @@ -16,5 +21,14 @@ tag.release:
version=${VERSION}
echo "Tagging release ${VERSION}"
git tag -a "v${VERSION}" -m "v${VERSION}" -f
git push origin "v${

git push origin

install:
helm upgrade hypha charts/hypha --install --timeout 20m

test:
helm test hypha

install.and.test: install test


6 changes: 3 additions & 3 deletions charts/hypha/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ dependencies:
version: 3.3.0
- name: tritoninferenceserver-hypha
repository: file://../tritoninferenceserver-hypha
version: 1.0.4
version: 1.0.5
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 17.11.6
digest: sha256:54badeeee47a31d44c715b931fca25801036bfebd773806eb31d74d5fa4feeb3
generated: "2023-07-03T12:44:14.147747653+01:00"
digest: sha256:f513dba8f9978281f7d8e496c3341cdcabb07389f08fe168e52869b186acc852
generated: "2023-09-19T10:41:56.049018409+01:00"
13 changes: 6 additions & 7 deletions charts/hypha/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
apiVersion: v2
name: hypha
description: A Helm chart for deploying Hypha to Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
Expand All @@ -11,18 +10,15 @@ description: A Helm chart for deploying Hypha to Kubernetes
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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.15.25

version: 0.16.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
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: 0.15.25

dependencies:
- name: docker-registry
# condition: docker-registry-mirror.enabled
Expand All @@ -47,9 +43,12 @@ dependencies:
# condition: ingress-nginx.enabled
- name: tritoninferenceserver-hypha
repository: "file://../tritoninferenceserver-hypha"
version: 1.0.4
version: 1.0.5
condition: tritoninferenceserver-hypha.enabled
- name: redis
repository: "https://charts.bitnami.com/bitnami"
version: 17.11.6
condition: redis.enabled
condition: redis.enabled
maintainers:
- name: ctr26
- name: oeway
Binary file removed charts/hypha/charts/redis-16.5.2.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 4 additions & 1 deletion charts/hypha/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{{- $S3_ENDPOINT_URL := .Values.s3_endpoint_url -}}
{{- $S3_ENDPOINT_URL_PUBLIC := .Values.s3_endpoint_url_public -}}
{{- $S3_ACCESS_KEY := .Values.s3_access_key -}}
Expand Down Expand Up @@ -43,6 +42,10 @@ spec:
labels:
{{- include "hypha.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
command: ["/bin/sh", "-c"]
Expand Down
File renamed without changes.
Empty file.
33 changes: 33 additions & 0 deletions charts/hypha/templates/tests/cellpose-test-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-test-script
data:
test-hypha.py: |
import subprocess
subprocess.call(["pip", "install", "pyotritonclient", "kaibu-utils","numpy","Pillow"])
import io
from PIL import Image
# import matplotlib.pyplot as plt
# import numpy as np
from pyotritonclient import execute
from kaibu_utils import fetch_image
import asyncio
async def main():
image = await fetch_image("https://static.imjoy.io/img/img02.png")
image = image.astype("float32")
print("example image downloaded: ", image.shape)
param = {"diameter": 30, "model_type": "cyto"}
# run inference
results = await execute([image.transpose(2, 0, 1), param],
server_url="http://{{ include "hypha.fullname" . }}/triton",
model_name="cellpose-python",
decode_bytes=True)
mask = results["mask"]
print("cellpose prediction: ", mask.shape)
if __name__ == "__main__":
asyncio.run(main())
20 changes: 0 additions & 20 deletions charts/hypha/templates/tests/test-connection.yaml

This file was deleted.

23 changes: 23 additions & 0 deletions charts/hypha/templates/tests/test-hypha-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ .Release.Name }}-hypha-test"
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
annotations:
"helm.sh/hook": test-success
spec:
template:
spec:
containers:
- name: hypha-test
image: python:3.8-slim
command: ["python", "/scripts/test-hypha.py"]
volumeMounts:
- name: test-script
mountPath: /scripts
restartPolicy: Never
volumes:
- name: test-script
configMap:
name: {{ .Release.Name }}-test-script
29 changes: 0 additions & 29 deletions charts/hypha/templates/tests/test-hypha.yaml.ignore

This file was deleted.

Loading

0 comments on commit 7ae3c94

Please sign in to comment.