Skip to content

Commit

Permalink
[ACM-10743] Fix lack of reconciliation of hub's metrics collector on …
Browse files Browse the repository at this point in the history
…update of the MCO OA spec (stolostron#1391)

* endpoint-metrics: listen for changing in the MCO resource

This makes the endpoint-observability-controller reconcile the
metrics-collector in the Hub when the MCO's observabilityAddonSpec is
updated.

Signed-off-by: Douglas Camata <[email protected]>

* Add oav1beta2 to scheme

Signed-off-by: Douglas Camata <[email protected]>

* Fix watch on namespace for cluster level object

Signed-off-by: Douglas Camata <[email protected]>

* Remove empty string from selector

Signed-off-by: Douglas Camata <[email protected]>

* Add some extra logging

Signed-off-by: Douglas Camata <[email protected]>

* Another attempt at fixing selector

Signed-off-by: Douglas Camata <[email protected]>

* Properly watch for MCO resources

Signed-off-by: Douglas Camata <[email protected]>

* Watch and catch only beta2 resources

Signed-off-by: Douglas Camata <[email protected]>

* Remove useless log

Signed-off-by: Douglas Camata <[email protected]>

* Remove old todo

Signed-off-by: Douglas Camata <[email protected]>

---------

Signed-off-by: Douglas Camata <[email protected]>
  • Loading branch information
douglascamata authored Apr 4, 2024
1 parent d0358ee commit e0af149
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ func (r *ObservabilityAddonReconciler) Reconcile(ctx context.Context, req ctrl.R
}
}

// TODO: UPDATE
return ctrl.Result{}, nil
}

Expand Down Expand Up @@ -477,6 +476,10 @@ func (r *ObservabilityAddonReconciler) SetupWithManager(mgr ctrl.Manager) error
&oav1beta1.ObservabilityAddon{},
builder.WithPredicates(getPred(obAddonName, namespace, true, true, true)),
).
Watches(
&source.Kind{Type: &oav1beta2.MultiClusterObservability{}},
&handler.EnqueueRequestForObject{},
).
Watches(
&source.Kind{Type: &corev1.Secret{}},
&handler.EnqueueRequestForObject{},
Expand Down
5 changes: 5 additions & 0 deletions operators/endpointmetrics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/stolostron/multicluster-observability-operator/operators/endpointmetrics/pkg/util"
"github.com/stolostron/multicluster-observability-operator/operators/endpointmetrics/version"
oav1beta1 "github.com/stolostron/multicluster-observability-operator/operators/multiclusterobservability/api/v1beta1"
oav1beta2 "github.com/stolostron/multicluster-observability-operator/operators/multiclusterobservability/api/v1beta2"
operatorconfig "github.com/stolostron/multicluster-observability-operator/operators/pkg/config"
operatorsutil "github.com/stolostron/multicluster-observability-operator/operators/pkg/util"
// +kubebuilder:scaffold:imports
Expand All @@ -47,6 +48,7 @@ var (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(oav1beta1.AddToScheme(scheme))
utilruntime.Must(oav1beta2.AddToScheme(scheme))
utilruntime.Must(ocinfrav1.AddToScheme(scheme))
utilruntime.Must(prometheusv1.AddToScheme(scheme))
utilruntime.Must(hyperv1.AddToScheme(scheme))
Expand Down Expand Up @@ -97,6 +99,9 @@ func main() {
oav1beta1.GroupVersion.WithKind("ObservabilityAddon"): {
{FieldSelector: namespaceSelector},
},
oav1beta2.GroupVersion.WithKind("MultiClusterObservability"): {
{FieldSelector: "metadata.name!=null"},
},
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Expand Down

0 comments on commit e0af149

Please sign in to comment.