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

[Multitenancy]: Add NodeInfo crd #2113

Merged
merged 19 commits into from
Aug 11, 2023
Merged

[Multitenancy]: Add NodeInfo crd #2113

merged 19 commits into from
Aug 11, 2023

Conversation

aggarwal0009
Copy link
Contributor

@aggarwal0009 aggarwal0009 commented Aug 9, 2023

Reason for Change:

This CRD is added to enable VNET multitenancy – which will be watched and managed by the control plane.

NodeInfo objects are created by CNS as part of the node registration flow, and is used to pass any metadata from the VM needed by control plane.

Issue Fixed:

Requirements:

Notes:

@aggarwal0009 aggarwal0009 requested a review from a team as a code owner August 9, 2023 15:39
@aggarwal0009 aggarwal0009 requested a review from aegal August 9, 2023 15:39
@rbtr rbtr requested a review from nddq August 9, 2023 16:19
@thatmattlong
Copy link
Contributor

I'm no expert on the rule here (is it like potato: potatoes or like radio: radios?), but this feels like it should be infos:
image

@aggarwal0009
Copy link
Contributor Author

aggarwal0009 commented Aug 9, 2023

I'm no expert on the rule here (is it like potato: potatoes or like radio: radios?), but this feels like it should be infos: image
It was autogen. Need to check how to fix this

Copy link
Contributor

@rbtr rbtr left a comment

Choose a reason for hiding this comment

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

we probably need to copy the embed boilerplate from the nnc/css pkgs also since these are supposed to be installed by the controlplane

@nddq
Copy link
Contributor

nddq commented Aug 9, 2023

Are we going to need a client for this CRD?

@tamilmani1989
Copy link
Member

@aggarwal0009 please make sure you add label to PR that you open in github indicating which component it is

@aggarwal0009
Copy link
Contributor Author

we probably need to copy the embed boilerplate from the nnc/css pkgs also since these are supposed to be installed by the controlplane

Added

@aggarwal0009
Copy link
Contributor Author

Are we going to need a client for this CRD?

I think we will. Added

@aggarwal0009 aggarwal0009 self-assigned this Aug 9, 2023
@aggarwal0009 aggarwal0009 requested a review from a team as a code owner August 9, 2023 23:43
}

// SetOwnerRef sets the controller of the NodeInfo to the given object atomically, using HTTP Patch.
// Deprecated: SetOwnerRef is deprecated, use the more correctly named SetControllerRef.
Copy link
Contributor

Choose a reason for hiding this comment

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

let's not add new funcs that are immediately deprecated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

}

// PatchSpec performs a server-side patch of the passed NodeInfoSpec to the NodeInfo specified by the NamespacedName.
func (c *Client) PatchSpec(ctx context.Context, key types.NamespacedName, spec *v1alpha1.NodeInfoSpec, fieldManager string) (*v1alpha1.NodeInfo, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not necessary as we will not be patching the spec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed


// UpdateSpec does a fetch, deepcopy, and update of the NodeInfo with the passed spec.
// Deprecated: UpdateSpec is deprecated and usage should migrate to PatchSpec.
func (c *Client) UpdateSpec(ctx context.Context, key types.NamespacedName, spec *v1alpha1.NodeInfoSpec) (*v1alpha1.NodeInfo, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not necessary as we will not be updating the spec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

}

// SetControllerRef sets the controller of the NodeInfo to the given object atomically, using HTTP Patch.
func (c *Client) SetControllerRef(ctx context.Context, key types.NamespacedName, owner metav1.Object, fieldManager string) (*v1alpha1.NodeInfo, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably not needed, client can just create the NodeInfo CRD with ownership at time of creation, don't need these funcs which mutate the ownership over time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

return obj, nil
}

func genPatchSkel(key types.NamespacedName) *v1alpha1.NodeInfo {
Copy link
Contributor

Choose a reason for hiding this comment

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

not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

miguelgoms
miguelgoms previously approved these changes Aug 10, 2023
// +kubebuilder:resource:scope=Namespaced
// +kubebuilder:resource:shortName=ni
// +kubebuilder:resource:path=nodeinfo
// +kubebuilder:subresource:status
Copy link
Contributor

Choose a reason for hiding this comment

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

status subresource not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. removed

Copy link
Contributor

@rbtr rbtr left a comment

Choose a reason for hiding this comment

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

nits except for the embed doc.go which is blocking

@aggarwal0009 aggarwal0009 requested a review from rbtr August 10, 2023 21:55
rbtr
rbtr previously approved these changes Aug 10, 2023
Copy link
Contributor

@rbtr rbtr left a comment

Choose a reason for hiding this comment

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

needs CRD regen then lgtm

neaggarwMS
neaggarwMS previously approved these changes Aug 10, 2023
@aggarwal0009 aggarwal0009 force-pushed the ankaggar/NodeInfo-CRD branch from 163c254 to 228cc09 Compare August 10, 2023 23:28
@aggarwal0009 aggarwal0009 dismissed stale reviews from neaggarwMS, rbtr, and miguelgoms via 65464a1 August 11, 2023 00:21
@aggarwal0009
Copy link
Contributor Author

needs CRD regen then lgtm

Fixed

@aggarwal0009 aggarwal0009 merged commit 6a9fddb into master Aug 11, 2023
@aggarwal0009 aggarwal0009 deleted the ankaggar/NodeInfo-CRD branch August 11, 2023 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants