Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Coleen Iona Quadros <[email protected]>
  • Loading branch information
coleenquadros committed Aug 26, 2024
1 parent bb8bc17 commit 72a71ba
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,6 @@ func (r *MultiClusterObservabilityReconciler) SetupWithManager(mgr ctrl.Manager)
cmPred := GetConfigMapPredicateFunc()
secretPred := GetAlertManagerSecretPredicateFunc()
namespacePred := GetNamespacePredicateFunc()
imageStreamPred := GetImageStreamPredicateFunc()

ctrBuilder := ctrl.NewControllerManagedBy(mgr).
// Watch for changes to primary resource MultiClusterObservability with predicate
For(&mcov1beta2.MultiClusterObservability{}, builder.WithPredicates(mcoPred)).
Expand All @@ -481,9 +479,6 @@ func (r *MultiClusterObservabilityReconciler) SetupWithManager(mgr ctrl.Manager)
// Watch the namespace for changes
Watches(&corev1.Namespace{}, &handler.EnqueueRequestForObject{},
builder.WithPredicates(namespacePred)).
// Watch the imagestream for changes
Watches(&imagev1.ImageStream{}, &handler.EnqueueRequestForObject{},
builder.WithPredicates(imageStreamPred)).
// Watch the kube-system extension-apiserver-authentication ConfigMap for changes
Watches(&corev1.ConfigMap{}, handler.EnqueueRequestsFromMapFunc(
func(ctx context.Context, a client.Object) []reconcile.Request {
Expand All @@ -498,6 +493,12 @@ func (r *MultiClusterObservabilityReconciler) SetupWithManager(mgr ctrl.Manager)
return nil
}), builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}))

if os.Getenv("IS_KIND_ENV") != "true" {
// Images stream is only available in OpenShift
imageStreamPred := GetImageStreamPredicateFunc()
ctrBuilder = ctrBuilder.Watches(&imagev1.ImageStream{}, &handler.EnqueueRequestForObject{}, builder.WithPredicates(imageStreamPred))
}

mchGroupKind := schema.GroupKind{Group: mchv1.GroupVersion.Group, Kind: "MultiClusterHub"}
if _, err := r.RESTMapper.RESTMapping(mchGroupKind, mchv1.GroupVersion.Version); err == nil {
mchPred := GetMCHPredicateFunc(c)
Expand Down

0 comments on commit 72a71ba

Please sign in to comment.