Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions check-rustfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,20 @@ echo " Access RustFS"
echo "========================================="
echo ""

# Check if Console is running locally
if pgrep -f "target/release/operator.*console" >/dev/null; then
echo "✅ Operator Console (local):"
echo " Running at: http://localhost:9090"
# Operator Console (deployed in K8s)
if kubectl get deployment rustfs-operator-console -n rustfs-system >/dev/null 2>&1; then
echo "✅ Operator Console (K8s Deployment):"
echo " Port forward: kubectl port-forward -n rustfs-system svc/rustfs-operator-console 9090:9090"
echo " Then access: http://localhost:9090"
echo " Health check: curl http://localhost:9090/healthz"
echo " API docs: deploy/console/README.md"
echo ""
echo " Create K8s token: kubectl create token default --duration=24h"
echo " Login: POST http://localhost:9090/api/v1/login"
echo ""
else
echo "⚠️ Operator Console not running locally"
echo " Start with: cargo run -- console --port 9090"
echo "⚠️ Operator Console Deployment not found in rustfs-system"
echo " Deploy with: ./deploy-rustfs.sh"
echo ""
fi

Expand Down
95 changes: 2 additions & 93 deletions cleanup-rustfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ confirm_cleanup() {
echo ""
log_warning "This operation will delete all RustFS resources:"
echo " - Tenant: example-tenant"
echo " - Namespace: rustfs-system (including all Pods, PVCs, Services)"
echo " - Namespace: rustfs-system (including Operator, Console, Pods, PVCs, Services)"
echo " - CRD: tenants.rustfs.com"
echo " - Operator process"
echo ""
read -p "Confirm deletion? (yes/no): " confirm

Expand Down Expand Up @@ -87,76 +86,6 @@ delete_tenant() {
fi
}

# Stop Operator
stop_operator() {
log_info "Stopping Operator process..."

# Method 1: Read from PID file
if [ -f operator.pid ]; then
local pid=$(cat operator.pid)
if ps -p $pid > /dev/null 2>&1; then
log_info "Stopping Operator (PID: $pid)..."
kill $pid 2>/dev/null || true
sleep 2

# If process still exists, force kill
if ps -p $pid > /dev/null 2>&1; then
log_warning "Process did not exit normally, forcing termination..."
kill -9 $pid 2>/dev/null || true
fi
fi
rm -f operator.pid
fi

# Method 2: Find all operator processes
local operator_pids=$(pgrep -f "target/release/operator.*server" 2>/dev/null || true)
if [ -n "$operator_pids" ]; then
log_info "Found Operator processes: $operator_pids"
pkill -f "target/release/operator.*server" || true
sleep 2

# Force kill remaining processes
pkill -9 -f "target/release/operator.*server" 2>/dev/null || true
fi

log_success "Operator stopped"
}

# Stop Console
stop_console() {
log_info "Stopping Console process..."

# Method 1: Read from PID file
if [ -f console.pid ]; then
local pid=$(cat console.pid)
if ps -p $pid > /dev/null 2>&1; then
log_info "Stopping Console (PID: $pid)..."
kill $pid 2>/dev/null || true
sleep 2

# If process still exists, force kill
if ps -p $pid > /dev/null 2>&1; then
log_warning "Process did not exit normally, forcing termination..."
kill -9 $pid 2>/dev/null || true
fi
fi
rm -f console.pid
fi

# Method 2: Find all console processes
local console_pids=$(pgrep -f "target/release/operator.*console" 2>/dev/null || true)
if [ -n "$console_pids" ]; then
log_info "Found Console processes: $console_pids"
pkill -f "target/release/operator.*console" || true
sleep 2

# Force kill remaining processes
pkill -9 -f "target/release/operator.*console" 2>/dev/null || true
fi

log_success "Console stopped"
}

# Delete Namespace
delete_namespace() {
log_info "Deleting Namespace: rustfs-system..."
Expand Down Expand Up @@ -223,10 +152,6 @@ cleanup_local_files() {
log_info "Cleaning up local files..."

local files_to_clean=(
"operator.log"
"operator.pid"
"console.log"
"console.pid"
"deploy/rustfs-operator/crds/tenant-crd.yaml"
)

Expand Down Expand Up @@ -271,21 +196,7 @@ verify_cleanup() {
log_success "✓ CRD cleaned"
fi

# Check Operator process
if pgrep -f "target/release/operator.*server" >/dev/null; then
log_error "Operator process still running"
issues=$((issues + 1))
else
log_success "✓ Operator stopped"
fi

# Check Console process
if pgrep -f "target/release/operator.*console" >/dev/null; then
log_error "Console process still running"
issues=$((issues + 1))
else
log_success "✓ Console stopped"
fi
# Operator and Console are deleted with namespace (no local process check)

echo ""
if [ $issues -eq 0 ]; then
Expand Down Expand Up @@ -331,8 +242,6 @@ main() {
echo ""

delete_tenant
stop_console
stop_operator
delete_namespace
delete_crd
cleanup_local_files
Expand Down
Loading