Skip to content

Commit

Permalink
Fix: Invalid if condition in GetScopedMatchingInstances when only…
Browse files Browse the repository at this point in the history
… 1 instance is unready (#1804)

* fix: Invalid if condition

* fix: r.Log is undefined resulting in missing logs

* chore: Remove ResyncPeriodHasElapsed requirement on CommonResource
  • Loading branch information
Baarsgaard authored Dec 30, 2024
1 parent 4633e22 commit 5296824
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion api/v1beta1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ type CommonResource interface {
MatchLabels() *metav1.LabelSelector
MatchNamespace() string
AllowCrossNamespace() bool
ResyncPeriodHasElapsed() bool
}

// The most recent observed state of a Grafana resource
Expand Down
2 changes: 1 addition & 1 deletion controllers/controller_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func GetScopedMatchingInstances(log logr.Logger, ctx context.Context, k8sClient
}
selectedList = append(selectedList, instance)
}
if len(unready_instances) > 1 {
if len(unready_instances) > 0 {
log.Info("Grafana instances not ready", "instances", unready_instances)
}

Expand Down
1 change: 1 addition & 0 deletions controllers/grafana_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type GrafanaReconciler struct {

func (r *GrafanaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
controllerLog := log.FromContext(ctx).WithName("GrafanaReconciler")
r.Log = controllerLog

grafana := &grafanav1beta1.Grafana{}
err := r.Get(ctx, req.NamespacedName, grafana)
Expand Down

0 comments on commit 5296824

Please sign in to comment.