Skip to content

Commit

Permalink
K8S manifest: Update ChatQnA/CodeGen/CodeTrans/DocSum
Browse files Browse the repository at this point in the history
- Update ChatQnA/CodeGen/CodeTrans/DocSum k8s manifest
  to avoid requiring creating directory for cache model.

- Add chatqna-guardrails manifest files.

- Fix bug #752 introduced by PR #669

Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
  • Loading branch information
lianhao authored and yongfengdu committed Sep 6, 2024
1 parent 4bd7841 commit 0629696
Show file tree
Hide file tree
Showing 14 changed files with 3,574 additions and 297 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/_manifest-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
echo "skip_validate=false" >> $GITHUB_ENV
else
echo "Timeout waiting for pods in namespace $NAMESPACE to be ready!"
.github/workflows/scripts/k8s-utils.sh dump_pods_status $NAMESPACE
exit 1
fi
sleep 60
Expand All @@ -91,7 +92,12 @@ jobs:
if $skip_validate; then
echo "Skip validate"
else
${{ github.workspace }}/${{ inputs.example }}/tests/test_manifest_on_${{ inputs.hardware }}.sh validate_${{ inputs.example }} $NAMESPACE
if ${{ github.workspace }}/${{ inputs.example }}/tests/test_manifest_on_${{ inputs.hardware }}.sh validate_${{ inputs.example }} $NAMESPACE ; then
echo "Validate ${{ inputs.example }} successful!"
else
echo "Validate ${{ inputs.example }} failure!!!"
.github/workflows/scripts/k8s-utils.sh dump_all_pod_logs $NAMESPACE
fi
fi
- name: Kubectl uninstall
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/scripts/k8s-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

#set -xe

function dump_pod_log() {
pod_name=$1
namespace=$2
echo "-----------Pod: $pod_name---------"
echo "#kubectl describe pod $pod_name -n $namespace"
kubectl describe pod $pod_name -n $namespace
echo "-----------------------------------"
echo "#kubectl logs $pod_name -n $namespace"
kubectl logs $pod_name -n $namespace
echo "-----------------------------------"
}

function dump_pods_status() {
namespace=$1
echo "-----DUMP POD STATUS in NS $namespace------"
kubectl get pods -n $namespace -o wide
echo "-----------------------------------"

# Get all pods in the namespace and their statuses
pods=$(kubectl get pods -n $namespace --no-headers)

# Loop through each pod
echo "$pods" | while read -r line; do
pod_name=$(echo $line | awk '{print $1}')
ready=$(echo $line | awk '{print $2}')
status=$(echo $line | awk '{print $3}')

# Extract the READY count
ready_count=$(echo $ready | cut -d'/' -f1)
required_count=$(echo $ready | cut -d'/' -f2)

# Check if the pod is not in "Running" status or READY count is less than required
if [[ "$status" != "Running" || "$ready_count" -lt "$required_count" ]]; then
dump_pod_log $pod_name $namespace
fi
done
}

function dump_all_pod_logs() {
namespace=$1
echo "-----DUMP POD STATUS AND LOG in NS $namespace------"

pods=$(kubectl get pods -n $namespace -o jsonpath='{.items[*].metadata.name}')
for pod_name in $pods
do
dump_pod_log $pod_name $namespace
done
}

if [ $# -eq 0 ]; then
echo "Usage: $0 <function_name>"
exit 1
fi

case "$1" in
dump_pods_status)
dump_pods_status $2
;;
dump_all_pod_logs)
dump_all_pod_logs $2
;;
*)
echo "Unknown function: $1"
;;
esac
Loading

0 comments on commit 0629696

Please sign in to comment.