feat: add helm chart

This commit is contained in:
earayu 2025-05-19 19:01:18 +08:00
parent 1429b36495
commit 777fe12bc0
9 changed files with 29 additions and 19 deletions

View File

@ -29,5 +29,5 @@ helm repo update
[ "$ENABLE_MONGODB" = true ] && print "Installing MongoDB addon..." && helm upgrade --install kb-addon-mongodb kubeblocks/mongodb --namespace kb-system --version $ADDON_CLUSTER_CHART_VERSION
[ "$ENABLE_NEO4J" = true ] && print "Installing Neo4j addon..." && helm upgrade --install kb-addon-neo4j kubeblocks/neo4j --namespace kb-system --version $ADDON_CLUSTER_CHART_VERSION
print "KubeBlocks database addons installation completed!"
print_success "KubeBlocks database addons installation completed!"
print "Now you can run 02-install-database.sh to install database clusters"

View File

@ -19,6 +19,6 @@ print "Installing database clusters..."
[ "$ENABLE_MONGODB" = true ] && print "Installing MongoDB cluster..." && helm upgrade --install mongodb-cluster kubeblocks/mongodb-cluster -f "$SCRIPT_DIR/mongodb/values.yaml" --namespace $NAMESPACE --version $ADDON_CLUSTER_CHART_VERSION
[ "$ENABLE_NEO4J" = true ] && print "Installing Neo4j cluster..." && helm upgrade --install neo4j-cluster kubeblocks/neo4j-cluster -f "$SCRIPT_DIR/neo4j/values.yaml" --namespace $NAMESPACE --version $ADDON_CLUSTER_CHART_VERSION
print "Database clusters installation completed!"
print_success "Database clusters installation completed!"
print "Use the following command to check the status of installed clusters:"
print "kubectl get clusters -n $NAMESPACE"

View File

@ -16,5 +16,5 @@ print "Uninstalling database clusters..."
[ "$ENABLE_MONGODB" = true ] && print "Uninstalling MongoDB cluster..." && helm uninstall mongodb-cluster --namespace $NAMESPACE 2>/dev/null || true
[ "$ENABLE_NEO4J" = true ] && print "Uninstalling Neo4j cluster..." && helm uninstall neo4j-cluster --namespace $NAMESPACE 2>/dev/null || true
print "Database clusters uninstalled"
print_success "Database clusters uninstalled"
print "To uninstall database addons and KubeBlocks, run 04-cleanup.sh"

View File

@ -16,11 +16,11 @@ print "Uninstalling KubeBlocks database addons..."
[ "$ENABLE_MONGODB" = true ] && print "Uninstalling MongoDB addon..." && helm uninstall kb-addon-mongodb --namespace kb-system 2>/dev/null || true
[ "$ENABLE_NEO4J" = true ] && print "Uninstalling Neo4j addon..." && helm uninstall kb-addon-neo4j --namespace kb-system 2>/dev/null || true
print "Database addons uninstallation completed!"
print_success "Database addons uninstallation completed!"
source "$SCRIPT_DIR/uninstall-kubeblocks.sh"
kubectl delete namespace $NAMESPACE
kubectl delete namespace kb-system
print "KubeBlocks uninstallation completed!"
print_success "KubeBlocks uninstallation completed!"

View File

@ -23,7 +23,7 @@ install_kubeblocks() {
# Install snapshot controller
helm install snapshot-controller piraeus-charts/snapshot-controller -n kb-system --create-namespace
kubectl wait --for=condition=ready pods -l app=snapshot-controller -n kb-system --timeout=120s
kubectl wait --for=condition=ready pods -l app.kubernetes.io/name=snapshot-controller -n kb-system --timeout=60s
print_success "snapshot-controller installation complete!"
# Install KubeBlocks CRDs
@ -38,7 +38,7 @@ install_kubeblocks() {
# Verify installation
print "Waiting for KubeBlocks to be ready..."
kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=kubeblocks -n kb-system --timeout=300s
kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=kubeblocks -n kb-system --timeout=120s
print_success "KubeBlocks installation complete!"
}

View File

@ -39,5 +39,5 @@ check_dependencies(){
print "Error: Kubernetes cluster is not accessible. Please ensure you have proper access to a Kubernetes cluster."
exit 1
fi
print "Kubernetes cluster is accessible."
print_success "Kubernetes cluster is accessible."
}

View File

@ -15,7 +15,6 @@ if ! kubectl cluster-info &>/dev/null; then
print "Error: Kubernetes cluster is not accessible. Please ensure you have proper access to a Kubernetes cluster."
exit 1
fi
print "Kubernetes cluster is accessible."
print "Checking if KubeBlocks is installed in kb-system namespace..."
if ! kubectl get namespace kb-system &>/dev/null; then

View File

@ -54,7 +54,7 @@ if ! kubectl get clusters -n rag pg-cluster &> /dev/null || ! kubectl get cluste
# Wait for databases to be ready
echo "Waiting for databases to be ready..."
TIMEOUT=600 # Set timeout to 10 minutes
TIMEOUT=300 # Set timeout to 5 minutes
START_TIME=$(date +%s)
while true; do
@ -66,19 +66,32 @@ if ! kubectl get clusters -n rag pg-cluster &> /dev/null || ! kubectl get cluste
exit 1
fi
PG_STATUS=$(kubectl get clusters -n rag pg-cluster -o jsonpath='{.status.phase}' 2>/dev/null)
NEO4J_STATUS=$(kubectl get clusters -n rag neo4j-cluster -o jsonpath='{.status.phase}' 2>/dev/null)
if [ "$PG_STATUS" == "Running" ] && [ "$NEO4J_STATUS" == "Running" ]; then
echo "Databases are ready, continuing with LightRAG deployment..."
# Use kubectl wait to check if both databases are ready
if kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=pg-cluster -n rag --timeout=10s &> /dev/null &&
kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=neo4j-cluster -n rag --timeout=10s &> /dev/null; then
echo "Database pods are ready, continuing with LightRAG deployment..."
break
fi
echo "Databases preparing... PostgreSQL: $PG_STATUS, Neo4J: $NEO4J_STATUS"
echo "Waiting for database pods to be ready..."
sleep 10
done
else
echo "Databases already installed, proceeding directly to LightRAG deployment..."
echo "Databases already installed, checking if database pods are ready..."
# Verify that pods are ready before proceeding
echo "Waiting for database pods to be ready..."
if ! kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=pg-cluster -n rag --timeout=60s; then
echo "PostgreSQL pods are not ready. Please check database status manually."
exit 1
fi
if ! kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=neo4j-cluster -n rag --timeout=60s; then
echo "Neo4j pods are not ready. Please check database status manually."
exit 1
fi
echo "Database pods are ready, proceeding with LightRAG deployment..."
fi
# Get database passwords from Kubernetes secrets

View File

@ -47,8 +47,6 @@ for var in "${required_env_vars[@]}"; do
fi
done
echo "Environment variables check passed"
if ! kubectl get namespace rag &> /dev/null; then
echo "creating namespace 'rag'..."
kubectl create namespace rag