-
Notifications
You must be signed in to change notification settings - Fork 33
98 lines (95 loc) · 3.79 KB
/
kubernetes-deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Test QS on Kubernetes
on:
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #4.1.7
- name: Install Kind
run: |
curl -Lo ./kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.20.0/kind-$(uname)-amd64"
chmod +x ./kind
sudo mv kind /usr/local/bin
which kind
- name: Create Kind cluster
uses: chainguard-dev/actions/setup-kind@main
with:
k8s-version: 1.29.x
kind-worker-count: 0
- name: Label nodes
run: kubectl label node kind-control-plane has-gpu=gpu has-cpu=cpu
- name: Build and load gateway
run: |
docker build -t gateway:test -f ./gateway/Dockerfile .
kind load docker-image gateway:test
docker image rm gateway:test
- name: Build and load ray node
run: |
docker build -t ray:test -f ./Dockerfile-ray-node .
kind load docker-image ray:test
docker image rm ray:test
- name: Install helm chart
run: |
cd charts/qiskit-serverless
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add kuberay https://ray-project.github.io/kuberay-helm
helm dependency build
helm install qs \
--set platform=kind \
--set repositoryEnable=false \
--set nginxIngressControllerEnable=false \
--set gateway.image.repository=gateway \
--set gateway.image.tag=test \
--set gateway.application.ray.nodeImage=ray:test \
--set gateway.application.ray.proxyImage=proxy:test \
--set gateway.application.ray.cpu=1 \
--set gateway.application.debug=1 \
--set gateway.application.limits.keepClusterOnComplete=false \
--set gateway.application.authMockproviderRegistry=test \
--set gateway.application.proxy.enabled=false \
.
GATEWAY=$(kubectl get pod -l app.kubernetes.io/name=gateway -o name)
kubectl wait --for=condition=Ready "$GATEWAY" --timeout 5m
- name: setup python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f #5.1.1
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip==24.2
cd client
pip install . --no-cache-dir
pip install --no-cache-dir \
ipywidgets==8.1.1 \
circuit-knitting-toolbox>=0.6.0 \
matplotlib==3.7.1 \
pyscf==2.2.1 \
scipy==1.10 \
qiskit-ibm-provider>=0.9.0 \
qiskit-aer>=0.13.3 \
certifi==2024.7.4
pip install nbmake==1.5.4 pytest==8.3.2
- name: Run tests
run: |
kubectl patch svc gateway -p '{"spec": {"type": "LoadBalancer"}}'
export GATEWAY_HOST="http://$(kubectl get svc gateway -o jsonpath="{.status.loadBalancer.ingress[0].ip}"):8000"
echo $GATEWAY_HOST
# basic tests
cd /home/runner/work/qiskit-serverless/qiskit-serverless/tests/basic
rm 06_function.py
for f in *.py; do echo "TEST: $f" && python "$f"; done
# experimental tests
cd /home/runner/work/qiskit-serverless/qiskit-serverless/tests/experimental
for f in *.py; do echo "TEST: $f" && python "$f"; done
- uses: chainguard-dev/actions/kind-diag@main
# Only upload logs on failure.
if: ${{ failure() }}
with:
cluster-resources: nodes,namespaces,crds
namespace-resources: configmaps,pods,svc,pvc,ingress
artifact-name: logs-${{ github.run_id }}