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

SDN-5007: introducing bfpapplication object #6

Merged
merged 16 commits into from
Jun 20, 2024

Conversation

msherif1234
Copy link
Contributor

@msherif1234 msherif1234 commented May 23, 2024

@msherif1234 msherif1234 marked this pull request as draft May 23, 2024 19:57
Copy link

codecov bot commented May 23, 2024

Codecov Report

Attention: Patch coverage is 35.62005% with 488 lines in your changes missing coverage. Please review.

Project coverage is 27.10%. Comparing base (eb369fa) to head (5fc5db8).
Report is 13 commits behind head on main.

Files Patch % Lines
controllers/bpfman-agent/application-program.go 34.82% 143 Missing and 3 partials ⚠️
...nt/clientset/typed/apis/v1alpha1/bpfapplication.go 0.00% 97 Missing ⚠️
apis/v1alpha1/zz_generated.deepcopy.go 48.80% 55 Missing and 9 partials ⚠️
...et/typed/apis/v1alpha1/fake/fake_bpfapplication.go 0.00% 63 Missing ⚠️
...ontrollers/bpfman-operator/application-programs.go 25.92% 38 Missing and 2 partials ⚠️
...t/externalversions/apis/v1alpha1/bpfapplication.go 0.00% 21 Missing ⚠️
pkg/client/apis/v1alpha1/bpfapplication.go 0.00% 16 Missing ⚠️
cmd/bpfman-agent/main.go 0.00% 6 Missing ⚠️
cmd/bpfman-operator/main.go 0.00% 6 Missing ⚠️
controllers/bpfman-agent/uprobe-program.go 70.58% 4 Missing and 1 partial ⚠️
... and 9 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #6      +/-   ##
==========================================
+ Coverage   26.74%   27.10%   +0.35%     
==========================================
  Files          75       81       +6     
  Lines        6146     6837     +691     
==========================================
+ Hits         1644     1853     +209     
- Misses       4337     4800     +463     
- Partials      165      184      +19     
Flag Coverage Δ
unittests 27.10% <35.62%> (+0.35%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anfredette
Copy link
Contributor

In general, I think your bpfapplication CRD looks okay. As I said above, I'm going to have to think about how/whether we could use the existing code some more though.

I added a few random thoughts in comments here.

@msherif1234 msherif1234 force-pushed the app-crd branch 5 times, most recently from 9e603ba to 755e463 Compare June 5, 2024 19:06
Copy link
Contributor

mergify bot commented Jun 5, 2024

@msherif1234, this pull request is now in conflict and requires a rebase.

@anfredette
Copy link
Contributor

Rebased on pr #21.

@msherif1234 msherif1234 changed the title WIP: introducing bfpapplication object WIP: SDN-5007: introducing bfpapplication object Jun 7, 2024
@anfredette anfredette force-pushed the app-crd branch 2 times, most recently from 14b2026 to 6dbcb97 Compare June 7, 2024 17:32
@anfredette
Copy link
Contributor

I fixed some lint errors.

@msherif1234 msherif1234 force-pushed the app-crd branch 2 times, most recently from 0cf6c68 to 051a49f Compare June 10, 2024 00:19
@msherif1234 msherif1234 marked this pull request as ready for review June 10, 2024 00:20
@msherif1234 msherif1234 changed the title WIP: SDN-5007: introducing bfpapplication object SDN-5007: introducing bfpapplication object Jun 10, 2024
@anfredette
Copy link
Contributor

anfredette commented Jun 14, 2024

we may just want to remove the uprobe entry to avoid having to deploy a target

If we change the attach point to the one being used in the uprobe sample, it won't require the target. I was going to make this change at some point.

@msherif1234 msherif1234 force-pushed the app-crd branch 3 times, most recently from bfbeccc to 23f279f Compare June 14, 2024 22:47
Copy link
Contributor

mergify bot commented Jun 18, 2024

@msherif1234, this pull request is now in conflict and requires a rebase.

@mergify mergify bot added the needs-rebase label Jun 18, 2024
msherif1234 and others added 15 commits June 18, 2024 18:59
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
- Ran make generate for latest BpfApplication CRD change
- Handle setting owner and object type
- If reconcile is complete for one program/object, continue with the
  next one
- Added unit test for fentry

TODO:
- Add BpfApplication tests for all program types
- Add sample BpfApplication yaml and test on kubernetes
- See if there's any way to reduce code duplication in application-program.go

Signed-off-by: Andre Fredette <afredette@redhat.com>
Signed-off-by: Andre Fredette <afredette@redhat.com>
Signed-off-by: Andre Fredette <afredette@redhat.com>
- Ran make generate for latest BpfApplication CRD change
- Handle setting owner and object type
- If reconcile is complete for one program/object, continue with the
  next one
- Added unit test for fentry

TODO:
- Add BpfApplication tests for all program types
- Add sample BpfApplication yaml and test on kubernetes
- See if there's any way to reduce code duplication in application-program.go

Signed-off-by: Andre Fredette <afredette@redhat.com>
- Handle setting owner and object type
- If reconcile is complete with one program/object, continue with the
  next one

These changes have not been tested.  Still need to write a unit test

Signed-off-by: Andre Fredette <afredette@redhat.com>
When reconciling a *Program object created by an ApplicationProgram,
getExistingBpfPrograms needs to return just the programs for the given
*Program.  However, the current implementation uses the BpfParentProgram
label, so that gets all the BpfPrograms created for the
ApplicationProgram, which messes up the reconcile logic.

This commit adds another label called BpfParentProgram which allows us
to get just the BpfPrograms for the current *Program regardless of
whether they were created for a single *Program CRD or by a program
entry for an ApplicationProgram CRD.

Signed-off-by: Andre Fredette <afredette@redhat.com>
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
Signed-off-by: Andre Fredette <afredette@redhat.com>
Signed-off-by: Andre Fredette <afredette@redhat.com>
Two changes were needed:
- The BpfPrograms needed the internal.BpfApplicationControllerFinalizer
  instead of the *Program finalizer.
- GetDeletionTimestamp() needs to be called on the Owner.  In this case,
  the owner is the BpfApplication.

Also moved SetupWithManager() in the BpfApplication operator controller
so that it was in the same order as the other controllers.  This made a
diff easier to read.

Signed-off-by: Andre Fredette <afredette@redhat.com>
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
Adds the attach point to the name of the BpfApplication programs so that
BpfPrograms created by multipl programs of the same type are unique.

Also
- Adds some helper functions for name generation
- Fixed an indent issue with the BpfApplication sample yaml

Signed-off-by: Andre Fredette <afredette@redhat.com>
Copy link
Member

@astoycos astoycos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks for all the hard work @anfredette @msherif1234!!

@mergify mergify bot merged commit 4c3fa0b into bpfman:main Jun 20, 2024
12 checks passed
mergify bot added a commit that referenced this pull request Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Streamlining eBPF Programs Management by consolidating CRDs into Application-Specific CRD
4 participants