Skip to content

Commit e7214e0

Browse files
committed
Set verbosity level for debug logs
In order to be able to filter debug logs from other info logs, we should use verbosity level. Zap used level 1 (-1 actually) for debug.
1 parent 4633f16 commit e7214e0

File tree

5 files changed

+34
-34
lines changed

5 files changed

+34
-34
lines changed

api/v1beta1/octavia_webhook.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var octavialog = logf.Log.WithName("octavia-resource")
4747
// SetupOctaviaDefaults - initialize Octavia spec defaults for use with either internal or external webhooks
4848
func SetupOctaviaDefaults(defaults OctaviaDefaults) {
4949
octaviaDefaults = defaults
50-
octavialog.Info("Octavia defaults initialized", "defaults", defaults)
50+
octavialog.V(1).Info("Octavia defaults initialized", "defaults", defaults)
5151
}
5252

5353
// SetupWebhookWithManager sets up the webhook with the Manager
@@ -63,7 +63,7 @@ var _ webhook.Defaulter = &Octavia{}
6363

6464
// Default implements webhook.Defaulter so a webhook will be registered for the type
6565
func (r *Octavia) Default() {
66-
octavialog.Info("default", "name", r.Name)
66+
octavialog.V(1).Info("default", "name", r.Name)
6767

6868
r.Spec.Default()
6969
}
@@ -99,7 +99,7 @@ var _ webhook.Validator = &Octavia{}
9999

