Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logs: simplify the bpfman-agent logs #336

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bundle/manifests/bpfman-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ metadata:
capabilities: Basic Install
categories: OpenShift Optional
containerImage: quay.io/bpfman/bpfman-operator:latest
createdAt: "2024-10-21T11:51:40Z"
createdAt: "2024-11-01T20:38:03Z"
features.operators.openshift.io/cnf: "false"
features.operators.openshift.io/cni: "false"
features.operators.openshift.io/csi: "true"
Expand Down Expand Up @@ -1102,7 +1102,7 @@ spec:
- /bpfman-operator
env:
- name: GO_LOG
value: debug
value: info
image: quay.io/bpfman/bpfman-operator:latest
imagePullPolicy: IfNotPresent
livenessProbe:
Expand Down
2 changes: 1 addition & 1 deletion config/bpfman-operator-deployment/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
imagePullPolicy: IfNotPresent
env:
- name: GO_LOG
value: debug
value: info
name: bpfman-operator
securityContext:
allowPrivilegeEscalation: false
Expand Down
20 changes: 9 additions & 11 deletions controllers/bpfman-agent/application-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
)

Expand All @@ -40,8 +39,7 @@
r.finalizer = internal.BpfApplicationControllerFinalizer
r.recType = internal.ApplicationString

ctxLogger := log.FromContext(ctx)
ctxLogger.Info("Reconcile Application: Enter", "ReconcileKey", req)
r.Logger.Info("bpfman-agent enter: application", "Name", req.Name)

// Lookup K8s node object for this bpfman-agent This should always succeed
if err := r.Get(ctx, types.NamespacedName{Namespace: v1.NamespaceAll, Name: r.NodeName}, r.ourNode); err != nil {
Expand Down Expand Up @@ -192,7 +190,7 @@
case bpfmaniov1alpha1.ProgTypeTC:
interfaces, ifErr := getInterfaces(&p.TC.InterfaceSelector, r.ourNode)
if ifErr != nil {
ctxLogger.Error(ifErr, "failed to get interfaces for TC Program",
r.Logger.Error(ifErr, "failed to get interfaces for TC Program",

Check warning on line 193 in controllers/bpfman-agent/application-program.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/application-program.go#L193

Added line #L193 was not covered by tests
"app program name", a.Name, "program index", j)
continue
}
Expand Down Expand Up @@ -220,7 +218,7 @@
case bpfmaniov1alpha1.ProgTypeTCX:
interfaces, ifErr := getInterfaces(&p.TCX.InterfaceSelector, r.ourNode)
if ifErr != nil {
ctxLogger.Error(ifErr, "failed to get interfaces for TCX Program",
r.Logger.Error(ifErr, "failed to get interfaces for TCX Program",

Check warning on line 221 in controllers/bpfman-agent/application-program.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/application-program.go#L221

Added line #L221 was not covered by tests
"app program name", a.Name, "program index", j)
continue
}
Expand Down Expand Up @@ -248,7 +246,7 @@
case bpfmaniov1alpha1.ProgTypeXDP:
interfaces, ifErr := getInterfaces(&p.XDP.InterfaceSelector, r.ourNode)
if ifErr != nil {
ctxLogger.Error(ifErr, "failed to get interfaces for XDP Program",
r.Logger.Error(ifErr, "failed to get interfaces for XDP Program",

Check warning on line 249 in controllers/bpfman-agent/application-program.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/application-program.go#L249

Added line #L249 was not covered by tests
"app program name", a.Name, "program index", j)
continue
}
Expand All @@ -274,12 +272,12 @@
complete, res, err = r.reconcileCommon(ctx, rec, xdpObjects)

default:
ctxLogger.Error(fmt.Errorf("unsupported bpf program type"), "unsupported bpf program type", "ProgType", p.Type)
r.Logger.Error(fmt.Errorf("unsupported bpf program type"), "unsupported bpf program type", "ProgType", p.Type)

Check warning on line 275 in controllers/bpfman-agent/application-program.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/application-program.go#L275

Added line #L275 was not covered by tests
// Skip this program and continue to the next one
continue
}

ctxLogger.V(1).Info("Reconcile Application", "Application", i, "Program", j, "Name", a.Name,
r.Logger.V(1).Info("Reconcile Application", "Application", i, "Program", j, "Name", a.Name,
"type", p.Type, "Complete", complete, "Result", res, "Error", err)

if complete {
Expand All @@ -296,20 +294,20 @@
// find programs that need to be deleted and delete them
opts := []client.ListOption{client.MatchingLabels{internal.BpfProgramOwner: a.Name}}
if err := r.List(ctx, bpfPrograms, opts...); err != nil {
ctxLogger.Error(err, "failed to get freshPrograms for full reconcile")
r.Logger.Error(err, "failed to get freshPrograms for full reconcile")

Check warning on line 297 in controllers/bpfman-agent/application-program.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/application-program.go#L297

Added line #L297 was not covered by tests
return ctrl.Result{}, err
}
for _, bpfProgram := range bpfPrograms.Items {
id := bpfProgram.Labels[internal.AppProgramId]
if _, ok := appProgramMap[id]; !ok {
ctxLogger.Info("Deleting BpfProgram", "AppProgramId", id, "BpfProgram", bpfProgram.Name)
r.Logger.Info("Deleting BpfProgram", "AppProgramId", id, "BpfProgram", bpfProgram.Name)

Check warning on line 303 in controllers/bpfman-agent/application-program.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/application-program.go#L303

Added line #L303 was not covered by tests
bpfDeletedPrograms.Items = append(bpfDeletedPrograms.Items, bpfProgram)
}
}
// Delete BpfPrograms that are no longer needed
res, err = r.unLoadAndDeleteBpfProgramsList(ctx, bpfDeletedPrograms, internal.BpfApplicationControllerFinalizer)
if err != nil {
ctxLogger.Error(err, "failed to delete programs")
r.Logger.Error(err, "failed to delete programs")

Check warning on line 310 in controllers/bpfman-agent/application-program.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/application-program.go#L310

Added line #L310 was not covered by tests
return ctrl.Result{}, err
}
// We've completed reconciling all programs for this application, continue to the next one
Expand Down
74 changes: 37 additions & 37 deletions controllers/bpfman-agent/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@

result, err := r.reconcileProgram(ctx, rec, program, loadedBpfPrograms)
if err != nil {
r.Logger.Error(err, "Reconciling program failed", "Program Name", rec.getName, "ReconcileResult", result.String())
r.Logger.Error(err, "Reconciling program failed", "Name", rec.getName, "ReconcileResult", result.String())

Check warning on line 170 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L170

Added line #L170 was not covered by tests
}

switch result {
Expand Down Expand Up @@ -202,7 +202,7 @@
isBeingDeleted bool,
mapOwnerStatus *MapOwnerParamStatus) (bpfmaniov1alpha1.BpfProgramConditionType, error) {

r.Logger.V(1).Info("enter reconcileBpfmanProgram()", "bpfProgram", bpfProgram.Name, "CurrentProgram", rec.getName())
r.Logger.V(1).Info("enter reconcileBpfmanProgram()", "Name", bpfProgram.Name, "CurrentProgram", rec.getName())

uuid := bpfProgram.UID
noContainersOnNode := noContainersOnNode(bpfProgram)
Expand All @@ -216,7 +216,7 @@
// prog ID should already have been set if program is loaded
id, err := bpfmanagentinternal.GetID(bpfProgram)
if err != nil {
r.Logger.Error(err, "Failed to get bpf program ID")
r.Logger.Error(err, "Failed to get kernel ID for BpfProgram")

Check warning on line 219 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L219

Added line #L219 was not covered by tests
return bpfmaniov1alpha1.BpfProgCondNotLoaded, err
}
switch shouldBeLoaded {
Expand All @@ -229,28 +229,28 @@
}
isSame, reasons := bpfmanagentinternal.DoesProgExist(loadedBpfProgram, loadRequest)
if !isSame {
r.Logger.V(1).Info("bpf program is in wrong state, unloading and reloading", "reason", reasons, "bpfProgram Name", bpfProgram.Name, "bpf program ID", id)
r.Logger.Info("BpfProgram is in wrong state, unloading and reloading", "reason", reasons, "Name", bpfProgram.Name, "Program ID", id)

Check warning on line 232 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L232

Added line #L232 was not covered by tests
if err := bpfmanagentinternal.UnloadBpfmanProgram(ctx, r.BpfmanClient, *id); err != nil {
r.Logger.Error(err, "Failed to unload BPF Program")
r.Logger.Error(err, "Failed to unload eBPF Program")

Check warning on line 234 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L234

Added line #L234 was not covered by tests
return bpfmaniov1alpha1.BpfProgCondNotUnloaded, err
}

r.Logger.Info("Calling bpfman to load bpf program on Node", "bpfProgram Name", bpfProgram.Name)
r.Logger.Info("Calling bpfman to load eBPF Program on Node", "Name", bpfProgram.Name)

Check warning on line 238 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L238

Added line #L238 was not covered by tests
r.progId, err = bpfmanagentinternal.LoadBpfmanProgram(ctx, r.BpfmanClient, loadRequest)
if err != nil {
r.Logger.Error(err, "Failed to load bpf program")
r.Logger.Error(err, "Failed to load eBPF Program")

Check warning on line 241 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L241

Added line #L241 was not covered by tests
return bpfmaniov1alpha1.BpfProgCondNotLoaded, err
}
} else {
// Program exists and bpfProgram K8s Object is up to date
r.Logger.V(1).Info("Program is in correct state. Nothing to do in bpfman")
r.Logger.V(1).Info("BpfProgram is in correct state. Nothing to do in bpfman")
r.progId = id
}
case false:
// The program is loaded but it shouldn't be loaded.
r.Logger.Info("Calling bpfman to unload program on node", "bpfProgram Name", bpfProgram.Name, "Program ID", id)
r.Logger.Info("Calling bpfman to unload eBPF Program on node", "Name", bpfProgram.Name, "Program ID", id)

Check warning on line 251 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L251

Added line #L251 was not covered by tests
if err := bpfmanagentinternal.UnloadBpfmanProgram(ctx, r.BpfmanClient, *id); err != nil {
r.Logger.Error(err, "Failed to unload Program")
r.Logger.Error(err, "Failed to unload eBPF Program")

Check warning on line 253 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L253

Added line #L253 was not covered by tests
return bpfmaniov1alpha1.BpfProgCondNotUnloaded, err
}
}
Expand All @@ -263,10 +263,10 @@
return bpfmaniov1alpha1.BpfProgCondBytecodeSelectorError, err
}

r.Logger.Info("Calling bpfman to load program on node", "bpfProgram name", bpfProgram.Name)
r.Logger.Info("Calling bpfman to load eBPF Program on node", "Name", bpfProgram.Name)
r.progId, err = bpfmanagentinternal.LoadBpfmanProgram(ctx, r.BpfmanClient, loadRequest)
if err != nil {
r.Logger.Error(err, "Failed to load Program")
r.Logger.Error(err, "Failed to load eBPF Program")

Check warning on line 269 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L269

Added line #L269 was not covered by tests
return bpfmaniov1alpha1.BpfProgCondNotLoaded, err
}
case false:
Expand Down Expand Up @@ -454,10 +454,10 @@
func (r *ReconcilerCommon) removeFinalizer(ctx context.Context, o client.Object, finalizer string) bool {
changed := controllerutil.RemoveFinalizer(o, finalizer)
if changed {
r.Logger.Info("Removing finalizer from bpfProgram", "object name", o.GetName())
r.Logger.Info("Calling KubeAPI to remove finalizer from BpfProgram", "object name", o.GetName())

Check warning on line 457 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L457

Added line #L457 was not covered by tests
err := r.Update(ctx, o)
if err != nil {
r.Logger.Error(err, "failed to remove bpfProgram Finalizer")
r.Logger.Error(err, "failed to remove BpfProgram Finalizer")

Check warning on line 460 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L460

Added line #L460 was not covered by tests
return true
}
}
Expand Down Expand Up @@ -496,9 +496,9 @@

meta.SetStatusCondition(&bpfProgram.Status.Conditions, cond.Condition())

r.Logger.V(1).Info("Updating bpfProgram condition", "bpfProgram", bpfProgram.Name, "condition", cond.Condition().Type)
r.Logger.Info("Calling KubeAPI to update BpfProgram condition", "Name", bpfProgram.Name, "condition", cond.Condition().Type)
if err := r.Status().Update(ctx, bpfProgram); err != nil {
r.Logger.Error(err, "failed to set bpfProgram object status")
r.Logger.Error(err, "failed to set BpfProgram object status")

Check warning on line 501 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L501

Added line #L501 was not covered by tests
}

r.Logger.V(1).Info("condition updated", "new condition", cond)
Expand Down Expand Up @@ -589,7 +589,7 @@

// Make the corresponding BpfProgramConfig the owner
if err := ctrl.SetControllerReference(rec.getOwner(), bpfProg, r.Scheme); err != nil {
return nil, fmt.Errorf("failed to bpfProgram object owner reference: %v", err)
return nil, fmt.Errorf("failed to set BpfProgram object owner reference: %v", err)

Check warning on line 592 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L592

Added line #L592 was not covered by tests
}

return bpfProg, nil
Expand Down Expand Up @@ -624,7 +624,7 @@
r.Logger.V(1).Info("handleProgDelete()", "isBeingDeleted", isBeingDeleted, "isNodeSelected",
isNodeSelected, "mapOwnerStatus", mapOwnerStatus)
for _, bpfProgram := range existingBpfPrograms {
r.Logger.V(1).Info("Deleting bpfProgram", "Name", bpfProgram.Name)
r.Logger.V(1).Info("Deleting BpfProgram", "Name", bpfProgram.Name)

Check warning on line 627 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L627

Added line #L627 was not covered by tests
// Reconcile the bpfProgram if error write condition and exit with
// retry.
cond, err := r.reconcileBpfProgram(ctx,
Expand All @@ -637,7 +637,7 @@
)
if err != nil {
r.updateStatus(ctx, &bpfProgram, cond)
return internal.Requeue, fmt.Errorf("failed to delete bpfman program: %v", err)
return internal.Requeue, fmt.Errorf("failed to delete program from bpfman: %v", err)

Check warning on line 640 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L640

Added line #L640 was not covered by tests
}

if r.removeFinalizer(ctx, &bpfProgram, rec.getFinalizer()) {
Expand All @@ -656,9 +656,9 @@
// to changes that caused the containers to not be selected anymore.
// So, explicitly delete them.
opts := client.DeleteOptions{}
r.Logger.Info("Deleting bpfProgram", "Name", bpfProgram.Name, "Owner", bpfProgram.GetName())
r.Logger.Info("Calling KubeAPI to delete BpfProgram", "Name", bpfProgram.Name, "Owner", bpfProgram.GetName())

Check warning on line 659 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L659

Added line #L659 was not covered by tests
if err := r.Delete(ctx, &bpfProgram, &opts); err != nil {
return internal.Requeue, fmt.Errorf("failed to delete bpfProgram object: %v", err)
return internal.Requeue, fmt.Errorf("failed to delete BpfProgram object: %v", err)

Check warning on line 661 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L661

Added line #L661 was not covered by tests
}
return internal.Updated, nil
}
Expand All @@ -674,20 +674,20 @@
// has changed such that the BpfPrograms are no longer needed.
func (r *ReconcilerCommon) unLoadAndDeleteBpfProgramsList(ctx context.Context, bpfProgramsList *bpfmaniov1alpha1.BpfProgramList, finalizerString string) (reconcile.Result, error) {
for _, bpfProgram := range bpfProgramsList.Items {
r.Logger.V(1).Info("Deleting bpfProgram", "Name", bpfProgram.Name)
r.Logger.V(1).Info("Deleting BpfProgram", "Name", bpfProgram.Name)

Check warning on line 677 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L677

Added line #L677 was not covered by tests
id, err := bpfmanagentinternal.GetID(&bpfProgram)
if err != nil {
r.Logger.Error(err, "Failed to get bpf program ID")
r.Logger.Error(err, "Failed to get kernel ID from BpfProgram")

Check warning on line 680 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L680

Added line #L680 was not covered by tests
return ctrl.Result{}, nil
}

if id != nil && !statusContains(&bpfProgram, bpfmaniov1alpha1.BpfProgCondUnloaded) {
r.Logger.Info("Calling bpfman to unload program on node", "bpfProgram Name", bpfProgram.Name, "Program ID", id)
r.Logger.Info("Calling bpfman to unload program on node", "Name", bpfProgram.Name, "Program ID", id)

Check warning on line 685 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L685

Added line #L685 was not covered by tests
if err := bpfmanagentinternal.UnloadBpfmanProgram(ctx, r.BpfmanClient, *id); err != nil {
if strings.Contains(err.Error(), programDoesNotExistErr) {
r.Logger.Info("Program not found on node", "bpfProgram Name", bpfProgram.Name, "Program ID", id)
r.Logger.Info("Program not found on node", "Name", bpfProgram.Name, "Program ID", id)

Check warning on line 688 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L688

Added line #L688 was not covered by tests
} else {
r.Logger.Error(err, "Failed to unload Program")
r.Logger.Error(err, "Failed to unload Program from bpfman")

Check warning on line 690 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L690

Added line #L690 was not covered by tests
return ctrl.Result{RequeueAfter: retryDurationAgent}, nil
}
if r.updateStatus(ctx, &bpfProgram, bpfmaniov1alpha1.BpfProgCondUnloaded) {
Expand All @@ -705,9 +705,9 @@
}

opts := client.DeleteOptions{}
r.Logger.Info("Deleting bpfProgram", "Name", bpfProgram.Name, "Owner", bpfProgram.GetName())
r.Logger.Info("Calling KubeAPI to delete BpfProgram", "Name", bpfProgram.Name, "Owner", bpfProgram.GetName())

Check warning on line 708 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L708

Added line #L708 was not covered by tests
if err := r.Delete(ctx, &bpfProgram, &opts); err != nil {
return ctrl.Result{RequeueAfter: retryDurationAgent}, fmt.Errorf("failed to delete bpfProgram object: %v", err)
return ctrl.Result{RequeueAfter: retryDurationAgent}, fmt.Errorf("failed to delete BpfProgram object: %v", err)

Check warning on line 710 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L710

Added line #L710 was not covered by tests
} else {
// we will deal one program at a time, so we can break out of the loop
break
Expand Down Expand Up @@ -748,9 +748,9 @@
} else {
// Create a new bpfProgram Object for this program.
opts := client.CreateOptions{}
r.Logger.Info("Creating bpfProgram", "Name", expectedBpfProgram.Name, "Owner", rec.getOwner().GetName())
r.Logger.Info("Calling KubeAPI to create BpfProgram", "Name", expectedBpfProgram.Name, "Owner", rec.getOwner().GetName())
if err := r.Create(ctx, &expectedBpfProgram, &opts); err != nil {
return internal.Requeue, fmt.Errorf("failed to create bpfProgram object: %v", err)
return internal.Requeue, fmt.Errorf("failed to create BpfProgram object: %v", err)

Check warning on line 753 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L753

Added line #L753 was not covered by tests
}
return internal.Updated, nil
}
Expand Down Expand Up @@ -792,11 +792,11 @@

// If bpfProgram Maps OR the program ID annotation isn't up to date just update it and return
if !reflect.DeepEqual(existingId, r.progId) {
r.Logger.Info("Updating bpfProgram Object", "Id", r.progId, "bpfProgram", existingBpfProgram.Name)
r.Logger.Info("Calling KubeAPI to update BpfProgram Object", "Id", r.progId, "Name", existingBpfProgram.Name)
// annotations should be populated on create
existingBpfProgram.Annotations[internal.IdAnnotation] = strconv.FormatUint(uint64(*r.progId), 10)
if err := r.Update(ctx, &existingBpfProgram, &client.UpdateOptions{}); err != nil {
return internal.Requeue, fmt.Errorf("failed to update bpfProgram's Programs: %v", err)
return internal.Requeue, fmt.Errorf("failed to update BpfProgram's Programs: %v", err)

Check warning on line 799 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L799

Added line #L799 was not covered by tests
}
return internal.Updated, nil
}
Expand All @@ -813,7 +813,7 @@
return r.handleProgDelete(ctx, rec, existingBpfPrograms, loadedBpfPrograms, isNodeSelected, isBeingDeleted, mapOwnerStatus)
} else {
// We're done reconciling.
r.Logger.Info("Finished reconciling", "program name", rec.getName())
r.Logger.Info("Finished reconciling", "Name", rec.getName())
return internal.Unchanged, nil
}
}
Expand Down Expand Up @@ -846,7 +846,7 @@
// on this node.
existingBpfPrograms, err := r.getExistingBpfPrograms(ctx, rec)
if err != nil {
return internal.Requeue, fmt.Errorf("failed to get existing bpfPrograms: %v", err)
return internal.Requeue, fmt.Errorf("failed to get existing BpfPrograms: %v", err)

Check warning on line 849 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L849

Added line #L849 was not covered by tests
}

// Determine if the MapOwnerSelector was set, and if so, see if the MapOwner
Expand All @@ -872,7 +872,7 @@
// installed in multiple containers because of ContainerSelector).
expectedBpfPrograms, err := rec.getExpectedBpfPrograms(ctx)
if err != nil {
return internal.Requeue, fmt.Errorf("failed to get expected bpfPrograms: %v", err)
return internal.Requeue, fmt.Errorf("failed to get expected BpfPrograms: %v", err)

Check warning on line 875 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L875

Added line #L875 was not covered by tests
}
return r.handleProgCreateOrUpdate(ctx, rec, existingBpfPrograms, expectedBpfPrograms, loadedBpfPrograms,
isNodeSelected, isBeingDeleted, mapOwnerStatus)
Expand Down Expand Up @@ -933,7 +933,7 @@
if len(bpfProgramList.Items) == 0 {
return mapOwnerStatus, nil
} else if len(bpfProgramList.Items) > 1 {
return mapOwnerStatus, fmt.Errorf("MapOwnerSelector resolved to multiple bpfProgram Objects")
return mapOwnerStatus, fmt.Errorf("MapOwnerSelector resolved to multiple BpfProgram Objects")

Check warning on line 936 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L936

Added line #L936 was not covered by tests
} else {
mapOwnerStatus.isFound = true

Expand Down Expand Up @@ -1029,5 +1029,5 @@
}
}

return fmt.Errorf("bpfProgram not found")
return fmt.Errorf("BpfProgram not found")

Check warning on line 1032 in controllers/bpfman-agent/common.go

View check run for this annotation

Codecov / codecov/patch

controllers/bpfman-agent/common.go#L1032

Added line #L1032 was not covered by tests
}
4 changes: 1 addition & 3 deletions controllers/bpfman-agent/fentry-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
)

Expand Down Expand Up @@ -149,8 +148,7 @@ func (r *FentryProgramReconciler) Reconcile(ctx context.Context, req ctrl.Reques
r.ourNode = &v1.Node{}
r.Logger = ctrl.Log.WithName("fentry")

ctxLogger := log.FromContext(ctx)
ctxLogger.Info("Reconcile Fentry: Enter", "ReconcileKey", req)
r.Logger.Info("bpfman-agent enter: fentry", "Name", req.Name)

// Lookup K8s node object for this bpfman-agent This should always succeed
if err := r.Get(ctx, types.NamespacedName{Namespace: v1.NamespaceAll, Name: r.NodeName}, r.ourNode); err != nil {
Expand Down
Loading
Loading