@@ -452,7 +452,7 @@ func (r *AutoscalingReconciler) reconcileNormal(
452452 Namespace : instance .Namespace ,
453453 }, prometheusEndpointSecret )
454454 if err != nil {
455- Log .Info ("No Prometheus Endpoint Secret found" )
455+ Log .Info ("Prometheus Endpoint Secret not found" )
456456 }
457457
458458 if instance .Spec .PrometheusHost == "" {
@@ -825,7 +825,7 @@ func (r *AutoscalingReconciler) SetupWithManager(ctx context.Context, mgr ctrl.M
825825 }
826826 return nil
827827 }
828- metricStorageFn := func (_ context.Context , o client.Object ) []reconcile.Request {
828+ prometheusEndpointFn := func (_ context.Context , o client.Object ) []reconcile.Request {
829829 result := []reconcile.Request {}
830830
831831 // get all autoscaling CRs
@@ -840,14 +840,17 @@ func (r *AutoscalingReconciler) SetupWithManager(ctx context.Context, mgr ctrl.M
840840
841841 for _ , cr := range autoscalings .Items {
842842 if cr .Spec .PrometheusHost == "" {
843- // the autoscaling is using MetricStorage for metrics
844- name := client.ObjectKey {
845- Namespace : o .GetNamespace (),
846- Name : cr .Name ,
843+ // the autoscaling is using PrometheusEndpoint secret for metrics
844+ if o .GetName () == autoscaling .PrometheusEndpointSecret {
845+ name := client.ObjectKey {
846+ Namespace : o .GetNamespace (),
847+ Name : cr .Name ,
848+ }
849+ Log .Info (fmt .Sprintf ("Secret %s is used by Autoscaling CR %s" , o .GetName (), cr .Name ))
850+ result = append (result , reconcile.Request {NamespacedName : name })
847851 }
848- Log .Info (fmt .Sprintf ("MetricStorage %s is used by Autoscaling CR %s" , o .GetName (), cr .Name ))
849- result = append (result , reconcile.Request {NamespacedName : name })
850852 }
853+
851854 }
852855 if len (result ) > 0 {
853856 return result
@@ -921,16 +924,12 @@ func (r *AutoscalingReconciler) SetupWithManager(ctx context.Context, mgr ctrl.M
921924 handler .EnqueueRequestsFromMapFunc (transportURLSecretFn )).
922925 Watches (& memcachedv1.Memcached {},
923926 handler .EnqueueRequestsFromMapFunc (memcachedFn )).
924- Watches (
925- & corev1.Secret {},
927+ Watches (& corev1.Secret {},
926928 handler .EnqueueRequestsFromMapFunc (r .findObjectsForSrc ),
927929 builder .WithPredicates (predicate.ResourceVersionChangedPredicate {}),
928930 ).
929- Watches (
930- & telemetryv1.MetricStorage {},
931- handler .EnqueueRequestsFromMapFunc (metricStorageFn ),
932- builder .WithPredicates (predicate.ResourceVersionChangedPredicate {}),
933- ).
931+ Watches (& corev1.Secret {},
932+ handler .EnqueueRequestsFromMapFunc (prometheusEndpointFn )).
934933 Watches (& topologyv1.Topology {},
935934 handler .EnqueueRequestsFromMapFunc (r .findObjectsForSrc ),
936935 builder .WithPredicates (predicate.GenerationChangedPredicate {})).
0 commit comments