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 KubeVirt Provider Network #1862

Merged

Conversation

moadqassem
Copy link
Member

What this PR does / why we need it:
KubeOvn has some features that can be used along side with KubeVirt. One of those features is subnet and vpc support. This PR supports the KubeOVN VPC and Subnet as a provider network in KubeVirt.
Which issue(s) this PR fixes:

Fixes #

What type of PR is this?
/kind feature

Special notes for your reviewer:

Does this PR introduce a user-facing change? Then add your Release Note here:

Support KubeOVN as a provider network in KubeVirt

Documentation:

None

@kubermatic-bot kubermatic-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. docs/none Denotes a PR that doesn't need documentation (changes). dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 4, 2024
@moadqassem moadqassem force-pushed the support-kv-provider-network branch from 0c2fd58 to f9a92a2 Compare October 4, 2024 13:09
@moadqassem moadqassem force-pushed the support-kv-provider-network branch from f9a92a2 to c073471 Compare October 4, 2024 13:11
@kubermatic-bot kubermatic-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 4, 2024
@moadqassem moadqassem requested a review from yaa110 October 4, 2024 13:36
annotations["kubevirt.io/allow-pod-bridge-network-live-migration"] = "true"

if c.ProviderNetworkName == "KubeOVN" {
Copy link

@yaa110 yaa110 Oct 4, 2024

Choose a reason for hiding this comment

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

Wouldn't it be better to compare the strings in lowercase?

if strings.ToLower(c.ProviderNetworkName) == "kubeovn" {}

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, this is not really a string comparison per se, it is semantically types comparison. However I see your point, I can lowercase it unconditionally

subnetGatewayIP = c.SubnetGatewayIP
}

annotations["ovn.kubernetes.io/routes"] = fmt.Sprintf(`|
Copy link

@yaa110 yaa110 Oct 4, 2024

Choose a reason for hiding this comment

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

Wouldn't it be better to create a struct and use the json package to marshal it into JSON, rather than constructing the JSON string manually?

type Routes struct {
    Gw string `json:"gw"`
}

routes := []Routes{{ Gw: subnetGatewayIP }}
b, _ := json.Marshal(&routes)
annotations["ovn.kubernetes.io/routes"] = string(b)

In this case, you won't need to manually handle escapes and multiline strings.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I tried that at the beginning and I got an error from kubeovn.,

Copy link
Member Author

Choose a reason for hiding this comment

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

I will double check though but I am pretty sure I got something incorrect

@@ -1042,3 +1062,37 @@ func getStorageTopologies(ctx context.Context, storageClasName string, c *Config

return nil
}

func setOVNAnnotations(c *Config, annotations map[string]string) error {
Copy link
Member

@kron4eg kron4eg Oct 4, 2024

Choose a reason for hiding this comment

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

Would be cool to see the effect of this function materialized in the testdata.

Copy link
Member Author

@moadqassem moadqassem Oct 4, 2024

Choose a reason for hiding this comment

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

Has been added e7cc534

@yaa110
Copy link

yaa110 commented Oct 4, 2024

/approve

@kubermatic-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yaa110

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubermatic-bot kubermatic-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 4, 2024
@yaa110
Copy link

yaa110 commented Oct 4, 2024

/lgtm

@kubermatic-bot kubermatic-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 4, 2024
@kubermatic-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 0c1252205b4fe6f47f0771bb1bc19246d629a4ff

@kubermatic-bot kubermatic-bot merged commit 6a9e720 into kubermatic:main Oct 4, 2024
12 checks passed
@moadqassem moadqassem deleted the support-kv-provider-network branch October 4, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. docs/none Denotes a PR that doesn't need documentation (changes). kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants