Skip to content

Commit

Permalink
update: watches to watchesgvk on two component types
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <wenzhou@redhat.com>
  • Loading branch information
zdtsw committed Nov 20, 2024
1 parent 6fbfc04 commit 70e59a7
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ import (
extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/handler"

componentsv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/deploy"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize"
Expand Down Expand Up @@ -68,9 +70,9 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.
Owns(&admissionregistrationv1.ValidatingWebhookConfiguration{}).
Owns(&templatev1.Template{}).
Owns(&appsv1.Deployment{}, builder.WithPredicates(resources.NewDeploymentPredicate())).
Watches(&componentsv1.ModelMeshServing{}). // watch ModelMeshServing
Watches(&componentsv1.Kserve{}). // watch Kserve
Watches(&extv1.CustomResourceDefinition{}). // call ForLabel() + new predicates
WatchesGVK(gvk.ModelMeshServing, &handler.EnqueueRequestForObject{}). // watch ModelMeshServing type with all default create, update, delete and generic
WatchesGVK(gvk.Kserve, &handler.EnqueueRequestForObject{}). // watch Kserve type with all default create, update, delete and generic
Watches(&extv1.CustomResourceDefinition{}). // call ForLabel() + new predicates
// Add ModelController specific actions
WithAction(initialize).
WithAction(devFlags).
Expand Down

0 comments on commit 70e59a7

Please sign in to comment.