-
Notifications
You must be signed in to change notification settings - Fork 131
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
Support KubeVirt Provider Network #1862
Conversation
0c2fd58
to
f9a92a2
Compare
f9a92a2
to
c073471
Compare
annotations["kubevirt.io/allow-pod-bridge-network-live-migration"] = "true" | ||
|
||
if c.ProviderNetworkName == "KubeOVN" { |
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.
Wouldn't it be better to compare the strings in lowercase?
if strings.ToLower(c.ProviderNetworkName) == "kubeovn" {}
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.
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(`| |
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.
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.
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.
Actually I tried that at the beginning and I got an error from kubeovn.,
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.
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 { |
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.
Would be cool to see the effect of this function materialized in the testdata.
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.
Has been added e7cc534
/approve |
[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 |
/lgtm |
LGTM label has been added. Git tree hash: 0c1252205b4fe6f47f0771bb1bc19246d629a4ff
|
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:
Documentation: