Skip to content

Commit

Permalink
Merge branch 'trustyai-explainability:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ruivieira authored May 16, 2024
2 parents 1cd732a + 114eb66 commit 30dc092
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM registry.access.redhat.com/ubi8/go-toolset:1.19 as builder
FROM registry.access.redhat.com/ubi8/go-toolset:1.20 as builder
ARG TARGETOS
ARG TARGETARCH

Expand All @@ -26,7 +26,7 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o ma

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532
Expand Down
9 changes: 9 additions & 0 deletions config/overlays/odh/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
configMapGenerator:
- env: params.env
behavior: merge
name: config
3 changes: 3 additions & 0 deletions config/overlays/odh/params.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
trustyaiServiceImage=quay.io/trustyai/trustyai-service:v0.13.0
trustyaiOperatorImage=quay.io/trustyai/trustyai-service-operator:v1.19.0
oauthProxyImage=quay.io/openshift/origin-oauth-proxy:4.14.0
5 changes: 5 additions & 0 deletions config/overlays/rhoai/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/trustyai-explainability/trustyai-service-operator

go 1.19
go 1.20

require (
github.com/kserve/kserve v0.11.2
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."

0 comments on commit 30dc092

Please sign in to comment.