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 updating VM networks and changing cluster network migration of vlanconfigs #67

Merged
merged 4 commits into from
Feb 14, 2023

Conversation

yaocw2020
Copy link
Contributor

Related issue: harvester/harvester#3372
Solution:

  • Add a mutating webhook to record the outdated cluster network and VLAN id by network.harvesterhci.io/last-clusternetwork and network.harvesterhci.io/last-vlan-id. Then controllers are able to know the outdated VLAN id and cluster network to do the cleanup process including deleting the related bridge configuration and route job.
  • All related running VMs need to be stopped before updating VM networks and vlanconfigs. The validating webhook is responsible for the VM checking.
  • Indicate the ready status of VM networks by the label network.harvesterhci.io/ready. Once the cluster network is unready(no vlanconfig in effect) , the nad under the cluster network will be unready and can't be used by running VMs.

Copy link
Member

@w13915984028 w13915984028 left a comment

Choose a reason for hiding this comment

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

Few questions, please double check, thanks.

Copy link
Member

@w13915984028 w13915984028 left a comment

Choose a reason for hiding this comment

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

another question, thanks.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@yaocw2020 yaocw2020 force-pushed the updateVcNad branch 2 times, most recently from aacd6ba to feaef8b Compare February 9, 2023 12:16
@guangbochen guangbochen requested a review from chrisho February 10, 2023 01:48
@yaocw2020 yaocw2020 force-pushed the updateVcNad branch 2 times, most recently from 29fd5cf to 169baea Compare February 10, 2023 02:55
Copy link
Contributor

@chrisho chrisho left a comment

Choose a reason for hiding this comment

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

LGTM and have verified the updated VM network and VlanConfig migration.

apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  creationTimestamp: "2023-02-10T07:13:09Z"
  finalizers:
  - wrangler.cattle.io/harvester-network-nad-controller
  - wrangler.cattle.io/harvester-network-manager-nad-controller
  generation: 2
  labels:
    network.harvesterhci.io/clusternetwork: enp7s0
    network.harvesterhci.io/last-type: L2VlanNetwork
    network.harvesterhci.io/last-vlan-id: "1"
    network.harvesterhci.io/ready: "true"
    network.harvesterhci.io/type: UntaggedNetwork
  name: vlan1
  namespace: default
  resourceVersion: "1506062"
  uid: e24a0755-c5d9-47f2-bb6c-5ad16fc82fc5
spec:
  config: '{"cniVersion":"0.3.1","name":"vlan1","type":"bridge","bridge":"enp7s0-br","promiscMode":true,"ipam":{}}'

Copy link
Member

@w13915984028 w13915984028 left a comment

Choose a reason for hiding this comment

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

Please double check the last question, thanks.

Copy link
Contributor

@guangbochen guangbochen left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

Copy link
Member

@w13915984028 w13915984028 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

}

// update nad if needed
if nadCopy != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Hint:
The general practice is to return the updated object when it is successful, let other OnChange be invoked with the updated object instead of old one.

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.

4 participants