-
Notifications
You must be signed in to change notification settings - Fork 53
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
interface-fn #69
interface-fn #69
Conversation
@henderiw thanks. I understand this will change once the function runtime library and it's client intarface are finalized and merged. If my understanding is correct, can you please convert this into a draft PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I only have cosmetic comments, This looks good to me even in it current state
// ClusterContextCallbackFn provides a callback for the cluster context | ||
// resources in the resourceList | ||
func (r *itfceFn) ClusterContextCallbackFn(o *fn.KubeObject) error { | ||
clusterKOE, err := kubeobject.NewFromKubeObject[*infrav1alpha1.ClusterContext](o) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is just a reminder for a potential need for change in the future:
As I wrote on Slack we should decide whether to use pointer or struct type parameters of KubeObjectExt.
If the decision will be pointers, than no comment here, otherwise the code here and other places should be aligned to the decision.
if err != nil { | ||
return nil, err | ||
} | ||
//alloc, err := ko.NewFromKubeObject[*vlanv1alpha1.VLANAllocation](vlanalloc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment is not needed any more
/lgtm |
/test presubmit-nephio-go-test |
@kispaljr: The
Use
In response to this:
Instructions 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/test-infra repository. |
/test presubmit-nephio-go-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nested go.mod files bites us again:
I've just realized that presubmit-nephio-go-test doesn't run any tests inside krm-functions/interface-fn
at all.
Actually since the new (not backward compatible) KubeObjectExt API was merged into this branch, this code doesn't compile. This should have been detected by our presubmit tests.
Wim, I've left comments for the quick changes required for the code to compile, otherwise this LGTM
// ClusterContextCallbackFn provides a callback for the cluster context | ||
// resources in the resourceList | ||
func (r *itfceFn) ClusterContextCallbackFn(o *fn.KubeObject) error { | ||
clusterKOE, err := kubeobject.NewFromKubeObject[*infrav1alpha1.ClusterContext](o) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simply change this to NewFromKubeObject[infrav1alpha1.ClusterContext]
(in theory nothing else have to be changed)
// belonging to the parent object | ||
resources := fn.KubeObjects{} | ||
|
||
itfceKOE, err := kubeobject.NewFromKubeObject[*nephioreqv1alpha1.Interface](o) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please loose the pointer from the type parameter: NewFromKubeObject[nephioreqv1alpha1.Interface]
if forObj == nil { | ||
return nil, fmt.Errorf("expected a for object but got nil") | ||
} | ||
itfceKOE, err := kubeobject.NewFromKubeObject[*nephioreqv1alpha1.Interface](forObj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please loose the pointer from the type parameter: NewFromKubeObject[nephioreqv1alpha1.Interface]
ipallocs := objs.Where(fn.IsGroupVersionKind(ipamv1alpha1.IPAllocationGroupVersionKind)) | ||
for _, ipalloc := range ipallocs { | ||
if ipalloc.GetName() == forObj.GetName() { | ||
alloc, err := kubeobject.NewFromKubeObject[*ipamv1alpha1.IPAllocation](ipalloc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please loose the pointer from the type parameter: NewFromKubeObject[ipamv1alpha1.IPAllocation]
} | ||
} | ||
// set the status | ||
err = itfceKOE.SetStatus(itfce.Status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the new API this should be:
itfceKOE.SetStatus(itfce)
Thanks @henderiw . A rebase is needed for this PR. |
@henderiw: The following test failed, say
Full PR test history. Your PR dashboard. Instructions 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/test-infra repository. I understand the commands that are listed here. |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: henderiw The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
interface-fn is a function in Nephio R1 that operates on the interface requirement CR. It performs CRUD operation in the package on the NAD, VLANALlocation and IP Allocation resources.