From 03c3087c96858b67d505d238b0a16622c17de54c Mon Sep 17 00:00:00 2001 From: r Date: Sun, 3 Sep 2023 11:00:17 +0300 Subject: [PATCH] switch to structured logging update logging update logging Structured logging Structured logging --- controllers/amphoracontroller_controller.go | 35 +++++++++----- controllers/octavia_controller.go | 53 +++++++++++++-------- controllers/octaviaapi_controller.go | 48 ++++++++++++------- main.go | 5 +- 4 files changed, 86 insertions(+), 55 deletions(-) diff --git a/controllers/amphoracontroller_controller.go b/controllers/amphoracontroller_controller.go index 699ff541..76792e5d 100644 --- a/controllers/amphoracontroller_controller.go +++ b/controllers/amphoracontroller_controller.go @@ -46,6 +46,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/log" ) // OctaviaAmphoraControllerReconciler reconciles an OctaviaAmmphoraController object @@ -56,6 +57,11 @@ type OctaviaAmphoraControllerReconciler struct { Scheme *runtime.Scheme } +// GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields +func (r *OctaviaAmphoraControllerReconciler) GetLogger(ctx context.Context) logr.Logger { + return log.FromContext(ctx).WithName("Controllers").WithName("OctaviaAmphoraController") +} + //+kubebuilder:rbac:groups=octavia.openstack.org,resources=octaviaamphoracontrollers,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=octavia.openstack.org,resources=octaviaamphoracontrollers/status,verbs=get;update;patch //+kubebuilder:rbac:groups=octavia.openstack.org,resources=octaviaamphoracontrollers/finalizers,verbs=update @@ -65,7 +71,7 @@ type OctaviaAmphoraControllerReconciler struct { // controllers like the octavia housekeeper, worker and health manager // services func (r *OctaviaAmphoraControllerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = r.Log.WithValues("amphoracontroller", req.NamespacedName) + Log := r.GetLogger(ctx) instance := &octaviav1.OctaviaAmphoraController{} err := r.Client.Get(ctx, req.NamespacedName, instance) @@ -110,7 +116,7 @@ func (r *OctaviaAmphoraControllerReconciler) Reconcile(ctx context.Context, req r.Client, r.Kclient, r.Scheme, - r.Log, + Log, ) if err != nil { return ctrl.Result{}, err @@ -124,14 +130,14 @@ func (r *OctaviaAmphoraControllerReconciler) Reconcile(ctx context.Context, req } if err := helper.SetAfter(instance); err != nil { - util.LogErrorForObject(helper, err, "Set after and calc patch/diff", instance) + Log.Error(err, "Set after and calc patch/diff") } if changed := helper.GetChanges()["status"]; changed { patch := client.MergeFrom(helper.GetBeforeObject()) if err := r.Status().Patch(ctx, instance, patch); err != nil && !k8s_errors.IsNotFound(err) { - util.LogErrorForObject(helper, err, "Update status", instance) + Log.Error(err, "Update status") } } }() @@ -147,7 +153,8 @@ func (r *OctaviaAmphoraControllerReconciler) Reconcile(ctx context.Context, req func (r *OctaviaAmphoraControllerReconciler) reconcileDelete(ctx context.Context, instance *octaviav1.OctaviaAmphoraController, helper *helper.Helper) (ctrl.Result, error) { - util.LogForObject(helper, "Reconciling Service delete", instance) + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service delete") controllerutil.RemoveFinalizer(instance, helper.GetFinalizer()) @@ -155,28 +162,30 @@ func (r *OctaviaAmphoraControllerReconciler) reconcileDelete(ctx context.Context return ctrl.Result{}, err } - util.LogForObject(helper, "Reconciled Service delete successfully", instance) + Log.Info("Reconciled Service delete successfully") return ctrl.Result{}, nil } func (r *OctaviaAmphoraControllerReconciler) reconcileUpdate(ctx context.Context, instance *octaviav1.OctaviaAmphoraController, helper *helper.Helper) (ctrl.Result, error) { - util.LogForObject(helper, "Reconciling Service update", instance) - util.LogForObject(helper, "Reconciled Service update successfully", instance) + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service update") + Log.Info("Reconciled Service update successfully") return ctrl.Result{}, nil } func (r *OctaviaAmphoraControllerReconciler) reconcileUpgrade(ctx context.Context, instance *octaviav1.OctaviaAmphoraController, helper *helper.Helper) (ctrl.Result, error) { - util.LogForObject(helper, "Reconciling Service upgrade", instance) - util.LogForObject(helper, "Reconciled Service upgrade successfully", instance) + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service upgrade") + Log.Info("Reconciled Service upgrade successfully") return ctrl.Result{}, nil } func (r *OctaviaAmphoraControllerReconciler) reconcileNormal(ctx context.Context, instance *octaviav1.OctaviaAmphoraController, helper *helper.Helper) (ctrl.Result, error) { - - util.LogForObject(helper, "Reconciling Service", instance) + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service") if !controllerutil.ContainsFinalizer(instance, helper.GetFinalizer()) { // If the service object doesn't have our finalizer, add it. controllerutil.AddFinalizer(instance, helper.GetFinalizer()) @@ -353,7 +362,7 @@ func (r *OctaviaAmphoraControllerReconciler) reconcileNormal(ctx context.Context // create Deployment - end - util.LogForObject(helper, "Reconciled Service successfully", instance) + Log.Info("Reconciled Service successfully") return ctrl.Result{}, nil } diff --git a/controllers/octavia_controller.go b/controllers/octavia_controller.go index 62db03ef..2b513513 100644 --- a/controllers/octavia_controller.go +++ b/controllers/octavia_controller.go @@ -49,16 +49,21 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/log" ) // OctaviaReconciler reconciles an Octavia object type OctaviaReconciler struct { client.Client Kclient kubernetes.Interface - Log logr.Logger Scheme *runtime.Scheme } +// GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields +func (r *OctaviaReconciler) GetLogger(ctx context.Context) logr.Logger { + return log.FromContext(ctx).WithName("Controllers").WithName("Octavia") +} + // +kubebuilder:rbac:groups=octavia.openstack.org,resources=octavias,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=octavia.openstack.org,resources=octavias/status,verbs=get;update;patch // +kubebuilder:rbac:groups=octavia.openstack.org,resources=octavias/finalizers,verbs=update @@ -96,7 +101,7 @@ type OctaviaReconciler struct { // For more details, check Reconcile and its Result here: // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.12.2/pkg/reconcile func (r *OctaviaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error) { - _ = r.Log.WithValues("octavia", req.NamespacedName) + Log := r.GetLogger(ctx) // Fetch the Octavia instance instance := &octaviav1.Octavia{} @@ -117,7 +122,7 @@ func (r *OctaviaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re r.Client, r.Kclient, r.Scheme, - r.Log, + Log, ) if err != nil { return ctrl.Result{}, err @@ -200,6 +205,7 @@ func (r *OctaviaReconciler) SetupWithManager(mgr ctrl.Manager) error { } func (r *OctaviaReconciler) reconcileDelete(ctx context.Context, instance *octaviav1.Octavia, helper *helper.Helper) (ctrl.Result, error) { + Log := r.GetLogger(ctx) util.LogForObject(helper, "Reconciling Service delete", instance) // remove db finalizer first @@ -217,7 +223,7 @@ func (r *OctaviaReconciler) reconcileDelete(ctx context.Context, instance *octav // We did all the cleanup on the objects we created so we can remove the // finalizer from ourselves to allow the deletion controllerutil.RemoveFinalizer(instance, helper.GetFinalizer()) - r.Log.Info(fmt.Sprintf("Reconciled Service '%s' delete successfully", instance.Name)) + Log.Info(fmt.Sprintf("Reconciled Service '%s' delete successfully", instance.Name)) util.LogForObject(helper, "Reconciled Service delete successfully", instance) return ctrl.Result{}, nil @@ -230,7 +236,8 @@ func (r *OctaviaReconciler) reconcileInit( serviceLabels map[string]string, serviceAnnotations map[string]string, ) (ctrl.Result, error) { - r.Log.Info("Reconciling Service init") + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service init") // // create service DB instance @@ -296,7 +303,7 @@ func (r *OctaviaReconciler) reconcileInit( // dbSyncHash := instance.Status.Hash[octaviav1.DbSyncHash] jobDef := octavia.DbSyncJob(instance, serviceLabels, serviceAnnotations) - r.Log.Info("Initializing db sync job") + Log.Info("Initializing db sync job") dbSyncjob := job.NewJob( jobDef, octaviav1.DbSyncHash, @@ -332,33 +339,36 @@ func (r *OctaviaReconciler) reconcileInit( // run octavia db sync - end - r.Log.Info("Reconciled Service init successfully") + Log.Info("Reconciled Service init successfully") return ctrl.Result{}, nil } func (r *OctaviaReconciler) reconcileUpdate(ctx context.Context, instance *octaviav1.Octavia, helper *helper.Helper) (ctrl.Result, error) { - r.Log.Info("Reconciling Service update") + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service update") // TODO: should have minor update tasks if required // - delete dbsync hash from status to rerun it? - r.Log.Info("Reconciled Service update successfully") + Log.Info("Reconciled Service update successfully") return ctrl.Result{}, nil } func (r *OctaviaReconciler) reconcileUpgrade(ctx context.Context, instance *octaviav1.Octavia, helper *helper.Helper) (ctrl.Result, error) { - r.Log.Info("Reconciling Service upgrade") + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service upgrade") // TODO: should have major version upgrade tasks // -delete dbsync hash from status to rerun it? - r.Log.Info("Reconciled Service upgrade successfully") + Log.Info("Reconciled Service upgrade successfully") return ctrl.Result{}, nil } // TODO(tweining): implement func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octaviav1.Octavia, helper *helper.Helper) (ctrl.Result, error) { - r.Log.Info("Reconciling Service") + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service") // Service account, role, binding rbacRules := []rbacv1.PolicyRule{ @@ -395,13 +405,13 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav } if op != controllerutil.OperationResultNone { - r.Log.Info(fmt.Sprintf("TransportURL %s successfully reconciled - operation: %s", transportURL.Name, string(op))) + Log.Info(fmt.Sprintf("TransportURL %s successfully reconciled - operation: %s", transportURL.Name, string(op))) } instance.Status.TransportURLSecret = transportURL.Status.SecretName if instance.Status.TransportURLSecret == "" { - r.Log.Info(fmt.Sprintf("Waiting for the TransportURL %s secret to be created", transportURL.Name)) + Log.Info(fmt.Sprintf("Waiting for the TransportURL %s secret to be created", transportURL.Name)) instance.Status.Conditions.Set(condition.FalseCondition( condition.InputReadyCondition, condition.RequestedReason, @@ -550,7 +560,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav return ctrlResult, nil } - r.Log.Info(fmt.Sprintf("Calling for deploy for API with %s", instance.Status.DatabaseHostname)) + Log.Info(fmt.Sprintf("Calling for deploy for API with %s", instance.Status.DatabaseHostname)) // TODO(beagles): look into adding condition types/messages in a common file octaviaAPI, op, err := r.apiDeploymentCreateOrUpdate(instance) @@ -564,7 +574,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav return ctrl.Result{}, err } if op != controllerutil.OperationResultNone { - r.Log.Info(fmt.Sprintf("Deployment %s successfully reconciled - operation: %s", instance.Name, string(op))) + Log.Info(fmt.Sprintf("Deployment %s successfully reconciled - operation: %s", instance.Name, string(op))) } // Mirror OctaviaAPI status' ReadyCount to this parent CR @@ -590,7 +600,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav } if op != controllerutil.OperationResultNone { - r.Log.Info(fmt.Sprintf("Deployment of OctaviaHousekeeping for %s successfully reconciled - operation: %s", instance.Name, string(op))) + Log.Info(fmt.Sprintf("Deployment of OctaviaHousekeeping for %s successfully reconciled - operation: %s", instance.Name, string(op))) } instance.Status.OctaviaHousekeepingReadyCount = octaviaHousekeeping.Status.ReadyCount @@ -613,7 +623,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav } if op != controllerutil.OperationResultNone { - r.Log.Info(fmt.Sprintf("Deployment of OctaviaHealthManager for %s successfully reconciled - operation: %s", instance.Name, string(op))) + Log.Info(fmt.Sprintf("Deployment of OctaviaHealthManager for %s successfully reconciled - operation: %s", instance.Name, string(op))) } instance.Status.OctaviaHealthManagerReadyCount = octaviaHealthManager.Status.ReadyCount @@ -636,7 +646,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav } if op != controllerutil.OperationResultNone { - r.Log.Info(fmt.Sprintf("Deployment of OctaviaWorker for %s successfully reconciled - operation: %s", instance.Name, string(op))) + Log.Info(fmt.Sprintf("Deployment of OctaviaWorker for %s successfully reconciled - operation: %s", instance.Name, string(op))) } instance.Status.OctaviaWorkerReadyCount = octaviaWorker.Status.ReadyCount @@ -649,7 +659,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav // create Deployment - end - r.Log.Info("Reconciled Service successfully") + Log.Info("Reconciled Service successfully") return ctrl.Result{}, nil } @@ -720,6 +730,7 @@ func (r *OctaviaReconciler) createHashOfInputHashes( instance *octaviav1.Octavia, envVars map[string]env.Setter, ) (string, bool, error) { + Log := r.GetLogger(ctx) var hashMap map[string]string changed := false mergedMapVars := env.MergeEnvs([]corev1.EnvVar{}, envVars) @@ -729,7 +740,7 @@ func (r *OctaviaReconciler) createHashOfInputHashes( } if hashMap, changed = util.SetHash(instance.Status.Hash, common.InputHashName, hash); changed { instance.Status.Hash = hashMap - r.Log.Info(fmt.Sprintf("Input maps hash %s - %s", common.InputHashName, hash)) + Log.Info(fmt.Sprintf("Input maps hash %s - %s", common.InputHashName, hash)) } return hash, changed, nil } diff --git a/controllers/octaviaapi_controller.go b/controllers/octaviaapi_controller.go index 109594f9..090f0dfa 100644 --- a/controllers/octaviaapi_controller.go +++ b/controllers/octaviaapi_controller.go @@ -51,6 +51,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/source" ) @@ -58,10 +59,14 @@ import ( type OctaviaAPIReconciler struct { client.Client Kclient kubernetes.Interface - Log logr.Logger Scheme *runtime.Scheme } +// GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields +func (r *OctaviaAPIReconciler) GetLogger(ctx context.Context) logr.Logger { + return log.FromContext(ctx).WithName("Controllers").WithName("OctaviaAPI") +} + // +kubebuilder:rbac:groups=octavia.openstack.org,resources=octaviaapis,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=octavia.openstack.org,resources=octaviaapis/status,verbs=get;update;patch // +kubebuilder:rbac:groups=octavia.openstack.org,resources=octaviaapis/finalizers,verbs=update @@ -90,7 +95,7 @@ type OctaviaAPIReconciler struct { // For more details, check Reconcile and its Result here: // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.12.2/pkg/reconcile func (r *OctaviaAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error) { - _ = r.Log.WithValues("octaviaapi", req.NamespacedName) + Log := r.GetLogger(ctx) // Fetch the OctaviaAPI instance instance := &octaviav1.OctaviaAPI{} @@ -111,7 +116,7 @@ func (r *OctaviaAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request) r.Client, r.Kclient, r.Scheme, - r.Log, + Log, ) if err != nil { return ctrl.Result{}, err @@ -172,7 +177,7 @@ func (r *OctaviaAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request) } // SetupWithManager sets up the controller with the Manager. -func (r *OctaviaAPIReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *OctaviaAPIReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error { crs := &octaviav1.OctaviaAPIList{} return ctrl.NewControllerManagedBy(mgr). For(&octaviav1.OctaviaAPI{}). @@ -183,11 +188,12 @@ func (r *OctaviaAPIReconciler) SetupWithManager(mgr ctrl.Manager) error { Owns(&corev1.Secret{}). Owns(&corev1.ConfigMap{}). Owns(&appsv1.Deployment{}). - Watches(&source.Kind{Type: &ovnclient.OVNDBCluster{}}, handler.EnqueueRequestsFromMapFunc(ovnclient.OVNDBClusterNamespaceMapFunc(crs, mgr.GetClient(), r.Log))). + Watches(&source.Kind{Type: &ovnclient.OVNDBCluster{}}, handler.EnqueueRequestsFromMapFunc(ovnclient.OVNDBClusterNamespaceMapFunc(crs, mgr.GetClient(), r.GetLogger(ctx)))). Complete(r) } func (r *OctaviaAPIReconciler) reconcileDelete(ctx context.Context, instance *octaviav1.OctaviaAPI, helper *helper.Helper) (ctrl.Result, error) { + Log := r.GetLogger(ctx) util.LogForObject(helper, "Reconciling Service delete", instance) // Remove the finalizer from our KeystoneEndpoint CR @@ -225,7 +231,7 @@ func (r *OctaviaAPIReconciler) reconcileDelete(ctx context.Context, instance *oc // We did all the cleanup on the objects we created so we can remove the // finalizer from ourselves to allow the deletion controllerutil.RemoveFinalizer(instance, helper.GetFinalizer()) - r.Log.Info(fmt.Sprintf("Reconciled Service '%s' delete successfully", instance.Name)) + Log.Info(fmt.Sprintf("Reconciled Service '%s' delete successfully", instance.Name)) util.LogForObject(helper, "Reconciled Service delete successfully", instance) return ctrl.Result{}, nil @@ -237,7 +243,8 @@ func (r *OctaviaAPIReconciler) reconcileInit( helper *helper.Helper, serviceLabels map[string]string, ) (ctrl.Result, error) { - r.Log.Info("Reconciling Service init") + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service init") // // expose the service (create service and return the created endpoint URLs) // @@ -398,33 +405,36 @@ func (r *OctaviaAPIReconciler) reconcileInit( instance.Status.Conditions.Set(c) } - r.Log.Info("Reconciled Service init successfully") + Log.Info("Reconciled Service init successfully") return ctrlResult, nil } func (r *OctaviaAPIReconciler) reconcileUpdate(ctx context.Context, instance *octaviav1.OctaviaAPI, helper *helper.Helper) (ctrl.Result, error) { - r.Log.Info("Reconciling Service update") + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service update") // TODO: should have minor update tasks if required // - delete dbsync hash from status to rerun it? - r.Log.Info("Reconciled Service update successfully") + Log.Info("Reconciled Service update successfully") return ctrl.Result{}, nil } func (r *OctaviaAPIReconciler) reconcileUpgrade(ctx context.Context, instance *octaviav1.OctaviaAPI, helper *helper.Helper) (ctrl.Result, error) { - r.Log.Info("Reconciling Service upgrade") + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service upgrade") // TODO: should have major version upgrade tasks // -delete dbsync hash from status to rerun it? - r.Log.Info("Reconciled Service upgrade successfully") + Log.Info("Reconciled Service upgrade successfully") return ctrl.Result{}, nil } // TODO(tweining): implement func (r *OctaviaAPIReconciler) reconcileNormal(ctx context.Context, instance *octaviav1.OctaviaAPI, helper *helper.Helper) (ctrl.Result, error) { - r.Log.Info("Reconciling Service") + Log := r.GetLogger(ctx) + Log.Info("Reconciling Service") // ConfigMap configMapVars := make(map[string]env.Setter) @@ -640,7 +650,7 @@ func (r *OctaviaAPIReconciler) reconcileNormal(ctx context.Context, instance *oc } // create Deployment - end - r.Log.Info("Reconciled Service successfully") + Log.Info("Reconciled Service successfully") return ctrl.Result{}, nil } @@ -652,7 +662,8 @@ func (r *OctaviaAPIReconciler) generateServiceConfigMaps( h *helper.Helper, envVars *map[string]env.Setter, ) error { - r.Log.Info("Generating service config map") + Log := r.GetLogger(ctx) + Log.Info("Generating service config map") // // create Configmap/Secret required for octavia input // - %-scripts configmap holding scripts to e.g. bootstrap the service @@ -730,10 +741,10 @@ func (r *OctaviaAPIReconciler) generateServiceConfigMaps( err = configmap.EnsureConfigMaps(ctx, h, instance, cms, envVars) if err != nil { - r.Log.Error(err, "unable to process config map") + Log.Error(err, "unable to process config map") return err } - r.Log.Info("Service config map generated") + Log.Info("Service config map generated") return nil } @@ -747,6 +758,7 @@ func (r *OctaviaAPIReconciler) createHashOfInputHashes( instance *octaviav1.OctaviaAPI, envVars map[string]env.Setter, ) (string, bool, error) { + Log := r.GetLogger(ctx) var hashMap map[string]string changed := false mergedMapVars := env.MergeEnvs([]corev1.EnvVar{}, envVars) @@ -756,7 +768,7 @@ func (r *OctaviaAPIReconciler) createHashOfInputHashes( } if hashMap, changed = util.SetHash(instance.Status.Hash, common.InputHashName, hash); changed { instance.Status.Hash = hashMap - r.Log.Info(fmt.Sprintf("Input maps hash %s - %s", common.InputHashName, hash)) + Log.Info(fmt.Sprintf("Input maps hash %s - %s", common.InputHashName, hash)) } return hash, changed, nil } diff --git a/main.go b/main.go index f5adbd51..8f8f4900 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,7 @@ limitations under the License. package main import ( + "context" "crypto/tls" "flag" "os" @@ -139,8 +140,7 @@ func main() { Client: mgr.GetClient(), Scheme: mgr.GetScheme(), Kclient: kclient, - Log: ctrl.Log.WithName("controllers").WithName("OctaviaAPI"), - }).SetupWithManager(mgr); err != nil { + }).SetupWithManager(context.Background(), mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "OctaviaAPI") os.Exit(1) } @@ -149,7 +149,6 @@ func main() { Client: mgr.GetClient(), Scheme: mgr.GetScheme(), Kclient: kclient, - Log: ctrl.Log.WithName("controllers").WithName("Octavia"), }).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "Octavia") os.Exit(1)