Skip to content

Commit

Permalink
ADded logging to controllers+
Browse files Browse the repository at this point in the history
  • Loading branch information
mariodietnercodit committed Jan 15, 2024
1 parent 758750a commit 1b035d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion operator/controllers/loki/lokistack_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ type LokiStackReconciler struct {
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
func (r *LokiStackReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {

r.Log.Info("Reconciliation for Request: ", "name", req.NamespacedName)
r.Log.Info("Reconciliation for Request: ", "Name", req.Name, "Namespace", req.Namespace)

ok, err := state.IsManaged(ctx, req, r.Client)
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion operator/controllers/loki/rulerconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ type RulerConfigReconciler struct {
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
func (r *RulerConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {

r.Log.Info("Reconciliation for Request: ", "name", req.NamespacedName)
r.Log.Info("Reconciliation for Request: ", "Name", req.Name, "Namespace", req.Namespace)

var rc lokiv1.RulerConfig
key := client.ObjectKey{Name: req.Name, Namespace: req.Namespace}
if err := r.Get(ctx, key, &rc); err != nil {

if errors.IsNotFound(err) {

r.Log.Info("")

// RulerConfig not found, remove annotation from LokiStack.
err = lokistack.RemoveRulerConfigAnnotation(ctx, r.Client, req.Name, req.Namespace)
if err != nil {
Expand Down

0 comments on commit 1b035d3

Please sign in to comment.