Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RHOAIENG-3845: Remove requeueing from finalizer #224

Merged
Merged
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
5 changes: 2 additions & 3 deletions controllers/trustyaiservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ func (r *TrustyAIServiceReconciler) Reconcile(ctx context.Context, req ctrl.Requ
if containsString(instance.Finalizers, finalizerName) {
// The finalizer is present, so we handle external dependency deletion
if err := r.deleteExternalDependency(req.Name, instance, req.Namespace, ctx); err != nil {
// If fail to delete the external dependency here, return with error
// so that it can be retried
return RequeueWithErrorMessage(ctx, err, "Failed to delete external dependencies.")
// Log the error instead of returning it, so we proceed to remove the finalizer without blocking
log.FromContext(ctx).Error(err, "Failed to delete external dependencies, but proceeding with finalizer removal.")
}

// Remove the finalizer from the list and update it.
Expand Down
26 changes: 23 additions & 3 deletions tests/smoke/test_smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,27 @@ SERVICE_NAME_2="trustyai-service-tls"
kubectl create namespace "$NAMESPACE"
kubectl apply -f "$CRD_PATH" -n "$NAMESPACE"

log_success() {
local message=$1
echo "✅ $message"
}

log_failure() {
local message=$1
echo "❌ $message"
exit 1
}

# Function to check resource existence
check_resource() {
local resource_type=$1
local resource_name=$2
local namespace=$3

if ! kubectl get "$resource_type" -n "$namespace" | grep -q "$resource_name"; then
echo "❌ Failed to find $resource_type: $resource_name in namespace $namespace"
exit 1
log_failure "Failed to find $resource_type: $resource_name in namespace $namespace"
else
echo "✅ $resource_type: $resource_name found in namespace $namespace"
log_success "$resource_type: $resource_name found in namespace $namespace"
fi
}

Expand All @@ -38,4 +48,14 @@ check_resource service "$SERVICE_NAME_2" "$NAMESPACE"
# Check for the PVC creation
check_resource pvc "$PVC_NAME" "$NAMESPACE"

kubectl delete namespace "$NAMESPACE"

sleep 10

if kubectl get namespace "$NAMESPACE" &> /dev/null; then
log_failure "Namespace $NAMESPACE was not deleted successfully"
else
log_success "Namespace $NAMESPACE has been deleted successfully"
fi

echo "All tests passed successfully."
Loading