Skip to content

Commit

Permalink
Use action to setup kind (#1373)
Browse files Browse the repository at this point in the history
* use action to setup kind

Signed-off-by: Paul S. Schweigert <[email protected]>

* go back to loadbalancer for k8s test

Signed-off-by: Paul S. Schweigert <[email protected]>

---------

Signed-off-by: Paul S. Schweigert <[email protected]>
  • Loading branch information
psschwei authored Jun 14, 2024
1 parent baca5b9 commit e561026
Showing 1 changed file with 12 additions and 69 deletions.
81 changes: 12 additions & 69 deletions .github/workflows/kubernetes-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,52 +17,10 @@ jobs:
sudo mv kind /usr/local/bin
which kind
- name: Create Kind cluster
run: |
set -ex
K8S_VERSION="1.28.7"
cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v${K8S_VERSION}
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
EOF
curl https://raw.githubusercontent.com/metallb/metallb/v0.13.5/config/manifests/metallb-native.yaml -k | \
sed '0,/args:/s//args:\n - --webhook-mode=disabled/' | \
sed '/apiVersion: admissionregistration/,$d' | \
kubectl apply -f -
# Add Layer 2 config
network=$(docker network inspect kind -f "{{(index .IPAM.Config 0).Subnet}}" | cut -d '.' -f1,2)
cat <<EOF | kubectl apply -f -
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: first-pool
namespace: metallb-system
spec:
addresses:
- $network.255.1-$network.255.250
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: example
namespace: metallb-system
EOF
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
uses: chainguard-dev/actions/setup-kind@main
with:
k8s-version: 1.28.x
kind-worker-count: 0
- name: Build and load gateway
run: |
docker build -t gateway:test --build-arg TARGETARCH="amd64" -f ./gateway/Dockerfile .
Expand Down Expand Up @@ -97,26 +55,6 @@ jobs:
.
GATEWAY=$(kubectl get pod -l app.kubernetes.io/name=gateway -o name)
kubectl wait --for=condition=Ready "$GATEWAY" --timeout 5m
NGINX_CONTROLLER=$(kubectl get po -n ingress-nginx -o name | grep controller)
kubectl wait -n ingress-nginx --for=condition=Ready "$NGINX_CONTROLLER" --timeout 5m
cat <<EOF | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ray-service
spec:
ingressClassName: nginx
rules:
- http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: gateway
port:
number: 8000
EOF
- name: setup python
uses: actions/setup-python@v4
with:
Expand All @@ -138,22 +76,27 @@ jobs:
pip install nbmake pytest
- name: Run tests
run: |
export GATEWAY_HOST="http://localhost"
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
for f in *.py; do echo "$f" && python "$f"; done
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 "$f" && python "$f"; done
for f in *.py; do echo "TEST: $f" && python "$f"; done
- name: Echo gateway logs
if: ${{ failure() }}
run: |
GATEWAY=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep gateway)
kubectl logs $GATEWAY
- name: Echo kuberay logs
if: ${{ failure() }}
run: |
KUBERAY=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep kuberay)
kubectl logs $KUBERAY
- name: Echo scheduler logs
if: ${{ failure() }}
run: |
SCHEDULER=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep scheduler)
kubectl logs $SCHEDULER
Expand Down

0 comments on commit e561026

Please sign in to comment.