Skip to content

Commit

Permalink
Add demo video generate scripts
Browse files Browse the repository at this point in the history
Signed-off-by: YouXam <[email protected]>
  • Loading branch information
YouXam committed Jul 16, 2024
1 parent 5a79488 commit 1ca3fed
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ go.work
*.swp
*.swo
*~

*.mp4
96 changes: 96 additions & 0 deletions demo/demo.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Output demo.mp4

Set FontSize 36
Set Width 2400
Set Height 1000
Set Shell zsh
Set FontFamily "MesloLGS NF"
Set TypingSpeed 0.1


Hide
Type "source ~/.zshrc"
Enter
Sleep 1s
Type "clear"
Enter
Sleep 1s
Show


Type "# There are currently no objects in the cluster."
Enter
Sleep 1s

Type "kubectl get aimodel,pod,deploy"
Enter
Sleep 4s

Type "bat demo.yaml"
Enter
Sleep 5s

Type "# Now create one"
Enter
Sleep 1s
Type "kubectl apply -f demo.yaml"
Enter
Sleep 1s

Type "# Now there is one AI model with three corresponding pods."
Enter
Sleep 3s
Type "kubectl get aimodel,pod,deploy"
Enter
Sleep 6s

Type "# Set replicas to 2."
Enter
Sleep 1s
Type "yq eval '.spec.replicas = 2' demo.yaml -i && bat demo.yaml"
Enter
Sleep 3s

Type "# Now update the ai model"
Enter
Sleep 1s
Type "kubectl apply -f demo.yaml"
Enter
Sleep 1s

Type "# Now there are 2 pods corresponding to the ai model."
Enter
Sleep 3s
Type "kubectl get aimodel,pod,deploy"
Enter
Sleep 4s


Type "# The status of the ai model should be 'Running'."
Enter
Sleep 2s
Type "kubectl get aimodel ai-model-sample -o=jsonpath='{.status}' | jq"
Enter
Sleep 2s

Type "# Trigger an error"
Enter
Sleep 1s
Type "./trigger.sh ConfigurationError some_error"
Enter
Sleep 3s

Type "# The status of the ai model should be 'Failed'."
Enter
Sleep 2s
Type "kubectl get aimodel ai-model-sample -o=jsonpath='{.status}' | jq"
Enter
Sleep 2s

Hide
Type "kubectl delete -f demo.yaml"
Enter
Sleep 2s
Type "yq eval '.spec.replicas = 3' demo.yaml -i"
Enter
Sleep 1s
10 changes: 10 additions & 0 deletions demo/demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: model.youxam.com/v1alpha1
kind: AIModel
metadata:
name: ai-model-sample
spec:
type: local
model: TinyLlama-1.1B
replicas: 3
image: youxam/uplion-aimodel-operator-test-worker:latest

11 changes: 11 additions & 0 deletions demo/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: ai-model-svc
spec:
selector:
aimodel-internel-selector: ai-model-sample
ports:
- protocol: TCP
port: 8080
targetPort: 8080
13 changes: 13 additions & 0 deletions demo/trigger.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
echo -e "\033[33mTriggering an error...\033[0m"
reason=${1:-"Unknown reason"}
message=${2:-"Unknown message"}
echo -e "\033[31m\t$reason: $message\033[0m"
kubectl apply -f service.yaml > /dev/null
sleep 1
kubectl port-forward svc/ai-model-svc 9999:8080 > /dev/null &
bg_pid=$!
sleep 0.5
trap "kill $bg_pid; exit" EXIT
curl -s "http://localhost:9999/?reason=$reason&message=$message" | jq -r '.message + " " + .status'
kubectl delete -f service.yaml > /dev/null

0 comments on commit 1ca3fed

Please sign in to comment.