temp checkpoint

This commit is contained in:
Kai Wu 2025-08-01 12:34:38 -07:00
parent a2bbb17fdd
commit 67f19f76b2
7 changed files with 1032 additions and 25 deletions

View file

@ -29,48 +29,130 @@ if [ -n "${NGC_API_KEY:-}" ]; then
export NGC_DOCKER_CONFIG_JSON=$(echo -n "$NGC_DOCKER_CONFIG" | base64)
fi
# Define namespace - default to current namespace if not specified
export NAMESPACE=${NAMESPACE:-$(kubectl config view --minify -o jsonpath='{..namespace}')}
if [ -z "$NAMESPACE" ]; then
export NAMESPACE="default"
fi
set -euo pipefail
set -x
# Delete resources in reverse order of creation to handle dependencies properly
# Delete UI deployment
echo "Starting comprehensive deletion of all LlamaStack resources..."
# Delete UI deployment and service
echo "Deleting UI resources..."
envsubst < ./ui-k8s.yaml.template | kubectl delete -f - --ignore-not-found=true
# Check for UI service template and delete if exists
if [ -f "./ui-service-k8s.yaml.template" ]; then
envsubst < ./ui-service-k8s.yaml.template | kubectl delete -f - --ignore-not-found=true
fi
# Delete monitoring resources
echo "Deleting monitoring resources..."
envsubst < ./monitoring-k8s.yaml.template | kubectl delete -f - --ignore-not-found=true
# Delete Prometheus RBAC resources
echo "Deleting Prometheus RBAC resources..."
kubectl delete -f ./prometheus-rbac.yaml --ignore-not-found=true
# Delete ingress
echo "Deleting ingress resources..."
envsubst < ./ingress-k8s.yaml.template | kubectl delete -f - --ignore-not-found=true
# Delete stack deployment
echo "Deleting stack deployment..."
envsubst < ./stack-k8s.yaml.template | kubectl delete -f - --ignore-not-found=true
# Delete configmap
# Delete configmaps
echo "Deleting configmaps..."
kubectl delete configmap llama-stack-config --ignore-not-found=true
# Check for stack configmap and delete if exists
if [ -f "./stack-configmap.yaml" ]; then
kubectl delete -f ./stack-configmap.yaml --ignore-not-found=true
fi
# Delete chroma deployment
echo "Deleting chroma deployment..."
envsubst < ./chroma-k8s.yaml.template | kubectl delete -f - --ignore-not-found=true
# Delete postgres deployment
echo "Deleting postgres deployment..."
envsubst < ./postgres-k8s.yaml.template | kubectl delete -f - --ignore-not-found=true
# Delete vllm-safety deployment
# Delete llama-nim deployment
echo "Deleting llama-nim deployment..."
envsubst < ./llama-nim.yaml.template | kubectl delete -f - --ignore-not-found=true
# Delete ollama-safety deployment
echo "Deleting ollama-safety deployment..."
envsubst < ./ollama-safety-k8s.yaml.template | kubectl delete -f - --ignore-not-found=true
# Delete vllm deployment
echo "Deleting vllm deployment..."
envsubst < ./vllm-k8s.yaml.template | kubectl delete -f - --ignore-not-found=true
# Delete the HF token secret if it exists
if [ -n "${HF_TOKEN:-}" ]; then
echo "Deleting HF token secret..."
envsubst < ./set-secret.yaml.template | kubectl delete -f - --ignore-not-found=true
fi
# NGC API key secrets are now part of llama-nim.yaml.template and are deleted with it
# Delete any other template files that might exist
echo "Checking for additional template files..."
for template in ./*.yaml.template; do
if [ -f "$template" ]; then
# Skip templates we've already processed
if [[ "$template" != "./ui-k8s.yaml.template" &&
"$template" != "./monitoring-k8s.yaml.template" &&
"$template" != "./ingress-k8s.yaml.template" &&
"$template" != "./stack-k8s.yaml.template" &&
"$template" != "./chroma-k8s.yaml.template" &&
"$template" != "./postgres-k8s.yaml.template" &&
"$template" != "./llama-nim.yaml.template" &&
"$template" != "./vllm-safety-k8s.yaml.template" &&
"$template" != "./ollama-safety-k8s.yaml.template" &&
"$template" != "./vllm-k8s.yaml.template" &&
"$template" != "./set-secret.yaml.template" &&
"$template" != "./ui-service-k8s.yaml.template" ]]; then
echo "Deleting resources from $template..."
envsubst < "$template" | kubectl delete -f - --ignore-not-found=true
fi
fi
done
echo "All LlamaStack Kubernetes resources have been deleted."
# Delete any PersistentVolumeClaims created by the stack
echo "Deleting PersistentVolumeClaims..."
kubectl delete pvc -l app=llama-stack --ignore-not-found=true
kubectl delete pvc -l app=chroma --ignore-not-found=true
kubectl delete pvc -l app=postgres --ignore-not-found=true
kubectl delete pvc -l app=vllm --ignore-not-found=true
kubectl delete pvc -l app.kubernetes.io/name=ollama-safety --ignore-not-found=true
# Delete any remaining services
echo "Deleting any remaining services..."
kubectl delete service -l app=llama-stack --ignore-not-found=true
kubectl delete service -l app=chroma --ignore-not-found=true
kubectl delete service -l app=postgres --ignore-not-found=true
kubectl delete service -l app=vllm --ignore-not-found=true
kubectl delete service -l app=llama-nim --ignore-not-found=true
kubectl delete service -l app.kubernetes.io/name=ollama-safety --ignore-not-found=true
# Delete any remaining secrets
echo "Deleting any remaining secrets..."
kubectl delete secret hf-secret --ignore-not-found=true
kubectl delete secret ngc-secret --ignore-not-found=true
kubectl delete secret -l app=llama-stack --ignore-not-found=true
# Verify no resources remain
echo "Verifying deletion..."
REMAINING_RESOURCES=$(kubectl get all -l app=llama-stack 2>/dev/null)
if [ -z "$REMAINING_RESOURCES" ]; then
echo "All LlamaStack Kubernetes resources have been successfully deleted."
else
echo "Some LlamaStack resources may still exist. Please check manually with:"
echo "kubectl get all -l app=llama-stack"
fi