DNM: Bpfman operator APIs review#2521
Conversation
|
Hello @andreaskaris! Some important instructions when contributing to openshift/api: |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Testing out the Claude API review I'm working on Looks like its picked up a few helpful things in there about markers that are not documented in the godocs |
e41b4c9 to
046259e
Compare
|
@JoelSpeed cool I'll address those and I'll ping you once I need that human review (I so far fixed some issues with the Config resource, first), thanks! |
2dca2ef to
7ebee29
Compare
|
@JoelSpeed This is ready for another AI review and/or human review. Changes:
Question: according to https://github.com/openshift/enhancements/blob/master/dev-guide/api-conventions.md#no-functions: So should we remove the methods in the aforementioned files, or are those o.k.? Thanks |
It appears (and I haven't checked the whole diff) that most if not all of your functions are "getters", since getters don't introduce new dependencies, they are fairly innocuous, but they do also form part of your API surface once you have introduced them. Personally, I'd lean on removing them and just fetching the fields directly, but they don't look like they'll necessarily cause issues |
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
Signed-off-by: Andreas Karis <ak.karis@gmail.com>
|
I'm still going through the review progress; meanwhile, some notes: Here's my current prompt for the api-review to Claude, just to make some progress.
My doubts / questions:
|
a3e45d6 to
f1965dd
Compare
|
O.k., I gave up on the Claude /api-review. Instead, I'm running: I fixed all the trivial stuff so far, with the following remaining: |
Signed-off-by: Andreas Karis <ak.karis@gmail.com> next Signed-off-by: Andreas Karis <ak.karis@gmail.com>
f1965dd to
58dc141
Compare
|
Just wanted to give an update that this is on my list of things to take a look at. I'm catching up on things post shift week, so if I don't get around to leaving an initial review by EOD today, it will be top of my list for tomorrow. |
everettraven
left a comment
There was a problem hiding this comment.
I've made it ~halfway through on this pass.
I'll have to circle back around to this one to continue where I've left off.
Most of the comments I've left here seem generally applicable throughout the APIs in this PR - please apply any changes wherever my comments apply.
| // Type will be one of: | ||
| // TC, TCX, UProbe, URetProbe, XDP |
There was a problem hiding this comment.
Nit: Be cautious of formatting like this. It may not render as you expect when users use oc explain or the OpenShift Console to see schema details of the type.
For OpenShift APIs, we generally try to stick to a sentence with the structure:
Allowed values are A, B, and C.
| // +listType=map | ||
| // +listMapKey=type | ||
| // +optional | ||
| // +kubebuilder:validation:MaxItems=1023 |
There was a problem hiding this comment.
You could have up to 1023 unique conditions? That's an awful lot of conditions.
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:MaxLength=253 | ||
| // +optional | ||
| Node string `json:"node,omitempty"` |
There was a problem hiding this comment.
What other constraints exist for a Node name beyond just the length? is there a particular pattern they must conform to?
There was a problem hiding this comment.
A quick google search seems to point to them needing to be RFC 1123 DNS subdomain names: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names
| // appLoadStatus reflects the status of loading the eBPF application on the | ||
| // given node. | ||
| // | ||
| // NotLoaded is a temporary state that is assigned when a | ||
| // ClusterBpfApplicationState is created and the initial reconcile is being | ||
| // processed. | ||
| // | ||
| // LoadSuccess is returned if all the programs have been loaded with no | ||
| // errors. | ||
| // | ||
| // LoadError is returned if one or more programs encountered an error and | ||
| // were not loaded. | ||
| // | ||
| // NotSelected is returned if this application did not select to run on this | ||
| // Kubernetes node. | ||
| // | ||
| // UnloadSuccess is returned when all the programs were successfully | ||
| // unloaded. | ||
| // | ||
| // UnloadError is returned if one or more programs encountered an error when | ||
| // being unloaded. | ||
| // +optional | ||
| AppLoadStatus AppLoadStatus `json:"appLoadStatus,omitempty"` |
There was a problem hiding this comment.
This reads as a Phase-like field that we generally try to avoid.
Any particular reason why this can't be represented as a condition or set of conditions?
| // being unloaded. | ||
| // +optional | ||
| AppLoadStatus AppLoadStatus `json:"appLoadStatus,omitempty"` | ||
| // programs is a list of eBPF programs contained in the parent BpfApplication |
There was a problem hiding this comment.
How do I find out the parent BpfApplication?
| // default, the eBPF program is triggered at the entry of the attachment point, | ||
| // but the attachment point can be adjusted using an optional offset. | ||
| // +optional | ||
| // +kubebuilder:validation:MaxItems=1 |
There was a problem hiding this comment.
Explain the constraint here in the GoDoc please.
| // attachment point function. If not provided, offset defaults to 0. | ||
| // +optional | ||
| // +kubebuilder:default:=0 | ||
| Offset uint64 `json:"offset"` |
There was a problem hiding this comment.
We strongly discourage the use of unsigned integers in APIs because their support is inconsistent across languages and libraries.
Instead, we prefer an explicit int32 or int64 with a minimum validation in place that ensures the value provided will never be negative. int64 field values should be capped at 2^53
| // +kubebuilder:default:={Pipe,DispatcherReturn} | ||
| // +kubebuilder:validation:MaxItems=1023 | ||
| // +listType=atomic | ||
| ProceedOn []TcProceedOnValue `json:"proceedOn,omitempty"` |
There was a problem hiding this comment.
Do you need unique entries here?
| // +required | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:MaxLength=63 | ||
| InterfaceName string `json:"interfaceName,omitempty"` |
There was a problem hiding this comment.
Any naming patterns that can be enforced here?
| // +optional | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:MaxLength=1023 | ||
| NetnsPath string `json:"netnsPath,omitempty"` |
There was a problem hiding this comment.
Any patterns that can be enforced here to ensure a valid path string is provided?
|
/test lint |
|
@andreaskaris: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Review skipped — only excluded labels are configured. (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Apis review for bpfman-operator in preparation for GA.
This is a follow-up to #2221
The second commit adds a new Config CRD (the plan is to squash all commits together eventually but right now for the review for clarity to keep the "old" stuff and the new additions separate)