Skip to content

Commit

Permalink
update a checking logic to find modelMesh enabled namespace
Browse files Browse the repository at this point in the history
Signed-off-by: jooho <jlee@redhat.com>
  • Loading branch information
Jooho authored and ckadner committed Sep 28, 2023
1 parent e6eb949 commit 1598b71
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controllers/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand All @@ -42,7 +43,10 @@ func modelMeshEnabled2(ctx context.Context, namespace, controllerNamespace strin
}
n := &corev1.Namespace{}
if err := client.Get(ctx, types.NamespacedName{Name: namespace}, n); err != nil {
return false, err
if errors.IsNotFound(err) {
// If the namespace has already been deleted, it can not be modelmesh namespace
return false, nil
}
}
return modelMeshEnabled(n, controllerNamespace), nil
}

0 comments on commit 1598b71

Please sign in to comment.