Skip to content

Commit

Permalink
fix: disable debug log level for retry messages
Browse files Browse the repository at this point in the history
In the end, it is usefull for customers to be able to know that a
dependency is not met.
  • Loading branch information
eliecharra committed Jun 20, 2024
1 parent 9964082 commit 2cef600
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions internal/controller/context_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (r *ContextReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
space, err := r.SpaceRepository.Get(ctx, types.NamespacedName{Namespace: context.Namespace, Name: *context.Spec.SpaceName})
if err != nil {
if k8sErrors.IsNotFound(err) {
logger.V(logging.Level4).Info("Unable to find space for context, will retry in 10 seconds")
logger.Info("Unable to find space for context, will retry in 10 seconds")
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
}
logger.Error(err, "Error fetching space for context.")
Expand Down Expand Up @@ -116,7 +116,7 @@ func (r *ContextReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
})
if err != nil {
if k8sErrors.IsNotFound(err) {
logger.V(logging.Level4).Info("Unable to find stack for context, will retry in 10 seconds")
logger.Info("Unable to find stack for context, will retry in 10 seconds")
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
}
logger.Error(err, "Error fetching stack for context.")
Expand Down
2 changes: 0 additions & 2 deletions internal/controller/context_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ func (s *ContextControllerTestSuite) TestContextCreation_OK_SpaceNotReady() {
return logs.Len() == 1
}, integration.DefaultTimeout, integration.DefaultInterval)
s.Assert().Equal("test-space", logs.All()[0].ContextMap()[logging.SpaceName])
s.Assert().EqualValues(logging.Level4, -logs.All()[0].Level)

s.Logs.TakeAll()
space, err := s.CreateTestSpace()
Expand Down Expand Up @@ -378,7 +377,6 @@ func (s *ContextControllerTestSuite) TestContextCreation_OK_AttachedStackNotRead
return logs.Len() == 1
}, integration.DefaultTimeout, integration.DefaultInterval)
s.Assert().Equal("test-stack", logs.All()[0].ContextMap()[logging.StackName])
s.Assert().EqualValues(logging.Level4, -logs.All()[0].Level)

s.Logs.TakeAll()
stack, err := s.CreateTestStack()
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/policy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (r *PolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
space, err := r.SpaceRepository.Get(ctx, types.NamespacedName{Namespace: policy.Namespace, Name: *policy.Spec.SpaceName})
if err != nil {
if k8sErrors.IsNotFound(err) {
logger.V(logging.Level4).Info("Unable to find space for policy, will retry in 10 seconds")
logger.Info("Unable to find space for policy, will retry in 10 seconds")
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
}
logger.Error(err, "Error fetching space for policy.")
Expand Down Expand Up @@ -109,7 +109,7 @@ func (r *PolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
stack, err := r.StackRepository.Get(ctx, types.NamespacedName{Namespace: policy.Namespace, Name: stackName})
if err != nil {
if k8sErrors.IsNotFound(err) {
logger.V(logging.Level4).Info("Unable to find attached stack for policy, will retry in 10 seconds")
logger.Info("Unable to find attached stack for policy, will retry in 10 seconds")
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
}
logger.Error(err, "Error fetching stack for policy.")
Expand Down
2 changes: 0 additions & 2 deletions internal/controller/policy_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ func (s *PolicyControllerSuite) TestPolicyCreation_OK_AttachedStackNotReady() {
return logs.Len() == 1
}, integration.DefaultTimeout, integration.DefaultInterval)
s.Assert().Equal("test-stack", logs.All()[0].ContextMap()[logging.StackName])
s.Assert().EqualValues(logging.Level4, -logs.All()[0].Level)

stack, err := s.CreateTestStack()
s.Require().NoError(err)
Expand Down Expand Up @@ -210,7 +209,6 @@ func (s *PolicyControllerSuite) TestPolicyCreation_OK_SpaceNotReady() {
return logs.Len() == 1
}, integration.DefaultTimeout, integration.DefaultInterval)
s.Assert().Equal("test-space", logs.All()[0].ContextMap()[logging.SpaceName])
s.Assert().EqualValues(logging.Level4, -logs.All()[0].Level)

space, err := s.CreateTestSpace()
s.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/run_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (r *RunReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
stack, err := r.StackRepository.Get(ctx, types.NamespacedName{Namespace: run.Namespace, Name: run.Spec.StackName})
if err != nil {
if k8sErrors.IsNotFound(err) {
logger.V(logging.Level4).Info("Unable to find stack for run")
logger.Info("Unable to find stack for run, will retry in 10 seconds")
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
}
logger.Error(err, "Error fetching stack for run.")
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/stack_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (r *StackReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl
space, err := r.SpaceRepository.Get(ctx, types.NamespacedName{Namespace: stack.Namespace, Name: *stack.Spec.SpaceName})
if err != nil {
if k8sErrors.IsNotFound(err) {
logger.V(logging.Level4).Info("Unable to find space for stack")
logger.Info("Unable to find space for stack, will retry in 10 seconds")
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
}
logger.Error(err, "Error fetching space for stack")
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/stack_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (s *StackControllerSuite) TestStackCreation_OK_SpaceNotReady() {

var logs *observer.ObservedLogs
s.Require().Eventually(func() bool {
logs = s.Logs.FilterMessage("Unable to find space for stack")
logs = s.Logs.FilterMessage("Unable to find space for stack, will retry in 10 seconds")
return logs.Len() == 1
}, integration.DefaultTimeout, integration.DefaultInterval)

Expand Down

0 comments on commit 2cef600

Please sign in to comment.