-
Notifications
You must be signed in to change notification settings - Fork 52
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
VLAN alloc with new KO #140
Conversation
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.
Thanks @henderiw . I am on the fence if we really need this with all the changes we made to the base KubeObjectExt. Added a couple of comments.
I think the tests for SetSpec and SetStatus are useful. Even if we decide to do away from this library, I suggest we keep the tests by moving them to the base KubeObjectExt .
vlanv1alpha1 "github.com/nokia/k8s-ipam/apis/alloc/vlan/v1alpha1" | ||
) | ||
|
||
type VLANAllocation struct { |
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.
Is there a need to create this structure? Can the functions developers just directly create the base KubeObjectExt structure? All the methods are used from there anyway.
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.
The value is you get explicit type checking for the object and we need this in several libraries. This is the reason to do this. otherwise people need to implement this in each function independently again and again.
|
||
// NewFromKubeObject creates a new KubeObjectExt | ||
// It expects a *fn.KubeObject as input representing the serialized yaml file | ||
func NewFromKubeObject(o *fn.KubeObject) (*VLANAllocation, error) { |
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.
In the same spirit as above comment, show we just return the base KubeObjectExt from here?
In fact I am also thinking can the function devs directly invoke kubeobject.NewFromKubeObject*vlanv1alpha1.VLANAllocation?
That could mean do we really need this library for indirection?
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.
The value is you get explicit type checking for the object and we need this in several libraries. This is the reason to do this. otherwise people need to implement this in each function independently again and again.
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.
Thanks @henderiw . Approved.
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.
/approve
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gvbalaji, 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 |
import ( | ||
"github.com/GoogleContainerTools/kpt-functions-sdk/go/fn" | ||
"github.com/nephio-project/nephio/krm-functions/lib/kubeobject" | ||
vlanv1alpha1 "github.com/nokia/k8s-ipam/apis/alloc/vlan/v1alpha1" |
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.
curious, will this always be in the nokia repo?
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.
no this is to be merged. But this is the workaround for now. So next week we start bringing this into nephio.
If I understand correctly, the main reason to have this wrapper at all, is the lack of static type checking in the |
/lgtm |
this PR implements the VLAN Allocation library with the new KubeObject aligned with SetSpec/SetStatus