-
Notifications
You must be signed in to change notification settings - Fork 82
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
api: add ovn bridge mappings to node network state #1237
api: add ovn bridge mappings to node network state #1237
Conversation
Hi @maiqueb. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cc @qinqon |
c2c4714
to
b99fcf4
Compare
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.
Let's generalize this PR and add the missing top level field with a transparent data type json.RawMessage
.
|
||
type bridgeMappings struct { | ||
PhysicalNetworkMappings []PhysicalNetworks `json:"bridge-mappings,omitempty" yaml:"bridge-mappings,omitempty"` | ||
} | ||
|
||
type PhysicalNetworks struct { | ||
Name string `json:"localnet" yaml:"localnet"` | ||
Bridge string `json:"bridge" yaml:"bridge"` | ||
State string `json:"state,omitempty" yaml:"state,omitempty"` | ||
} |
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.
This is not really needed since we don't need to filter it out, we just need an "ovn" field at desiredState level of type json.RawMessage
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.
It's not only filtering - it makes testing a lot easier, since I can use these structs to assert against.
I prefer to
Expect(nodeBridgeMappings(node)).To(
ConsistOf(state.PhysicalNetworks{Name: networkName, Bridge: bridgeName}))
instead of comparing against a string.
But I won't insist.
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.
We will consume a generated golang api in the furure so I am ok with this.
@@ -28,6 +28,7 @@ type rootState struct { | |||
Interfaces []interfaceState `json:"interfaces" yaml:"interfaces"` | |||
Routes *routes `json:"routes,omitempty" yaml:"routes,omitempty"` | |||
DNSResolver *dnsResolver `json:"dns-resolver,omitempty" yaml:"dns-resolver,omitempty"` | |||
Ovn *bridgeMappings `json:"ovn,omitempty" yaml:"ovn,omitempty"` |
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.
Ovn *bridgeMappings `json:"ovn,omitempty" yaml:"ovn,omitempty"` | |
Ovn json.RawMessage `json:"ovn,omitempty" yaml:"ovn,omitempty"` |
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.
Now that we are a it maybe we can add the missing ones looking at https://docs.rs/nmstate/latest/nmstate/struct.NetworkState.html
We are missing:
- hostname
- route-rules
- ovs-db
So we can do the following
type rootState struct {
Interfaces []interfaceState `json:"interfaces" yaml:"interfaces"`
Routes *routes `json:"routes,omitempty" yaml:"routes,omitempty"`
DNSResolver *dnsResolver `json:"dns-resolver,omitempty" yaml:"dns-resolver,omitempty"`
Hostname json.RawMessage `json:"hostname,omitempty" yaml:"ovn,omitempty"`
RouteRules json.RawMessage `json:"route-rules,omitempty" yaml:"ovn,omitempty"`
OVSDb json.RawMessage `json:"ovs-db,omitempty" yaml:"ovs-db,omitempty"`
OVN json.RawMessage `json:"ovn,omitempty" yaml:"ovn,omitempty"`
}
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.
An alternative is a custom encoder that will just bypass whatever we don't need to filter
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'd rather focus exclusively on the attributes that I need to add. And test only those attributes.
/lgtm |
b99fcf4
to
874deca
Compare
/lgtm |
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
874deca
to
caf1f23
Compare
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qinqon 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 |
/test pull-kubernetes-nmstate-e2e-operator-k8s |
@maiqueb: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
/test pull-kubernetes-nmstate-e2e-operator-k8s |
@maiqueb: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/test pull-kubernetes-nmstate-e2e-operator-k8s |
@maiqueb: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
hm, I'm checking this locally and it passes. Could it be we need to somehow integrate OVS in CI for this to work ? |
/test pull-kubernetes-nmstate-e2e-handler-k8s |
@qinqon ok, so this got merged. When / how will it become available downstream ? What's the flow here ? ... Will it be automatically cherry-picked downstream by some automation, or do I need to do something further ? Thanks for your help and time. |
It will land in downstream automatically after a few days. Unless you have a critical case and need it in downstream immediately, there is nothing to do at all, just sit and watch |
Is this a BUG FIX or a FEATURE ?:
/kind bug
What this PR does / why we need it:
This PR exposes the node's ovn bridge mappings (already provided on
nmstatectl show
) via the NNS object.Special notes for your reviewer:
Release note: