Skip to content

Commit

Permalink
fix: add odh-modle-controller NWP to whitelist (opendatahub-io#1087)
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw authored Jun 28, 2024
1 parent 97e29c9 commit 70332d8
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,13 @@ var modelMeshRolePredicates = predicate.Funcs{
},
}

// a workaround for modelmesh and kserve both create same odh-model-controller NWP.
var networkpolicyPredicates = predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
return e.ObjectNew.GetName() != "odh-model-controller"
},
}

var modelMeshRBPredicates = predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
notAllowedNames := []string{"leader-election-rolebinding", "proxy-rolebinding", "odh-model-controller-rolebinding-opendatahub"}
Expand Down Expand Up @@ -432,7 +439,7 @@ func (r *DataScienceClusterReconciler) SetupWithManager(ctx context.Context, mgr
Owns(&corev1.Namespace{}).
Owns(&corev1.Secret{}).
Owns(&corev1.ConfigMap{}, builder.WithPredicates(configMapPredicates)).
Owns(&networkingv1.NetworkPolicy{}).
Owns(&networkingv1.NetworkPolicy{}, builder.WithPredicates(networkpolicyPredicates)).
Owns(&rbacv1.Role{}, builder.WithPredicates(predicate.Or(predicate.GenerationChangedPredicate{}, modelMeshRolePredicates))).
Owns(&rbacv1.RoleBinding{}, builder.WithPredicates(predicate.Or(predicate.GenerationChangedPredicate{}, modelMeshRBPredicates))).
Owns(&rbacv1.ClusterRole{}, builder.WithPredicates(predicate.Or(predicate.GenerationChangedPredicate{}, modelMeshRolePredicates))).
Expand Down

0 comments on commit 70332d8

Please sign in to comment.