|
| 1 | +name: Run Kind Tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ["Build and Push Distro Image"] |
| 6 | + types: |
| 7 | + - completed |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +env: |
| 13 | + REGISTRY: quay.io |
| 14 | + ORG: trustyai_testing |
| 15 | + IMAGE_NAME: llama-stack-trustyai-fms |
| 16 | + |
| 17 | +jobs: |
| 18 | + deploy: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + if: ${{ github.event_name == 'pull_request' || github.event.workflow_run.conclusion == 'success' }} |
| 21 | + env: |
| 22 | + PR_NUMBER: ${{ github.event.pull_request.number || 'default-pr-number' }} |
| 23 | + steps: |
| 24 | + - name: Check labels |
| 25 | + uses: mheap/github-action-required-labels@v5 |
| 26 | + with: |
| 27 | + mode: minimum |
| 28 | + count: 1 |
| 29 | + labels: "ok-to-test, lgtm, approved" |
| 30 | + |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v2 |
| 33 | + |
| 34 | + - name: Create kind config |
| 35 | + run: | |
| 36 | + cat > kind-config.yaml << EOF |
| 37 | + kind: Cluster |
| 38 | + apiVersion: kind.x-k8s.io/v1alpha4 |
| 39 | + containerdConfigPatches: |
| 40 | + - |- |
| 41 | + [plugins."io.containerd.grpc.v1.cri".registry] |
| 42 | + config_path = "/etc/containerd/certs.d" |
| 43 | + nodes: |
| 44 | + - role: control-plane |
| 45 | + kubeadmConfigPatches: |
| 46 | + - | |
| 47 | + kind: InitConfiguration |
| 48 | + nodeRegistration: |
| 49 | + kubeletExtraArgs: |
| 50 | + system-reserved: memory=1Gi |
| 51 | + eviction-hard: memory.available<500Mi |
| 52 | + - | |
| 53 | + kind: ClusterConfiguration |
| 54 | + apiServer: |
| 55 | + extraArgs: |
| 56 | + disable-admission-plugins: "PodSecurity" |
| 57 | + extraPortMappings: |
| 58 | + - containerPort: 80 |
| 59 | + hostPort: 80 |
| 60 | + protocol: TCP |
| 61 | + - containerPort: 443 |
| 62 | + hostPort: 443 |
| 63 | + protocol: TCP |
| 64 | + EOF |
| 65 | +
|
| 66 | + - name: Create k8s Kind Cluster |
| 67 | + id: kind |
| 68 | + uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0 |
| 69 | + with: |
| 70 | + registry: true |
| 71 | + registry_name: kind-registry |
| 72 | + registry_port: 5000 |
| 73 | + registry_enable_delete: true |
| 74 | + config: kind-config.yaml |
| 75 | + wait: 120s |
| 76 | + |
| 77 | + - name: Clone llama-stack-k8s-operator |
| 78 | + run: | |
| 79 | + git clone https://github.com/opendatahub-io/llama-stack-k8s-operator.git |
| 80 | + cd llama-stack-k8s-operator |
| 81 | + git checkout odh |
| 82 | +
|
| 83 | + - name: Build llama-stack-k8s-operator and push to Kind registry |
| 84 | + run: | |
| 85 | + cd llama-stack-k8s-operator |
| 86 | + docker build -t kind-registry:5000/llama-stack-k8s-operator:latest -f Dockerfile . |
| 87 | + docker push kind-registry:5000/llama-stack-k8s-operator:latest |
| 88 | +
|
| 89 | + - name: Deploy llama-stack-k8s-operator |
| 90 | + run: | |
| 91 | + |
| 92 | + cd llama-stack-k8s-operator |
| 93 | + make deploy IMG=kind-registry:5000/llama-stack-k8s-operator:latest |
| 94 | + |
| 95 | + # Wait for operator deployment to be ready |
| 96 | + if ! kubectl wait --for=condition=available --timeout=300s deployment/llama-stack-k8s-operator-controller-manager -n llama-stack-k8s-operator-system; then |
| 97 | + echo "Deployment failed to become ready. Debugging information:" |
| 98 | + kubectl describe deployment llama-stack-k8s-operator-controller-manager -n llama-stack-k8s-operator-system |
| 99 | + kubectl logs -l control-plane=controller-manager -n llama-stack-k8s-operator-system --tail=100 |
| 100 | + kubectl get events -n system --sort-by='.lastTimestamp' |
| 101 | + exit 1 |
| 102 | + fi |
| 103 | +
|
| 104 | + - name: Pull FMS provider image and push to kind registry |
| 105 | + run: | |
| 106 | + docker pull ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:pr-${{ env.PR_NUMBER }} |
| 107 | + docker tag ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:pr-${{ env.PR_NUMBER }} kind-registry:5000/llama-stack-trustyai-fms:latest |
| 108 | + docker push kind-registry:5000/llama-stack-trustyai-fms:latest |
| 109 | +
|
| 110 | + - name: Load TrustyAI operator image into Kind |
| 111 | + run: | |
| 112 | + docker pull quay.io/trustyai/trustyai-service-operator:latest |
| 113 | + docker tag quay.io/trustyai/trustyai-service-operator:latest kind-registry:5000/trustyai-service-operator:latest |
| 114 | + docker push kind-registry:5000/trustyai-service-operator:latest |
| 115 | +
|
| 116 | + - name: Load VLLM emulator image into Kind |
| 117 | + run: | |
| 118 | + docker pull quay.io/trustyai_testing/vllm_emulator:latest |
| 119 | + docker tag quay.io/trustyai_testing/vllm_emulator:latest kind-registry:5000/vllm_emulator:latest |
| 120 | + docker push kind-registry:5000/vllm_emulator:latest |
| 121 | +
|
| 122 | + - name: Install kustomize |
| 123 | + run: | |
| 124 | + curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash |
| 125 | + sudo mv kustomize /usr/local/bin/ |
| 126 | +
|
| 127 | + - name: Clone TrustyAI operator repository |
| 128 | + run: | |
| 129 | + git clone https://github.com/trustyai-explainability/trustyai-service-operator.git |
| 130 | + cd trustyai-service-operator |
| 131 | + git checkout main |
| 132 | +
|
| 133 | + - name: Apply CRDs |
| 134 | + run: | |
| 135 | + kubectl apply -f tests/kind/manifests/route_crd.yaml |
| 136 | + kubectl apply -f tests/kind/manifests/monitoring.coreos.com_servicemonitors.yaml |
| 137 | + kubectl apply -f tests/kind/manifests/serving.kserve.io_inferenceservices.yaml |
| 138 | +
|
| 139 | + kubectl apply -k https://github.com/llamastack/llama-stack-k8s-operator/config/crd |
| 140 | +
|
| 141 | + cd trustyai-service-operator |
| 142 | + kustomize build config/crd | kubectl apply -f - |
| 143 | +
|
| 144 | + - name: Deploy TrustyAI operator |
| 145 | + run: | |
| 146 | + kubectl create namespace system |
| 147 | +
|
| 148 | + cd trustyai-service-operator |
| 149 | + kustomize build config/base | kubectl apply -n system -f - |
| 150 | +
|
| 151 | + - name: Run Kind Tests |
| 152 | + run: ./tests/kind/test_kind.sh |
| 153 | + |
| 154 | + - name: Get logs |
| 155 | + if: ${{ always() }} |
| 156 | + run: | |
| 157 | + # Test namespace resources and logs |
| 158 | + kubectl -n test get all -o yaml > test-ns-logs.log |
| 159 | + kubectl -n test describe all > test-ns-describe.log |
| 160 | + kubectl -n test describe events > test-ns-events.log |
| 161 | +
|
| 162 | + # LlamaStack-related logs |
| 163 | + kubectl -n llama-stack-k8s-operator-system logs deployment.apps/llama-stack-k8s-operator-controller-manager > lls-controller-manager.log |
| 164 | + kubectl -n test get llamastackdistributions -o yaml > lls-dist.log |
| 165 | + kubectl -n test logs -l app.kubernetes.io/instance=llamastack-custom-distribution --all-containers=true > llama-stack-distribution-pods.log || echo "No llama stack distribution pods found" > lls-dist-pod-logs.log |
| 166 | +
|
| 167 | + # TrustyAI operator logs and resources |
| 168 | + kubectl -n system logs -l control-plane=controller-manager > trustyai-operator.log || echo "No TrustyAI operator logs available" > trustyai-operator.log |
| 169 | +
|
| 170 | + # GuardrailsOrchestrator resources |
| 171 | + kubectl -n test describe GuardrailsOrchestrator > guardrails-orchestrator-describe.log || echo "No GuardrailsOrchestrator in test namespace" > guardrails-orchestrator-describe.log |
| 172 | +
|
| 173 | + # Cluster-wide information |
| 174 | + kubectl get pods --all-namespaces > all-pods.log |
| 175 | + kubectl get events --all-namespaces --sort-by='.lastTimestamp' > all-events.log |
| 176 | +
|
| 177 | + - name: Upload all logs to artifacts |
| 178 | + if: ${{ always() }} |
| 179 | + uses: actions/upload-artifact@v4 |
| 180 | + with: |
| 181 | + name: logs-${{ github.run_id }}-${{ github.run_attempt }} |
| 182 | + path: | |
| 183 | + *.log |
| 184 | + retention-days: 1 |
0 commit comments