100100
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
101101
func (r *Octavia) ValidateCreate() (admission.Warnings, error) {
102-
octavialog.Info("validate create", "name", r.Name)
102+
octavialog.V(1).Info("validate create", "name", r.Name)
103103

104104
var allErrs field.ErrorList
105105
basePath := field.NewPath("spec")
@@ -142,7 +142,7 @@ func (r *OctaviaSpecCore) ValidateCreate(basePath *field.Path) field.ErrorList {
142142

143143
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
144144
func (r *Octavia) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
145-
octavialog.Info("validate update", "name", r.Name)
145+
octavialog.V(1).Info("validate update", "name", r.Name)
146146

147147
oldOctavia, ok := old.(*Octavia)
148148
if !ok || oldOctavia == nil {

controllers/amphoracontroller_controller.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,32 +186,32 @@ func (r *OctaviaAmphoraControllerReconciler) Reconcile(ctx context.Context, req
186186
func (r *OctaviaAmphoraControllerReconciler) reconcileDelete(ctx context.Context, instance *octaviav1.OctaviaAmphoraController,
187187
helper *helper.Helper) (ctrl.Result, error) {
188188
Log := r.GetLogger(ctx)
189-
Log.Info("Reconciling Service delete")
189+
Log.V(1).Info("Reconciling Service delete")
190190

191191
controllerutil.RemoveFinalizer(instance, helper.GetFinalizer())
192192

193-
Log.Info("Reconciled Service delete successfully")
193+
Log.V(1).Info("Reconciled Service delete successfully")
194194
return ctrl.Result{}, nil
195195
}
196196

197197
func (r *OctaviaAmphoraControllerReconciler) reconcileUpdate(ctx context.Context) (ctrl.Result, error) {
198198
Log := r.GetLogger(ctx)
199-
Log.Info("Reconciling Service update")
200-
Log.Info("Reconciled Service update successfully")
199+
Log.V(1).Info("Reconciling Service update")
200+
Log.V(1).Info("Reconciled Service update successfully")
201201
return ctrl.Result{}, nil
202202
}
203203

204204
func (r *OctaviaAmphoraControllerReconciler) reconcileUpgrade(ctx context.Context) (ctrl.Result, error) {
205205
Log := r.GetLogger(ctx)
206-
Log.Info("Reconciling Service upgrade")
207-
Log.Info("Reconciled Service upgrade successfully")
206+
Log.V(1).Info("Reconciling Service upgrade")
207+
Log.V(1).Info("Reconciled Service upgrade successfully")
208208
return ctrl.Result{}, nil
209209
}
210210

211211
func (r *OctaviaAmphoraControllerReconciler) reconcileNormal(ctx context.Context, instance *octaviav1.OctaviaAmphoraController,
212212
helper *helper.Helper) (ctrl.Result, error) {
213213
Log := r.GetLogger(ctx)
214-
Log.Info("Reconciling Service")
214+
Log.V(1).Info("Reconciling Service")
215215

216216
// Prepare NetworkAttachments first, it must be done before generating the
217217
// configuration as the config uses IP addresses of the attachments.
@@ -305,7 +305,7 @@ func (r *OctaviaAmphoraControllerReconciler) reconcileNormal(ctx context.Context
305305
if err != nil {
306306
return ctrl.Result{}, err
307307
}
308-
r.Log.Info(fmt.Sprintf("Using default flavor \"%s\"", defaultFlavorID))
308+
r.Log.V(1).Info(fmt.Sprintf("Using default flavor \"%s\"", defaultFlavorID))
309309

310310
templateVars := OctaviaTemplateVars{
311311
LbMgmtNetworkID: instance.Spec.LbMgmtNetworkID,
@@ -458,10 +458,11 @@ func (r *OctaviaAmphoraControllerReconciler) reconcileNormal(ctx context.Context
458458
// We reached the end of the Reconcile, update the Ready condition based on
459459
// the sub conditions
460460
if instance.Status.Conditions.AllSubConditionIsTrue() {
461+
Log.Info("Amphora controller is now ready.")
461462
instance.Status.Conditions.MarkTrue(
462463
condition.ReadyCondition, condition.ReadyMessage)
463464
} else {
464-
Log.Info("Not all conditions are ready for Amphora controller")
465+
Log.V(1).Info("Not all conditions are ready for Amphora controller yet")
465466
}
466467
return ctrl.Result{}, nil
467468
}
@@ -474,7 +475,7 @@ func (r *OctaviaAmphoraControllerReconciler) generateServiceConfigMaps(
474475
templateVars OctaviaTemplateVars,
475476
ospSecret *corev1.Secret,
476477
) error {
477-
r.Log.Info(fmt.Sprintf("generating service config map for %s (%s)", instance.Name, instance.Kind))
478+
r.Log.V(1).Info(fmt.Sprintf("generating service config map for %s (%s)", instance.Name, instance.Kind))
478479
cmLabels := labels.GetLabels(instance, labels.GetGroupLabel(instance.ObjectMeta.Name), map[string]string{})
479480
db, err := mariadbv1.GetDatabaseByNameAndAccount(ctx, helper, octavia.DatabaseName, instance.Spec.DatabaseAccount, instance.Namespace)
480481
if err != nil {
@@ -642,8 +643,7 @@ func (r *OctaviaAmphoraControllerReconciler) generateServiceConfigMaps(
642643
return err
643644
}
644645

645-
r.Log.Info("Service config map generated")
646-
646+
r.Log.V(1).Info("Service config map generated")
647647
return nil
648648
}
649649

controllers/octavia_controller.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,35 +429,35 @@ func (r *OctaviaReconciler) reconcileInit(
429429

430430
// run octavia db sync - end
431431

432-
Log.Info("Reconciled Service init successfully")
432+
Log.V(1).Info("Reconciled Service init successfully")
433433
return ctrl.Result{}, nil
434434
}
435435

436436
func (r *OctaviaReconciler) reconcileUpdate(ctx context.Context) (ctrl.Result, error) {
437437
Log := r.GetLogger(ctx)
438-
Log.Info("Reconciling Service update")
438+
Log.V(1).Info("Reconciling Service update")
439439

440440
// TODO: should have minor update tasks if required
441441
// - delete dbsync hash from status to rerun it?
442442

443-
Log.Info("Reconciled Service update successfully")
443+
Log.V(1).Info("Reconciled Service update successfully")
444444
return ctrl.Result{}, nil
445445
}
446446

447447
func (r *OctaviaReconciler) reconcileUpgrade(ctx context.Context) (ctrl.Result, error) {
448448
Log := r.GetLogger(ctx)
449-
Log.Info("Reconciling Service upgrade")
449+
Log.V(1).Info("Reconciling Service upgrade")
450450

451451
// TODO: should have major version upgrade tasks
452452
// -delete dbsync hash from status to rerun it?
453453

454-
Log.Info("Reconciled Service upgrade successfully")
454+
Log.V(1).Info("Reconciled Service upgrade successfully")
455455
return ctrl.Result{}, nil
456456
}
457457

458458
func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octaviav1.Octavia, helper *helper.Helper) (ctrl.Result, error) {
459459
Log := r.GetLogger(ctx)
460-
Log.Info("Reconciling Service")
460+
Log.V(1).Info("Reconciling Service")
461461

462462
// Service account, role, binding
463463
rbacRules := []rbacv1.PolicyRule{

controllers/octaviaapi_controller.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ func (r *OctaviaAPIReconciler) reconcileInit(
361361
serviceLabels map[string]string,
362362
) (ctrl.Result, error) {
363363
Log := r.GetLogger(ctx)
364-
Log.Info("Reconciling Service init")
364+
Log.V(1).Info("Reconciling Service init")
365365
//
366366
// expose the service (create service and return the created endpoint URLs)
367367
//
@@ -526,36 +526,36 @@ func (r *OctaviaAPIReconciler) reconcileInit(
526526
instance.Status.Conditions.Set(c)
527527
}
528528

529-
Log.Info("Reconciled Service init successfully")
529+
Log.V(1).Info("Reconciled Service init successfully")
530530
return ctrlResult, nil
531531
}
532532

533533
func (r *OctaviaAPIReconciler) reconcileUpdate(ctx context.Context) (ctrl.Result, error) {
534534
Log := r.GetLogger(ctx)
535-
Log.Info("Reconciling Service update")
535+
Log.V(1).Info("Reconciling Service update")
536536

537537
// TODO: should have minor update tasks if required
538538
// - delete dbsync hash from status to rerun it?
539539

540-
Log.Info("Reconciled Service update successfully")
540+
Log.V(1).Info("Reconciled Service update successfully")
541541
return ctrl.Result{}, nil
542542
}
543543

544544
func (r *OctaviaAPIReconciler) reconcileUpgrade(ctx context.Context) (ctrl.Result, error) {
545545
Log := r.GetLogger(ctx)
546-
Log.Info("Reconciling Service upgrade")
546+
Log.V(1).Info("Reconciling Service upgrade")
547547

548548
// TODO: should have major version upgrade tasks
549549
// -delete dbsync hash from status to rerun it?
550550

551-
Log.Info("Reconciled Service upgrade successfully")
551+
Log.V(1).Info("Reconciled Service upgrade successfully")
552552
return ctrl.Result{}, nil
553553
}
554554

555555
// TODO(tweining): implement
556556
func (r *OctaviaAPIReconciler) reconcileNormal(ctx context.Context, instance *octaviav1.OctaviaAPI, helper *helper.Helper) (ctrl.Result, error) {
557557
Log := r.GetLogger(ctx)
558-
Log.Info("Reconciling Service")
558+
Log.V(1).Info("Reconciling Service")
559559

560560
// ConfigMap
561561
configMapVars := make(map[string]env.Setter)
@@ -836,7 +836,7 @@ func (r *OctaviaAPIReconciler) reconcileNormal(ctx context.Context, instance *oc
836836
instance.Status.Conditions.MarkTrue(
837837
condition.ReadyCondition, condition.ReadyMessage)
838838
}
839-
Log.Info("Reconciled Service successfully")
839+
Log.V(1).Info("Reconciled Service successfully")
840840
return ctrl.Result{}, nil
841841
}
842842

@@ -849,7 +849,7 @@ func (r *OctaviaAPIReconciler) generateServiceConfigMaps(
849849
envVars *map[string]env.Setter,
850850
) error {
851851
Log := r.GetLogger(ctx)
852-
Log.Info("Generating service config map")
852+
Log.V(1).Info("Generating service config map")
853853
//
854854
// create Configmap/Secret required for octavia input
855855
// - %-scripts configmap holding scripts to e.g. bootstrap the service
@@ -1004,7 +1004,7 @@ func (r *OctaviaAPIReconciler) generateServiceConfigMaps(
10041004
Log.Error(err, "unable to process config map")
10051005
return err
10061006
}
1007-
Log.Info("Service config map generated")
1007+
Log.V(1).Info("Service config map generated")
10081008

10091009
return nil
10101010
}

pkg/octavia/lb_mgmt_network.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,12 +847,12 @@ func EnsureAmphoraManagementNetwork(
847847
return NetworkProvisioningSummary{}, err
848848
}
849849
if router != nil {
850-
log.Info("Router object found, reconciling")
850+
log.V(1).Info("Router object found, reconciling")
851851
router, err = reconcileRouter(client, router, providerNetwork, providerSubnet, networkParameters, log)
852852
if err != nil {
853853
return NetworkProvisioningSummary{}, err
854854
}
855-
log.Info(fmt.Sprintf("Reconciled router %s (%s)", router.Name, router.ID))
855+
log.V(1).Info(fmt.Sprintf("Reconciled router %s (%s)", router.Name, router.ID))
856856
} else {
857857
log.Info("Creating octavia provider router")
858858
enableSNAT := false

0 commit comments

Comments
 (0)