-
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.
This automatically adds additional fields like reconcile_id etc.. from the controller context. uses openstack package level logger GetLog
- Loading branch information
1 parent
015b6a5
commit 97f7532
Showing
21 changed files
with
91 additions
and
56 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 |
---|---|---|
|
@@ -42,14 +42,12 @@ import ( | |
telemetryv1 "github.com/openstack-k8s-operators/telemetry-operator/api/v1beta1" | ||
rabbitmqv1 "github.com/rabbitmq/cluster-operator/api/v1beta1" | ||
|
||
"github.com/go-logr/logr" | ||
k8s_errors "k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/client-go/kubernetes" | ||
ctrl "sigs.k8s.io/controller-runtime" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/log" | ||
|
||
"github.com/go-logr/logr" | ||
k8s_errors "k8s.io/apimachinery/pkg/api/errors" | ||
) | ||
|
||
// OpenStackControlPlaneReconciler reconciles a OpenStackControlPlane object | ||
|
@@ -90,9 +88,10 @@ type OpenStackControlPlaneReconciler struct { | |
// | ||
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
|
||
func (r *OpenStackControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error) { | ||
_ = log.FromContext(ctx) | ||
|
||
l := openstack.GetLog(ctx) | ||
// Fetch the OpenStackControlPlane instance | ||
instance := &corev1beta1.OpenStackControlPlane{} | ||
err := r.Client.Get(ctx, req.NamespacedName, instance) | ||
|
@@ -101,7 +100,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 +116,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
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
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
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
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
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
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
Oops, something went wrong.