earayu commited on
Commit
7f80c6c
·
1 Parent(s): 3da2bd5

feat: add helm chart

Browse files
k8s-deploy/databases/01-prepare.sh CHANGED
@@ -29,5 +29,5 @@ helm repo update
29
  [ "$ENABLE_MONGODB" = true ] && print "Installing MongoDB addon..." && helm upgrade --install kb-addon-mongodb kubeblocks/mongodb --namespace kb-system --version $ADDON_CLUSTER_CHART_VERSION
30
  [ "$ENABLE_NEO4J" = true ] && print "Installing Neo4j addon..." && helm upgrade --install kb-addon-neo4j kubeblocks/neo4j --namespace kb-system --version $ADDON_CLUSTER_CHART_VERSION
31
 
32
- print "KubeBlocks database addons installation completed!"
33
  print "Now you can run 02-install-database.sh to install database clusters"
 
29
  [ "$ENABLE_MONGODB" = true ] && print "Installing MongoDB addon..." && helm upgrade --install kb-addon-mongodb kubeblocks/mongodb --namespace kb-system --version $ADDON_CLUSTER_CHART_VERSION
30
  [ "$ENABLE_NEO4J" = true ] && print "Installing Neo4j addon..." && helm upgrade --install kb-addon-neo4j kubeblocks/neo4j --namespace kb-system --version $ADDON_CLUSTER_CHART_VERSION
31
 
32
+ print_success "KubeBlocks database addons installation completed!"
33
  print "Now you can run 02-install-database.sh to install database clusters"
k8s-deploy/databases/02-install-database.sh CHANGED
@@ -19,6 +19,6 @@ print "Installing database clusters..."
19
  [ "$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
20
  [ "$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
21
 
22
- print "Database clusters installation completed!"
23
  print "Use the following command to check the status of installed clusters:"
24
  print "kubectl get clusters -n $NAMESPACE"
 
19
  [ "$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
20
  [ "$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
21
 
22
+ print_success "Database clusters installation completed!"
23
  print "Use the following command to check the status of installed clusters:"
24
  print "kubectl get clusters -n $NAMESPACE"
k8s-deploy/databases/03-uninstall-database.sh CHANGED
@@ -16,5 +16,5 @@ print "Uninstalling database clusters..."
16
  [ "$ENABLE_MONGODB" = true ] && print "Uninstalling MongoDB cluster..." && helm uninstall mongodb-cluster --namespace $NAMESPACE 2>/dev/null || true
17
  [ "$ENABLE_NEO4J" = true ] && print "Uninstalling Neo4j cluster..." && helm uninstall neo4j-cluster --namespace $NAMESPACE 2>/dev/null || true
18
 
19
- print "Database clusters uninstalled"
20
  print "To uninstall database addons and KubeBlocks, run 04-cleanup.sh"
 
16
  [ "$ENABLE_MONGODB" = true ] && print "Uninstalling MongoDB cluster..." && helm uninstall mongodb-cluster --namespace $NAMESPACE 2>/dev/null || true
17
  [ "$ENABLE_NEO4J" = true ] && print "Uninstalling Neo4j cluster..." && helm uninstall neo4j-cluster --namespace $NAMESPACE 2>/dev/null || true
18
 
19
+ print_success "Database clusters uninstalled"
20
  print "To uninstall database addons and KubeBlocks, run 04-cleanup.sh"
k8s-deploy/databases/04-cleanup.sh CHANGED
@@ -16,11 +16,11 @@ print "Uninstalling KubeBlocks database addons..."
16
  [ "$ENABLE_MONGODB" = true ] && print "Uninstalling MongoDB addon..." && helm uninstall kb-addon-mongodb --namespace kb-system 2>/dev/null || true
17
  [ "$ENABLE_NEO4J" = true ] && print "Uninstalling Neo4j addon..." && helm uninstall kb-addon-neo4j --namespace kb-system 2>/dev/null || true
18
 
19
- print "Database addons uninstallation completed!"
20
 
21
  source "$SCRIPT_DIR/uninstall-kubeblocks.sh"
22
 
23
  kubectl delete namespace $NAMESPACE
24
  kubectl delete namespace kb-system
25
 
26
- print "KubeBlocks uninstallation completed!"
 
16
  [ "$ENABLE_MONGODB" = true ] && print "Uninstalling MongoDB addon..." && helm uninstall kb-addon-mongodb --namespace kb-system 2>/dev/null || true
17
  [ "$ENABLE_NEO4J" = true ] && print "Uninstalling Neo4j addon..." && helm uninstall kb-addon-neo4j --namespace kb-system 2>/dev/null || true
18
 
19
+ print_success "Database addons uninstallation completed!"
20
 
21
  source "$SCRIPT_DIR/uninstall-kubeblocks.sh"
22
 
23
  kubectl delete namespace $NAMESPACE
24
  kubectl delete namespace kb-system
25
 
26
+ print_success "KubeBlocks uninstallation completed!"
k8s-deploy/databases/install-kubeblocks.sh CHANGED
@@ -23,7 +23,7 @@ install_kubeblocks() {
23
 
24
  # Install snapshot controller
25
  helm install snapshot-controller piraeus-charts/snapshot-controller -n kb-system --create-namespace
26
- kubectl wait --for=condition=ready pods -l app=snapshot-controller -n kb-system --timeout=120s
27
  print_success "snapshot-controller installation complete!"
28
 
29
  # Install KubeBlocks CRDs
@@ -38,7 +38,7 @@ install_kubeblocks() {
38
 
39
  # Verify installation
40
  print "Waiting for KubeBlocks to be ready..."
41
- kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=kubeblocks -n kb-system --timeout=300s
42
  print_success "KubeBlocks installation complete!"
43
  }
44
 
 
23
 
24
  # Install snapshot controller
25
  helm install snapshot-controller piraeus-charts/snapshot-controller -n kb-system --create-namespace
26
+ kubectl wait --for=condition=ready pods -l app.kubernetes.io/name=snapshot-controller -n kb-system --timeout=60s
27
  print_success "snapshot-controller installation complete!"
28
 
29
  # Install KubeBlocks CRDs
 
38
 
39
  # Verify installation
40
  print "Waiting for KubeBlocks to be ready..."
41
+ kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=kubeblocks -n kb-system --timeout=120s
42
  print_success "KubeBlocks installation complete!"
43
  }
44
 
k8s-deploy/databases/scripts/common.sh CHANGED
@@ -39,5 +39,5 @@ check_dependencies(){
39
  print "Error: Kubernetes cluster is not accessible. Please ensure you have proper access to a Kubernetes cluster."
40
  exit 1
41
  fi
42
- print "Kubernetes cluster is accessible."
43
  }
 
39
  print "Error: Kubernetes cluster is not accessible. Please ensure you have proper access to a Kubernetes cluster."
40
  exit 1
41
  fi
42
+ print_success "Kubernetes cluster is accessible."
43
  }
k8s-deploy/databases/uninstall-kubeblocks.sh CHANGED
@@ -15,7 +15,6 @@ if ! kubectl cluster-info &>/dev/null; then
15
  print "Error: Kubernetes cluster is not accessible. Please ensure you have proper access to a Kubernetes cluster."
16
  exit 1
17
  fi
18
- print "Kubernetes cluster is accessible."
19
 
20
  print "Checking if KubeBlocks is installed in kb-system namespace..."
21
  if ! kubectl get namespace kb-system &>/dev/null; then
 
15
  print "Error: Kubernetes cluster is not accessible. Please ensure you have proper access to a Kubernetes cluster."
16
  exit 1
17
  fi
 
18
 
19
  print "Checking if KubeBlocks is installed in kb-system namespace..."
20
  if ! kubectl get namespace kb-system &>/dev/null; then
k8s-deploy/install_lightrag.sh CHANGED
@@ -54,7 +54,7 @@ if ! kubectl get clusters -n rag pg-cluster &> /dev/null || ! kubectl get cluste
54
 
55
  # Wait for databases to be ready
56
  echo "Waiting for databases to be ready..."
57
- TIMEOUT=600 # Set timeout to 10 minutes
58
  START_TIME=$(date +%s)
59
 
60
  while true; do
@@ -66,19 +66,32 @@ if ! kubectl get clusters -n rag pg-cluster &> /dev/null || ! kubectl get cluste
66
  exit 1
67
  fi
68
 
69
- PG_STATUS=$(kubectl get clusters -n rag pg-cluster -o jsonpath='{.status.phase}' 2>/dev/null)
70
- NEO4J_STATUS=$(kubectl get clusters -n rag neo4j-cluster -o jsonpath='{.status.phase}' 2>/dev/null)
71
-
72
- if [ "$PG_STATUS" == "Running" ] && [ "$NEO4J_STATUS" == "Running" ]; then
73
- echo "Databases are ready, continuing with LightRAG deployment..."
74
  break
75
  fi
76
 
77
- echo "Databases preparing... PostgreSQL: $PG_STATUS, Neo4J: $NEO4J_STATUS"
78
  sleep 10
79
  done
80
  else
81
- echo "Databases already installed, proceeding directly to LightRAG deployment..."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  fi
83
 
84
  # Get database passwords from Kubernetes secrets
 
54
 
55
  # Wait for databases to be ready
56
  echo "Waiting for databases to be ready..."
57
+ TIMEOUT=300 # Set timeout to 5 minutes
58
  START_TIME=$(date +%s)
59
 
60
  while true; do
 
66
  exit 1
67
  fi
68
 
69
+ # Use kubectl wait to check if both databases are ready
70
+ if kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=pg-cluster -n rag --timeout=10s &> /dev/null &&
71
+ kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=neo4j-cluster -n rag --timeout=10s &> /dev/null; then
72
+ echo "Database pods are ready, continuing with LightRAG deployment..."
 
73
  break
74
  fi
75
 
76
+ echo "Waiting for database pods to be ready..."
77
  sleep 10
78
  done
79
  else
80
+ echo "Databases already installed, checking if database pods are ready..."
81
+
82
+ # Verify that pods are ready before proceeding
83
+ echo "Waiting for database pods to be ready..."
84
+ if ! kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=pg-cluster -n rag --timeout=60s; then
85
+ echo "PostgreSQL pods are not ready. Please check database status manually."
86
+ exit 1
87
+ fi
88
+
89
+ if ! kubectl wait --for=condition=ready pods -l app.kubernetes.io/instance=neo4j-cluster -n rag --timeout=60s; then
90
+ echo "Neo4j pods are not ready. Please check database status manually."
91
+ exit 1
92
+ fi
93
+
94
+ echo "Database pods are ready, proceeding with LightRAG deployment..."
95
  fi
96
 
97
  # Get database passwords from Kubernetes secrets
k8s-deploy/install_lightrag_dev.sh CHANGED
@@ -47,8 +47,6 @@ for var in "${required_env_vars[@]}"; do
47
  fi
48
  done
49
 
50
- echo "Environment variables check passed"
51
-
52
  if ! kubectl get namespace rag &> /dev/null; then
53
  echo "creating namespace 'rag'..."
54
  kubectl create namespace rag
 
47
  fi
48
  done
49
 
 
 
50
  if ! kubectl get namespace rag &> /dev/null; then
51
  echo "creating namespace 'rag'..."
52
  kubectl create namespace rag