diff --git a/controllers/trustyaiservice_controller.go b/controllers/trustyaiservice_controller.go index cf0ec97f..00600da7 100644 --- a/controllers/trustyaiservice_controller.go +++ b/controllers/trustyaiservice_controller.go @@ -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. diff --git a/tests/smoke/test_smoke.sh b/tests/smoke/test_smoke.sh index 710c5d2b..ed77b145 100755 --- a/tests/smoke/test_smoke.sh +++ b/tests/smoke/test_smoke.sh @@ -15,6 +15,17 @@ 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 @@ -22,10 +33,9 @@ check_resource() { 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 } @@ -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."