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

Support multiple NIC for machines #254

Merged
merged 1 commit into from
Dec 3, 2022
Merged

Conversation

erkanerol
Copy link
Contributor

@erkanerol erkanerol commented Sep 14, 2022

Description

Fixes #235

Checklist

  • tested locally
  • updated any relevant dependencies
  • updated any relevant documentation or examples

API Changes

Are there API changes?

  • Yes
  • No

If yes, please fill in the below

  1. Updated conversions?
    • Yes
    • No
    • N/A
  2. Updated CRDs?
    • Yes
    • No
    • N/A
  3. Updated infrastructure-components.yaml?
    • Yes
    • No
    • N/A
  4. Updated ./examples/capi-quickstart.yaml?
    • Yes
    • No
    • N/A
  5. Updated necessary files under ./infrastructure-vcd/v1.0.0/?
    • Yes
    • No
    • N/A

Issue

If applicable, please reference the relevant issue

Fixes #


This change is Reviewable

@vmwclabot
Copy link
Member

@erkanerol, you must sign our contributor license agreement before your changes are merged. Click here to sign the agreement. If you are a VMware employee, read this for further instruction.

@erkanerol erkanerol mentioned this pull request Sep 14, 2022
@vmwclabot
Copy link
Member

@erkanerol, we have received your signed contributor license agreement. It will be reviewed by VMware shortly. Another comment will be added to the pull request to notify you when the merge can proceed.

@vmwclabot
Copy link
Member

@erkanerol, VMware has approved your signed contributor license agreement.

@arunmk
Copy link
Collaborator

arunmk commented Sep 19, 2022

@erkanerol in the case that you want to support: is it that different machine deployments will have different sets of NICs?

@bavarianbidi
Copy link

@erkanerol in the case that you want to support: is it that different machine deployments will have different sets of NICs?

@arunmk at the moment we don't have this requirement. If i'm right this requirement might be already fulfilled with this PR as we can create different vcdmachinetemplates (where we define different sets of NICs) and refer to them via machinedeployment.spec.template.spec.infrastructureRef. (Or do i oversee something?)

@erkanerol erkanerol marked this pull request as ready for review October 5, 2022 11:34
@erkanerol
Copy link
Contributor Author

@arunmk As @bavarianbidi says, this PR supports additional network attachments for VCDMachines. For different MachineDeployments, Users can use the same VCDMachineTemplate or different ones. Both scenarios are supported.

Copy link
Collaborator

@arunmk arunmk left a comment

Choose a reason for hiding this comment

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

I have a basic comment that may change the way this is done: should this be done in the machine controller or cluster controller?

If we do it in the cluster controller (since the machines will anyways inherit it from the vApp), we may have a simpler approach.

api/v1beta1/vcdmachine_types.go Show resolved Hide resolved
@@ -510,6 +513,12 @@ func (r *VCDMachineReconciler) reconcileNormal(ctx context.Context, cluster *clu
// VCDResourceSet can get bloated with VMs if the cluster contains a large number of worker nodes
}

desiredNetworks := append([]string{vcdCluster.Spec.OvdcNetwork}, vcdMachine.Spec.AdditionalOvdcNetworks...)
if err = r.reconcileVMNetworks(vdcManager, vApp, vm, desiredNetworks); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have a basic question: If we put the networks into the vApp, all VMs get visibility to it. Can we do this in the vcdcluster controller itself? That can in fact be an input parameter to GetOrCreateVApp. Then we do not need to do the merge etc

@@ -754,6 +764,113 @@ func (r *VCDMachineReconciler) reconcileNormal(ctx context.Context, cluster *clu
return ctrl.Result{}, nil
}

// getPrimaryNetwork returns the primary network based on vm.NetworkConnectionSection.PrimaryNetworkConnectionIndex
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! 👍
@Anirudh9794 we should also use this in the VM network attach flow

return nil
}

// containsTheSameElements checks all elements in the two array are the same regardless of order
Copy link
Collaborator

Choose a reason for hiding this comment

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

The time-complexity can be potentially improved using a small map with the key as the network name. That is a common pattern used and hence will be easier to read. This is not a big deal since the number of networks is small. Only the readability aspect is of interest, but this is also fine.

@erkanerol erkanerol force-pushed the multiple-nic branch 2 times, most recently from ea7936e to b15a2bc Compare October 25, 2022 08:20
@erkanerol
Copy link
Contributor Author

@arunmk I rebased this PR.

Since this PR already implements network attachment to VMS, the changes in previous PR is not necessary anymore: #316

I run make conversion but it didn't change anything in the auto-converted files.

Is there anything you want from my side?

@arunmk
Copy link
Collaborator

arunmk commented Nov 28, 2022

@erkanerol we were waiting to complete the release on 1.0.0 before merging this. Can you please rebase and I will merge this right away.

Sincere apologies for the delay.

@arunmk
Copy link
Collaborator

arunmk commented Dec 2, 2022

@sahithi shall we merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-homed nodes
4 participants