-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
controplane getlog func and mariah log update
- Loading branch information
1 parent
ce1e894
commit a164ffa
Showing
3 changed files
with
16 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,9 +90,15 @@ type OpenStackControlPlaneReconciler struct { | |
// | ||
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
|
||
// GetLog returns a logger object with a prefix of "conroller.name" and aditional controller context fields | ||
func GetLog(ctx context.Context) logr.Logger { | ||
return log.FromContext(ctx).WithName("Controllers").WithName("OpenstackControlPlane") | ||
} | ||
|
||
func (r *OpenStackControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error) { | ||
_ = log.FromContext(ctx) | ||
|
||
l := GetLog(ctx) | ||
// Fetch the OpenStackControlPlane instance | ||
instance := &corev1beta1.OpenStackControlPlane{} | ||
err := r.Client.Get(ctx, req.NamespacedName, instance) | ||
|
@@ -101,7 +107,7 @@ func (r *OpenStackControlPlaneReconciler) Reconcile(ctx context.Context, req ctr | |
// Request object not found, could have been deleted after reconcile request. | ||
// Owned objects are automatically garbage collected. | ||
// For additional cleanup logic use finalizers. Return and don't requeue. | ||
r.Log.Info("OpenStackControlPlane instance is not found, probaby deleted. Nothing to do.") | ||
l.Info("OpenStackControlPlane instance is not found, probaby deleted. Nothing to do.") | ||
return ctrl.Result{}, nil | ||
} | ||
// Error reading the object - requeue the request. | ||
|
@@ -117,7 +123,7 @@ func (r *OpenStackControlPlaneReconciler) Reconcile(ctx context.Context, req ctr | |
) | ||
if err != nil { | ||
// helper might be nil, so can't use util.LogErrorForObject since it requires helper as first arg | ||
r.Log.Error(err, fmt.Sprintf("unable to acquire helper for OpenStackControlPlane %s", instance.Name)) | ||
l.Error(err, fmt.Sprintf("unable to acquire helper for OpenStackControlPlane %s", instance.Name)) | ||
return ctrl.Result{}, err | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters